[Scummvm-git-logs] scummvm master -> bd9f970e1e7fc04660e911c689f0d3a20d54aadd

mduggan noreply at scummvm.org
Wed Nov 22 06:24:52 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
bd9f970e1e MTROPOLIS: Correct default palette for Unit: Rebooted


Commit: bd9f970e1e7fc04660e911c689f0d3a20d54aadd
    https://github.com/scummvm/scummvm/commit/bd9f970e1e7fc04660e911c689f0d3a20d54aadd
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-11-22T17:21:46+11:00

Commit Message:
MTROPOLIS: Correct default palette for Unit: Rebooted

Changed paths:
    engines/mtropolis/mtropolis.cpp
    engines/mtropolis/runtime.cpp
    engines/mtropolis/runtime.h


diff --git a/engines/mtropolis/mtropolis.cpp b/engines/mtropolis/mtropolis.cpp
index 99475c22d29..c9c20600d26 100644
--- a/engines/mtropolis/mtropolis.cpp
+++ b/engines/mtropolis/mtropolis.cpp
@@ -178,6 +178,10 @@ Common::Error MTropolisEngine::run() {
 		preferredHeight = 480;
 		preferredColorDepthMode = kColorDepthMode32Bit;
 		enhancedColorDepthMode = kColorDepthMode32Bit;
+
+		Palette pal;
+		pal.initDefaultPalette(2);
+		_runtime->setGlobalPalette(pal);
 	}
 
 	if (ConfMan.getBool("mtropolis_mod_minimum_transition_duration"))
diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index 48882b93779..e994b1e26e5 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -4197,6 +4197,13 @@ void SceneTransitionHooks::onSceneTransitionEnded(Runtime *runtime, const Common
 
 
 Palette::Palette() {
+	initDefaultPalette(1);
+}
+
+void Palette::initDefaultPalette(int version) {
+	// NOTE: The "V2" pallete is correct for Unit: Rebooted.
+	// Is it correct for all V2 apps?
+	assert(version == 1 || version == 2);
 	int outColorIndex = 0;
 	for (int rb = 0; rb < 6; rb++) {
 		for (int rg = 0; rg < 6; rg++) {
@@ -4204,9 +4211,15 @@ Palette::Palette() {
 				byte *color = _colors + outColorIndex * 3;
 				outColorIndex++;
 
-				color[0] = 255 - rr * 51;
-				color[1] = 255 - rg * 51;
-				color[2] = 255 - rb * 51;
+				if (version == 1) {
+					color[0] = 255 - rr * 51;
+					color[1] = 255 - rg * 51;
+					color[2] = 255 - rb * 51;
+				} else {
+					color[2] = 255 - rr * 51;
+					color[1] = 255 - rg * 51;
+					color[0] = 255 - rb * 51;
+				}
 			}
 		}
 	}
@@ -4223,7 +4236,7 @@ Palette::Palette() {
 
 			byte intensity = 255 - ri * 17;
 
-			if (ch == 4) {
+			if (ch == 3) {
 				color[0] = color[1] = color[2] = intensity;
 			} else {
 				color[0] = color[1] = color[2] = 0;
@@ -4234,9 +4247,18 @@ Palette::Palette() {
 
 	assert(outColorIndex == 255);
 
-	_colors[255 * 3 + 0] = 0;
-	_colors[255 * 3 + 1] = 0;
-	_colors[255 * 3 + 2] = 0;
+	if (version == 1) {
+		_colors[255 * 3 + 0] = 0;
+		_colors[255 * 3 + 1] = 0;
+		_colors[255 * 3 + 2] = 0;
+	} else {
+		_colors[0 * 3 + 0] = 0;
+		_colors[0 * 3 + 1] = 0;
+		_colors[0 * 3 + 2] = 0;
+		_colors[255 * 3 + 0] = 255;
+		_colors[255 * 3 + 1] = 255;
+		_colors[255 * 3 + 2] = 255;
+	}
 }
 
 Palette::Palette(const ColorRGB8 *colors) {
diff --git a/engines/mtropolis/runtime.h b/engines/mtropolis/runtime.h
index 7213f761aaf..a27660add7a 100644
--- a/engines/mtropolis/runtime.h
+++ b/engines/mtropolis/runtime.h
@@ -1569,6 +1569,8 @@ public:
 	Palette();
 	explicit Palette(const ColorRGB8 *colors);
 
+	void initDefaultPalette(int version);
+
 	const byte *getPalette() const;
 
 	static const uint kNumColors = 256;




More information about the Scummvm-git-logs mailing list