aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/script_patches.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine/script_patches.cpp')
-rw-r--r--engines/sci/engine/script_patches.cpp116
1 files changed, 105 insertions, 11 deletions
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index dbc351d8f2..b2d66d0170 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -105,6 +105,7 @@ static const char *const selectorNameTable[] = {
"setLoop", // Laura Bow 1 Colonel's Bequest
#ifdef ENABLE_SCI32
"newWith", // SCI2 array script
+ "scrollSelections", // GK2
#endif
NULL
};
@@ -137,7 +138,8 @@ enum ScriptPatcherSelectors {
SELECTOR_setLoop
#ifdef ENABLE_SCI32
,
- SELECTOR_newWith
+ SELECTOR_newWith,
+ SELECTOR_scrollSelections
#endif
};
@@ -1012,11 +1014,40 @@ static const SciScriptPatcherEntry gk1Signatures[] = {
#pragma mark -
#pragma mark Gabriel Knight 2
-// script, description, signature patch
+// The down scroll button in GK2 jumps up a pixel on mousedown because there is
+// a send to scrollSelections using an immediate value 1, which means to scroll
+// up by 1 pixel. This patch fixes the send to scrollSelections by passing the
+// button's delta instead of 1.
+//
+// Applies to at least: English CD 1.00, English Steam 1.01
+// Responsible method: ScrollButton::track
+static const uint16 gk2InvScrollSignature[] = {
+ 0x7e, SIG_ADDTOOFFSET(2), // line whatever
+ SIG_MAGICDWORD,
+ 0x38, SIG_SELECTOR16(scrollSelections), // pushi $2c3
+ 0x78, // push1
+ 0x78, // push1
+ 0x63, 0x98, // pToa $98
+ 0x4a, SIG_UINT16(0x06), // send $6
+ SIG_END
+};
+
+static const uint16 gk2InvScrollPatch[] = {
+ 0x38, PATCH_SELECTOR16(scrollSelections), // pushi $2c3
+ 0x78, // push1
+ 0x67, 0x9a, // pTos $9a (delta)
+ 0x63, 0x98, // pToa $98
+ 0x4a, PATCH_UINT16(0x06), // send $6
+ 0x18, 0x18, // waste bytes
+ PATCH_END
+};
+
+// script, description, signature patch
static const SciScriptPatcherEntry gk2Signatures[] = {
- { true, 64990, "increase number of save games", 1, sci2NumSavesSignature1, sci2NumSavesPatch1 },
- { true, 64990, "increase number of save games", 1, sci2NumSavesSignature2, sci2NumSavesPatch2 },
- { true, 64990, "disable change directory button", 1, sci2ChangeDirSignature, sci2ChangeDirPatch },
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature1, sci2NumSavesPatch1 },
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature2, sci2NumSavesPatch2 },
+ { true, 64990, "disable change directory button", 1, sci2ChangeDirSignature, sci2ChangeDirPatch },
+ { true, 23, "inventory starts scroll down in the wrong direction", 1, gk2InvScrollSignature, gk2InvScrollPatch },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1488,6 +1519,7 @@ static const uint16 kq6CDPatchAudioTextSupport2[] = {
// Additional patch specifically for King's Quest 6
// Fixes special windows, used for example in the Pawn shop (room 280),
// when the man in a robe complains about no more mints.
+// Or also in room 300 at the cliffs (aka copy protection), when Alexander falls down the cliffs.
// We have to change even more code, because the game uses PODialog class for
// text windows and myDialog class for audio. Both are saved to KQ6Print::dialog
// Sadly PODialog is created during KQ6Print::addText, myDialog is set during
@@ -1514,13 +1546,34 @@ static const uint16 kq6CDSignatureAudioTextSupport3[] = {
};
static const uint16 kq6CDPatchAudioTextSupport3[] = {
- 0x31, 0x5c, // adjust jump to reuse audio mode addText-calling code
- PATCH_ADDTOOFFSET(102),
- 0x48, // ret
- 0x48, // ret (waste byte)
+ 0x31, 0x68, // adjust jump to reuse audio mode addText-calling code
+ PATCH_ADDTOOFFSET(+85), // right at the MAGIC_DWORD
+ // check, if text is supposed to be shown. If yes, skip the follow-up check (param[1])
+ 0x89, 0x5a, // lsg global[5Ah]
+ 0x35, 0x01, // ldi 01
+ 0x12, // and
+ 0x2f, 0x07, // bt [skip over param check]
+ // original code, checks param[1]
+ 0x8f, 0x01, // lsp param[1]
+ 0x35, 0x01, // ldi 01
+ 0x1a, // eq?
+ 0x31, 0x10, // bnt [code to set property repressText to 1], adjusted
+ // use myDialog class, so that text box automatically disappears (this is not done for text only mode, like in the original)
0x72, 0x0e, 0x00, // lofsa myDialog
0x65, 0x12, // aTop dialog
- 0x33, 0xed, // jump back to audio mode addText-calling code
+ // followed by original addText-calling code
+ 0x38,
+ PATCH_GETORIGINALBYTE(+95),
+ PATCH_GETORIGINALBYTE(+96), // pushi addText
+ 0x78, // push1
+ 0x8f, 0x02, // lsp param[2]
+ 0x59, 0x03, // &rest 03
+ 0x54, 0x06, // self 06
+ 0x48, // ret
+
+ 0x35, 0x01, // ldi 01
+ 0x65, 0x2e, // aTop repressText
+ 0x48, // ret
PATCH_END
};
@@ -2842,6 +2895,43 @@ static const SciScriptPatcherEntry mothergoose256Signatures[] = {
#ifdef ENABLE_SCI32
#pragma mark -
+#pragma mark Mixed-up Mother Goose Deluxe
+
+// The game uses pic 10005 to render the Sierra logo, but then it also
+// initialises a logo object with view 502 on the same priority as the pic. In
+// the original interpreter, it is dumb luck which is drawn first (based on the
+// order of the memory IDs), though usually the pic is drawn first because not
+// many objects have been created at the start of the game. In ScummVM, the
+// renderer guarantees a sort order based on the creation order of screen items,
+// and since the view is created after the pic, it wins and is drawn on top.
+// This patch stops the view object from being created at all.
+//
+// Applies to at least: English CD from King's Quest Collection
+// Responsible method: sShowLogo::changeState
+static const uint16 mothergooseHiresSignatureLogo[] = {
+ 0x38, SIG_UINT16(0x8e), // pushi $8e
+ SIG_MAGICDWORD,
+ 0x76, // push0
+ 0x72, SIG_UINT16(0x82), // lofsa logo[82]
+ 0x4a, SIG_UINT16(0x04), // send $4
+ SIG_END
+};
+
+static const uint16 mothergooseHiresPatchLogo[] = {
+ 0x18, 0x18, 0x18, // waste bytes
+ 0x18, // waste bytes
+ 0x18, 0x18, 0x18, // waste bytes
+ 0x18, 0x18, 0x18, // waste bytes
+ PATCH_END
+};
+
+// script, description, signature patch
+static const SciScriptPatcherEntry mothergooseHiresSignatures[] = {
+ { true, 108, "bad logo rendering", 1, mothergooseHiresSignatureLogo, mothergooseHiresPatchLogo },
+ SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+#pragma mark -
#pragma mark Phantasmagoria
// script, description, signature patch
@@ -4601,7 +4691,7 @@ static const uint16 sq6SlowTransitionSignature1[] = {
};
static const uint16 sq6SlowTransitionPatch1[] = {
- 0x38, SIG_UINT16(180), // pushi 180
+ 0x38, SIG_UINT16(500), // pushi 500
PATCH_END
};
@@ -5125,6 +5215,10 @@ void ScriptPatcher::processScript(uint16 scriptNr, byte *scriptData, const uint3
signatureTable = mothergoose256Signatures;
break;
#ifdef ENABLE_SCI32
+ case GID_MOTHERGOOSEHIRES:
+ signatureTable = mothergooseHiresSignatures;
+ break;
+
case GID_PHANTASMAGORIA:
signatureTable = phantasmagoriaSignatures;
break;