diff options
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 27 | ||||
-rw-r--r-- | engines/sci/engine/script_patches.cpp | 25 |
2 files changed, 39 insertions, 13 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index ee9212bd47..8e97716b96 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 96515c9b06..87b67c734b 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 }, |