diff options
author | Colin Snover | 2017-01-12 15:04:15 -0600 |
---|---|---|
committer | Colin Snover | 2017-01-12 15:04:45 -0600 |
commit | d34e5266edc86c8680a3eb314d711b6d10bf171b (patch) | |
tree | bd6ccdf913634ed3d1b6404317d083656c4e49fb | |
parent | ba50f88a3c60e5ad90aa830739a271ee2ba844f0 (diff) | |
download | scummvm-rg350-d34e5266edc86c8680a3eb314d711b6d10bf171b.tar.gz scummvm-rg350-d34e5266edc86c8680a3eb314d711b6d10bf171b.tar.bz2 scummvm-rg350-d34e5266edc86c8680a3eb314d711b6d10bf171b.zip |
SCI32: Fix bad scroll delta in GK2 inventory
Fixes Trac#9648.
-rw-r--r-- | engines/sci/engine/script_patches.cpp | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index 6f064368fa..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 }; |