aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorColin Snover2017-06-24 16:47:16 -0500
committerColin Snover2017-06-24 16:54:31 -0500
commit1ca905e860035c4bfa5e0dd54a2a9788bf3e7f37 (patch)
treec0af35d490d3e75dff3821559fba9bfbf30b486c /engines/sci
parent6f02bbc8ddff87a566d47b4608b14cdd37d7c31c (diff)
downloadscummvm-rg350-1ca905e860035c4bfa5e0dd54a2a9788bf3e7f37.tar.gz
scummvm-rg350-1ca905e860035c4bfa5e0dd54a2a9788bf3e7f37.tar.bz2
scummvm-rg350-1ca905e860035c4bfa5e0dd54a2a9788bf3e7f37.zip
SCI32: Replace Torin dragon's cave patch with a better patch
The previous script patch for this bug was much simpler and targeted the bad code that hangs, instead of the bad code that caused the unexpected flag setting, but this caused glitches in the dragon's cave that couldn't really be fixed since different animations relied on some common code for positioning Boogle. So, now, this more complicated patch fixes the fast-forward code in the seraglio to set Boogle's in-the-bag flag, which is what the dragon's cave needs in order to not hang when worming Boogle. Also, because this patch now targets the code that caused the bad flag state, instead of the code that hangs on the bad state, any save game in the dragon's cave with the bag flag setting will need to be fixed by exiting and re-entering the dragon's cave. Refs Trac#9836.
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/script_patches.cpp132
1 files changed, 94 insertions, 38 deletions
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index c7d3ed57ab..9bc2b85fb2 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -113,6 +113,9 @@ static const char *const selectorNameTable[] = {
"detailLevel", // GK2 benchmarking
"view", // RAMA benchmarking
"test", // Torin
+ "get", // Torin
+ "set", // Torin
+ "clear", // Torin
#endif
NULL
};
@@ -152,7 +155,10 @@ enum ScriptPatcherSelectors {
SELECTOR_posn,
SELECTOR_detailLevel,
SELECTOR_view,
- SELECTOR_test
+ SELECTOR_test,
+ SELECTOR_get,
+ SELECTOR_set,
+ SELECTOR_clear
#endif
};
@@ -5607,55 +5613,105 @@ static const uint16 torinNumSavesPatch[] = {
};
// In Escarpa, it is possible for Boogle to be left outside of Torin's bag
-// before attempting to worm into the dragon's cave. When this happens, Boogle
-// can be on the wrong side of the navigable area barrier, and cannot move
-// through it to continue the cutscene. In contrast, when Boogle is in Torin's
-// bag, the game moves Boogle out of the bag and into a position that is
-// guaranteed to work. This patch simply removes the bag check so that Boogle is
-// unconditionally repositioned for the cutscene.
+// when fast-forwarding through the exit animation of the seraglio. If this
+// happens, when the player goes from the seraglio to the dragon's cave and then
+// tries to worm Boogle to the left side of the cave, the game will hang because
+// Boogle is on the wrong side of the navigable area barrier and cannot move
+// through it to continue the cutscene. This patch fixes the fast-forward code
+// in the seraglio so that Boogle's in-the-bag flag is set when fast forwarding.
// Applies to at least: English CD
-static const uint16 torinBoogleWormInSignature[] = {
- 0x38, SIG_SELECTOR16(test), // pushi test
- 0x78, // push1
+static const uint16 torinSeraglioBoogleFlagSignature[] = {
+ 0x35, 0x00, // ldi 0
SIG_MAGICDWORD,
- 0x38, SIG_UINT16(0xe8), // pushi $232 (boogle in bag flag)
- 0x7a, // push2
- 0x38, SIG_UINT16(0xfa11), // pushi 64017
- 0x76, // push0
- 0x43, 0x02, SIG_UINT16(0x04), // callk ScriptID[2], 4
- 0x4a, SIG_UINT16(0x06), // send 6
- 0x30, SIG_ADDTOOFFSET(+2), // bnt
+ 0xa3, 0x00, // sal 0
+ 0x38, SIG_SELECTOR16(test), // pushi test
+ SIG_ADDTOOFFSET(0x5a), // all the rest of the method
SIG_END
};
-static const uint16 torinBoogleWormInPatch[] = {
- 0x32, PATCH_UINT16(0x13), // jmp [to boogle init]
- PATCH_END
-};
+static const uint16 torinSeraglioBoogleFlagPatch[] = {
+ // @1e5f
+ // ldi 0, sal 0 removed from here (+4 bytes)
-// The previous patch for this bug will cause Boogle to glitch back to the
-// entrance when Boogle is wormed to the left, then unwormed, then wormed to the
-// left again without exiting and re-entering the dragon's cave. To keep this
-// from happening, this patch causes Boogle to walk back to the entrance when
-// unworming, instead of stopping in the middle of the screen.
-// Applies to at least: English CD
-static const uint16 torinBoogleWormSignature[] = {
- SIG_MAGICDWORD,
- 0x38, SIG_UINT16(0x29e), // pushi 670
- 0x38, SIG_UINT16(0xc2), // pushi 194
- SIG_END
-};
+ // @1e5f (+4 bytes)
+ // local[0] = /* oFlags */ ScriptID(64017, 0);
+ 0x7a, // push2
+ 0x38, PATCH_UINT16(0xfa11), // pushi 64017
+ 0x76, // push0
+ 0x43, 0x02, PATCH_UINT16(4), // callk ScriptID[2], 4
+ 0xa3, 0x00, // sal 0 (-2 bytes)
+
+ // @1e6a (+2 bytes)
+ // acc = local[0].test(94);
+ 0x38, PATCH_SELECTOR16(test), // pushi test
+ 0x78, // push1
+ 0x39, 0x5e, // pushi 94
+ 0x4a, PATCH_UINT16(0x06), // send 6
+
+ // @1e73 (+2 bytes)
+ // if (!acc) goto elseCase;
+ 0x30, PATCH_UINT16(0x34), // bnt 0x31 + 3
+
+ // @1e76 (+2 bytes)
+ // global[0].get(ScriptID(64001, 0).get(20));
+ 0x38, PATCH_SELECTOR16(get), // pushi get
+ 0x78, // push1
+ 0x38, PATCH_SELECTOR16(get), // pushi get
+ 0x78, // push1
+ 0x39, 0x14, // pushi 20
+ 0x7a, // push2
+ 0x38, PATCH_UINT16(0xfa01), // pushi 64001
+ 0x76, // push0
+ 0x43, 0x02, PATCH_UINT16(4), // callk ScriptID[2], 4
+ 0x4a, PATCH_UINT16(0x06), // send 6
+ 0x36, // push
+ 0x81, 0x00, // lag 0 (ego)
+ 0x4a, PATCH_UINT16(0x06), // send 6
+
+ // @1e92 (+2 bytes)
+ // local[0].set(52);
+ 0x38, PATCH_SELECTOR16(set), // pushi set
+ 0x78, // push1
+ 0x39, 0x34, // pushi 52
+ 0x83, 0x00, // lal 0 (+7 byte)
+ 0x4a, PATCH_UINT16(0x06), // send 6
+
+ // @1e9d (+9 bytes)
+ // goto endOfBranch;
+ 0x33, 0x0b, // jmp [to end of conditional branch] (+1 byte)
+
+ // @1e9f (+10 bytes)
+ // elseCase: local[0].clear(97);
+ 0x38, PATCH_SELECTOR16(clear), // pushi clear
+ 0x78, // push1
+ 0x39, 0x61, // pushi 97
+ 0x83, 0x00, // lal 0 (+7 bytes)
+ 0x4a, PATCH_UINT16(0x06), // send 6
+
+ // @1eaa (+17 bytes)
+ // endOfBranch: local[0].set(232);
+ 0x38, PATCH_SELECTOR16(set), // pushi set (-3 bytes)
+ 0x78, // push1 (-1 byte)
+ 0x38, PATCH_UINT16(0xe8), // pushi 232 (Boogle-in-bag flag) (-3 bytes)
+ 0x83, 0x00, // lal 0 (-2 bytes)
+ 0x4a, PATCH_UINT16(0x06), // send 6 (-3 bytes)
+
+ // @1eb6 (+5 bytes)
+ // local[0] = 0; self.dispose();
+ 0x38, PATCH_SELECTOR16(dispose), // pushi dispose
+ 0x76, // push0
+ 0x3c, // dup (-1 byte)
+ 0xab, 0x00, // ssl 0 (-2 bytes)
+ 0x54, PATCH_UINT16(4), // self 4
+ 0x48, // ret
-static const uint16 torinBoogleWormPatch[] = {
- 0x38, SIG_UINT16(940),
- 0x38, SIG_UINT16(216),
+ // @1ec1 (+2 bytes)
PATCH_END
};
// script, description, signature patch
static const SciScriptPatcherEntry torinSignatures[] = {
- { true, 20400, "fix hang when worming into dragon cave 1/2", 1, torinBoogleWormInSignature, torinBoogleWormInPatch },
- { true, 20400, "fix hang when worming into dragon cave 2/2", 1, torinBoogleWormSignature, torinBoogleWormPatch },
+ { true, 20600, "fix wrong boogle bag flag on fast-forward", 1, torinSeraglioBoogleFlagSignature, torinSeraglioBoogleFlagPatch },
{ true, 64000, "disable volume reset on startup 1/2", 1, torinVolumeResetSignature1, torinVolumeResetPatch1 },
{ true, 64000, "disable volume reset on startup 2/2", 1, torinVolumeResetSignature2, torinVolumeResetPatch2 },
{ true, 64866, "increase number of save games", 1, torinNumSavesSignature, torinNumSavesPatch },