[Scummvm-git-logs] scummvm master -> 5a77aa1aa71a8cd5fe73b966f012e2028c1f6a17

AndywinXp noreply at scummvm.org
Sat Sep 7 19:45:22 UTC 2024


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:
5a77aa1aa7 SCUMM: MONKEY1 (CD): Improve palette fix for room 36


Commit: 5a77aa1aa71a8cd5fe73b966f012e2028c1f6a17
    https://github.com/scummvm/scummvm/commit/5a77aa1aa71a8cd5fe73b966f012e2028c1f6a17
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-09-07T21:45:17+02:00

Commit Message:
SCUMM: MONKEY1 (CD): Improve palette fix for room 36

Saving and loading now handle the palette change correctly

Changed paths:
    engines/scumm/palette.cpp
    engines/scumm/room.cpp
    engines/scumm/scumm.cpp
    engines/scumm/scumm.h


diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp
index 629854164ca..9bf8afe63fc 100644
--- a/engines/scumm/palette.cpp
+++ b/engines/scumm/palette.cpp
@@ -1629,6 +1629,19 @@ void ScummEngine::applyGrayscaleToPaletteRange(int min, int max) {
 	setDirtyColors(min, max);
 }
 
+bool ScummEngine::haveToApplyMonkey1PaletteFix() {
+	if (_game.id != GID_MONKEY)
+		return false;
+
+	bool canChangeMonkey1PaletteSlot = _game.platform == Common::kPlatformMacintosh;
+
+	canChangeMonkey1PaletteSlot |= enhancementEnabled(kEnhVisualChanges) &&
+								   (_game.platform != Common::kPlatformSegaCD && _game.platform != Common::kPlatformFMTowns &&
+									!(_game.features & GF_ULTIMATE_TALKIE));
+
+	return canChangeMonkey1PaletteSlot;
+}
+
 void ScummEngine::updatePalette() {
 	if (_game.features & GF_16BIT_COLOR)
 		return;
diff --git a/engines/scumm/room.cpp b/engines/scumm/room.cpp
index 9f5cc4194d5..7a88019f4aa 100644
--- a/engines/scumm/room.cpp
+++ b/engines/scumm/room.cpp
@@ -143,13 +143,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) {
 	// version makes the text more readable by giving it a black outline.
 	// The Ultimate Talkie version already takes care of that within the data files.
 
-	bool canChangeMonkey1PaletteSlot = _game.platform == Common::kPlatformMacintosh;
-
-	canChangeMonkey1PaletteSlot |= enhancementEnabled(kEnhVisualChanges) &&
-		(_game.platform != Common::kPlatformSegaCD && _game.platform != Common::kPlatformFMTowns &&
-		!(_game.features & GF_ULTIMATE_TALKIE));
-
-	if (_game.id == GID_MONKEY && room == 36 && canChangeMonkey1PaletteSlot)
+	if (haveToApplyMonkey1PaletteFix() && room == 36)
 		_roomPalette[47] = 15;
 
 	VAR(VAR_ROOM) = room;
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 205244aa0b2..ada525028ba 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -3508,6 +3508,18 @@ void ScummEngine_v5::scummLoop_handleSaveLoad() {
 		}
 	}
 
+	// Reset the room palette after changing it in room 36 and
+	// loading a savegame (which doesn't trigger a startScene() call)...
+	if (haveToApplyMonkey1PaletteFix()) {
+		for (int i = 0; i < ARRAYSIZE(_roomPalette); i++) {
+			_roomPalette[i] = i;
+		}
+
+		// If we're coming from a different room, apply the fix...
+		if (_currentRoom == 36)
+			_roomPalette[47] = 15;
+	}
+
 	if (_completeScreenRedraw) {
 		clearCharsetMask();
 		_charset->_hasMask = false;
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index a522190250d..e96e3c98bfb 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1388,6 +1388,7 @@ protected:
 	void palManipulate();
 	uint32 findClosestPaletteColor(byte *palette, int paletteLength, byte r, byte g, byte b);
 	void applyGrayscaleToPaletteRange(int min, int max); // For Sam&Max original noir mode
+	bool haveToApplyMonkey1PaletteFix();
 
 public:
 	uint8 *getHEPaletteSlot(uint16 palSlot);




More information about the Scummvm-git-logs mailing list