aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsluicebox2019-10-30 05:02:26 -0700
committersluicebox2019-10-30 05:05:48 -0700
commit08191db22a79f09a367e732fd30bc024882cc17b (patch)
tree8481a8c7d59db1be242dddc450633830602a8541
parenta3c65b1a15d6c588c011799264c74aa8da7a44c4 (diff)
downloadscummvm-rg350-08191db22a79f09a367e732fd30bc024882cc17b.tar.gz
scummvm-rg350-08191db22a79f09a367e732fd30bc024882cc17b.tar.bz2
scummvm-rg350-08191db22a79f09a367e732fd30bc024882cc17b.zip
SCI: Fix QFG3 Johari and Manu map bugs
Fixes bug #11216
-rw-r--r--engines/sci/engine/script_patches.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 6db0222e1a..255d8dd9a5 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -10203,6 +10203,42 @@ static const uint16 qfg3PatchChestIconBar[] = {
PATCH_END
};
+// Entering the jungle close to the Leopardman village and then exiting with
+// Johari causes the game to display corrupt message boxes and divide by zero.
+// Manu's script has the same bugs which could potentially be triggered.
+//
+// The script fromJungle in room 170 sets local0 to the result of calculations
+// based on ego's initial distance to his destination. The scripts walkJohari
+// and walkManu divide by local0. fromJungle checks to see if it's set local0
+// to zero, but instead of addressing this, it displays a series of messages
+// all at once and corrupts the screen before continuing on to the error.
+//
+// We fix this by not setting local0 to zero and disabling the broken messages.
+// The message code is unnecessary since later in the same game cycle a local
+// procedure displays the messages correctly. This is similar to the fix in the
+// QFG3 Unofficial Update: https://github.com/AshLancer/QFG3-Fan-Patch
+//
+// Applies to: All versions
+// Responsible method: fromJungle:changeState(0)
+// Fixes bug: #11216
+static const uint16 qfg3SignatureJohariManuMapBugs[] = {
+ SIG_MAGICDWORD,
+ 0xa3, 0x00, // sal 00 [ local0 = result ]
+ 0x36, // push
+ 0x35, 0x01, // ldi 01
+ 0x22, // lt? [ local0 < 1 ]
+ 0x31, // bnt [ skip broken messages ]
+ SIG_END
+};
+
+static const uint16 qfg3PatchJohariManuMapBugs[] = {
+ 0x2f, 0x02, // bt 02
+ 0x35, 0x01, // ldi 01
+ 0xa3, 0x00, // sal 00 [ local0 = result ? result : 1 ]
+ 0x33, // jmp [ always skip broken messages ]
+ PATCH_END
+};
+
// script, description, signature patch
static const SciScriptPatcherEntry qfg3Signatures[] = {
{ true, 944, "import dialog continuous calls", 1, qfg3SignatureImportDialog, qfg3PatchImportDialog },
@@ -10220,6 +10256,7 @@ static const SciScriptPatcherEntry qfg3Signatures[] = {
{ true, 750, "hero goes out of bounds in room 750", 2, qfg3SignatureRoom750Bounds2, qfg3PatchRoom750Bounds2 },
{ true, 750, "hero goes out of bounds in room 750", 2, qfg3SignatureRoom750Bounds3, qfg3PatchRoom750Bounds3 },
{ true, 29, "icon bar crash when using chest", 1, qfg3SignatureChestIconBar, qfg3PatchChestIconBar },
+ { true, 170, "johari/manu map crash and message bugs", 2, qfg3SignatureJohariManuMapBugs, qfg3PatchJohariManuMapBugs },
SCI_SIGNATUREENTRY_TERMINATOR
};