diff options
Diffstat (limited to 'engines/sci/engine/script_patches.cpp')
-rw-r--r-- | engines/sci/engine/script_patches.cpp | 84 |
1 files changed, 78 insertions, 6 deletions
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index c928cf3569..20c5c52178 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -23,6 +23,7 @@ #include "sci/sci.h" #include "sci/engine/script.h" #include "sci/engine/state.h" +#include "sci/engine/features.h" #include "common/util.h" @@ -62,7 +63,7 @@ struct SciScriptSignature { // boundaries of room 660. Normally a textbox is supposed to get on screen // but the call is wrong, so not only do we get an error message the script // is also hanging because the cue won't get sent out -// This also happens in sierra sci - ffs. bug #3038387 +// This also happens in sierra sci - refer to bug #3038387 const byte ecoquest1SignatureStayAndHelp[] = { 40, 0x3f, 0x01, // link 01 @@ -128,7 +129,7 @@ const SciScriptSignature ecoquest1Signatures[] = { // ecorder. This is done by reusing temp-space, that was filled on state 1. // this worked in sierra sci just by accident. In our sci, the temp space // is resetted every time, which means the previous text isn't available -// anymore. We have to patch the code because of that ffs. bug #3035386 +// anymore. We have to patch the code because of that - bug #3035386 const byte ecoquest2SignatureEcorder[] = { 35, 0x31, 0x22, // bnt [next state] @@ -363,10 +364,42 @@ const uint16 freddypharkasPatchLadderEvent[] = { PATCH_END }; +// In the Macintosh version of Freddy Pharkas, kRespondsTo is broken for +// property selectors. They hacked the script to work around the issue, +// so we revert the script back to using the values of the DOS script. +const byte freddypharkasSignatureMacInventory[] = { + 10, + 0x39, 0x23, // pushi 23 + 0x39, 0x74, // pushi 74 + 0x78, // push1 + 0x38, 0x01, 0x74, // pushi 0174 + 0x85, 0x15, // lat 15 + 0 +}; + +const uint16 freddypharkasPatchMacInventory[] = { + 0x39, 0x02, // pushi 02 (now matches the DOS version) + 0x39, 0x74, // pushi 74 + 0x78, // push1 + 0x38, 0x01, 0x74, // pushi 0174 + 0x85, 0x15, // lat 15 + 0x4a, 0x06, // send 06 + 0x31, 0x08, // bnt 08 + 0x38, 0x01, 0x74, // pushi 0174 + 0x76, // push0 + 0x85, 0x15, // lat 15 + 0x4a, 0x04, // send 04 + 0x02, // add + 0xa5, 0x12, // sat 12 + 0x39, 0x04, // pushi 04 (now matches the DOS version) + PATCH_END +}; + // script, description, magic DWORD, adjust const SciScriptSignature freddypharkasSignatures[] = { { 0, "CD: score early disposal", 1, PATCH_MAGICDWORD(0x39, 0x0d, 0x43, 0x75), -3, freddypharkasSignatureScoreDisposal, freddypharkasPatchScoreDisposal }, - { 235, "CD: canister pickup hang", 3, PATCH_MAGICDWORD(0x39, 0x07, 0x39, 0x08), -4, freddypharkasSignatureCanisterHang, freddypharkasPatchCanisterHang }, + { 15, "Mac: broken inventory", 1, PATCH_MAGICDWORD(0x39, 0x23, 0x39, 0x74), 0, freddypharkasSignatureMacInventory, freddypharkasPatchMacInventory }, + { 235, "CD: canister pickup hang", 3, PATCH_MAGICDWORD(0x39, 0x07, 0x39, 0x08), -4, freddypharkasSignatureCanisterHang, freddypharkasPatchCanisterHang }, { 320, "ladder event issue", 2, PATCH_MAGICDWORD(0x6d, 0x76, 0x38, 0xf5), -1, freddypharkasSignatureLadderEvent, freddypharkasPatchLadderEvent }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -590,6 +623,34 @@ const uint16 kq5PatchWitchCageInit[] = { PATCH_END }; + +// In the final battle, the DOS version uses signals in the music to handle +// timing, while in the Windows version another method is used and the GM +// tracks do not contain these signals. +// The original kq5 interpreter used global 400 to distinguish between +// Windows (1) and DOS (0) versions. +// We replace the 4 relevant checks for global 400 by a fixed true when +// we use these GM tracks. +// +// Instead, we could have set global 400, but this has the possibly unwanted +// side effects of switching to black&white cursors (which also needs complex +// changes to GameFeatures::detectsetCursorType() ) and breaking savegame +// compatibilty between the DOS and Windows CD versions of KQ5. +// TODO: Investigate these side effects more closely. +const byte kq5SignatureWinGMSignals[] = { + 9, + 0x80, 0x90, 0x01, // lag 0x190 + 0x18, // not + 0x30, 0x1b, 0x00, // bnt +0x001B + 0x89, 0x57, // lsg 0x57 + 0 +}; + +const uint16 kq5PatchWinGMSignals[] = { + 0x34, 0x01, 0x00, // ldi 0x0001 + PATCH_END +}; + // script, description, magic DWORD, adjust const SciScriptSignature kq5Signatures[] = { { 0, "CD: harpy volume change", 1, PATCH_MAGICDWORD(0x80, 0x91, 0x01, 0x18), 0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume }, @@ -597,6 +658,13 @@ const SciScriptSignature kq5Signatures[] = { SCI_SIGNATUREENTRY_TERMINATOR }; +const SciScriptSignature kq5WinGMSignatures[] = { + { 0, "CD: harpy volume change", 1, PATCH_MAGICDWORD(0x80, 0x91, 0x01, 0x18), 0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume }, + { 200, "CD: witch cage init", 1, PATCH_MAGICDWORD(0x7a, 0x00, 0xc8, 0x00), -10, kq5SignatureWitchCageInit, kq5PatchWitchCageInit }, + { 124, "Win: GM Music signal checks", 4, PATCH_MAGICDWORD(0x80, 0x90, 0x01, 0x18), 0, kq5SignatureWinGMSignals, kq5PatchWinGMSignals }, + SCI_SIGNATUREENTRY_TERMINATOR +}; + // =========================================================================== // When giving the milk bottle to one of the babies in the garden in KQ6 (room // 480), script 481 starts a looping baby cry sound. However, that particular @@ -1034,7 +1102,7 @@ const SciScriptSignature qfg3Signatures[] = { // adds it to nest::x. The problem is that the script also checks if x exceeds // we never reach that of course, so the pterodactyl-flight will go endlessly // we could either calculate property count differently somehow fixing this -// but I think just patching it out is cleaner (ffs. bug #3037938) +// but I think just patching it out is cleaner (bug #3037938) const byte sq4FloppySignatureEndlessFlight[] = { 8, 0x39, 0x04, // pushi 04 (selector x) @@ -1045,7 +1113,7 @@ const byte sq4FloppySignatureEndlessFlight[] = { 0 }; -// Similar to the above, for the German version (ffs. bug #3110215) +// Similar to the above, for the German version (bug #3110215) const byte sq4FloppySignatureEndlessFlightGerman[] = { 8, 0x39, 0x04, // pushi 04 (selector x) @@ -1317,7 +1385,11 @@ void Script::matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uin signatureTable = gk1Signatures; break; case GID_KQ5: - signatureTable = kq5Signatures; + // See the explanation in the kq5SignatureWinGMSignals comment + if (g_sci->_features->useAltWinGMSound()) + signatureTable = kq5WinGMSignatures; + else + signatureTable = kq5Signatures; break; case GID_KQ6: signatureTable = kq6Signatures; |