[Scummvm-git-logs] scummvm master -> 474ef22e24a4c885532db6f8acdf63c7957e45fe
sluicebox
noreply at scummvm.org
Thu Mar 28 16:21:38 UTC 2024
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:
474ef22e24 SCI32: Fix QFG4 crash when throwing at rock pile
Commit: 474ef22e24a4c885532db6f8acdf63c7957e45fe
https://github.com/scummvm/scummvm/commit/474ef22e24a4c885532db6f8acdf63c7957e45fe
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-03-28T09:21:21-07:00
Commit Message:
SCI32: Fix QFG4 crash when throwing at rock pile
Fixes bug #14921
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 8b78a0b2dbc..7cbad1e1c3a 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -19146,6 +19146,58 @@ static const uint16 qfg4WalkDownSlopeNrsPatch[] = {
PATCH_END
};
+// When throwing a projectile at the rock pile in room 800, the game crashes if
+// the target is hit before hero finishes animating. This is a script bug that
+// also occurs in the original. It depends on the game's speed setting and
+// where hero throws from. Setting the speed to fast avoids the crash.
+//
+// This is similar to the bug in the final room when casting a spell: there's no
+// synchronization with the `project` room script. When the projectile reaches
+// the rocks, fRocks:getHurt sets the room script to sThrowIt. If `project` is
+// still running then it's interrupted before it can restore hero's state.
+// Attempting to walk from this unexpected state crashes the game by sending a
+// message to a non-object.
+//
+// We fix this by calling hero:normalize in sThrowIt:changeState so that hero's
+// state is always reset, even if the `project` script was interrupted.
+//
+// Applies to: All versions
+// Responsible method: sThrowIt:changeState(1)
+// Fixes bug: #14921
+static const uint16 qfg4RockPileThrowSignature[] = {
+ 0x8b, SIG_MAGICDWORD, 0x0a, // lsl 0a
+ 0x35, 0x03, // ldi 03
+ 0x1c, // ne? [ local10 != 3 ]
+ 0x31, 0x13, // bnt 13 [ move bush ]
+ 0x38, SIG_SELECTOR16(handsOn), // pushi handsOn
+ 0x76, // push0
+ 0x81, 0x01, // lag 01
+ 0x4a, SIG_UINT16(0x0004), // send 04 [ Glory handsOn: ]
+ 0x38, SIG_SELECTOR16(dispose), // pushi dispose
+ 0x76, // push0
+ 0x54, SIG_UINT16(0x0004), // self 04 [ self dispose: ]
+ 0x32, // jmp [ toss, ret ]
+ SIG_END
+};
+
+static const uint16 qfg4RockPileThrowPatch[] = {
+ 0x38, PATCH_SELECTOR16(normalize), // pushi normalize
+ 0x78, // push1
+ 0x76, // push0
+ 0x81, 0x00, // lag 00
+ 0x4a, PATCH_UINT16(0x0006), // send 06 [ hero normalize: 0 ]
+ 0x7a, // push2
+ 0x83, 0x0a, // lal 0a
+ 0x20, // ge? [ 2 >= local10 ]
+ 0x31, 0x0a, // bnt 0a [ move bush ]
+ 0x38, PATCH_SELECTOR16(changeState),// pushi changeState
+ 0x78, // push1
+ 0x39, 0x04, // pushi 04
+ 0x54, PATCH_UINT16(0x0006), // self 06 [ self changeState: 4 (handsOn, dispose) ]
+ 0x48, // ret
+ PATCH_END
+};
+
// The NRS fan-patch for wraiths has a bug which locks up the game. This occurs
// when a wraith initializes while game time is greater than $7fff. The patch
// throttles wraith:doit to execute no more than once per game tick, which it
@@ -20848,6 +20900,7 @@ static const SciScriptPatcherEntry qfg4Signatures[] = {
{ true, 770, "fix bone cage teller", 1, qfg4BoneCageTellerSignature, qfg4BoneCageTellerPatch },
{ true, 800, "fix setScaler calls", 1, qfg4SetScalerSignature, qfg4SetScalerPatch },
{ true, 800, "fix grapnel removing hero's scaler", 1, qfg4RopeScalerSignature, qfg4RopeScalerPatch },
+ { true, 800, "fix rock pile throw", 1, qfg4RockPileThrowSignature, qfg4RockPileThrowPatch },
{ true, 801, "fix runes puzzle (1/2)", 1, qfg4RunesPuzzleSignature1, qfg4RunesPuzzlePatch1 },
{ true, 801, "fix runes puzzle (2/2)", 1, qfg4RunesPuzzleSignature2, qfg4RunesPuzzlePatch2 },
{ true, 803, "CD: fix sliding down slope", 1, qfg4SlidingDownSlopeCDSignature, qfg4SlidingDownSlopeCDPatch },
More information about the Scummvm-git-logs
mailing list