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

bluegr bluegr at gmail.com
Tue Mar 19 05:08:03 CET 2019


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:
a398d363b1 SCI: Apply SQ4 timing workaround to non-VGA versions


Commit: a398d363b17cea9362ca75895985ac97d7485ccd
    https://github.com/scummvm/scummvm/commit/a398d363b17cea9362ca75895985ac97d7485ccd
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2019-03-19T06:07:59+02:00

Commit Message:
SCI: Apply SQ4 timing workaround to non-VGA versions

Fixes bug #6193 by applying the SQ4 floppy kPaletteAnimation timing
workaround from 99de89c974fc24bf58b034842750e522d7d441d4 to versions
with less than 256 colors. This includes DOS EGA, PC-98, and Amiga.

This also patches out the intro script's workaround that uses different
timing in EGA mode, as this is incompatible with ours and makes the
intro screen last over 3 minutes instead of 5 seconds.

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


diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index ee9212b..8e97716 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -646,18 +646,17 @@ reg_t kPaletteAnimate(EngineState *s, int argc, reg_t *argv) {
 	bool paletteChanged = false;
 
 	// Palette animation in non-VGA SCI1 games has been removed
-	if (g_sci->_gfxPalette16->getTotalColorCount() < 256)
-		return s->r_acc;
-
-	for (argNr = 0; argNr < argc; argNr += 3) {
-		uint16 fromColor = argv[argNr].toUint16();
-		uint16 toColor = argv[argNr + 1].toUint16();
-		int16 speed = argv[argNr + 2].toSint16();
-		if (g_sci->_gfxPalette16->kernelAnimate(fromColor, toColor, speed))
-			paletteChanged = true;
+	if (g_sci->_gfxPalette16->getTotalColorCount() == 256) {
+		for (argNr = 0; argNr < argc; argNr += 3) {
+			uint16 fromColor = argv[argNr].toUint16();
+			uint16 toColor = argv[argNr + 1].toUint16();
+			int16 speed = argv[argNr + 2].toSint16();
+			if (g_sci->_gfxPalette16->kernelAnimate(fromColor, toColor, speed))
+				paletteChanged = true;
+		}
+		if (paletteChanged)
+			g_sci->_gfxPalette16->kernelAnimateSet();
 	}
-	if (paletteChanged)
-		g_sci->_gfxPalette16->kernelAnimateSet();
 
 	// WORKAROUND: The game scripts in SQ4 floppy count the number of elapsed
 	// cycles in the intro from the number of successive kAnimate calls during
@@ -668,8 +667,10 @@ reg_t kPaletteAnimate(EngineState *s, int argc, reg_t *argv) {
 	// speed throttler gets called) between the different palette animation calls.
 	// Thus, we add a small delay between each animate call to make the whole
 	// palette animation effect slower and visible, and not have the logo screen
-	// get skipped because the scripts don't wait between animation steps. Fixes
-	// bug #3537232.
+	// get skipped because the scripts don't wait between animation steps. This
+	// workaround is applied to non-VGA versions as well because even though they
+	// don't use palette animation they still call this function and use it for
+	// timing. Fixes bugs #6057, #6193.
 	// The original workaround was for the intro SQ4 logo (room#1).
 	// This problem also happens in the time pod (room#531).
 	// This problem also happens in the ending cutscene time rip (room#21).
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 96515c9..87b67c7 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -11092,6 +11092,30 @@ static const uint16 sq4CdPatchGettingShotWhileGettingRope[] = {
 	PATCH_END
 };
 
+// During the SQ4 introduction logo, EGA versions increase the number of calls
+//  to kPaletteAnimate by 40x. This was probably to achieve the same delay as
+//  VGA even though no palette animation occurred. This adjustment interferes
+//  with our kPaletteAnimate speed throttling for SQ4 scripts such as this, bug
+//  #6057. We remove the EGA delay, making all versions consistent, otherwise
+//  the logo is displayed for over 3 minutes instead of 5 seconds.
+//
+// Applies to: English PC EGA Floppy, Japanese PC-98
+// Responsible method: rmScript:changeState
+// Fixes bug #6193
+static const uint16 sq4SignatureEgaIntroDelay[] = {
+	SIG_MAGICDWORD,
+	0x89, 0x69,                         // lsg 69 [ system colors ]
+	0x35, 0x10,                         // ldi 10
+	0x1e,                               // gt?    [ system colors > 16 ]
+	0x30,                               // bnt    [ use EGA delay ]
+	SIG_END
+};
+
+static const uint16 sq4PatchEgaIntroDelay[] = {
+	0x33, 0x06,                         // jmp 06 [ don't use EGA delay ]
+	PATCH_END
+};
+
 // Talking in room 520 results in a missing message due to passing the wrong
 //  modNum to the narrator.
 //
@@ -11351,6 +11375,7 @@ static const uint16 sq4CdPatchTextOptions[] = {
 
 //          script, description,                                      signature                                      patch
 static const SciScriptPatcherEntry sq4Signatures[] = {
+	{  true,     1, "Floppy: EGA intro delay fix",                    2, sq4SignatureEgaIntroDelay,                     sq4PatchEgaIntroDelay },
 	{  true,   298, "Floppy: endless flight",                         1, sq4FloppySignatureEndlessFlight,               sq4FloppyPatchEndlessFlight },
 	{  true,   700, "Floppy: throw stuff at sequel police bug",       1, sq4FloppySignatureThrowStuffAtSequelPoliceBug, sq4FloppyPatchThrowStuffAtSequelPoliceBug },
 	{  true,    35, "CD: sidewalk smell message fix",                 1, sq4CdSignatureSidewalkSmellMessage,            sq4CdPatchSidewalkSmellMessage },





More information about the Scummvm-git-logs mailing list