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

sluicebox noreply at scummvm.org
Wed Dec 14 13:01:00 UTC 2022


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:
e46767b8f8 SCI: Fix LONGBOW map animation speed


Commit: e46767b8f8acd7ddcb6a11e4d794d7889c243ca6
    https://github.com/scummvm/scummvm/commit/e46767b8f8acd7ddcb6a11e4d794d7889c243ca6
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-12-14T05:00:42-08:00

Commit Message:
SCI: Fix LONGBOW map animation speed

Speed throttling was disabled on LONGBOW maps because they were treated
as speed tests by the heuristic in GfxAnimate::throttleSpeed. This bug
was masked by fast-cast throttling being applied everywhere, but that
was changed in e09010f7d8b7cc30ae3c8477d1a8b61b24d96306

Now the map rooms trigger throttling so that they don't run too fast.
But the game scripts also attempt to throttle the animations based on
speed test results, causing them to run too slow, so that's patched out.

Fixes bug #13966

Changed paths:
    engines/sci/engine/kmisc.cpp
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 5c961df39d3..cbe7de8c62c 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -137,6 +137,16 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
 			neededSleep = 60;
 		}
 		break;
+	case GID_LONGBOW:
+		// LONWBOW map rooms have no cast, so kAnimate doesn't trigger throttling
+		// because it thinks it's a speed test room. See: GfxAnimate::throttleSpeed.
+		// This causes the palette animation to run unthrottled. Sierra also attempts
+		// to throttle these screens in a conflicting way based on speed test results,
+		// and we patch that out.
+		if (s->currentRoomNumber() == 100 || s->currentRoomNumber() == 260) {
+			s->_throttleTrigger = true;
+		}
+		break;
 	default:
 		break;
 	}
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 068e18b39f3..e8afb8da5e9 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -8171,9 +8171,43 @@ static const uint16 longbowPatchHedgeMazeMusic[] = {
 	PATCH_END
 };
 
+// Map rooms palette animate their rivers at unthrottled speeds, except that
+//  scripts limit them to every X game cycles based on speed test results.
+//  On fast DOS machines this was still effectively unthrottled because there is
+//  no cast to animate in these rooms. In ScummVM we patch speed tests to pass
+//  and throttle game cycles to a reasonable rate. Under these conditions, the
+//  map animates slowly every 2.5 seconds.
+//
+// We fix this by setting the map palette animation speed to once every 15 game
+//  cycles instead of using speed test results. This is what DOSBox achieves at
+//  3,000 clock cycles per second.
+//
+// Applies to: All versions
+// Responsible methods: rm100:init, rm260:init
+// Fixes bug: #13966
+static const uint16 longbowSignatureMapPaletteSpeed[] = {
+	SIG_MAGICDWORD,
+	0x89, 0x57,                     // lsg 57 [ speed test result ]
+	0x3c,                           // dup
+	0x35, 0x00,                     // ldi 00
+	0x1a,                           // eq?
+	0x30, SIG_UINT16(0x0005),       // bnt 0005
+	0x35, 0x28,                     // ldi 28 [ animate every 40 cycles ]
+	0x32,                           // jmp    [ toss ]
+	SIG_END
+};
+
+static const uint16 longbowPatchMapPaletteSpeed[] = {
+	0x35, 0x0f,                     // ldi 0f [ animate every 15 cycles ]
+	0x36,                           // push   [ for toss ]
+	0x33, 0x06,                     // jmp 06 [ toss ]
+	PATCH_END
+};
+
 //          script, description,                                      signature                                patch
 static const SciScriptPatcherEntry longbowSignatures[] = {
 	{  true,    29, "amiga day 1 peasant woman",                   1, longbowSignatureAmigaPeasantWoman,       longbowPatchAmigaPeasantWoman},
+	{  true,   100, "map palette speed",                           1, longbowSignatureMapPaletteSpeed,         longbowPatchMapPaletteSpeed },
 	{  true,   140, "green man riddles and forest sweep fix",      1, longbowSignatureGreenManForestSweepFix,  longbowPatchGreenManForestSweepFix },
 	{  true,   150, "day 5/6 camp sunset fix",                     2, longbowSignatureCampSunsetFix,           longbowPatchCampSunsetFix },
 	{  true,   150, "day 7 tuck net fix",                          1, longbowSignatureTuckNetFix,              longbowPatchTuckNetFix },
@@ -8181,6 +8215,7 @@ static const SciScriptPatcherEntry longbowSignatures[] = {
 	{  true,   225, "arithmetic berry bush fix",                   1, longbowSignatureBerryBushFix,            longbowPatchBerryBushFix },
 	{  true,   250, "day 5/6 rescue flag fix",                     1, longbowSignatureRescueFlagFix,           longbowPatchRescueFlagFix },
 	{  true,   260, "day 5/6 town map sunset fix",                 1, longbowSignatureTownMapSunsetFix,        longbowPatchTownMapSunsetFix },
+	{  true,   260, "map palette speed",                           1, longbowSignatureMapPaletteSpeed,         longbowPatchMapPaletteSpeed },
 	{  true,   320, "day 8 archer pathfinding workaround",         1, longbowSignatureArcherPathfinding,       longbowPatchArcherPathfinding },
 	{  true,   350, "day 9 cobbler hut fix",                      10, longbowSignatureCobblerHut,              longbowPatchCobblerHut },
 	{  true,   422, "marian messages fix",                         1, longbowSignatureMarianMessagesFix,       longbowPatchMarianMessagesFix },




More information about the Scummvm-git-logs mailing list