[Scummvm-git-logs] scummvm master -> adb211613ffcb39d1313885e0dd2b1288d458861
sluicebox
noreply at scummvm.org
Sat Jul 30 20:39:46 UTC 2022
This automated email contains information about 8 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
55c719aea9 SCI: Handle alternate bit orders in game flag debug commands
d2d46b67c5 SCI: Fix KQ5 bandit music fade workaround
befeca6c9b SCI: Fix kDoSound redundant fade detection
6a3fb9b5f8 SCI: Fix LONGBOW hedge maze music
6e5b1e31f0 SCI: Include all music fade flags in save files
c346905a1a SCI: Reset palette cycling when loading games
b267706b8d SCI: Fix SQ5 WD40 tunnel entrance lockup
adb211613f SCI: Fix SQ5 WD40 missing messages
Commit: 55c719aea9290552b1c5dde3dd7ea7d04d0421b4
https://github.com/scummvm/scummvm/commit/55c719aea9290552b1c5dde3dd7ea7d04d0421b4
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-07-30T16:39:24-04:00
Commit Message:
SCI: Handle alternate bit orders in game flag debug commands
Five games store flags in a different bit order than the rest
Changed paths:
engines/sci/console.cpp
engines/sci/engine/features.cpp
engines/sci/engine/features.h
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 6af90adf3b6..aa95cf313c5 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -4640,7 +4640,12 @@ bool Console::processGameFlagsOperation(GameFlagsOperation op, int argc, const c
continue;
}
uint16 globalValue = globalReg->toUint16();
- uint16 flagMask = 0x8000 >> (flagNumber % 16);
+ uint16 flagMask;
+ if (g_sci->_features->isGameFlagBitOrderNormal()) {
+ flagMask = 0x0001 << (flagNumber % 16);
+ } else {
+ flagMask = 0x8000 >> (flagNumber % 16);
+ }
// set or clear the flag
bool already = false;
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index 5e02bb34d6c..75189fddbe4 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -907,13 +907,13 @@ uint16 GameFeatures::getGameFlagsGlobal() const {
case GID_GK2: return 150;
// ICEMAN uses object properties
case GID_ISLANDBRAIN: return 250;
- case GID_LAURABOW: return 440;
- case GID_LAURABOW2: return 186;
case GID_KQ1: return 150;
// KQ4 has no flags
case GID_KQ5: return 129;
case GID_KQ6: return 137;
case GID_KQ7: return 127;
+ case GID_LAURABOW: return 440;
+ case GID_LAURABOW2: return 186;
case GID_LIGHTHOUSE: return 116;
case GID_LONGBOW: return 200;
case GID_LSL1: return 111;
@@ -946,4 +946,18 @@ uint16 GameFeatures::getGameFlagsGlobal() const {
}
}
+bool GameFeatures::isGameFlagBitOrderNormal() const {
+ // Most games store flags in reverse bit order
+ switch (g_sci->getGameId()) {
+ case GID_KQ5:
+ case GID_LAURABOW:
+ case GID_PEPPER:
+ case GID_PQ1:
+ case GID_PQ3:
+ return true;
+ default:
+ return false;
+ }
+}
+
} // End of namespace Sci
diff --git a/engines/sci/engine/features.h b/engines/sci/engine/features.h
index ce9b12b3ff6..0702b007414 100644
--- a/engines/sci/engine/features.h
+++ b/engines/sci/engine/features.h
@@ -290,6 +290,13 @@ public:
*/
uint16 getGameFlagsGlobal() const;
+ /**
+ * Returns the bit order in which game flags are stored.
+ *
+ * @return true if bit order is normal or false if reversed.
+ */
+ bool isGameFlagBitOrderNormal() const;
+
private:
reg_t getDetectionAddr(const Common::String &objName, Selector slc, int methodNum = -1);
Commit: d2d46b67c5950cc74664ca584f338190bc4d59aa
https://github.com/scummvm/scummvm/commit/d2d46b67c5950cc74664ca584f338190bc4d59aa
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-07-30T16:39:24-04:00
Commit Message:
SCI: Fix KQ5 bandit music fade workaround
The existing workaround prevented a crash but it performed volume tests
on an object's offset and abruptly ended the bandit music instead of
fading it out as in the original.
The broken kDoSoundFade call is redundant because a second script calls
kDoSoundFade correctly at the same time. Now the broken call is ignored
and the music fades out normally.
Bug #5078
Changed paths:
engines/sci/engine/workarounds.cpp
engines/sci/sound/soundcmd.cpp
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 490d0870058..1655cbf3837 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -769,11 +769,11 @@ const SciWorkaroundEntry kDoSoundPlay_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, local-call-signature, index-range, workaround
const SciWorkaroundEntry kDoSoundFade_workarounds[] = {
- { GID_KQ5, 213, 989, 0, "globalSound3", "fade", nullptr, 0, 0, { WORKAROUND_STILLCALL, 0 } }, // english floppy: when bandits leave the secret temple, parameter 4 is an object - bug #5078
+ { GID_KQ5, 213, 989, 0, "globalSound3", "fade", nullptr, 0, 0, { WORKAROUND_IGNORE, 0 } }, // english floppy: when bandits leave the secret temple, parameter 1 is an object followed by 3 non-existent parameters. Ignore; rideOut2 calls the same fade correctly at the same time - bug #5078
{ GID_KQ6, 105, 989, 0, "globalSound", "fade", nullptr, 0, 0, { WORKAROUND_STILLCALL, 0 } }, // floppy: during intro, parameter 4 is an object
{ GID_KQ6, 460, 989, 0, "globalSound2", "fade", nullptr, 0, 0, { WORKAROUND_STILLCALL, 0 } }, // after pulling the black widow's web on the isle of wonder, parameter 4 is an object - bug #4954
{ GID_QFG4, -1, 64989, 1, "GlorySong", "fade", nullptr, 0, 0, { WORKAROUND_STILLCALL, 0 } }, // CD version: many places, parameter 4 is an object (the sound object itself)
- { GID_SQ5, 800, 989, 0, "sq5Music1", "fade", nullptr, 0, 0, { WORKAROUND_STILLCALL, 0 } }, // when cutting the wrong part of Goliath with the laser - bug #6341
+ { GID_SQ5, 800, 989, 0, "sq5Music1", "fade", nullptr, 0, 0, { WORKAROUND_STILLCALL, 0 } }, // when cutting the wrong part of Goliath with the laser, parameter 4 is an object - bug #6341
SCI_WORKAROUNDENTRY_TERMINATOR
};
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index 2d7defd6ff5..4a8edb63c5b 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -488,11 +488,7 @@ reg_t SoundCommandParser::kDoSoundFade(EngineState *s, int argc, reg_t *argv) {
if (musicSlot->fadeTo == musicSlot->volume)
return s->r_acc;
- // Sometimes we get objects in that position, so fix the value (refer to workarounds.cpp)
- if (!argv[1].getSegment())
- musicSlot->fadeStep = volume > musicSlot->fadeTo ? -argv[3].toUint16() : argv[3].toUint16();
- else
- musicSlot->fadeStep = volume > musicSlot->fadeTo ? -5 : 5;
+ musicSlot->fadeStep = volume > musicSlot->fadeTo ? -argv[3].toUint16() : argv[3].toUint16();
musicSlot->fadeTickerStep = argv[2].toUint16() * 16667 / _music->soundGetTempo();
musicSlot->fadeTicker = 0;
Commit: befeca6c9b05e76cc6c5debc7473f8dc22f412e7
https://github.com/scummvm/scummvm/commit/befeca6c9b05e76cc6c5debc7473f8dc22f412e7
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-07-30T16:39:25-04:00
Commit Message:
SCI: Fix kDoSound redundant fade detection
Fixes two discrepancies in redundant fade detection that were discovered
while investigating LONGBOW bug #13674:
- MusicEntry::fadeTo was altered even when the fade was ignored
- Redundant fades are allowed in SSCI when the stopOnFade flag is passed
Changed paths:
engines/sci/sound/soundcmd.cpp
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index 4a8edb63c5b..e1edbac3f37 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -480,27 +480,31 @@ reg_t SoundCommandParser::kDoSoundFade(EngineState *s, int argc, reg_t *argv) {
musicSlot->fadeTicker = 0;
break;
- case 4: // SCI01+
- case 5: // SCI1+ (SCI1 late sound scheme), with fade and continue
- musicSlot->fadeTo = CLIP<uint16>(argv[1].toUint16(), 0, MUSIC_VOLUME_MAX);
- // Check if the song is already at the requested volume. If it is, don't
- // perform any fading. Happens for example during the intro of Longbow.
- if (musicSlot->fadeTo == musicSlot->volume)
+ case 4: // SCI01+
+ case 5: { // SCI1+ (SCI1 late sound scheme), with fade and continue
+ byte fadeTo = CLIP<uint16>(argv[1].toUint16(), 0, MUSIC_VOLUME_MAX);
+
+ // argv[4] is a boolean. Scripts sometimes pass strange values,
+ // but SSCI only checks for zero/non-zero. (Verified in KQ6).
+ // KQ6 room 460 even passes an object, but treating this as 'true'
+ // seems fine in that case. Bug #6120
+ bool stopAfterFading = (argc == 5) && !argv[4].isNull();
+
+ // Ignore the fade request if the song is already at the requested volume and
+ // the stopAfterFading flag isn't being set. SSCI stored this flag in the upper
+ // bit of the target volume before comparing it to the current volume.
+ // Longbow relies on this in its introduction. Bug #5239
+ if (musicSlot->volume == fadeTo && !stopAfterFading) {
return s->r_acc;
+ }
+ musicSlot->fadeTo = fadeTo;
musicSlot->fadeStep = volume > musicSlot->fadeTo ? -argv[3].toUint16() : argv[3].toUint16();
musicSlot->fadeTickerStep = argv[2].toUint16() * 16667 / _music->soundGetTempo();
musicSlot->fadeTicker = 0;
-
- // argv[4] is a boolean. Scripts sometimes pass strange values,
- // but SSCI only checks for zero/non-zero. (Verified in KQ6).
- // KQ6 room 460 even passes an object, but treating this as 'true'
- // seems fine in that case.
- if (argc == 5)
- musicSlot->stopAfterFading = !argv[4].isNull();
- else
- musicSlot->stopAfterFading = false;
+ musicSlot->stopAfterFading = stopAfterFading;
break;
+ }
default:
error("kDoSound(fade): unsupported argc %d", argc);
Commit: 6a3fb9b5f803e05a8d98a4b220ee02eca3ea3b09
https://github.com/scummvm/scummvm/commit/6a3fb9b5f803e05a8d98a4b220ee02eca3ea3b09
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-07-30T16:39:25-04:00
Commit Message:
SCI: Fix LONGBOW hedge maze music
Fixes bug #13674
Changed paths:
engines/sci/engine/script_patches.cpp
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 1f4ca130d1c..d7d80e5b32a 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -150,6 +150,8 @@ static const char *const selectorNameTable[] = {
"setVol", // Laura Bow 2 CD
"at", // Longbow, QFG4
"owner", // Longbow, QFG4
+ "fade", // Longbow, Shivers
+ "enable", // Longbow, SQ6
"delete", // EcoQuest 1
"size", // EcoQuest 1
"signal", // EcoQuest 1, GK1
@@ -160,7 +162,6 @@ static const char *const selectorNameTable[] = {
"newWith", // SCI2 array script
"posn", // GK1, Phant2, QFG4
"printLang", // GK2
- "fade", // Shivers
"test", // Torin
"get", // Torin, GK1
"normalize", // GK1
@@ -208,7 +209,6 @@ static const char *const selectorNameTable[] = {
"setLooper", // QFG4
"useStamina", // QFG4
"value", // QFG4
- "enable", // SQ6
"setupExit", // SQ6
"vol", // SQ6
"walkIconItem", // SQ6
@@ -286,6 +286,8 @@ enum ScriptPatcherSelectors {
SELECTOR_setVol,
SELECTOR_at,
SELECTOR_owner,
+ SELECTOR_fade,
+ SELECTOR_enable,
SELECTOR_delete,
SELECTOR_size,
SELECTOR_signal,
@@ -297,7 +299,6 @@ enum ScriptPatcherSelectors {
SELECTOR_newWith,
SELECTOR_posn,
SELECTOR_printLang,
- SELECTOR_fade,
SELECTOR_test,
SELECTOR_get,
SELECTOR_normalize,
@@ -345,7 +346,6 @@ enum ScriptPatcherSelectors {
SELECTOR_setLooper,
SELECTOR_useStamina,
SELECTOR_value,
- SELECTOR_enable,
SELECTOR_setupExit,
SELECTOR_vol,
SELECTOR_walkIconItem
@@ -7887,6 +7887,67 @@ static const uint16 longbowPatchMarianMessagesFix[] = {
PATCH_END
};
+// In the abbey hedge maze, the music stops if the interpreter loads the next
+// maze room in under half a second. ScummVM can achieve this on fast machines.
+// When changing maze rooms, the old room sets the music to slowly fade to zero
+// without waiting. The new room then sets the music to fade back in to full
+// volume (127). This has no noticeable effect since the second fade reverts
+// the first almost instantly, but if the new room loads before the fade timer
+// has lowered the volume at all then kDoSoundFade ignores the second fade
+// because the volume is already at the target. The first fade then proceeds to
+// lower the volume to zero and stop the sound, after which it never resumes.
+//
+// We fix this by patching HedgeRow:dispose to only fade out the music when
+// exiting the maze. This doesn't change the music since the fades canceled
+// each other out when changing maze rooms. There is already a nearby check for
+// exiting the maze so this patch re-orders the instructions.
+//
+// Applies to: All versions
+// Responsible method: HedgeRow:dispose
+// Fixes bug: #13674
+static const uint16 longbowSignatureHedgeMazeMusic[] = {
+ SIG_MAGICDWORD,
+ 0x38, SIG_SELECTOR16(fade), // pushi fade
+ 0x39, 0x04, // pushi 04
+ 0x76, // push0
+ 0x39, 0x1e, // pushi 1e
+ 0x39, 0x08, // pushi 08
+ 0x78, // push1
+ 0x81, 0x64, // lag 64
+ 0x4a, 0x0c, // send 0c [ rgnMusic fade: 0 30 8 1 ]
+ 0x38, SIG_SELECTOR16(enable), // pushi enable
+ 0x78, // push1
+ 0x39, 0x05, // pushi 05
+ 0x81, 0x45, // lag 45
+ 0x4a, 0x06, // send 06 [ IconBar enable: 5 ]
+ 0x89, 0x0d, // lsg 0d [ new room ]
+ 0x35, 0x55, // ldi 55 [ max maze room ]
+ 0x1e, // gt? [ exiting hedge maze? ]
+ 0x30, SIG_UINT16(0x0020), // bnt 0020
+ SIG_END
+};
+
+static const uint16 longbowPatchHedgeMazeMusic[] = {
+ 0x38, PATCH_SELECTOR16(enable), // pushi enable
+ 0x78, // push1
+ 0x39, 0x05, // pushi 05
+ 0x81, 0x45, // lag 45
+ 0x4a, 0x06, // send 06 [ IconBar enable: 5 ]
+ 0x89, 0x0d, // lsg 0d [ new room ]
+ 0x35, 0x55, // ldi 55 [ max maze room ]
+ 0x1e, // gt? [ exiting hedge maze? ]
+ 0x30, PATCH_UINT16(0x002f), // bnt 002f
+ 0x38, PATCH_SELECTOR16(fade), // pushi fade
+ 0x39, 0x04, // pushi 04
+ 0x76, // push0
+ 0x39, 0x1e, // pushi 1e
+ 0x39, 0x08, // pushi 08
+ 0x78, // push1
+ 0x81, 0x64, // lag 64
+ 0x4a, 0x0c, // send 0c [ rgnMusic fade: 0 30 8 1 ]
+ PATCH_END
+};
+
// script, description, signature patch
static const SciScriptPatcherEntry longbowSignatures[] = {
{ true, 29, "amiga day 1 peasant woman", 1, longbowSignatureAmigaPeasantWoman, longbowPatchAmigaPeasantWoman},
@@ -7900,6 +7961,7 @@ static const SciScriptPatcherEntry longbowSignatures[] = {
{ 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 },
+ { true, 490, "hedge maze music", 1, longbowSignatureHedgeMazeMusic, longbowPatchHedgeMazeMusic },
{ true, 530, "amiga pub fix", 1, longbowSignatureAmigaPubFix, longbowPatchAmigaPubFix },
{ true, 600, "amiga fulk rescue fix", 1, longbowSignatureAmigaFulkRescue, longbowPatchAmigaFulkRescue },
{ true, 803, "amiga speed test", 1, longbowSignatureAmigaSpeedTest, longbowPatchAmigaSpeedTest },
Commit: 6e5b1e31f0f9672cb979a7fa12d4bed35a4f6bf1
https://github.com/scummvm/scummvm/commit/6e5b1e31f0f9672cb979a7fa12d4bed35a4f6bf1
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-07-30T16:39:25-04:00
Commit Message:
SCI: Include all music fade flags in save files
fadeSetVolume and fadeCompleted are used by the fade timer to signal
SoundCommand::processUpdateCues() that there is work to be done.
By not syncing them, if a save occurs after a fade completes but before
it's processed then the game won't see the completed fade when loading.
This can happen when the game is paused because the user has brought up
the game's menu bar or control panel in order to save a game. The fade
completes while the UI is displayed, then a save occurs, and then the
fade is processed after the UI is dismissed.
Now completed fades are processed when loading.
Fixes bug #7073 in KQ6 where saving in the Land of the Dead while
Alexander dismounts Night Mare results in a softlocked save.
Fixes bug #13546 in LSL6HIRES where saving while music fades from
a previous room results in a save that doesn't play the new music.
Changed paths:
engines/sci/engine/savegame.cpp
engines/sci/engine/savegame.h
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index a519164f436..097c57aa560 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -688,6 +688,8 @@ void MusicEntry::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsSint16LE(fadeStep);
s.syncAsSint32LE(fadeTicker);
s.syncAsSint32LE(fadeTickerStep);
+ s.syncAsByte(fadeSetVolume, VER(46));
+ s.syncAsByte(fadeCompleted, VER(46));
s.syncAsByte(stopAfterFading, VER(45));
s.syncAsByte(status);
if (s.getVersion() >= 32)
diff --git a/engines/sci/engine/savegame.h b/engines/sci/engine/savegame.h
index ae5b9eed793..ec62fbc93ba 100644
--- a/engines/sci/engine/savegame.h
+++ b/engines/sci/engine/savegame.h
@@ -36,7 +36,8 @@ struct EngineState;
*
* Version - new/changed feature
* =============================
- * 45 - Sync stopAfterFading
+ * 46 - Sync MusicEntry::fadeSetVolume and MusicEntry::fadeCompleted
+ * 45 - Sync MusicEntry::stopAfterFading
* 44 - GK2+SCI3 audio resource locks
* 43 - stop saving SCI3 mustSetViewVisible array
* 42 - SCI3 robots and VM objects
@@ -69,7 +70,7 @@ struct EngineState;
*/
enum {
- CURRENT_SAVEGAME_VERSION = 45,
+ CURRENT_SAVEGAME_VERSION = 46,
MINIMUM_SAVEGAME_VERSION = 14
#ifdef ENABLE_SCI32
,
Commit: c346905a1a8d8ef0a12cd5a32a7ba19376785559
https://github.com/scummvm/scummvm/commit/c346905a1a8d8ef0a12cd5a32a7ba19376785559
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-07-30T16:39:26-04:00
Commit Message:
SCI: Reset palette cycling when loading games
Fixes frozen palette animation when loading from within the engine
Changed paths:
engines/sci/engine/savegame.cpp
engines/sci/graphics/palette.cpp
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 097c57aa560..a27b699dd1a 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -847,6 +847,13 @@ void GfxPalette::palVarySaveLoadPalette(Common::Serializer &s, Palette *palette)
}
void GfxPalette::saveLoadWithSerializer(Common::Serializer &s) {
+ if (s.isLoading()) {
+ // Palette cycling schedules must be reset on load because we persist the engine tick count.
+ // Otherwise, loading during cycling leaves the animation stuck until the new lower tick count
+ // reaches the stale scheduled values. (Example: SQ5 Kiz Urazgubi waterfalls)
+ // SSCI didn't persist or reset engine tick count so it didn't need to reset the schedules.
+ _schedules.clear();
+ }
if (s.getVersion() >= 25) {
// We need to save intensity of the _sysPalette at least for kq6 when entering the dark cave (room 390)
// from room 340. scripts will set intensity to 60 for this room and restore them when leaving.
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 859ce4d464b..40852d7f5b8 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -572,11 +572,10 @@ int16 GfxPalette::kernelFindColor(uint16 r, uint16 g, uint16 b, bool force16BitC
// Returns true, if palette got changed
bool GfxPalette::kernelAnimate(byte fromColor, byte toColor, int speed) {
Color col;
- //byte colorNr;
int16 colorCount;
uint32 now = g_sci->getTickCount();
- // search for sheduled animations with the same 'from' value
+ // search for scheduled animations with the same 'from' value
// schedule animation...
int scheduleCount = _schedules.size();
int scheduleNr;
Commit: b267706b8d5380d144bd14e0fbb025b349ac6dd8
https://github.com/scummvm/scummvm/commit/b267706b8d5380d144bd14e0fbb025b349ac6dd8
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-07-30T16:39:26-04:00
Commit Message:
SCI: Fix SQ5 WD40 tunnel entrance lockup
Fixes bug #9988
Changed paths:
engines/sci/engine/script_patches.cpp
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index d7d80e5b32a..8d30ed9480f 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -22189,6 +22189,53 @@ static const uint16 sq5PatchTabInventoryCursorFix[] = {
PATCH_END
};
+// In room 310, if WD40 appears while ego is exiting through the left tunnel
+// then the room exits break. When ego is near the tunnel, sWD40Appear waits
+// for seven seconds before calling handsOff. If sExitViaTunnelB is running
+// then handsOff stops ego's exit motion and the room script never completes.
+//
+// We fix this by clearing sWD40Appear:seconds when starting sExitViaTunnelB so
+// that the timer in sWD40Appear state 0 is stopped once ego begins exiting the
+// the room. sWD40Appear already checks that sExitViaTunnelB isn't running in
+// its later states, but it's missing the check in state 1.
+//
+// Applies to: All versions
+// Responsible method: rm310:doit
+// Fixes bug: #9988
+static const uint16 sq5SignatureWd40TunnelLockupFix[] = {
+ 0x72, SIG_ADDTOOFFSET(+2), // lofsa sWD40Appear
+ SIG_ADDTOOFFSET(+15),
+ 0x38, SIG_SELECTOR16(script), // pushi script
+ 0x76, // push0
+ 0x81, 0x02, // lag 02
+ 0x4a, SIG_MAGICDWORD, 0x04, // send 04 [ rm310 script? ]
+ 0x18, // not
+ 0x31, 0x0e, // bnt 0e [ skip sExitViaTunnelB if room has script ]
+ 0x38, SIG_SELECTOR16(setScript), // pushi setScript
+ 0x78, // push1
+ 0x72, SIG_ADDTOOFFSET(+2), // lofsa sExitViaTunnelB
+ 0x36, // push
+ 0x81, 0x02, // lag 02
+ 0x4a, 0x06, // send 06 [ rm310 setScript: sExitViaTunnelB ]
+ SIG_END
+};
+
+static const uint16 sq5PatchWd40TunnelLockupFix[] = {
+ PATCH_ADDTOOFFSET(+18),
+ 0x63, 0x12, // pToa script
+ 0x2f, 0x15, // bt 15 [ skip sExitViaTunnelB if room has script ]
+ 0x38, PATCH_SELECTOR16(setScript), // pushi setScript
+ 0x78, // push1
+ 0x74, PATCH_GETORIGINALUINT16(+34), // lofss sExitViaTunnelB
+ 0x54, 0x06, // self 06 [ self setScript: sExitViaTunnelB ]
+ 0x38, PATCH_SELECTOR16(seconds), // pushi seconds
+ 0x78, // push1
+ 0x76, // push0
+ 0x72, PATCH_GETORIGINALUINT16(+1), // lofsa sWD40Appear
+ 0x4a, 0x06, // send 06 [ sWD40Appear seconds: 0 (stop timer) ]
+ PATCH_END
+};
+
// script, description, signature patch
static const SciScriptPatcherEntry sq5Signatures[] = {
{ true, 0, "tab inventory cursor fix", 1, sq5SignatureTabInventoryCursorFix, sq5PatchTabInventoryCursorFix },
@@ -22197,6 +22244,7 @@ static const SciScriptPatcherEntry sq5Signatures[] = {
{ true, 243, "transporter room speed fix", 3, sq5SignatureTransporterRoomSpeedFix, sq5PatchTransporterRoomSpeedFix },
{ true, 250, "elevator handsOn fix", 1, sq5SignatureElevatorHandsOn, sq5PatchElevatorHandsOn },
{ true, 305, "wd40 fruit fix", 1, sq5SignatureWd40FruitFix, sq5PatchWd40FruitFix },
+ { true, 310, "wd40 tunnel lockup fix", 1, sq5SignatureWd40TunnelLockupFix, sq5PatchWd40TunnelLockupFix },
{ true, 335, "wd40 alarm countdown fix", 1, sq5SignatureWd40AlarmCountdownFix, sq5PatchWd40AlarmCountdownFix },
{ true, 730, "genetix bridge handsOn fix", 1, sq5SignatureGenetixBridgeHandsOn, sq5PatchGenetixBridgeHandsOn },
{ true, 30, "ChoiceTalker lockup fix", 1, sciNarratorLockupSignature, sciNarratorLockupPatch },
Commit: adb211613ffcb39d1313885e0dd2b1288d458861
https://github.com/scummvm/scummvm/commit/adb211613ffcb39d1313885e0dd2b1288d458861
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-07-30T16:39:26-04:00
Commit Message:
SCI: Fix SQ5 WD40 missing messages
Changed paths:
engines/sci/engine/script_patches.cpp
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 8d30ed9480f..996ce45850c 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -22236,6 +22236,39 @@ static const uint16 sq5PatchWd40TunnelLockupFix[] = {
PATCH_END
};
+// In room 310, clicking Talk or most inventory items on WD40 results in a
+// missing message error. When WD40 is visible, wd40:doVerb passes the incoming
+// verb directly to testMessager:say without first checking if a message exists
+// for the verb. We fix this by setting the noun and modNum as in the other
+// rooms on K.U. and then calling super:doVerb as normal.
+//
+// Applies to: All versions
+// Responsible method: wd40:doVerb
+static const uint16 sq5SignatureWd40MissingMessages[] = {
+ 0x38, SIG_SELECTOR16(say), // pushi say
+ SIG_MAGICDWORD,
+ 0x39, 0x06, // pushi 06
+ 0x39, 0x04, // pushi 04
+ 0x8f, 0x01, // lsp 01
+ 0x76, // push0
+ 0x76, // push0
+ 0x76, // push0
+ 0x38, SIG_UINT16(0x012d), // pushi 012d
+ 0x81, 0x5b, // lag 5b
+ 0x4a, 0x10, // send 10 [ testMessager say: 4 verb 0 0 0 301 ]
+ 0x33, 0x0b, // jmp 0b [ skip super: doVerb verb &rest ]
+ SIG_END
+};
+
+static const uint16 sq5PatchWd40MissingMessages[] = {
+ 0x35, 0x04, // ldi 04
+ 0x65, 0x1a, // aTop noun [ noun = 4 ]
+ 0x34, PATCH_UINT16(0x012d), // ldi 012d
+ 0x65, 0x1c, // aTop modNum [ modNum = 301 ]
+ 0x33, 0x0a, // jmp 0a [ super: doVerb verb &rest ]
+ PATCH_END
+};
+
// script, description, signature patch
static const SciScriptPatcherEntry sq5Signatures[] = {
{ true, 0, "tab inventory cursor fix", 1, sq5SignatureTabInventoryCursorFix, sq5PatchTabInventoryCursorFix },
@@ -22245,6 +22278,7 @@ static const SciScriptPatcherEntry sq5Signatures[] = {
{ true, 250, "elevator handsOn fix", 1, sq5SignatureElevatorHandsOn, sq5PatchElevatorHandsOn },
{ true, 305, "wd40 fruit fix", 1, sq5SignatureWd40FruitFix, sq5PatchWd40FruitFix },
{ true, 310, "wd40 tunnel lockup fix", 1, sq5SignatureWd40TunnelLockupFix, sq5PatchWd40TunnelLockupFix },
+ { true, 310, "wd40 missing messages", 1, sq5SignatureWd40MissingMessages, sq5PatchWd40MissingMessages },
{ true, 335, "wd40 alarm countdown fix", 1, sq5SignatureWd40AlarmCountdownFix, sq5PatchWd40AlarmCountdownFix },
{ true, 730, "genetix bridge handsOn fix", 1, sq5SignatureGenetixBridgeHandsOn, sq5PatchGenetixBridgeHandsOn },
{ true, 30, "ChoiceTalker lockup fix", 1, sciNarratorLockupSignature, sciNarratorLockupPatch },
More information about the Scummvm-git-logs
mailing list