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

athrxx noreply at scummvm.org
Sat Jul 16 12:51:46 UTC 2022


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

Summary:
3d27309624 SCUMM: (LOOM/CGA) - fix minor actor palette glitch
2fd8bf67db SCUMM: fix videomode var handling (LOOM CGA actor palette glitch)
f9db5607d8 SCUMM: fix dissolveEffect for non VGA/EGA-rendering modes


Commit: 3d27309624b1d861e4f51e2712a003c9f2bd51f7
    https://github.com/scummvm/scummvm/commit/3d27309624b1d861e4f51e2712a003c9f2bd51f7
Author: athrxx (athrxx at scummvm.org)
Date: 2022-07-16T14:51:06+02:00

Commit Message:
SCUMM: (LOOM/CGA) - fix minor actor palette glitch

(original interpreter bug, reported by antoniou79)

The original interpreter has an actor palette fix for the CGA mode, but it isn't properly re-applied after the script makes changes to the actor palette)

Changed paths:
    engines/scumm/script_v5.cpp


diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp
index 9d4110dc618..9031d456317 100644
--- a/engines/scumm/script_v5.cpp
+++ b/engines/scumm/script_v5.cpp
@@ -538,6 +538,18 @@ void ScummEngine_v5::o5_actorOps() {
 					i = 3;
 			}
 
+			// WORKAROUND for original bug. The original interpreter has a color fix for CGA mode which can be seen
+			// in Actor::setActorCostume(). Sometimes (e. g. when Bobbin walks out of the darkened tent) the actor
+			// colors are changed via script without taking into the account the need to repeat the color fix.
+			if (_game.id == GID_LOOM && _renderMode == Common::kRenderCGA && act == 1) {
+				if (i == 6 && j == 6)
+					j = 5;
+				else if (i == 7 && j == 7)
+					j = 15;
+				else if (i == 8 && j == 8)
+					j = 0;
+			}
+
 			// Setting palette color 0 to 0 appears to be a way to
 			// reset the actor palette in the TurboGrafx-16 version
 			// of Loom. It's used in several places, but the only
@@ -547,7 +559,7 @@ void ScummEngine_v5::o5_actorOps() {
 			if (_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine && i == 0 && j == 0) {
 				for (int k = 0; k < 32; k++)
 					a->setPalette(k, 0xFF);
-			} else {
+			} else {	
 				a->setPalette(i, j);
 			}
 			break;


Commit: 2fd8bf67db65b187d2052bb95fc872dcdaa9a747
    https://github.com/scummvm/scummvm/commit/2fd8bf67db65b187d2052bb95fc872dcdaa9a747
Author: athrxx (athrxx at scummvm.org)
Date: 2022-07-16T14:51:11+02:00

Commit Message:
SCUMM: fix videomode var handling (LOOM CGA actor palette glitch)

(original bug)

In LOOM, the scripts actually read the videomode var and make actor palette adjustments based on that. Which means for games saved in EGA mode, with the wrong videomode var value,  there will be glitches.

This concerns not only Bobbin, but the script does things for various actors and costumes in various situations.

We just set the videomode var to the actual config after loading.

For Bobbin in normal costume, I also include a post-load fix for savegames that will not have the actor palettes fixed by the scripts (savegames that we allow in situations where the original would prevent them).

Changed paths:
    NEWS.md
    engines/scumm/actor.cpp
    engines/scumm/saveload.cpp
    engines/scumm/scumm.h
    engines/scumm/vars.cpp


diff --git a/NEWS.md b/NEWS.md
index fa4c065d7c7..e6a0eb9db67 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -21,8 +21,11 @@ For a more comprehensive changelog of the latest experimental code, see:
    - Added support for the Hebrew version of Legend of Kyrandia 3.
 
  SCUMM:
-   - Add support for CGA, CGA Composite, CGA black & white and Hercules modes
-     for SCUMM 1 versions of Zak McKracken and Maniac Mansion.
+   - Added support for CGA, CGA Composite, CGA black & white and Hercules modes
+     for SCUMM 1 versions of Zak McKracken and Maniac Mansion. Also improved
+	 accuracy of CGA and Hercules modes for SCUMM 2 (enhanced) versions of
+	 Zak McKracken and Maniac Mansion and fixed some minor glitches for the
+	 CGA mode of Loom.
 
  Toon:
    - Made game menus behave like in the original.
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 284bf6bc8f8..5678b66924c 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -3827,6 +3827,12 @@ void Actor::saveLoadWithSerializer(Common::Serializer &s) {
 				_cost.frame[i] = (_cost.frame[i] << 2) | newDirToOldDir(_facing);
 		}
 	}
+
+	// Post-load fix for games that were saved with a different video mode and which do not receive the normal
+	// post-load treatment in ScummEngine_v3::scummLoop_handleSaveLoad() where the script will take care of the
+	// actor palette. This fix is only for Bobbin in his normal costume.
+	if (_vm->_game.id == GID_LOOM && s.isLoading() && _vm->_renderMode == Common::kRenderCGA && _number == 1 && _palette[8] == 8)
+		_palette[8] = 0;
 }
 
 void Actor_v3::saveLoadWithSerializer(Common::Serializer &s) {
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index d1a4240fec4..6dd2dbeddcd 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -1443,6 +1443,10 @@ void ScummEngine::saveLoadWithSerializer(Common::Serializer &s) {
 
 	s.syncBytes(_bitVars, _numBitVariables / 8);
 
+	// Set video mode var to the current actual mode, not the one that was enabled when the game was saved.
+	// At least for Loom this fixes glitches, since the game actually reads the var and makes actor palette
+	// adjustments based on that. This is a bug that happens in the original interpreter, too.
+	setVideoModeVarToCurrentConfig();
 
 	// WORKAROUND: FM-TOWNS Zak used the extra 40 pixels at the bottom to increase the inventory to 10 items
 	// if we trim to 200 pixels, we can show only 6 items
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 3bc449b4531..16f36a5932b 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -426,6 +426,7 @@ protected:
 
 	virtual void setupScummVars();
 	virtual void resetScummVars();
+	void setVideoModeVarToCurrentConfig();
 
 	void setupCharsetRenderer(const Common::String &macFontFile);
 	void setupCostumeRenderer();
diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp
index 375356266a7..28ba1a54c80 100644
--- a/engines/scumm/vars.cpp
+++ b/engines/scumm/vars.cpp
@@ -783,24 +783,7 @@ void ScummEngine::resetScummVars() {
 			break;
 		}
 
-		if (_game.platform == Common::kPlatformFMTowns)
-			VAR(VAR_VIDEOMODE) = 42;
-		// Value only used by the Macintosh version of Indiana Jones and the Last Crusade
-		else if (_game.platform == Common::kPlatformMacintosh && _game.version == 3)
-			VAR(VAR_VIDEOMODE) = 50;
-		// Value only used by the Amiga version of Monkey Island 2
-		else if (_game.platform == Common::kPlatformAmiga)
-			VAR(VAR_VIDEOMODE) = 82;
-		else if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderCGAComp)
-			VAR(VAR_VIDEOMODE) = 4;
-		else if (_renderMode == Common::kRenderCGA_BW)
-			VAR(VAR_VIDEOMODE) = 6;
-		else if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG)
-			VAR(VAR_VIDEOMODE) = 30;
-		else if (_renderMode == Common::kRenderEGA)
-			VAR(VAR_VIDEOMODE) = 13;
-		else
-			VAR(VAR_VIDEOMODE) = 19;
+		setVideoModeVarToCurrentConfig();
 
 		if (_game.platform == Common::kPlatformMacintosh && (_game.features & GF_OLD_BUNDLE)) {
 			// Set screen size for the Macintosh version of Indy3/Loom
@@ -847,4 +830,25 @@ void ScummEngine::resetScummVars() {
 	setTalkingActor(0);
 }
 
+void ScummEngine::setVideoModeVarToCurrentConfig() {
+	if (_game.platform == Common::kPlatformFMTowns)
+		VAR(VAR_VIDEOMODE) = 42;
+	// Value only used by the Macintosh version of Indiana Jones and the Last Crusade
+	else if (_game.platform == Common::kPlatformMacintosh && _game.version == 3)
+		VAR(VAR_VIDEOMODE) = 50;
+	// Value only used by the Amiga version of Monkey Island 2
+	else if (_game.platform == Common::kPlatformAmiga)
+		VAR(VAR_VIDEOMODE) = 82;
+	else if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderCGAComp)
+		VAR(VAR_VIDEOMODE) = 4;
+	else if (_renderMode == Common::kRenderCGA_BW)
+		VAR(VAR_VIDEOMODE) = 6;
+	else if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG)
+		VAR(VAR_VIDEOMODE) = 30;
+	else if (_renderMode == Common::kRenderEGA)
+		VAR(VAR_VIDEOMODE) = 13;
+	else
+		VAR(VAR_VIDEOMODE) = 19;
+}
+
 } // End of namespace Scumm


Commit: f9db5607d8a3213db0c65e00c796858c7df5449f
    https://github.com/scummvm/scummvm/commit/f9db5607d8a3213db0c65e00c796858c7df5449f
Author: athrxx (athrxx at scummvm.org)
Date: 2022-07-16T14:51:15+02:00

Commit Message:
SCUMM: fix dissolveEffect for non VGA/EGA-rendering modes

(quite obvious in LOOM CGA mode, when suddenly the normal EGA colors appear on screen)

Changed paths:
    engines/scumm/gfx.cpp


diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 27ea8aa4bec..19e1980b913 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -4262,7 +4262,12 @@ void ScummEngine::dissolveEffect(int width, int height) {
 #endif
 		if (_macScreen)
 			mac_drawStripToScreen(vs, y, x, y + vs->topline, width, height);
+		else if (IS_ALIGNED(width, 4))
+			drawStripToScreen(vs, x, width, y, y + height);
 		else
+			// This is not suitable for any render mode that requires post-processing of the pixels (CGA; Hercules...).
+			// Currently, non of the targets in concern will arrive here, but we will have to look at this again if we
+			// want to support things like the EGA mode of LOOM VGA Talkie...
 			_system->copyRectToScreen(vs->getPixels(x, y), vs->pitch, x, y + vs->topline, width, height);
 
 		// Test for 1x1 pattern...




More information about the Scummvm-git-logs mailing list