[Scummvm-git-logs] scummvm master -> a9316560ab896fb7198b74f2ce8437177ddf0201

csnover csnover at users.noreply.github.com
Sat Sep 16 23:34:51 CEST 2017


This automated email contains information about 18 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
60460cc9ff GIT: Ignore all root Xcode project files
96d4bb603d SCI32: Clean-up pass on GK1 script patches
bbcee7e6a1 SCI32: Clean-up pass on GK2 script patches
08291cca3c SCI32: Clean-up pass on KQ7 script patches
59fe526b16 SCI32: Clean-up pass on Lighthouse script patches
ea33f26d05 SCI32: Clean-up pass on LSL6hires script patches
f7d20dc2e7 SCI32: Clean-up pass on LSL7 script patches
bfb87389f7 SCI32: Clean-up pass on MGDX script patches
6fc09ae7c9 SCI32: Clean-up pass on Phant1 script patches
b9600bf466 SCI32: Clean-up pass on Phant2 script patches
34683f1725 SCI32: Clean-up pass on PQ:SWAT script patches
c5dce17b1f SCI32: Clean-up pass on PQ4 script patches
3b7e610364 SCI32: Clean-up pass on QFG4 script patches
4dcf88ef4f SCI32: Clean-up pass on Rama script patches
4e6fa4d690 SCI32: Clean-up pass on Shivers script patches
d1c43b24ea SCI32: Clean-up pass on GK1 script patches
e400f1aec2 SCI32: Clean-up pass on Torin script patches
a9316560ab SCI: Remove unused selector from script patcher selectors list


Commit: 60460cc9ffc64902eb970c05ea9a2efc9c6a60df
    https://github.com/scummvm/scummvm/commit/60460cc9ffc64902eb970c05ea9a2efc9c6a60df
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:06-05:00

Commit Message:
GIT: Ignore all root Xcode project files

[ci skip]

Changed paths:
    .gitignore


diff --git a/.gitignore b/.gitignore
index e4efe90..c19710f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -209,7 +209,7 @@ dists/msvc*/**
 
 #Ignore Xcode output/project files
 out/
-scummvm.xcodeproj
+/*.xcodeproj
 
 #Ignore PSP2 files
 psp2pkg/


Commit: 96d4bb603d69b96c96049fc46a3999d71e98a50e
    https://github.com/scummvm/scummvm/commit/96d4bb603d69b96c96049fc46a3999d71e98a50e
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:06-05:00

Commit Message:
SCI32: Clean-up pass on GK1 script patches

* Convert selector literals to SIG_SELECTOR/PATCH_SELECTOR
* Convert word-size numeric literals to SIG_UINT16/PATCH_UINT16
* Wrap comments at 80 columns
* Rewrite comments for clarity and brevity
* Make alignment of operation comments consistent
* Make identifier suffixes, patch descriptions, and patch table
  ordering consistent
* Remove no-longer-needed script patch for day 10 room 808, which
  has been fixed using a different, generic mechanism since commit
  e8c429832f7b6393f853fd6d9ce8ba2e62f6a93c

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index cc7194e..038cce4 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -96,7 +96,6 @@ static const char *const selectorNameTable[] = {
 	"setMotion",    // system selector
 	"overlay",      // system selector
 	"setPri",       // system selector - for setting priority
-	"deskSarg",     // Gabriel Knight
 	"localize",     // Freddy Pharkas
 	"put",          // Police Quest 1 VGA
 	"say",          // Quest For Glory 1 VGA
@@ -114,21 +113,23 @@ static const char *const selectorNameTable[] = {
 	"scrollSelections", // GK2
 	"posn",         // SCI2 benchmarking script
 	"detailLevel",  // GK2 benchmarking
-	"view",         // RAMA benchmarking
+	"view",         // RAMA benchmarking, GK1
 	"fade",         // Shivers sound fix
 	"play",         // Shivers sound fix
 	"test",         // Torin
-	"get",          // Torin
+	"get",          // Torin, GK1
+	"has",          // GK1
 	"set",          // Torin
 	"clear",        // Torin
 	"masterVolume", // SCI2 master volume reset
 	"data",         // Phant2
 	"format",       // Phant2
 	"setSize",      // Phant2
-	"setCel",       // Phant2
+	"setCel",       // Phant2, GK1
 	"iconV",        // Phant2
 	"update",       // Phant2
 	"xOff",         // Phant2
+	"setCycle",     // GK1
 #endif
 	NULL
 };
@@ -148,7 +149,6 @@ enum ScriptPatcherSelectors {
 	SELECTOR_setMotion,
 	SELECTOR_overlay,
 	SELECTOR_setPri,
-	SELECTOR_deskSarg,
 	SELECTOR_localize,
 	SELECTOR_put,
 	SELECTOR_say,
@@ -172,6 +172,7 @@ enum ScriptPatcherSelectors {
 	SELECTOR_play,
 	SELECTOR_test,
 	SELECTOR_get,
+	SELECTOR_has,
 	SELECTOR_set,
 	SELECTOR_clear,
 	SELECTOR_masterVolume,
@@ -181,7 +182,8 @@ enum ScriptPatcherSelectors {
 	SELECTOR_setCel,
 	SELECTOR_iconV,
 	SELECTOR_update,
-	SELECTOR_xOff
+	SELECTOR_xOff,
+	SELECTOR_setCycle
 #endif
 };
 
@@ -882,341 +884,229 @@ static const SciScriptPatcherEntry hoyle5Signatures[] = {
 #pragma mark -
 #pragma mark Gabriel Knight 1
 
-// ===========================================================================
-// daySixBeignet::changeState (4) is called when the cop goes out and sets cycles to 220.
-//  this is not enough time to get to the door, so we patch that to 23 seconds
+// `daySixBeignet::changeState(4)` is called when the cop goes outside. It sets
+// cycles to 220. This is a CPU-speed dependent value and not usually enough
+// time to get to the door, so patch it to 22 seconds.
 // Applies to at least: English PC-CD, German PC-CD, English Mac
-// Responsible method: daySixBeignet::changeState(4), script 230
-static const uint16 gk1SignatureDay6PoliceBeignet1[] = {
-	0x35, 0x04,                         // ldi 04
-	0x1a,                               // eq?
-	0x30, SIG_ADDTOOFFSET(+2),          // bnt [next state check]
-	0x38, SIG_SELECTOR16(dispose),      // pushi dispose
-	0x76,                               // push0
-	0x72, SIG_ADDTOOFFSET(+2),          // lofsa deskSarg
-	0x4a, SIG_UINT16(0x0004),           // send 04
+static const uint16 gk1Day6PoliceBeignetSignature1[] = {
+	0x35, 0x04,                    // ldi 4
+	0x1a,                          // eq?
+	0x30, SIG_ADDTOOFFSET(+2),     // bnt [next state check]
+	0x38, SIG_SELECTOR16(dispose), // pushi dispose
+	0x76,                          // push0
+	0x72, SIG_ADDTOOFFSET(+2),     // lofsa deskSarg
+	0x4a, SIG_UINT16(0x04),        // send 4
 	SIG_MAGICDWORD,
-	0x34, SIG_UINT16(0x00dc),           // ldi 220
-	0x65, SIG_ADDTOOFFSET(+1),          // aTop cycles (1a for PC, 1c for Mac)
-	0x32,                               // jmp [end]
+	0x34, SIG_UINT16(0xdc),        // ldi 220
+	0x65, SIG_ADDTOOFFSET(+1),     // aTop cycles ($1a for PC, $1c for Mac)
+	0x32,                          // jmp [end]
 	SIG_END
 };
 
-static const uint16 gk1PatchDay6PoliceBeignet1[] = {
+static const uint16 gk1Day6PoliceBeignetPatch1[] = {
 	PATCH_ADDTOOFFSET(+16),
-	0x34, PATCH_UINT16(0x0017),         // ldi 23
-	0x65, PATCH_GETORIGINALBYTEADJUST(+20, +2), // aTop seconds (1c for PC, 1e for Mac)
+	0x34, PATCH_UINT16(0x16),                   // ldi 22
+	0x65, PATCH_GETORIGINALBYTEADJUST(+20, +2), // aTop seconds ($1c for PC, $1e for Mac)
 	PATCH_END
 };
 
-// sInGateWithPermission::changeState (0) is called, when the player walks through the swinging door.
-//  When it's day 6 and the desk sergeant is outside for the beignet, this state will also set
-//  daySixBeignet::cycles to basically reset the overall timer, which is 200.
-//  This is not enough time to get to the door, so we patch that to 20 seconds
+// `sInGateWithPermission::changeState(0)` is called whenever the player walks
+// through the swinging door. On day 6, when the cop is outside for the beignet,
+// this action will also reset the puzzle timer so the player has 200 cycles to
+// get through the area before the cop returns. This is a CPU-speed dependent
+// value and not usually enough time to get to the door, so patch it to 20
+// seconds instead.
 // Applies to at least: English PC-CD, German PC-CD, English Mac
-// Responsible method: sInGateWithPermission::changeState(0), script 230
-// Fixes bug: #9805
-static const uint16 gk1SignatureDay6PoliceBeignet2[] = {
-	0x72, SIG_ADDTOOFFSET(+2),          // lofsa daySixBeignet
-	0x1a,                               // eq?
-	0x31, 0x0d,                         // bnt [skip set cycles]
-	0x38, SIG_SELECTOR16(cycles),       // pushi (cycles)
-	0x78,                               // push1
+static const uint16 gk1Day6PoliceBeignetSignature2[] = {
+	0x72, SIG_ADDTOOFFSET(+2),    // lofsa daySixBeignet
+	0x1a,                         // eq?
+	0x31, 0x0d,                   // bnt [skip set cycles]
+	0x38, SIG_SELECTOR16(cycles), // pushi (cycles)
+	0x78,                         // push1
 	SIG_MAGICDWORD,
-	0x38, SIG_UINT16(200),              // pushi 200d
-	0x72,                               // lofsa
+	0x38, SIG_UINT16(0xc8),       // pushi 200
+	0x72,                         // lofsa
 	SIG_END
 };
 
-static const uint16 gk1PatchDay6PoliceBeignet2[] = {
+static const uint16 gk1Day6PoliceBeignetPatch2[] = {
 	PATCH_ADDTOOFFSET(+6),
-	0x38, PATCH_SELECTOR16(seconds),    // pushi (seconds)
-	0x78,                               // push1
-	0x38, PATCH_UINT16(20),             // pushi 20
+	0x38, PATCH_SELECTOR16(seconds), // pushi (seconds)
+	0x78,                            // push1
+	0x38, PATCH_UINT16(0x14),        // pushi 20
 	PATCH_END
 };
 
-// sargSleeping::changeState (8) is called when the cop falls asleep and sets cycles to 220.
-//  this is not enough time to get to the door, so we patch it to 42 seconds
+// `sargSleeping::changeState(8)` is called when the cop falls asleep and sets
+// the puzzle timer to 220 cycles. This is CPU-speed dependent and not usually
+// enough time to get to the door, so patch it to 22 seconds instead.
 // Applies to at least: English PC-CD, German PC-CD, English Mac
-// Responsible method: sargSleeping::changeState
-static const uint16 gk1SignatureDay6PoliceSleep[] = {
-	0x35, 0x08,                         // ldi 08
-	0x1a,                               // eq?
-	0x31, SIG_ADDTOOFFSET(+1),          // bnt [next state check]
+static const uint16 gk1Day6PoliceSleepSignature[] = {
+	0x35, 0x08,                // ldi 8
+	0x1a,                      // eq?
+	0x31, SIG_ADDTOOFFSET(+1), // bnt [next state check]
 	SIG_MAGICDWORD,
-	0x34, SIG_UINT16(0x00dc),           // ldi 220
-	0x65, SIG_ADDTOOFFSET(+1),          // aTop cycles (1a for PC, 1c for Mac)
-	0x32,                               // jmp [end]
+	0x34, SIG_UINT16(0xdc),    // ldi 220
+	0x65, SIG_ADDTOOFFSET(+1), // aTop cycles ($1a for PC, $1c for Mac)
+	0x32,                      // jmp [end]
 	SIG_END
 };
 
-static const uint16 gk1PatchDay6PoliceSleep[] = {
+static const uint16 gk1Day6PoliceSleepPatch[] = {
 	PATCH_ADDTOOFFSET(+5),
-	0x34, PATCH_UINT16(0x002a),         // ldi 42
+	0x34, PATCH_UINT16(0x16),                  // ldi 22
 	0x65, PATCH_GETORIGINALBYTEADJUST(+9, +2), // aTop seconds (1c for PC, 1e for Mac)
 	PATCH_END
 };
 
-// At the start of day 5, there is like always some dialogue with Grace.
-//
-// The dialogue script code about the drum book + veve newspaper clip is a bit broken.
-//
-// In case the player already has the veve, but is supposed to get the drum book, then the drum book
-// dialogue is repeated twice and the veve newspaper dialogue is also repeated (although it was played on day 4
-// in such case already).
-//
-// Drum book dialogue is called twice.
-// Once via GetTheVeve::changeState(0) and a second time via GetTheVeve::changeState(11).
-//
-// GetTheVeve::changeState(0) would also play the first line of the veve pattern newspaper and that's skipped,
-// when the player is supposed to get the drum book.
-// GetTheVeve::changeState(1) up to state 10 will do the dialogue about the veve newspaper.
-// At the start of state 1 though, the player will get the drum book in case he ask for research.
-// Right after that the scripts check, if the player has the drum book and then go the veve newspaper route.
+// At the start of day 5, when the player already has the veve but still needs
+// to get the drum book, the drum book dialogue with Grace is played twice in
+// a row, and then the veve dialogue gets played again even though it was
+// already played during day 4.
 //
-// We fix this by skipping the drum book check in case the player just got the drum book.
-// The scripts will then skip to state 12, skipping over the second drum book dialogue call.
+// The duplicate drum book dialogue happens because it is triggered once in
+// `GetTheVeve::changeState(0)` and then again in `GetTheVeve::changeState(11)`.
+// The re-run of the veve dialogue happens because the game gives the player
+// the drum book in `GetTheVeVe::changeState(1)`, then *after* doing so, checks
+// if the player has the drum book and runs the veve dialogue if so.
 //
-// More notes: The veve newspaper item is inventory 9. The drum book is inventory 14.
-//             The flag for veve research is 36, the flag for drum research is 73.
+// We fix both of these issues by skipping the has-drum-book check if the player
+// just got the drum book. Doing this causes the game to jump from state 1 to
+// state 12, which bypasses the duplicate drum book dialogue in state 11, as
+// well as the veve dialogue trigger in the has-drum-book check.
 //
-// This bug of course also occurs, when using the original interpreter.
+// More notes: The veve newspaper item is inventory 9. The drum book is
+//             inventory 14. The flag for veve research is 36, the flag for drum
+//             research is 73.
 //
-// Special thanks, credits and kudos to sluicebox on IRC, who did a ton of research on this and even found this game bug originally.
+// Special thanks, credits and kudos to sluicebox on IRC, who did a ton of
+// research on this and even found this game bug originally.
 //
 // Applies to at least: English PC-CD, German PC-CD
-// Responsible method: getTheVeve::changeState(1) - script 212
-static const uint16 gk1SignatureDay5DrumBookDialogue[] = {
+// Responsible method: getTheVeve::changeState(1)
+static const uint16 gk1Day5DrumBookDialogueSignature[] = {
 	0x31, 0x0b,                         // bnt [skip giving player drum book code]
-	0x38, SIG_UINT16(0x0200),           // pushi 0200h
+	0x38, SIG_SELECTOR16(get),          // pushi $200 (get)
 	0x78,                               // push1
 	SIG_MAGICDWORD,
-	0x39, 0x0e,                         // pushi 0Eh
+	0x39, 0x0e,                         // pushi $e
 	0x81, 0x00,                         // lag global[0]
-	0x4a, 0x06, 0x00,                   // send 06 - GKEgo::get(0Eh)
+	0x4a, SIG_UINT16(0x06),             // send 6 - GKEgo::get($e)
 	// end of giving player drum book code
-	0x38, SIG_UINT16(0x0202),           // pushi 0202h
+	0x38, SIG_SELECTOR16(has),          // pushi $202 (has)
 	0x78,                               // push1
-	0x39, 0x0e,                         // pushi 0Eh
+	0x39, 0x0e,                         // pushi $e
 	0x81, 0x00,                         // lag global[0]
-	0x4a, 0x06, 0x00,                   // send 06 - GKEgo::has(0Eh)
+	0x4a, SIG_UINT16(0x06),             // send 6 - GKEgo::has($e)
 	0x18,                               // not
-	0x30, SIG_UINT16(0x0025),           // bnt [veve newspaper code]
+	0x30, SIG_UINT16(0x25),             // bnt [veve newspaper code]
 	SIG_END
 };
 
-static const uint16 gk1PatchDay5DrumBookDialogue[] = {
+static const uint16 gk1Day5DrumBookDialoguePatch[] = {
 	0x31, 0x0d,                         // bnt [skip giving player drum book code] adjusted
 	PATCH_ADDTOOFFSET(+11),             // skip give player drum book original code
 	0x33, 0x0D,                         // jmp [over the check inventory for drum book code]
 	// check inventory for drum book
-	0x38, SIG_UINT16(0x0202),           // pushi 0202h
+	0x38, PATCH_SELECTOR16(has),        // pushi $202 (has)
 	0x78,                               // push1
-	0x39, 0x0e,                         // pushi 0Eh
+	0x39, 0x0e,                         // pushi $e
 	0x81, 0x00,                         // lag global[0]
-	0x4a, 0x06, 0x00,                   // send 06 - GKEgo::has(0Eh)
+	0x4a, PATCH_UINT16(0x06),           // send 6 - GKEgo::has($e)
 	0x2f, 0x23,                         // bt [veve newspaper code] (adjusted, saves 2 bytes)
 	PATCH_END
 };
 
-// startOfDay5::changeState (20h) - when gabriel goes to the phone the script will hang
+// When Gabriel goes to the phone, the script softlocks at
+// `startOfDay5::changeState(32)`.
 // Applies to at least: English PC-CD, German PC-CD, English Mac
-// Responsible method: startOfDay5::changeState
-static const uint16 gk1SignatureDay5PhoneFreeze[] = {
-	0x4a,
-	SIG_MAGICDWORD, SIG_UINT16(0x000c), // send 0c
-	0x35, 0x03,                         // ldi 03
-	0x65, SIG_ADDTOOFFSET(+1),          // aTop cycles
-	0x32, SIG_ADDTOOFFSET(+2),          // jmp [end]
-	0x3c,                               // dup
-	0x35, 0x21,                         // ldi 21
+static const uint16 gk1Day5PhoneFreezeSignature[] = {
+	0x4a,                             // send ...
+	SIG_MAGICDWORD, SIG_UINT16(0x0c), // ... $c
+	0x35, 0x03,                       // ldi 3
+	0x65, SIG_ADDTOOFFSET(+1),        // aTop cycles
+	0x32, SIG_ADDTOOFFSET(+2),        // jmp [end]
+	0x3c,                             // dup
+	0x35, 0x21,                       // ldi $21
 	SIG_END
 };
 
-static const uint16 gk1PatchDay5PhoneFreeze[] = {
-	PATCH_ADDTOOFFSET(+3),
-	0x35, 0x06,                         // ldi 01
+static const uint16 gk1Day5PhoneFreezePatch[] = {
+	PATCH_ADDTOOFFSET(+3),                     // send $c
+	0x35, 0x06,                                // ldi 1
 	0x65, PATCH_GETORIGINALBYTEADJUST(+6, +6), // aTop ticks
 	PATCH_END
 };
 
-// Floppy version: Interrogation::dispose() compares an object reference
-// (stored in the view selector) with a number, leading to a crash (this kind
-// of comparison was not used in SCI32). The view selector is used to store
-// both a view number (in some cases), and a view reference (in other cases).
-// In the floppy version, the checks are in the wrong order, so there is a
-// comparison between a number an an object. In the CD version, the checks are
-// in the correct order, thus the comparison is correct, thus we use the code
-// from the CD version in the floppy one.
+// In GK1, the `view` selector is used to store view numbers in some cases and
+// object references to Views in other cases. `Interrogation::dispose` compares
+// an object stored in the `view` selector with a number (which is not valid)
+// because its checks are in the wrong order. The check order was fixed in the
+// CD version, so just do what the CD version does.
 // Applies to at least: English Floppy
-// Responsible method: Interrogation::dispose
-// TODO: Check, if English Mac is affected too and if this patch applies
-static const uint16 gk1SignatureInterrogationBug[] = {
+// TODO: Check if English Mac is affected too and if this patch applies
+static const uint16 gk1InterrogationBugSignature[] = {
 	SIG_MAGICDWORD,
-	0x65, 0x4c,                      // aTop 4c
-	0x67, 0x50,                      // pTos 50
-	0x34, SIG_UINT16(0x2710),        // ldi 2710
+	0x65, 0x4c,                      // aTop $4c
+	0x67, 0x50,                      // pTos $50
+	0x34, SIG_UINT16(0x2710),        // ldi $2710
 	0x1e,                            // gt?
-	0x31, 0x08,                      // bnt 08  [05a0]
-	0x67, 0x50,                      // pTos 50
-	0x34, SIG_UINT16(0x2710),        // ldi 2710
+	0x31, 0x08,                      // bnt 8  [05a0]
+	0x67, 0x50,                      // pTos $50
+	0x34, SIG_UINT16(0x2710),        // ldi $2710
 	0x04,                            // sub
-	0x65, 0x50,                      // aTop 50
-	0x63, 0x50,                      // pToa 50
-	0x31, 0x15,                      // bnt 15  [05b9]
-	0x39, 0x0e,                      // pushi 0e
+	0x65, 0x50,                      // aTop $50
+	0x63, 0x50,                      // pToa $50
+	0x31, 0x15,                      // bnt $15  [05b9]
+	0x39, SIG_SELECTOR8(view),       // pushi $e (view)
 	0x76,                            // push0
-	0x4a, SIG_UINT16(0x0004),        // send 0004
-	0xa5, 0x00,                      // sat 00
+	0x4a, SIG_UINT16(0x04),          // send 4
+	0xa5, 0x00,                      // sat 0
 	0x38, SIG_SELECTOR16(dispose),   // pushi dispose
 	0x76,                            // push0
-	0x63, 0x50,                      // pToa 50
-	0x4a, SIG_UINT16(0x0004),        // send 0004
-	0x85, 0x00,                      // lat 00
-	0x65, 0x50,                      // aTop 50
+	0x63, 0x50,                      // pToa $50
+	0x4a, SIG_UINT16(0x04),          // send 4
+	0x85, 0x00,                      // lat 0
+	0x65, 0x50,                      // aTop $50
 	SIG_END
 };
 
-static const uint16 gk1PatchInterrogationBug[] = {
-	0x65, 0x4c,                      // aTop 4c
-	0x63, 0x50,                      // pToa 50
-	0x31, 0x15,                      // bnt 15  [05b9]
-	0x39, 0x0e,                      // pushi 0e
+static const uint16 gk1InterrogationBugPatch[] = {
+	0x65, 0x4c,                      // aTop $4c
+	0x63, 0x50,                      // pToa $50
+	0x31, 0x15,                      // bnt $15  [05b9]
+	0x39, PATCH_SELECTOR8(view),     // pushi $e (view)
 	0x76,                            // push0
-	0x4a, 0x04, 0x00,                // send 0004
+	0x4a, PATCH_UINT16(0x04),        // send 4
 	0xa5, 0x00,                      // sat 00
 	0x38, PATCH_SELECTOR16(dispose), // pushi dispose
 	0x76,                            // push0
-	0x63, 0x50,                      // pToa 50
-	0x4a, 0x04, 0x00,                // send 0004
-	0x85, 0x00,                      // lat 00
-	0x65, 0x50,                      // aTop 50
-	0x67, 0x50,                      // pTos 50
-	0x34, PATCH_UINT16(0x2710),      // ldi 2710
+	0x63, 0x50,                      // pToa $50
+	0x4a, PATCH_UINT16(0x04),        // send 4
+	0x85, 0x00,                      // lat 0
+	0x65, 0x50,                      // aTop $50
+	0x67, 0x50,                      // pTos $50
+	0x34, PATCH_UINT16(0x2710),      // ldi $2710
 	0x1e,                            // gt?
-	0x31, 0x08,                      // bnt 08  [05b9]
-	0x67, 0x50,                      // pTos 50
-	0x34, PATCH_UINT16(0x2710),      // ldi 2710
+	0x31, 0x08,                      // bnt 8  [05b9]
+	0x67, 0x50,                      // pTos $50
+	0x34, PATCH_UINT16(0x2710),      // ldi $2710
 	0x04,                            // sub
-	0x65, 0x50,                      // aTop 50
-	PATCH_END
-};
-
-// On day 10 nearly at the end of the game, Gabriel Knight dresses up and right after that
-// someone will be at the door. Gabriel turns around to see what's going on.
-//
-// In ScummVM Gabriel turning around plays endlessly. This is caused by the loop of Gabriel
-// being kept at 1, but view + cel were changed accordingly. The view used - which is view 859 -
-// does not have a loop 1. kNumCels is called on that, BUT kNumCels in SSCI is broken in that
-// regard. It checks for loop > count and not loop >= count and will return basically random data
-// in case loop == count.
-//
-// In SSCI this simply worked by accident. kNumCels returned 0x53 in this case, but later script code
-// fixed that up somehow, so it worked out in the end.
-//
-// The setup for this is done in SDJEnters::changeState(0). The cycler will never reach the goal
-// because the goal will be cel -1, so it loops endlessly.
-//
-// We fix this by adding a setLoop(0).
-//
-// Applies to at least: English PC-CD, German PC-CD
-// Responsible method: sDJEnters::changeState
-static const uint16 gk1SignatureDay10GabrielDressUp[] = {
-	0x87, 0x01,                         // lap param[1]
-	0x65, 0x14,                         // aTop state
-	0x36,                               // push
-	0x3c,                               // dup
-	0x35, 0x00,                         // ldi 0
-	0x1a,                               // eq?
-	0x30, SIG_UINT16(0x006f),           // bnt [next state 1]
-	SIG_ADDTOOFFSET(+84),
-	0x39, 0x0e,                         // pushi 0Eh (view)
-	0x78,                               // push1
-	SIG_MAGICDWORD,
-	0x38, SIG_UINT16(0x035B),           // pushi 035Bh (859d)
-	0x38, SIG_UINT16(0x0141),           // pushi 0141h (setCel)
-	0x78,                               // push1
-	0x76,                               // push0
-	0x38, SIG_UINT16(0x00E9),           // pushi 00E9h (setCycle)
-	0x7a,                               // push2
-	0x51, 0x18,                         // class End
-	0x36,                               // push
-	0x7c,                               // pushSelf
-	0x81, 0x00,                         // lag global[0]
-	0x4a, 0x14, 0x00,                   // send 14h
-										// GKEgo::view(859)
-										// GKEgo::setCel(0)
-										// GKEgo::setCycle(End, sDJEnters)
-	0x32, SIG_UINT16(0x0233),           // jmp [ret]
-	// next state
-	0x3c,                               // dup
-	0x35, 0x01,                         // ldi 01
-	0x1a,                               // eq?
-	0x31, 0x07,                         // bnt [next state 2]
-	0x35, 0x02,                         // ldi 02
-	0x65, 0x1a,                         // aTop cycles
-	0x32, SIG_UINT16(0x0226),           // jmp [ret]
-	// next state
-	0x3c,                               // dup
-	0x35, 0x02,                         // ldi 02
-	0x1a,                               // eq?
-	0x31, 0x2a,                         // bnt [next state 3]
-	0x78,                               // push1
-	SIG_ADDTOOFFSET(+34),
-	// part of state 2 code, delays for 1 cycle
-	0x35, 0x01,                         // ldi 1
-	0x65, 0x1a,                         // aTop cycles
-	SIG_END
-};
-
-static const uint16 gk1PatchDay10GabrielDressUp[] = {
-	PATCH_ADDTOOFFSET(+9),
-	0x30, SIG_UINT16(0x0073),           // bnt [next state 1] - offset adjusted
-	SIG_ADDTOOFFSET(+84 + 11),
-	// added by us: setting loop to 0 (5 bytes needed)
-	0x38, SIG_UINT16(0x00FB),           // pushi 00FBh (setLoop)
-	0x78,                               // push1
-	0x76,                               // push0
-	// original code, but offset changed
-	0x38, SIG_UINT16(0x00E9),           // pushi 00E9h (setCycle)
-	0x7a,                               // push2
-	0x51, 0x18,                         // class End
-	0x36,                               // push
-	0x7c,                               // pushSelf
-	0x81, 0x00,                         // lag global[0]
-	0x4a, 0x1a, 0x00,                   // send 1Ah - adjusted
-										// GKEgo::view(859)
-										// GKEgo::setCel(0)
-										// GKEgo::setLoop(0) <-- new, by us
-										// GKEgo::setCycle(End, sDJEnters)
-	// end of original code
-	0x3a,                               // toss
-	0x48,                               // ret (saves 1 byte)
-	// state 1 code
-	0x3c,                               // dup
-	0x34, SIG_UINT16(0x0001),           // ldi 0001 (waste 1 byte)
-	0x1a,                               // eq?
-	0x31, 2,                            // bnt [next state 2]
-	0x33, 41,                           // jmp to state 2 delay code
-	SIG_ADDTOOFFSET(+41),
-	// wait 2 cycles instead of only 1
-	0x35, 0x02,                         // ldi 2
+	0x65, 0x50,                      // aTop $50
 	PATCH_END
 };
 
 //          script, description,                                      signature                         patch
 static const SciScriptPatcherEntry gk1Signatures[] = {
-	{  true,    51, "interrogation bug",                           1, gk1SignatureInterrogationBug,     gk1PatchInterrogationBug },
-	{  true,   212, "day 5 drum book dialogue error",              1, gk1SignatureDay5DrumBookDialogue, gk1PatchDay5DrumBookDialogue },
-	{  true,   212, "day 5 phone freeze",                          1, gk1SignatureDay5PhoneFreeze,      gk1PatchDay5PhoneFreeze },
-	{  true,   230, "day 6 police beignet timer issue 1/2",        1, gk1SignatureDay6PoliceBeignet1,   gk1PatchDay6PoliceBeignet1 },
-	{  true,   230, "day 6 police beignet timer issue 2/2",        1, gk1SignatureDay6PoliceBeignet2,   gk1PatchDay6PoliceBeignet2 },
-	{  true,   230, "day 6 police sleep timer issue",              1, gk1SignatureDay6PoliceSleep,      gk1PatchDay6PoliceSleep },
-	{  true,   808, "day 10 gabriel dress up infinite turning",    1, gk1SignatureDay10GabrielDressUp,  gk1PatchDay10GabrielDressUp },
+	{  true,    51, "fix interrogation bug",                       1, gk1InterrogationBugSignature,     gk1InterrogationBugPatch },
+	{  true,   212, "fix day 5 drum book dialogue error",          1, gk1Day5DrumBookDialogueSignature, gk1Day5DrumBookDialoguePatch },
+	{  true,   212, "fix day 5 phone softlock",                    1, gk1Day5PhoneFreezeSignature,      gk1Day5PhoneFreezePatch },
+	{  true,   230, "fix day 6 police beignet timer issue (1/2)",  1, gk1Day6PoliceBeignetSignature1,   gk1Day6PoliceBeignetPatch1 },
+	{  true,   230, "fix day 6 police beignet timer issue (2/2)",  1, gk1Day6PoliceBeignetSignature2,   gk1Day6PoliceBeignetPatch2 },
+	{  true,   230, "fix day 6 police sleep timer issue",          1, gk1Day6PoliceSleepSignature,      gk1Day6PoliceSleepPatch },
 	{  true, 64908, "disable video benchmarking",                  1, sci2BenchmarkSignature,           sci2BenchmarkPatch },
-	{  true, 64990, "increase number of save games",               1, sci2NumSavesSignature1,           sci2NumSavesPatch1 },
-	{  true, 64990, "increase number of save games",               1, sci2NumSavesSignature2,           sci2NumSavesPatch2 },
+	{  true, 64990, "increase number of save games (1/2)",         1, sci2NumSavesSignature1,           sci2NumSavesPatch1 },
+	{  true, 64990, "increase number of save games (2/2)",         1, sci2NumSavesSignature2,           sci2NumSavesPatch2 },
 	{  true, 64990, "disable change directory button",             1, sci2ChangeDirSignature,           sci2ChangeDirPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };


Commit: bbcee7e6a104960a221ca09f0124474a9a89c9ef
    https://github.com/scummvm/scummvm/commit/bbcee7e6a104960a221ca09f0124474a9a89c9ef
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:06-05:00

Commit Message:
SCI32: Clean-up pass on GK2 script patches

* Convert selector literals to SIG_SELECTOR/PATCH_SELECTOR
* Make alignment of operation comments consistent
* Make patch descriptions consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 038cce4..338ee62 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -1128,7 +1128,7 @@ static const uint16 gk2InvScrollSignature[] = {
 	0x78,                                   // push1
 	0x78,                                   // push1
 	0x63, 0x98,                             // pToa $98
-	0x4a, SIG_UINT16(0x06),                 // send $6
+	0x4a, SIG_UINT16(0x06),                 // send 6
 	SIG_END
 };
 
@@ -1137,7 +1137,7 @@ static const uint16 gk2InvScrollPatch[] = {
 	0x78,                                     // push1
 	0x67, 0x9a,                               // pTos $9a (delta)
 	0x63, 0x98,                               // pToa $98
-	0x4a, PATCH_UINT16(0x06),                 // send $6
+	0x4a, PATCH_UINT16(0x06),                 // send 6
 	0x18, 0x18,                               // waste bytes
 	PATCH_END
 };
@@ -1169,7 +1169,7 @@ static const uint16 gk2BenchmarkSignature[] = {
 	0xa5, 0x00,                // sat 0
 	0x7e, SIG_ADDTOOFFSET(+2), // line
 	0x7e, SIG_ADDTOOFFSET(+2), // line
-	0x39, 0x0e,                // pushi $e
+	0x39, SIG_SELECTOR8(view), // pushi $e (view)
 	SIG_MAGICDWORD,
 	0x78,                      // push1
 	0x38, SIG_UINT16(0xfdd4),  // pushi 64980
@@ -1191,9 +1191,9 @@ static const uint16 gk2BenchmarkPatch[] = {
 static const SciScriptPatcherEntry gk2Signatures[] = {
 	{  true,     0, "disable volume reset on startup",                     1, gk2VolumeResetSignature,          gk2VolumeResetPatch },
 	{  true,     0, "disable video benchmarking",                          1, gk2BenchmarkSignature,            gk2BenchmarkPatch },
-	{  true,    23, "inventory starts scroll down in the wrong direction", 1, gk2InvScrollSignature,            gk2InvScrollPatch },
-	{  true, 64990, "increase number of save games",                       1, sci2NumSavesSignature1,           sci2NumSavesPatch1 },
-	{  true, 64990, "increase number of save games",                       1, sci2NumSavesSignature2,           sci2NumSavesPatch2 },
+	{  true,    23, "fix inventory scroll start direction",                1, gk2InvScrollSignature,            gk2InvScrollPatch },
+	{  true, 64990, "increase number of save games (1/2)",                 1, sci2NumSavesSignature1,           sci2NumSavesPatch1 },
+	{  true, 64990, "increase number of save games (2/2)",                 1, sci2NumSavesSignature2,           sci2NumSavesPatch2 },
 	{  true, 64990, "disable change directory button",                     1, sci2ChangeDirSignature,           sci2ChangeDirPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };


Commit: 08291cca3c61b17640e8315bc2e41f3a9de40c11
    https://github.com/scummvm/scummvm/commit/08291cca3c61b17640e8315bc2e41f3a9de40c11
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:07-05:00

Commit Message:
SCI32: Clean-up pass on KQ7 script patches

* Convert selector literals to SIG_SELECTOR/PATCH_SELECTOR
* Convert word-size numeric literals to SIG_UINT16/PATCH_UINT16
* Wrap comments at 80 columns
* Rewrite comments for clarity and brevity
* Make alignment of operation comments consistent
* Make identifier suffixes and patch descriptions consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 338ee62..6c647bf 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -130,6 +130,9 @@ static const char *const selectorNameTable[] = {
 	"update",       // Phant2
 	"xOff",         // Phant2
 	"setCycle",     // GK1
+	"fore",         // KQ7
+	"back",         // KQ7
+	"font",         // KQ7
 #endif
 	NULL
 };
@@ -183,7 +186,10 @@ enum ScriptPatcherSelectors {
 	SELECTOR_iconV,
 	SELECTOR_update,
 	SELECTOR_xOff,
-	SELECTOR_setCycle
+	SELECTOR_setCycle,
+	SELECTOR_fore,
+	SELECTOR_back,
+	SELECTOR_font
 #endif
 };
 
@@ -1988,155 +1994,139 @@ static const SciScriptPatcherEntry kq6Signatures[] = {
 #pragma mark -
 #pragma mark Kings Quest 7
 
-// ===========================================================================
-
-// King's Quest 7 has really weird subtitles. It seems as if the subtitles were
-// not fully finished.
-//
-// Method kqMessager::findTalker in script 0 tries to figure out, which class to use for
-// displaying subtitles. It uses the "talker" data of the given message to do that.
-// Strangely this "talker" data seems to be quite broken.
-// For example chapter 2 starts with a cutscene.
-// Troll king: "Welcome, most beautiful of princesses!" - talker 6
-// Which is followed by the princess going
-// "Hmm?" - which is set to talker 99, normally the princess is talker 7.
-//
-// Talker 99 is seen as unknown and thus treated as "narrator", which makes
-// the scripts put the text at the top of the game screen and even use a
-// different font.
-//
-// In other cases, when the player character thinks to himself talker 99
-// is also used. In such situations it may make somewhat sense to do so,
-// but putting the text at the top of the screen is also irritating to the player.
-// It's really weird.
-//
-// The scripts also put the regular text in the middle of the screen, blocking
-// animations.
+// KQ7's subtitles were left unfinished in the shipped game, so there are
+// several problems when enabling them from the ScummVM launcher:
 //
-// And for certain rooms, the subtitle box may use another color
-// like for example pink/purple at the start of chapter 5.
+// 1. `kqMessager::findTalker` tries to determine which class to use for
+//    displaying subtitles using the talker number of each message, but the
+//    talker data is often bogus (e.g. princess messages normally use talker 7,
+//    but talker 99 (which is for the narrator) is used for her messages at the
+//    start of chapter 2), so it can't be used.
+// 2. Some display classes render subtitles at the top or middle of the game
+//    area, blocking the view of what is on the screen.
+// 3. In some areas, the colors of the subtitles are changed arbitrarily (e.g.
+//    pink/purple at the start of chapter 2).
 //
-// We fix all of that (hopefully - lots of testing is required).
-// We put the text at the bottom of the play screen.
-// We also make the scripts use the regular KQTalker instead of KQNarrator.
-// And we also make the subtitle box use color 255, which is fixed white.
+// To work around these problems, we always use KQTalker, force the text area to
+// the bottom of the game area, and force it to always use black & white, which
+// are guaranteed to not be changed by game scripts.
 //
 // Applies to at least: PC CD 1.4 English, 1.51 English, 1.51 German, 2.00 English
-// Patched method: KQNarrator::init (script 31)
-static const uint16 kq7SignatureSubtitleFix1[] = {
+// Patched method: KQNarrator::init
+static const uint16 kq7SubtitleFixSignature1[] = {
 	SIG_MAGICDWORD,
-	0x39, 0x25,                         // pushi 25h (fore)
-	0x78,                               // push1
-	0x39, 0x06,                         // pushi 06 - sets back to 6
-	0x39, 0x26,                         // pushi 26 (back)
-	0x78,                               // push1
-	0x78,                               // push1 - sets back to 1
-	0x39, 0x2a,                         // pushi 2Ah (font)
-	0x78,                               // push1
-	0x89, 0x16,                         // lsg global[16h] - sets font to global[16h]
-	0x7a,                               // push2 (y)
-	0x78,                               // push1
-	0x76,                               // push0 - sets y to 0
-	0x54, SIG_UINT16(0x0018),           // self 18h
+	0x39, SIG_SELECTOR8(fore), // pushi $25 (fore)
+	0x78,                      // push1
+	0x39, 0x06,                // pushi 6 - sets fore to 6
+	0x39, SIG_SELECTOR8(back), // pushi $26 (back)
+	0x78,                      // push1
+	0x78,                      // push1 - sets back to 1
+	0x39, SIG_SELECTOR8(font), // pushi $2a (font)
+	0x78,                      // push1
+	0x89, 0x16,                // lsg global[$16] - sets font to global[$16]
+	0x7a,                      // push2 (y)
+	0x78,                      // push1
+	0x76,                      // push0 - sets y to 0
+	0x54, SIG_UINT16(0x18),    // self $18
 	SIG_END
 };
 
-static const uint16 kq7PatchSubtitleFix1[] = {
-	0x33, 0x12,                         // jmp [skip special init code]
+static const uint16 kq7SubtitleFixPatch1[] = {
+	0x33, 0x12, // jmp [skip special init code]
 	PATCH_END
 };
 
 // Applies to at least: PC CD 1.51 English, 1.51 German, 2.00 English
-// Patched method: Narrator::init (script 64928)
-static const uint16 kq7SignatureSubtitleFix2[] = {
+// Patched method: Narrator::init
+static const uint16 kq7SubtitleFixSignature2[] = {
 	SIG_MAGICDWORD,
-	0x89, 0x5a,                         // lsg global[5a]
-	0x35, 0x02,                         // ldi 02
+	0x89, 0x5a,                         // lsg global[$5a]
+	0x35, 0x02,                         // ldi 2
 	0x12,                               // and
 	0x31, 0x1e,                         // bnt [skip audio volume code]
-	0x38, SIG_ADDTOOFFSET(+2),          // pushi masterVolume (0212h for 2.00, 0219h for 1.51)
+	0x38, SIG_SELECTOR16(masterVolume), // pushi masterVolume (0212h for 2.00, 0219h for 1.51)
 	0x76,                               // push0
 	0x81, 0x01,                         // lag global[1]
-	0x4a, 0x04, 0x00,                   // send 04
+	0x4a, SIG_UINT16(0x04),             // send 4
 	0x65, 0x32,                         // aTop curVolume
-	0x38, SIG_ADDTOOFFSET(+2),          // pushi masterVolume (0212h for 2.00, 0219h for 1.51)
+	0x38, SIG_SELECTOR16(masterVolume), // pushi masterVolume (0212h for 2.00, 0219h for 1.51)
 	0x78,                               // push1
 	0x67, 0x32,                         // pTos curVolume
-	0x35, 0x02,                         // ldi 02
+	0x35, 0x02,                         // ldi 2
 	0x06,                               // mul
 	0x36,                               // push
-	0x35, 0x03,                         // ldi 03
+	0x35, 0x03,                         // ldi 3
 	0x08,                               // div
 	0x36,                               // push
 	0x81, 0x01,                         // lag global[1]
-	0x4a, 0x06, 0x00,                   // send 06
+	0x4a, SIG_UINT16(0x06),             // send 6
 	// end of volume code
-	0x35, 0x01,                         // ldi 01
+	0x35, 0x01,                         // ldi 1
 	0x65, 0x28,                         // aTop initialized
 	SIG_END
 };
 
-static const uint16 kq7PatchSubtitleFix2[] = {
-	PATCH_ADDTOOFFSET(+5),              // skip to bnt
-	0x31, 0x1b,                         // bnt [skip audio volume code]
-	PATCH_ADDTOOFFSET(+15),             // right after "aTop curVolume / pushi masterVolume / push1"
-	0x7a,                               // push2
-	0x06,                               // mul (saves 3 bytes in total)
-	0x36,                               // push
-	0x35, 0x03,                         // ldi 03
-	0x08,                               // div
-	0x36,                               // push
-	0x81, 0x01,                         // lag global[1]
-	0x4a, 0x06, 0x00,                   // send 06
+static const uint16 kq7SubtitleFixPatch2[] = {
+	PATCH_ADDTOOFFSET(+5),    // skip to bnt
+	0x31, 0x1b,               // bnt [skip audio volume code]
+	PATCH_ADDTOOFFSET(+15),   // right after "aTop curVolume / pushi masterVolume / push1"
+	0x7a,                     // push2
+	0x06,                     // mul (saves 3 bytes in total)
+	0x36,                     // push
+	0x35, 0x03,               // ldi 3
+	0x08,                     // div
+	0x36,                     // push
+	0x81, 0x01,               // lag global[1]
+	0x4a, PATCH_UINT16(0x06), // send 6
 	// end of volume code
-	0x35, 118,                          // ldi 118d
-	0x65, 0x16,                         // aTop y
-	0x78,                               // push1 (saves 1 byte)
-	0x69, 0x28,                         // sTop initialized
+	0x35, 0x76,               // ldi 118
+	0x65, 0x16,               // aTop y
+	0x78,                     // push1 (saves 1 byte)
+	0x69, 0x28,               // sTop initialized
 	PATCH_END
 };
 
 // Applies to at least: PC CD 1.51 English, 1.51 German, 2.00 English
-// Patched method: Narrator::say (script 64928)
-static const uint16 kq7SignatureSubtitleFix3[] = {
+// Patched method: Narrator::say
+static const uint16 kq7SubtitleFixSignature3[] = {
 	SIG_MAGICDWORD,
-	0x63, 0x28,                         // pToa initialized
-	0x18,                               // not
-	0x31, 0x07,                         // bnt [skip init code]
-	0x38, SIG_ADDTOOFFSET(+2),          // pushi init (008Eh for 2.00, 0093h for 1.51)
-	0x76,                               // push0
-	0x54, SIG_UINT16(0x0004),           // self 04
+	0x63, 0x28,                 // pToa initialized
+	0x18,                       // not
+	0x31, 0x07,                 // bnt [skip init code]
+	0x38, SIG_SELECTOR16(init), // pushi init ($8e for 2.00, $93 for 1.51)
+	0x76,                       // push0
+	0x54, SIG_UINT16(0x04),     // self 4
 	// end of init code
-	0x8f, 0x00,                         // lsp param[0]
-	0x35, 0x01,                         // ldi 01
-	0x1e,                               // gt?
-	0x31, 0x08,                         // bnt [set acc to 0]
-	0x87, 0x02,                         // lap param[2]
-	0x31, 0x04,                         // bnt [set acc to 0]
-	0x87, 0x02,                         // lap param[2]
-	0x33, 0x02,                         // jmp [over set acc to 0 code]
-	0x35, 0x00,                         // ldi 00
-	0x65, 0x18,                         // aTop caller
-	SIG_END
-};
-
-static const uint16 kq7PatchSubtitleFix3[] = {
-	PATCH_ADDTOOFFSET(+2),              // skip over "pToa initialized code"
-	0x2f, 0x0c,                         // bt [skip init code] - saved 1 byte
+	0x8f, 0x00,                 // lsp param[0]
+	0x35, 0x01,                 // ldi 1
+	0x1e,                       // gt?
+	0x31, 0x08,                 // bnt [set acc to 0]
+	0x87, 0x02,                 // lap param[2]
+	0x31, 0x04,                 // bnt [set acc to 0]
+	0x87, 0x02,                 // lap param[2]
+	0x33, 0x02,                 // jmp [over set acc to 0 code]
+	0x35, 0x00,                 // ldi 00
+	0x65, 0x18,                 // aTop caller
+	SIG_END
+};
+
+static const uint16 kq7SubtitleFixPatch3[] = {
+	PATCH_ADDTOOFFSET(+2),       // skip over "pToa initialized code"
+	0x2f, 0x0c,                  // bt [skip init code] - saved 1 byte
 	0x38,
-	PATCH_GETORIGINALUINT16(+6),        // pushi (init)
-	0x76,                               // push0
-	0x54, PATCH_UINT16(0x0004),           // self 04
+	PATCH_GETORIGINALUINT16(+6), // pushi (init)
+	0x76,                        // push0
+	0x54, PATCH_UINT16(0x04),    // self 4
 	// additionally set background color here (5 bytes)
-	0x34, PATCH_UINT16(255),            // pushi 255d
-	0x65, 0x2e,                         // aTop back
+	0x34, PATCH_UINT16(0xFF),    // pushi 255
+	0x65, 0x2e,                  // aTop back
 	// end of init code
-	0x8f, 0x00,                         // lsp param[0]
-	0x35, 0x01,                         // ldi 01 - this may get optimized to get another byte
-	0x1e,                               // gt?
-	0x31, 0x04,                         // bnt [set acc to 0]
-	0x87, 0x02,                         // lap param[2]
-	0x2f, 0x02,                         // bt [over set acc to 0 code]
+	0x8f, 0x00,                  // lsp param[0]
+	0x35, 0x01,                  // ldi 1 - this may get optimized to get another byte
+	0x1e,                        // gt?
+	0x31, 0x04,                  // bnt [set acc to 0]
+	0x87, 0x02,                  // lap param[2]
+	0x2f, 0x02,                  // bt [over set acc to 0 code]
 	PATCH_END
 };
 
@@ -2148,7 +2138,7 @@ static const uint16 kq7BenchmarkSignature[] = {
 	0x51, SIG_ADDTOOFFSET(+1), // class Actor
 	0x4a, SIG_UINT16(0x04),    // send 4
 	0xa5, 0x00,                // sat 0
-	0x39, 0x0e,                // pushi $e
+	0x39, SIG_SELECTOR8(view), // pushi $e (view)
 	SIG_MAGICDWORD,
 	0x78,                      // push1
 	0x38, SIG_UINT16(0xfdd4),  // pushi 64980
@@ -2189,9 +2179,9 @@ static const uint16 kq7PragmaFailSpinPatch[] = {
 static const SciScriptPatcherEntry kq7Signatures[] = {
 	{  true,     0, "disable video benchmarking",                  1, kq7BenchmarkSignature,                    kq7BenchmarkPatch },
 	{  true,     0, "remove hardcoded spinloop",                   1, kq7PragmaFailSpinSignature,               kq7PragmaFailSpinPatch },
-	{  true,    31, "subtitle fix 1/3",                            1, kq7SignatureSubtitleFix1,                 kq7PatchSubtitleFix1 },
-	{  true, 64928, "subtitle fix 2/3",                            1, kq7SignatureSubtitleFix2,                 kq7PatchSubtitleFix2 },
-	{  true, 64928, "subtitle fix 3/3",                            1, kq7SignatureSubtitleFix3,                 kq7PatchSubtitleFix3 },
+	{  true,    31, "enable subtitles (1/3)",                      1, kq7SubtitleFixSignature1,                 kq7SubtitleFixPatch1 },
+	{  true, 64928, "enable subtitles (2/3)",                      1, kq7SubtitleFixSignature2,                 kq7SubtitleFixPatch2 },
+	{  true, 64928, "enable subtitles (3/3)",                      1, kq7SubtitleFixSignature3,                 kq7SubtitleFixPatch3 },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };
 


Commit: 59fe526b16364a777a2cb3cbd94ce79f5ca13736
    https://github.com/scummvm/scummvm/commit/59fe526b16364a777a2cb3cbd94ce79f5ca13736
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:07-05:00

Commit Message:
SCI32: Clean-up pass on Lighthouse script patches

* Make patch descriptions consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 6c647bf..9f988d6 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -2209,8 +2209,8 @@ static const uint16 lighthouseFlagResetPatch[] = {
 //          script, description,                                      signature                         patch
 static const SciScriptPatcherEntry lighthouseSignatures[] = {
 	{  true,     5, "fix bad globals clear after credits",         1, lighthouseFlagResetSignature,     lighthouseFlagResetPatch },
-	{  true, 64990, "increase number of save games",               1, sci2NumSavesSignature1,           sci2NumSavesPatch1 },
-	{  true, 64990, "increase number of save games",               1, sci2NumSavesSignature2,           sci2NumSavesPatch2 },
+	{  true, 64990, "increase number of save games (1/2)",         1, sci2NumSavesSignature1,           sci2NumSavesPatch1 },
+	{  true, 64990, "increase number of save games (2/2)",         1, sci2NumSavesSignature2,           sci2NumSavesPatch2 },
 	{  true, 64990, "disable change directory button",             1, sci2ChangeDirSignature,           sci2ChangeDirPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };


Commit: ea33f26d051d2ea09aa9c16e3aef33fe9568823c
    https://github.com/scummvm/scummvm/commit/ea33f26d051d2ea09aa9c16e3aef33fe9568823c
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:07-05:00

Commit Message:
SCI32: Clean-up pass on LSL6hires script patches

* Convert selector literals to SIG_SELECTOR/PATCH_SELECTOR
* Make identifier suffixes and patch descriptions consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 9f988d6..2825b5f 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -133,6 +133,8 @@ static const char *const selectorNameTable[] = {
 	"fore",         // KQ7
 	"back",         // KQ7
 	"font",         // KQ7
+	"setScale",     // LSL6hires
+	"setScaler",    // LSL6hires
 #endif
 	NULL
 };
@@ -189,7 +191,9 @@ enum ScriptPatcherSelectors {
 	SELECTOR_setCycle,
 	SELECTOR_fore,
 	SELECTOR_back,
-	SELECTOR_font
+	SELECTOR_font,
+	SELECTOR_setScale,
+	SELECTOR_setScaler
 #endif
 };
 
@@ -2526,16 +2530,16 @@ static const SciScriptPatcherEntry larry6Signatures[] = {
 // In SSCI this did not do much because the first argument happened to be
 // smaller than the y-position of `ego`, but in ScummVM the first argument is
 // larger and so a debug message "y value less than vanishingY" is displayed.
-static const uint16 larry6HiresSignatureSetScale[] = {
+static const uint16 larry6HiresSetScaleSignature[] = {
 	SIG_MAGICDWORD,
-	0x38, SIG_UINT16(0x14b), // pushi 014b (setScale)
-	0x38, SIG_UINT16(0x05),  // pushi 0005
-	0x51, 0x2c,              // class 2c (Scaler)
+	0x38, SIG_SELECTOR16(setScale), // pushi $14b (setScale)
+	0x38, SIG_UINT16(0x05),         // pushi 5
+	0x51, 0x2c,                     // class 2c (Scaler)
 	SIG_END
 };
 
-static const uint16 larry6HiresPatchSetScale[] = {
-	0x38, SIG_UINT16(0x14f), // pushi 014f (setScaler)
+static const uint16 larry6HiresSetScalePatch[] = {
+	0x38, PATCH_SELECTOR16(setScaler), // pushi $14f (setScaler)
 	PATCH_END
 };
 
@@ -2543,14 +2547,14 @@ static const uint16 larry6HiresPatchSetScale[] = {
 // master music volume to 12 (and the volume dial to 11), but the game should
 // always use the volume stored in ScummVM.
 // Applies to at least: English CD
-static const uint16 larry6HiresSignatureVolumeReset[] = {
+static const uint16 larry6HiresVolumeResetSignature[] = {
 	SIG_MAGICDWORD,
 	0x35, 0x0b,                         // ldi $0b
 	0xa1, 0xc2,                         // sag $c2
 	SIG_END
 };
 
-static const uint16 larry6HiresPatchVolumeReset[] = {
+static const uint16 larry6HiresVolumeResetPatch[] = {
 	0x32, PATCH_UINT16(1),  // jmp 1 [past volume change]
 	PATCH_END
 };
@@ -2558,11 +2562,11 @@ static const uint16 larry6HiresPatchVolumeReset[] = {
 //          script, description,                                      signature                         patch
 static const SciScriptPatcherEntry larry6HiresSignatures[] = {
 	{  true,    71, "disable volume reset on startup (1/2)",       1, sci2VolumeResetSignature,         sci2VolumeResetPatch },
-	{  true,    71, "disable volume reset on startup (2/2)",       1, larry6HiresSignatureVolumeReset,  larry6HiresPatchVolumeReset },
-	{  true,   270, "fix incorrect setScale call",                 1, larry6HiresSignatureSetScale,     larry6HiresPatchSetScale },
+	{  true,    71, "disable volume reset on startup (2/2)",       1, larry6HiresVolumeResetSignature,  larry6HiresVolumeResetPatch },
+	{  true,   270, "fix incorrect setScale call",                 1, larry6HiresSetScaleSignature,     larry6HiresSetScalePatch },
 	{  true, 64908, "disable video benchmarking",                  1, sci2BenchmarkSignature,           sci2BenchmarkPatch },
-	{  true, 64990, "increase number of save games",               1, sci2NumSavesSignature1,           sci2NumSavesPatch1 },
-	{  true, 64990, "increase number of save games",               1, sci2NumSavesSignature2,           sci2NumSavesPatch2 },
+	{  true, 64990, "increase number of save games (1/2)",         1, sci2NumSavesSignature1,           sci2NumSavesPatch1 },
+	{  true, 64990, "increase number of save games (2/2)",         1, sci2NumSavesSignature2,           sci2NumSavesPatch2 },
 	{  true, 64990, "disable change directory button",             1, sci2ChangeDirSignature,           sci2ChangeDirPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };


Commit: f7d20dc2e7f5832754e6eee42032735a8b6a8e09
    https://github.com/scummvm/scummvm/commit/f7d20dc2e7f5832754e6eee42032735a8b6a8e09
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:08-05:00

Commit Message:
SCI32: Clean-up pass on LSL7 script patches

* Convert selector literals to SIG_SELECTOR/PATCH_SELECTOR
* Convert word-size numeric literals to SIG_UINT16/PATCH_UINT16
* Wrap comments at 80 columns
* Rewrite comments for clarity and brevity
* Make alignment of operation comments consistent
* Make identifier suffixes and patch descriptions consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 2825b5f..92d7443 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -135,6 +135,7 @@ static const char *const selectorNameTable[] = {
 	"font",         // KQ7
 	"setScale",     // LSL6hires
 	"setScaler",    // LSL6hires
+	"readWord",     // LSL7
 #endif
 	NULL
 };
@@ -193,7 +194,8 @@ enum ScriptPatcherSelectors {
 	SELECTOR_back,
 	SELECTOR_font,
 	SELECTOR_setScale,
-	SELECTOR_setScaler
+	SELECTOR_setScaler,
+	SELECTOR_readWord
 #endif
 };
 
@@ -2604,16 +2606,16 @@ static const uint16 larry7VolumeResetPatch1[] = {
 // Applies to at least: English CD
 static const uint16 larry7VolumeResetSignature2[] = {
 	SIG_MAGICDWORD,
-	0x38, SIG_UINT16(0x19d), // pushi readWord
-	0x76,                    // push0
-	SIG_ADDTOOFFSET(6),      // advance file stream
-	0xa1, 0xe3,              // sag $e3 (music volume)
-	SIG_ADDTOOFFSET(3),      // line whatever
-	SIG_ADDTOOFFSET(10),     // advance file stream
-	0xa1, 0xe4,              // sag $e4 (sfx volume)
-	SIG_ADDTOOFFSET(3),      // line whatever
-	SIG_ADDTOOFFSET(10),     // advance file stream
-	0xa1, 0xe5,              // sag $e5 (speech volume)
+	0x38, SIG_SELECTOR16(readWord), // pushi readWord
+	0x76,                           // push0
+	SIG_ADDTOOFFSET(6),             // advance file stream
+	0xa1, 0xe3,                     // sag $e3 (music volume)
+	SIG_ADDTOOFFSET(3),             // line whatever
+	SIG_ADDTOOFFSET(10),            // advance file stream
+	0xa1, 0xe4,                     // sag $e4 (sfx volume)
+	SIG_ADDTOOFFSET(3),             // line whatever
+	SIG_ADDTOOFFSET(10),            // advance file stream
+	0xa1, 0xe5,                     // sag $e5 (speech volume)
 	SIG_END
 };
 
@@ -2629,66 +2631,56 @@ static const uint16 larry7VolumeResetPatch2[] = {
 	PATCH_END
 };
 
-// ===========================================================================
-// In room 540 of Leisure Suit Larry 7, Larry will use 4 items on a so called cheese maker.
-//  A short cutscene will then play.
-//  During that cutscene on state 6, an animation will get triggered via a special
-//  cycler ("End", but from script 64041), that is capable of doing ::cues on specific cels.
-//  The code of the state is broken and pushes the object itself as the 2nd cel to cue on.
-//  This parameter gets later changed to last cel by CycleCueList::init.
-//  Right now, we do not handle comparisons between references to objects and regular values like
-//  SSCI, so this will need to get fixed too. But this script bug should also get fixed, because
-//  otherwise it works just by accident.
+// In room 540 of Leisure Suit Larry 7, when using the cheese maker,
+// `soMakeCheese::changeState(6)` incorrectly pushes `self` as the end cel
+// instead of a cel number to the End cycler. In SSCI, this bad argument would
+// get corrected down to the final cel in the loop by `CycleCueList::init`, but
+// because ScummVM currently always sorts numbers higher than objects, the
+// comparison fails and the cel number is not corrected, so the cycler never
+// calls back and the game softlocks.
+// Here, we fix the call so a proper cel number is given for the second argument
+// instead of a bogus object pointer.
 //
 // Applies to at least: English PC-CD, German PC-CD
-// Responsible method: soMakeCheese::changeState(6) in script 540
-static const uint16 larry7SignatureMakeCheese[] = {
-	0x38, SIG_UINT16(4),             // pushi 04
-	0x51, 0xc4,                      // class End
-	0x36,                            // push
+static const uint16 larry7MakeCheeseCyclerSignature[] = {
+	0x38, SIG_UINT16(0x04), // pushi 4
+	0x51, 0xc4,             // class End
+	0x36,                   // push
 	SIG_MAGICDWORD,
-	0x7c,                            // pushSelf
-	0x39, 0x04,                      // pushi 04
-	0x7c,                            // pushSelf
+	0x7c,                   // pushSelf
+	0x39, 0x04,             // pushi 4
+	0x7c,                   // pushSelf
 	SIG_END
 };
 
-static const uint16 larry7PatchMakeCheese[] = {
-	0x39, 0x04,                      // pushi 04 - save 1 byte
-	0x51, 0xc4,                      // class End
-	0x36,
-	0x7c,                            // pushSelf
-	0x39, 0x04,                      // pushi 04
-	0x39, 0x10,                      // pushi 10h (last cel of view 54007, loop 0)
+static const uint16 larry7MakeCheeseCyclerPatch[] = {
+	0x39, 0x04, // pushi 4 - save 1 byte
+	0x51, 0xc4, // class End
+	0x36,       // push
+	0x7c,       // pushSelf
+	0x39, 0x04, // pushi 4
+	0x39, 0x10, // pushi $10 (last cel of view 54007, loop 0)
 	PATCH_END
 };
 
-// ===========================================================================
-// During the same cheese maker cutscene as mentioned before, there is also
-//  a little priority issue, which also happens in the original interpreter.
-//  While Larry is pouring liquid into the cheese maker, he appears shortly right
-//  in front of the guillotine instead of behind it.
-//  This is caused by soMakeCheese::changeState(2) setting priority of ego to 500.
-//  It is needed to change priority a bit, otherwise Larry would also appear behind the cheese
-//  maker and that wouldn't make sense, but the cheese maker has a priority of only 373.
-//
-// This of course also happens, when using the original interpreter.
-//
-// We change this to set priority to 374, which works fine.
-//
+// During the cheese maker cutscene, `soMakeCheese::changeState(2)` sets the
+// priority of ego to 500 to draw him over the cheese maker, but this is also
+// above the guillotine (view 54000, cel 7, priority 400), so ego gets
+// incorrectly drawn on top of the guillotine as well. The cheese maker has a
+// priority of 373, so use priority 374 instead of 500.
 // Applies to at least: English PC-CD, German PC-CD
 // Responsible method: soMakeCheese::changeState(2) in script 540
-static const uint16 larry7SignatureMakeCheesePriority[] = {
+static const uint16 larry7MakeCheesePrioritySignature[] = {
 	0x38, SIG_SELECTOR16(setPri),    // pushi (setPri)
 	SIG_MAGICDWORD,
 	0x78,                            // push1
-	0x38, SIG_UINT16(500),           // pushi 1F4h (500d)
+	0x38, SIG_UINT16(500),           // pushi $1f4
 	SIG_END
 };
 
-static const uint16 larry7PatchMakeCheesePriority[] = {
-	PATCH_ADDTOOFFSET(+4),
-	0x38, PATCH_UINT16(374),         // pushi 176h (374d)
+static const uint16 larry7MakeCheesePriorityPatch[] = {
+	PATCH_ADDTOOFFSET(+4),           // pushi setPri, push1
+	0x38, PATCH_UINT16(374),         // pushi $176
 	PATCH_END
 };
 
@@ -2714,10 +2706,10 @@ static const uint16 larry7MessageTypeResetPatch[] = {
 //          script, description,                                signature                           patch
 static const SciScriptPatcherEntry larry7Signatures[] = {
 	{  true,     0, "disable message type reset on startup", 1, larry7MessageTypeResetSignature,    larry7MessageTypeResetPatch },
-	{  true,   540, "fix make cheese cutscene (cycler)",     1, larry7SignatureMakeCheese,          larry7PatchMakeCheese },
-	{  true,   540, "fix make cheese cutscene (priority)",   1, larry7SignatureMakeCheesePriority,  larry7PatchMakeCheesePriority },
-	{  true, 64000, "disable volume reset on startup 1/2",   1, larry7VolumeResetSignature1,        larry7VolumeResetPatch1 },
-	{  true, 64000, "disable volume reset on startup 2/2",   1, larry7VolumeResetSignature2,        larry7VolumeResetPatch2 },
+	{  true,   540, "fix make cheese cutscene (cycler)",     1, larry7MakeCheeseCyclerSignature,    larry7MakeCheeseCyclerPatch },
+	{  true,   540, "fix make cheese cutscene (priority)",   1, larry7MakeCheesePrioritySignature,  larry7MakeCheesePriorityPatch },
+	{  true, 64000, "disable volume reset on startup (1/2)", 1, larry7VolumeResetSignature1,        larry7VolumeResetPatch1 },
+	{  true, 64000, "disable volume reset on startup (2/2)", 1, larry7VolumeResetSignature2,        larry7VolumeResetPatch2 },
 	{  true, 64866, "increase number of save games",         1, torinLarry7NumSavesSignature,       torinLarry7NumSavesPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };


Commit: bfb87389f70c31309394d9e598e9fb870e5f3abe
    https://github.com/scummvm/scummvm/commit/bfb87389f70c31309394d9e598e9fb870e5f3abe
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:08-05:00

Commit Message:
SCI32: Clean-up pass on MGDX script patches

* Convert selector literals to SIG_SELECTOR/PATCH_SELECTOR
* Fix a patch to use jmp instead of waste bytes
* Make identifier suffixes and patch descriptions consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 92d7443..fe18dd0 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -3513,8 +3513,8 @@ static const SciScriptPatcherEntry mothergoose256Signatures[] = {
 //
 // 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
+static const uint16 mothergooseHiresLogoSignature[] = {
+	0x38, SIG_SELECTOR16(init),      // pushi $8e (init)
 	SIG_MAGICDWORD,
 	0x76,                            // push0
 	0x72, SIG_UINT16(0x82),          // lofsa logo[82]
@@ -3522,11 +3522,8 @@ static const uint16 mothergooseHiresSignatureLogo[] = {
 	SIG_END
 };
 
-static const uint16 mothergooseHiresPatchLogo[] = {
-	0x18, 0x18, 0x18,                // waste bytes
-	0x18,                            // waste bytes
-	0x18, 0x18, 0x18,                // waste bytes
-	0x18, 0x18, 0x18,                // waste bytes
+static const uint16 mothergooseHiresLogoPatch[] = {
+	0x33, 0x08, // jmp [past bad logo init]
 	PATCH_END
 };
 
@@ -3537,7 +3534,7 @@ static const uint16 mothergooseHiresPatchLogo[] = {
 //
 // Applies to at least: English CD from King's Quest Collection
 // Responsible method: rhymeScript::changeState
-static const uint16 mothergooseHiresSignatureHorse[] = {
+static const uint16 mothergooseHiresHorseSignature[] = {
 	SIG_MAGICDWORD,
 	0x39, SIG_SELECTOR8(setPri), // pushi $4a (setPri)
 	0x78,                        // push1
@@ -3545,9 +3542,9 @@ static const uint16 mothergooseHiresSignatureHorse[] = {
 	SIG_END
 };
 
-static const uint16 mothergooseHiresPatchHorse[] = {
-	PATCH_ADDTOOFFSET(3),
-	0x38, PATCH_UINT16(0x59),
+static const uint16 mothergooseHiresHorsePatch[] = {
+	PATCH_ADDTOOFFSET(3),     // pushi setPri, push1
+	0x38, PATCH_UINT16(0x59), // pushi $59
 	PATCH_END
 };
 
@@ -3555,8 +3552,8 @@ static const uint16 mothergooseHiresPatchHorse[] = {
 static const SciScriptPatcherEntry mothergooseHiresSignatures[] = {
 	{  true,     0, "disable volume reset on startup (1/2)",       2, sci2VolumeResetSignature,         sci2VolumeResetPatch },
 	{  true,    90, "disable volume reset on startup (2/2)",       1, sci2VolumeResetSignature,         sci2VolumeResetPatch },
-	{  true,   108, "bad logo rendering",                          1, mothergooseHiresSignatureLogo,    mothergooseHiresPatchLogo },
-	{  true,   318, "bad horse z-index",                           1, mothergooseHiresSignatureHorse,   mothergooseHiresPatchHorse },
+	{  true,   108, "fix bad logo rendering",                      1, mothergooseHiresLogoSignature,    mothergooseHiresLogoPatch },
+	{  true,   318, "fix bad horse z-index",                       1, mothergooseHiresHorseSignature,   mothergooseHiresHorsePatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };
 


Commit: 6fc09ae7c91f4229e6bded55b474c2b41b1cc853
    https://github.com/scummvm/scummvm/commit/6fc09ae7c91f4229e6bded55b474c2b41b1cc853
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:08-05:00

Commit Message:
SCI32: Clean-up pass on Phant1 script patches

* Convert selector literals to SIG_SELECTOR/PATCH_SELECTOR
* Make identifier suffixes, patch descriptions, and patch table
  ordering consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index fe18dd0..9262440 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -135,7 +135,7 @@ static const char *const selectorNameTable[] = {
 	"font",         // KQ7
 	"setScale",     // LSL6hires
 	"setScaler",    // LSL6hires
-	"readWord",     // LSL7
+	"readWord",     // LSL7, Phant1
 #endif
 	NULL
 };
@@ -3564,30 +3564,30 @@ static const SciScriptPatcherEntry mothergooseHiresSignatures[] = {
 // game volumes through the launcher, so stop the game from overwriting the
 // ScummVM volumes with volumes from save games.
 // Applies to at least: English CD
-static const uint16 phant1SignatureSavedVolume[] = {
-	0x7a,                         // push2
-	0x39, 0x08,                   // pushi 8
-	0x38, SIG_UINT16(0x20b),      // push $20b (readWord)
-	0x76,                         // push0
-	0x72, SIG_UINT16(0x13c),      // lofsa $13c (PREF.DAT)
-	0x4a, SIG_UINT16(0x04),       // send 4
+static const uint16 phant1SavedVolumeSignature[] = {
+	0x7a,                           // push2
+	0x39, 0x08,                     // pushi 8
+	0x38, SIG_SELECTOR16(readWord), // push $20b (readWord)
+	0x76,                           // push0
+	0x72, SIG_UINT16(0x13c),        // lofsa $13c (PREF.DAT)
+	0x4a, SIG_UINT16(0x04),         // send 4
 	SIG_MAGICDWORD,
-	0xa1, 0xbc,                   // sag $bc
-	0x36,                         // push
-	0x43, 0x76, SIG_UINT16(0x04), // callk DoAudio[76], 4
-	0x7a,                         // push2
-	0x76,                         // push0
-	0x38, SIG_UINT16(0x20b),      // push $20b (readWord)
-	0x76,                         // push0
-	0x72, SIG_UINT16(0x13c),      // lofsa $13c (PREF.DAT)
-	0x4a, SIG_UINT16(0x04),       // send 4
-	0xa1, 0xbb,                   // sag $bb
-	0x36,                         // push
-	0x43, 0x75, SIG_UINT16(0x04), // callk DoSound[75], 4
+	0xa1, 0xbc,                     // sag $bc
+	0x36,                           // push
+	0x43, 0x76, SIG_UINT16(0x04),   // callk DoAudio[76], 4
+	0x7a,                           // push2
+	0x76,                           // push0
+	0x38, SIG_SELECTOR16(readWord), // push $20b (readWord)
+	0x76,                           // push0
+	0x72, SIG_UINT16(0x13c),        // lofsa $13c (PREF.DAT)
+	0x4a, SIG_UINT16(0x04),         // send 4
+	0xa1, 0xbb,                     // sag $bb
+	0x36,                           // push
+	0x43, 0x75, SIG_UINT16(0x04),   // callk DoSound[75], 4
 	SIG_END
 };
 
-static const uint16 phant1PatchSavedVolume[] = {
+static const uint16 phant1SavedVolumePatch[] = {
 	0x32, PATCH_UINT16(36),         // jmp [to prefFile::close]
 	PATCH_END
 };
@@ -3611,7 +3611,7 @@ static const uint16 phant1RatSignature[] = {
 	SIG_MAGICDWORD,
 	0x78,                         // push1
 	0x39, 0x1a,                   // pushi $1a
-	0x45, 0x03, SIG_UINT16(0x02), // callb 03, 0002
+	0x45, 0x03, SIG_UINT16(0x02), // callb 3, 2
 	0x18,                         // not
 	0x31, 0x18,                   // bnt $18
 	SIG_END
@@ -3624,9 +3624,9 @@ static const uint16 phant1RatPatch[] = {
 
 //          script, description,                                      signature                        patch
 static const SciScriptPatcherEntry phantasmagoriaSignatures[] = {
-	{  true,   901, "invalid array construction",                  1, sci21IntArraySignature,          sci21IntArrayPatch },
+	{  true,   901, "fix invalid array construction",              1, sci21IntArraySignature,          sci21IntArrayPatch },
+	{  true,  1111, "ignore audio settings from save game",        1, phant1SavedVolumeSignature,      phant1SavedVolumePatch },
 	{  true, 20200, "fix broken rat init in sEnterFromAlcove",     1, phant1RatSignature,              phant1RatPatch },
-	{  true,  1111, "ignore audio settings from save game",        1, phant1SignatureSavedVolume,      phant1PatchSavedVolume },
 	{  true, 64908, "disable video benchmarking",                  1, sci2BenchmarkSignature,          sci2BenchmarkPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };


Commit: b9600bf466bb722a98c6857d498161f17977001d
    https://github.com/scummvm/scummvm/commit/b9600bf466bb722a98c6857d498161f17977001d
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:08-05:00

Commit Message:
SCI32: Clean-up pass on Phant2 script patches

* Minor clarity fixes to comments
* Make patch descriptions and patch table ordering consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 9262440..229585e 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -3777,8 +3777,8 @@ static const uint16 phant2RatboyPatch[] = {
 // Applies to at least: US English
 static const uint16 phant2AudioVolumeSignature[] = {
 	SIG_MAGICDWORD,
-	0x39, 0x7f,           // pushi 127 (clientMax)
-	0x39, 0x14,           // pushi 20  (clientPageSize)
+	0x39, 0x7f,           // pushi 127 (clientMax value)
+	0x39, 0x14,           // pushi 20  (clientPageSize value)
 	SIG_ADDTOOFFSET(+10), // skip other init arguments
 	0x51, 0x5e,           // class P2ScrollBar
 	SIG_ADDTOOFFSET(+3),  // skip send
@@ -3992,8 +3992,8 @@ static const uint16 phant2InvOffsetPatch[] = {
 
 //          script, description,                                      signature                      patch
 static const SciScriptPatcherEntry phantasmagoria2Signatures[] = {
-	{  true,     0, "slow interface fades",                        3, phant2SlowIFadeSignature,      phant2SlowIFadePatch },
-	{  true,     0, "bad arguments to get game version",           1, phant2GetVersionSignature,     phant2GetVersionPatch },
+	{  true,     0, "speed up interface fades",                    3, phant2SlowIFadeSignature,      phant2SlowIFadePatch },
+	{  true,     0, "fix bad arguments to get game version",       1, phant2GetVersionSignature,     phant2GetVersionPatch },
 	{  true,  3000, "replace spin loop in alien password window",  1, phant2WaitParam1Signature,     phant2WaitParam1Patch },
 	{  true,  4081, "replace spin loop after ratboy puzzle",       1, phant2RatboySignature,         phant2RatboyPatch },
 	{  true, 63001, "fix inventory left scroll delta",             1, phant2InvLeftDeltaSignature,   phant2InvLeftDeltaPatch },
@@ -4006,9 +4006,9 @@ static const SciScriptPatcherEntry phantasmagoria2Signatures[] = {
 	{  true, 63019, "fix bad doc/email name & memo positioning",   2, phant2BadPositionSignature,    phant2BadPositionPatch },
 	{  true, 63019, "fix bad folder/doc icon refresh",             2, phant2BadIconSignature,        phant2BadIconPatch },
 	{  true, 64990, "remove save game name mangling (1/2)",        1, phant2SaveNameSignature1,      phant2SaveNamePatch1 },
+	{  true, 64990, "increase number of save games (1/2)",         1, phant2NumSavesSignature1,      phant2NumSavesPatch1 },
+	{  true, 64990, "increase number of save games (2/2)",         2, phant2NumSavesSignature2,      phant2NumSavesPatch2 },
 	{  true, 64994, "remove save game name mangling (2/2)",        1, phant2SaveNameSignature2,      phant2SaveNamePatch2 },
-	{  true, 64990, "increase number of save games",               1, phant2NumSavesSignature1,      phant2NumSavesPatch1 },
-	{  true, 64990, "increase number of save games",               2, phant2NumSavesSignature2,      phant2NumSavesPatch2 },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };
 


Commit: 34683f1725edde081653f45e2a532d4f9bcc3259
    https://github.com/scummvm/scummvm/commit/34683f1725edde081653f45e2a532d4f9bcc3259
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:08-05:00

Commit Message:
SCI32: Clean-up pass on PQ:SWAT script patches

* Make patch descriptions consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 229585e..fc4d0fa 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -4496,7 +4496,7 @@ static const SciScriptPatcherEntry pq4Signatures[] = {
 // master sound volume to 127, but the game should always use the volume stored
 // in ScummVM.
 // Applies to at least: English CD
-static const uint16 pqSwatSignatureVolumeReset1[] = {
+static const uint16 pqSwatVolumeResetSignature[] = {
 	SIG_MAGICDWORD,
 	0x38, SIG_SELECTOR16(masterVolume), // pushi masterVolume
 	0x78,                               // push1
@@ -4505,14 +4505,14 @@ static const uint16 pqSwatSignatureVolumeReset1[] = {
 	SIG_END
 };
 
-static const uint16 pqSwatPatchVolumeReset1[] = {
+static const uint16 pqSwatVolumeResetPatch[] = {
 	0x32, PATCH_UINT16(6), // jmp 6 [past volume reset]
 	PATCH_END
 };
 
 //          script, description,                                      signature                         patch
 static const SciScriptPatcherEntry pqSwatSignatures[] = {
-	{  true,     0, "disable volume reset on startup (1/2)",       1, pqSwatSignatureVolumeReset1,       pqSwatPatchVolumeReset1 },
+	{  true,     0, "disable volume reset on startup (1/2)",       1, pqSwatVolumeResetSignature,        pqSwatVolumeResetPatch },
 	{  true,     1, "disable volume reset on startup (2/2)",       1, sci2VolumeResetSignature,          sci2VolumeResetPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };


Commit: c5dce17b1f1392feb8825aba5addbc3999eeaa51
    https://github.com/scummvm/scummvm/commit/c5dce17b1f1392feb8825aba5addbc3999eeaa51
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:08-05:00

Commit Message:
SCI32: Clean-up pass on PQ4 script patches

* Convert selector literals to SIG_SELECTOR/PATCH_SELECTOR
* Convert word-size numeric literals to SIG_UINT16/PATCH_UINT16
* Wrap comments at 80 columns
* Rewrite comments for clarity and brevity
* Make alignment of operation comments consistent
* Make identifier suffixes, patch descriptions, and patch table
  ordering consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index fc4d0fa..c86e5c1 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -136,6 +136,8 @@ static const char *const selectorNameTable[] = {
 	"setScale",     // LSL6hires
 	"setScaler",    // LSL6hires
 	"readWord",     // LSL7, Phant1
+	"flag",         // PQ4
+	"select",       // PQ4
 #endif
 	NULL
 };
@@ -195,7 +197,9 @@ enum ScriptPatcherSelectors {
 	SELECTOR_font,
 	SELECTOR_setScale,
 	SELECTOR_setScaler,
-	SELECTOR_readWord
+	SELECTOR_readWord,
+	SELECTOR_flag,
+	SELECTOR_select
 #endif
 };
 
@@ -4230,133 +4234,115 @@ static const SciScriptPatcherEntry pq3Signatures[] = {
 #pragma mark -
 #pragma mark Police Quest 4
 
-// Adding support to also select both (text + speech at the same time) inside the game menu.
-// There is lowres support inside this code, but the button is never created for the lowres
-// version. That's why we effectively remove lowres support in those 2 methods, which
-// gives us more spare bytes to work with.
-//
-// For this to fully work, we need to inject our own view for the button that has both text and speech enabled.
-//
+// Add support for simultaneous speech & subtitles to the in-game UI.
+// The original game code has code paths for lo-res mode but only creates the
+// buttons in hi-res mode, so the lo-res code paths are removed to gain more
+// space for the patch.
 // Applies to: English CD
-// Responsible method: iconText::init, iconText::select (script 9)
-// Implements enhancement request: #9690
-static const uint16 pq4CDGameMenuSupportBOTHSignature[] = {
-	// We don't check the 2 methods completely, only the important bits
-	0x76,                               // push0
-	0x43, 0x22, 0x00, 0x00,             // callk IsHiRes
-	0x18,                               // not
-	0x31, 0x05,                         // bnt [skip next 2 opcodes, when hires]
+// Responsible method: iconText::init, iconText::select
+static const uint16 pq4CdSpeechAndSubtitlesSignature[] = {
+	// iconText::init
+	0x76,                         // push0
+	0x43, 0x22, SIG_UINT16(0x00), // callk IsHiRes
+	0x18,                         // not
+	0x31, 0x05,                   // bnt [skip next 2 opcodes, when hires]
 	SIG_MAGICDWORD,
-	0x34, SIG_UINT16(0x2661),           // ldi 2661h
-	0x65, 0x78,                         // aTop mainView
-	0x89, 0x5a,                         // lsg global[5Ah]
-	0x35, 0x01,                         // ldi 01
-	0x12,                               // and
-	0x30, SIG_UINT16(0x1b),             // bnt [when in speech mode]
-	0x76,                               // push0
-	0x43, 0x22, 0x00, 0x00,             // callk IsHiRes
-	SIG_ADDTOOFFSET(+45),               // skip over the remaining code
-	0x38, SIG_UINT16(0x93),             // pushi 93h (init)
-	0x76,                               // push0
-	0x59, 0x01,                         // &rest 01
-	0x57, 0x8f, 0x04, 0x00,             // super GCItem
-	0x48,                               // ret
-	// now we should be at iconText::select
-	0x38, SIG_UINT16(0x01c4),           // pushi 1C4h (select)
-	0x76,                               // push0
-	0x59, 0x01,                         // &rest 01
-	0x57, 0x8f, 0x04, 0x00,             // super GCItem, 04
-	0x89, 0x5a,                         // lsg global[5Ah]
-	0x35, 0x02,                         // ldi 02
-	0x12,                               // and
-	0x30, SIG_UINT16(0x1F),             // bnt [jump to currently-in-text-mode code]
-	SIG_ADDTOOFFSET(+67),               // skip over the rest
-	0x48,                               // ret
+	0x34, SIG_UINT16(0x2661),     // ldi 9825
+	0x65, 0x78,                   // aTop mainView
+	0x89, 0x5a,                   // lsg global[$5a]
+	0x35, 0x01,                   // ldi 1
+	0x12,                         // and
+	0x30, SIG_UINT16(0x1b),       // bnt [when in speech mode]
+	0x76,                         // push0
+	0x43, 0x22, SIG_UINT16(0x00), // callk IsHiRes
+	SIG_ADDTOOFFSET(+45),         // skip over the remaining code
+	0x38, SIG_SELECTOR16(init),   // pushi $93 (init)
+	0x76,                         // push0
+	0x59, 0x01,                   // &rest 01
+	0x57, 0x8f, SIG_UINT16(0x04), // super GCItem
+	0x48,                         // ret
+
+	// iconText::select
+	0x38, SIG_SELECTOR16(select), // pushi $1c4 (select)
+	0x76,                         // push0
+	0x59, 0x01,                   // &rest 01
+	0x57, 0x8f, SIG_UINT16(0x04), // super GCItem, 4
+	0x89, 0x5a,                   // lsg global[$5a]
+	0x35, 0x02,                   // ldi 2
+	0x12,                         // and
+	0x30, SIG_UINT16(0x1f),       // bnt [jump to currently-in-text-mode code]
+	SIG_ADDTOOFFSET(+67),         // skip over the rest
+	0x48,                         // ret
 	SIG_END
 };
 
-static const uint16 pq4CDGameMenuSupportBOTHPatch[] = {
-	0x76,                               // push0
-	0x41, 2, PATCH_UINT16(0),           // call our new routine, that does set view+loop+cel
-	0x33, 64,                           // jmp (to original init, super GCItem call)
+static const uint16 pq4CdSpeechAndSubtitlesPatch[] = {
+	// iconText::init
+	0x76,                           // push0
+	0x41, 0x02, PATCH_UINT16(0x00), // call [our new subroutine which sets view+loop+cel], 0
+	0x33, 0x40,                     // jmp [to original init, super GCItem call]
 	// new code for setting view+loop+cel
-	0x34, PATCH_UINT16(10987),          // ldi 10987
-	0x65, 0x78,                         // aTop mainView - always set this view, because it's used by 2 states
-	0x89, 0x5a,                         // lsg global[5Ah]
-	0x35, 0x03,                         // ldi 03
-	0x1a,                               // eq?
-	0x31, 4,                            // bnt [skip over follow up code]
-	// set, when in dual mode
-	0x78,                               // push1
-	0x69, 0x7a,                         // sTop mainLoop
-	0x48,                               // ret
-	0x89, 0x5a,                         // lsg global[5Ah]
-	0x35, 0x01,                         // ldi 01
-	0x12,                               // and
-	0x31, 4,                            // bnt [skip over follow up code]
-	// set, when in text mode
-	0x76,                               // push0
-	0x69, 0x7a,                         // sTop mainLoop
-	0x48,                               // ret
-	// set, when in speech mode
-	0x34, PATCH_UINT16(10982),          // ldi 10982
-	0x65, 0x78,                         // aTop mainView
-	0x35, 15,                           // ldi 15d
-	0x65, 0x7a,                         // aTop mainLoop
-	0x48,                               // ret
-	PATCH_ADDTOOFFSET(+38),             // skip to iconText::select
+	0x34, PATCH_UINT16(0x2aeb),     // ldi 10987
+	0x65, 0x78,                     // aTop mainView - always set this view, because it's used by 2 states
+	0x89, 0x5a,                     // lsg global[$5a]
+	0x35, 0x03,                     // ldi 3
+	0x1a,                           // eq?
+	0x31, 0x04,                     // bnt [skip over follow up code]
+	// speech+subtitles mode
+	0x78,                           // push1
+	0x69, 0x7a,                     // sTop mainLoop
+	0x48,                           // ret
+	0x89, 0x5a,                     // lsg global[$5a]
+	0x35, 0x01,                     // ldi 1
+	0x12,                           // and
+	0x31, 0x04,                     // bnt [skip over follow up code]
+	// subtitles mode
+	0x76,                           // push0
+	0x69, 0x7a,                     // sTop mainLoop
+	0x48,                           // ret
+	// speech mode
+	0x34, PATCH_UINT16(0x2ae6),     // ldi 10982
+	0x65, 0x78,                     // aTop mainView
+	0x35, 0x0f,                     // ldi 15
+	0x65, 0x7a,                     // aTop mainLoop
+	0x48,                           // ret
+	PATCH_ADDTOOFFSET(+38),         // skip to iconText::select
+
 	// iconText::select
-	PATCH_ADDTOOFFSET(+10),             // skip over the super code
-	0xC1, 0x5A,                         // plusag 5Ah (increase 5Ah by one)
-	0xA1, 0x5A,                         // sag 5Ah (save)
-	0x36,                               // push
-	0x35, 0x04,                         // ldi 04
-	0x28,                               // uge?
-	0x31, 3,                            // bnt [skip over follow up code]
-	0x78,                               // push1
-	0xA9, 0x5A,                         // ssg 5Ah (save)
-	0x76,                               // push0
-	0x41, 153, PATCH_UINT16(0),         // call our new routine, that does set view+loop+cel, effectively -103
-	0x33, 47,                           // jmp (to end of original select, show call)
+	PATCH_ADDTOOFFSET(+10),         // skip over the super code
+	0xc1, 0x5a,                     // plusag 5Ah (increase 5Ah by one)
+	0xa1, 0x5a,                     // sag 5Ah (save)
+	0x36,                           // push
+	0x35, 0x04,                     // ldi 04
+	0x28,                           // uge?
+	0x31, 0x03,                     // bnt [skip over follow up code]
+	0x78,                           // push1
+	0xa9, 0x5a,                     // ssg 5Ah (save)
+	0x76,                           // push0
+	0x41, 0x99, PATCH_UINT16(0x00), // call [our new subroutine which sets view+loop+cel, effectively -103], 0
+	0x33, 0x2f,                     // jmp [to end of original select, show call]
 	PATCH_END
 };
 
-// In Police Quest 4 inside the Bitty Kitty show (room 315), the player has to first talk with a young woman, show her the police badge, then
-// show her the red shoe. She will tell the player that may "Barbie" knows more.
-// After leaving and entering later (not detailed here), Barbie will be available.
-// Now the player needs to show her the police badge as well and then it goes a bit weird.
-//
-// The player can show her the red shoe immediately, which will work dialog-wise, but points won't be awarded and the corresponding flag will also not get set.
-// Internally the game checks if some regular talking dialog (for Barbie) has been accessed before awarding the points and setting the flags.
-// When the player does not recognize this, the player may get stuck and it will look as if a game breaking glitch has happened.
-//
-// Showing the red shoe to the young woman AND showing it to Barbie is all done using the same script.
-// It works via shoeShoe::changeState.
-//
-// The code in there of state 0 checks first who is currently inside the room using stripper::noun.
-// Afterwards for the young woman it checks local 3 if it's zero or not zero.
-// Local 3 is set, when the player has shown the police badge to the person, that is currently inside the room.
-//
-// For Barbie strangely global 9Ah is checked instead, which then causes those issues.
-//
-// We change the Barbie code to also check local 3, which seems to work out.
-// We can't simply remove the check, otherwise the flag will get set even when the player
-// hasn't shown the badge, which will cause Barbie to not answer the question and the player
-// won't be able to show her the shoe a second time.
-//
-// This of course also happened, when using the original interpreter.
-//
+// When showing the red shoe to Barbie after showing the police badge but before
+// exhausting the normal dialogue tree, the game plays the expected dialogue but
+// fails to award points or set an internal flag indicating this interaction has
+// occurred (which is needed to progress in the game). This is because the game
+// checks global $9a (dialogue progress flag) instead of local 3 (badge shown
+// flag) when interacting with Barbie. The game uses the same
+// `shoeShoe::changeState` method for showing the shoe to the young woman at the
+// bar earlier in the game, and checks local 3 then, so just check local 3 in
+// both cases to prevent the game from appearing to be in an unwinnable state
+// just because the player interacted in the "wrong" order.
 // Applies to at least: English floppy, German floppy, English CD
-// Responsible method: showShoe::changeState(0) - script 315
-// Fixes bug: #9849
 static const uint16 pq4BittyKittyShowBarieRedShoeSignature[] = {
 	// stripper::noun check is for checking, if police badge was shown
 	SIG_MAGICDWORD,
-	0x89, 0x9a,                         // lsg global[9Ah]
-	0x35, 0x02,                         // ldi 02
+	0x89, 0x9a,                         // lsg global[$9a]
+	0x35, 0x02,                         // ldi 2
 	0x1e,                               // gt?
 	0x30, SIG_UINT16(0x0028),           // bnt [skip 2 points code]
-	0x39, 0x61,                         // pushi 61h (flag)
+	0x39, SIG_SELECTOR8(flag),          // pushi $61 (flag)
 	SIG_END
 };
 
@@ -4367,22 +4353,18 @@ static const uint16 pq4BittyKittyShowBarbieRedShoePatch[] = {
 	PATCH_END
 };
 
-// In Police Quest 4 scripts for room 390 (city hall) use ticks instead of seconds.
-// Ticks are not behaving the same as seconds. Ticks will also go down within game menus including inventory.
-// When getting attacked, the player has almost no time to draw the gun - and even when the player has the gun
-// equipped in advance, afterwards the attacker needs to get cuffed. Which means selecting the cuffs inside
-// the inventory.
-// It's not obvious that this sequence doesn't stop time while inside game menus, which is why the player
-// may think it's a bug when the player is literally instantly attacked and killed after returning from inventory.
-//
-// Another action-sequence right before that uses ::seconds (woman, who attacks ego with a knife).
-//
-// That's why we change all occurrences of ::ticks to ::seconds and also adjust the values accordingly.
-//
-// This is not a perfect solution. The game system will decrease ::seconds by 1 after entering+exiting the game menu,
-// that's why I raised some of the timers for 1 or 2 seconds. A better solution would be to make it so game system
-// won't decrease ticks/seconds after returning from the game menu. That could of course break things, but should be investigated.
-//
+// In PQ4, scripts for the city hall action sequences use `ticks`. These
+// continue to count down even during inventory interaction, so if the user is
+// unable to find the correct inventory item quickly enough for the sequence,
+// the game will immediately end with a "game over" once they close the
+// inventory and the main game loop resumes. This can seem like a game bug, so
+// we change these sequences to use `seconds`, which only tick down by 1 when
+// the game returns to the main loop and the wall time has changed, even if many
+// seconds have actually elapsed. However, since `seconds` uses absolute
+// hardware clock time with a granularity of 1 second, "one" second can actually
+// be less than one second if the timer is set in between hardware clock
+// seconds, so the values are increased slightly from their equivalent tick
+// values to compensate for this.
 // Applies to at least: English Floppy, German floppy
 // Responsible method: metzAttack::changeState(2) - 120 ticks (player needs to draw gun)
 //                     stickScr::changeState(0) - 180 ticks (player needs to tell enemy to drop gun)
@@ -4390,101 +4372,106 @@ static const uint16 pq4BittyKittyShowBarbieRedShoePatch[] = {
 //                     turnMetz::changeState(5) - 600/420 ticks (player needs to cuff Metz)
 //                     all in script 390
 //
-// The code for the CD version was changed quite a bit, the selector for ticks also changed from 0x10 (so opcode-wise it's 0x20) to 0x11 (opcode-wise 0x22),
-// so additional signatures/patches will need to be added for CD version.
-//
-// metzAttack::changeState(2)
+// TODO: The object structure changed in PQ4CD so ticks moved from 0x20 to 0x22.
+// Additional signatures/patches will need to be added for CD version.
 static const uint16 pq4FloppyCityHallDrawGunTimerSignature[] = {
 	SIG_MAGICDWORD,
-	0x4a, SIG_UINT16(0x0008),           // send 08
-	0x32,                               // jmp [ret]
-	SIG_ADDTOOFFSET(+8),                // skip over some code
-	0x35, 0x78,                         // pushi 0078h (120)
-	0x65, 0x20,                         // aTop ticks
+	0x4a, SIG_UINT16(0x08), // send 8
+	0x32,                   // jmp [ret]
+	SIG_ADDTOOFFSET(+8),    // skip over some code
+	0x35, 0x78,             // pushi $78 (120)
+	0x65, 0x20,             // aTop ticks
 	SIG_END
 };
+
 static const uint16 pq4FloppyCityHallDrawGunTimerPatch[] = {
-	PATCH_ADDTOOFFSET(12),
-	0x35, 0x05,                         // pushi 4
-	0x65, 0x1c,                         // aTop seconds - raise time from 2 seconds to 4 seconds
+	PATCH_ADDTOOFFSET(+12), // send 8, jmp, skip over some code
+	0x35, 0x05,             // pushi 4 (120t/2s -> 4s)
+	0x65, 0x1c,             // aTop seconds
 	PATCH_END
 };
+
 // stickScr::changeState(0)
 static const uint16 pq4FloppyCityHallTellEnemyDropWeaponTimerSignature[] = {
 	SIG_MAGICDWORD,
-	0x34, SIG_UINT16(180),              // pushi 00B4h (180)
-	0x65, 0x20,                         // aTop ticks
-	0x32, SIG_UINT16(0x005e),           // jmp to ret
+	0x34, SIG_UINT16(0xb4), // pushi $b4 (180)
+	0x65, 0x20,             // aTop ticks
+	0x32, SIG_UINT16(0x5e), // jmp to ret
 	SIG_END
 };
+
 static const uint16 pq4FloppyCityHallTellEnemyDropWeaponTimerPatch[] = {
-	0x34, PATCH_UINT16(5),              // pushi 5
-	0x65, 0x1c,                         // aTop seconds - raise time from 3 seconds to 5 seconds
+	0x34, PATCH_UINT16(0x05), // pushi 5 (180t/3s -> 5s)
+	0x65, 0x1c,               // aTop seconds
 	PATCH_END
 };
+
 // dropStick::changeState(5)
 static const uint16 pq4FloppyCityHallTellEnemyTurnAroundTimerSignature[] = {
 	SIG_MAGICDWORD,
-	0x4a, SIG_UINT16(0x0004),           // send 04
-	0x35, 0x78,                         // pushi 0078h (120)
-	0x65, 0x20,                         // aTop ticks
+	0x4a, SIG_UINT16(0x04), // send 4
+	0x35, 0x78,             // pushi $78 (120)
+	0x65, 0x20,             // aTop ticks
 	SIG_END
 };
+
 static const uint16 pq4FloppyCityHallTellEnemyTurnAroundTimerPatch[] = {
-	PATCH_ADDTOOFFSET(+3),
-	0x35, 0x03,                         // pushi 3
-	0x65, 0x1c,                         // aTop seconds - raise time from 2 seconds to 3 seconds
+	PATCH_ADDTOOFFSET(+3), // send 4
+	0x35, 0x03,            // pushi 3 (120t/2s -> 3s)
+	0x65, 0x1c,            // aTop seconds
 	PATCH_END
 };
+
 // turnMetz::changeState(5)
 static const uint16 pq4FloppyCityHallCuffEnemyTimerSignature[] = {
 	SIG_MAGICDWORD,
-	0x34, SIG_UINT16(600),              // pushi 258h (600)
-	0x65, 0x20,                         // aTop ticks
+	0x34, SIG_UINT16(0x258), // pushi $258 (600)
+	0x65, 0x20,              // aTop ticks
 	SIG_ADDTOOFFSET(+3),
-	0x34, SIG_UINT16(420),              // pushi 1A4h (420)
-	0x65, 0x20,                         // aTop ticks
+	0x34, SIG_UINT16(0x1a4), // pushi $1a4 (420)
+	0x65, 0x20,              // aTop ticks
 	SIG_END
 };
+
 static const uint16 pq4FloppyCityHallCuffEnemyTimerPatch[] = {
-	0x34, PATCH_UINT16(10),             // pushi 10
-	0x65, 0x1c,                         // aTop seconds - time is 10 seconds
+	0x34, PATCH_UINT16(0x0a), // pushi 10 (600t/10s)
+	0x65, 0x1c,               // aTop seconds
 	PATCH_ADDTOOFFSET(+3),
-	0x34, SIG_UINT16(7),                // pushi 7
-	0x65, 0x1c,                         // aTop seconds - time is 7 seconds
+	0x34, SIG_UINT16(0x07),   // pushi 7 (420t/7s)
+	0x65, 0x1c,               // aTop seconds
 	PATCH_END
 };
 
-// Right at the end in room 755, the last action sequence is also using ticks instead of seconds.
-// For details, read the description of city hall action sequence issues right above this.
-//
+// The end game action sequence also uses ticks instead of seconds. See the
+// description of city hall action sequence issues for more information.
 // Applies to at least: English Floppy, German floppy, English CD
-// Responsible method: comeInLast::changeState(11) - 300 ticks (player needs to use item) - in script 755
+// Responsible method: comeInLast::changeState(11)
 static const uint16 pq4LastActionHeroTimerSignature[] = {
 	SIG_MAGICDWORD,
-	0x34, SIG_UINT16(300),              // pushi 012Ch (300)
-	0x65, SIG_ADDTOOFFSET(+1),          // aTop ticks (20h for floppy, 22h for CD)
+	0x34, SIG_UINT16(0x12c),   // pushi $12c (300)
+	0x65, SIG_ADDTOOFFSET(+1), // aTop ticks ($20 for floppy, $22 for CD)
 	SIG_END
 };
+
 static const uint16 pq4LastActionHeroTimerPatch[] = {
-	0x34, PATCH_UINT16(5),                    // pushi 5
-	0x65, PATCH_GETORIGINALBYTEADJUST(4, -4), // aTop seconds - 5 seconds
+	0x34, PATCH_UINT16(0x05),                 // pushi 5 (300t/5s)
+	0x65, PATCH_GETORIGINALBYTEADJUST(4, -4), // aTop seconds
 	PATCH_END
 };
 
 //          script, description,                                          signature                                           patch
 static const SciScriptPatcherEntry pq4Signatures[] = {
-	{  true,     9, "CD: game menu to support BOTH",                   1, pq4CDGameMenuSupportBOTHSignature,                  pq4CDGameMenuSupportBOTHPatch },
-	{  true,   315, "show barbie the red shoe points fix",             1, pq4BittyKittyShowBarieRedShoeSignature,             pq4BittyKittyShowBarbieRedShoePatch },
-	{  true,   390, "floppy: city hall: draw gun timer",               1, pq4FloppyCityHallDrawGunTimerSignature,             pq4FloppyCityHallDrawGunTimerPatch },
-	{  true,   390, "floppy: city hall: tell enemy drop weapon timer", 1, pq4FloppyCityHallTellEnemyDropWeaponTimerSignature, pq4FloppyCityHallTellEnemyDropWeaponTimerPatch },
-	{  true,   390, "floppy: city hall: tell enemy turn around timer", 1, pq4FloppyCityHallTellEnemyTurnAroundTimerSignature, pq4FloppyCityHallTellEnemyTurnAroundTimerPatch },
-	{  true,   390, "floppy: city hall: cuff enemy timer",             1, pq4FloppyCityHallCuffEnemyTimerSignature,           pq4FloppyCityHallCuffEnemyTimerPatch },
-	{  true,   755, "last action sequence timer",                      1, pq4LastActionHeroTimerSignature,                    pq4LastActionHeroTimerPatch },
-	{  true, 64918, "Str::strip fix for floppy version",               1, sci2BrokenStrStripSignature,                        sci2BrokenStrStripPatch },
+	{  true,     9, "add speech+subtitles to in-game UI",              1, pq4CdSpeechAndSubtitlesSignature,                   pq4CdSpeechAndSubtitlesPatch },
+	{  true,   315, "fix missing points showing barbie the red shoe",  1, pq4BittyKittyShowBarieRedShoeSignature,             pq4BittyKittyShowBarbieRedShoePatch },
+	{  true,   390, "change floppy city hall use gun timer",           1, pq4FloppyCityHallDrawGunTimerSignature,             pq4FloppyCityHallDrawGunTimerPatch },
+	{  true,   390, "change floppy city hall say 'drop weapon' timer", 1, pq4FloppyCityHallTellEnemyDropWeaponTimerSignature, pq4FloppyCityHallTellEnemyDropWeaponTimerPatch },
+	{  true,   390, "change floppy city hall say 'turn around' timer", 1, pq4FloppyCityHallTellEnemyTurnAroundTimerSignature, pq4FloppyCityHallTellEnemyTurnAroundTimerPatch },
+	{  true,   390, "change floppy city hall use handcuffs timer",     1, pq4FloppyCityHallCuffEnemyTimerSignature,           pq4FloppyCityHallCuffEnemyTimerPatch },
+	{  true,   755, "change last action sequence timer",               1, pq4LastActionHeroTimerSignature,                    pq4LastActionHeroTimerPatch },
 	{  true, 64908, "disable video benchmarking",                      1, sci2BenchmarkSignature,                             sci2BenchmarkPatch },
-	{  true, 64990, "increase number of save games",                   1, sci2NumSavesSignature1,                             sci2NumSavesPatch1 },
-	{  true, 64990, "increase number of save games",                   1, sci2NumSavesSignature2,                             sci2NumSavesPatch2 },
+	{  true, 64918, "fix Str::strip in floppy version",                1, sci2BrokenStrStripSignature,                        sci2BrokenStrStripPatch },
+	{  true, 64990, "increase number of save games (1/2)",             1, sci2NumSavesSignature1,                             sci2NumSavesPatch1 },
+	{  true, 64990, "increase number of save games (2/2)",             1, sci2NumSavesSignature2,                             sci2NumSavesPatch2 },
 	{  true, 64990, "disable change directory button",                 1, sci2ChangeDirSignature,                             sci2ChangeDirPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };


Commit: 3b7e6103647143d916b3ec93acd6d07c621c9a5c
    https://github.com/scummvm/scummvm/commit/3b7e6103647143d916b3ec93acd6d07c621c9a5c
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:09-05:00

Commit Message:
SCI32: Clean-up pass on QFG4 script patches

* Convert selector literals to SIG_SELECTOR/PATCH_SELECTOR
* Make identifier suffixes and patch descriptions consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index c86e5c1..af9278f 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -5478,7 +5478,7 @@ static const SciScriptPatcherEntry qfg3Signatures[] = {
 
 // The trap init code incorrectly creates an int array for string data.
 // Applies to at least: English CD
-static const uint16 qfg4SignatureTrapArrayType[] = {
+static const uint16 qfg4TrapArrayTypeSignature[] = {
 	0x38, SIG_SELECTOR16(new), // pushi new
 	0x78,                      // push1
 	0x38, SIG_UINT16(0x80),    // pushi $80 (128)
@@ -5488,7 +5488,7 @@ static const uint16 qfg4SignatureTrapArrayType[] = {
 	SIG_END
 };
 
-static const uint16 qfg4PatchTrapArrayType[] = {
+static const uint16 qfg4TrapArrayTypePatch[] = {
 	PATCH_ADDTOOFFSET(+4),     // pushi $92 (new), push1
 	0x38, PATCH_UINT16(0x100), // pushi $100 (256)
 	0x51, 0x0d,                // class $d (ByteArray)
@@ -5503,7 +5503,7 @@ static const uint16 qfg4BenchmarkSignature[] = {
 	0x51, SIG_ADDTOOFFSET(+1), // class View
 	0x4a, SIG_UINT16(0x04),    // send 4
 	0xa5, 0x00,                // sat 0
-	0x39, 0x0e,                // pushi $e
+	0x39, SIG_SELECTOR8(view), // pushi $e (view)
 	SIG_MAGICDWORD,
 	0x78,                      // push1
 	0x38, SIG_UINT16(0x270f),  // push $270f (9999)
@@ -5521,9 +5521,9 @@ static const uint16 qfg4BenchmarkPatch[] = {
 static const SciScriptPatcherEntry qfg4Signatures[] = {
 	{  true,     1, "disable volume reset on startup",             1, sci2VolumeResetSignature,         sci2VolumeResetPatch },
 	{  true,     1, "disable video benchmarking",                  1, qfg4BenchmarkSignature,           qfg4BenchmarkPatch },
-	{  true,    83, "fix incorrect array type",                    1, qfg4SignatureTrapArrayType,       qfg4PatchTrapArrayType },
-	{  true, 64990, "increase number of save games",               1, sci2NumSavesSignature1,           sci2NumSavesPatch1 },
-	{  true, 64990, "increase number of save games",               1, sci2NumSavesSignature2,           sci2NumSavesPatch2 },
+	{  true,    83, "fix incorrect array type",                    1, qfg4TrapArrayTypeSignature,       qfg4TrapArrayTypePatch },
+	{  true, 64990, "increase number of save games (1/2)",         1, sci2NumSavesSignature1,           sci2NumSavesPatch1 },
+	{  true, 64990, "increase number of save games (2/2)",         1, sci2NumSavesSignature2,           sci2NumSavesPatch2 },
 	{  true, 64990, "disable change directory button",             1, sci2ChangeDirSignature,           sci2ChangeDirPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };


Commit: 4dcf88ef4f77e86bef447da1e77786d425c916b9
    https://github.com/scummvm/scummvm/commit/4dcf88ef4f77e86bef447da1e77786d425c916b9
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:09-05:00

Commit Message:
SCI32: Clean-up pass on Rama script patches

* Make alignment of operation comments consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index af9278f..3b275a1 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -6108,8 +6108,8 @@ static const uint16 ramaBenchmarkSignature[] = {
 };
 
 static const uint16 ramaBenchmarkPatch[] = {
-	0x34, PATCH_UINT16(10000), // ldi 10000
-	0x48,                      // ret
+	0x34, PATCH_UINT16(0x2710), // ldi 10000
+	0x48,                       // ret
 	PATCH_END
 };
 


Commit: 4e6fa4d690215749a55530957961244148226cd7
    https://github.com/scummvm/scummvm/commit/4e6fa4d690215749a55530957961244148226cd7
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:09-05:00

Commit Message:
SCI32: Clean-up pass on Shivers script patches

* Convert selector literals to SIG_SELECTOR/PATCH_SELECTOR
* Wrap comments at 80 columns
* Rewrite comments for clarity and brevity
* Make identifier suffixes, patch descriptions, and patch table
  ordering consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 3b275a1..ae999a7 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -114,8 +114,9 @@ static const char *const selectorNameTable[] = {
 	"posn",         // SCI2 benchmarking script
 	"detailLevel",  // GK2 benchmarking
 	"view",         // RAMA benchmarking, GK1
-	"fade",         // Shivers sound fix
-	"play",         // Shivers sound fix
+	"fade",         // Shivers
+	"play",         // Shivers
+	"handleEvent",  // Shivers
 	"test",         // Torin
 	"get",          // Torin, GK1
 	"has",          // GK1
@@ -178,6 +179,7 @@ enum ScriptPatcherSelectors {
 	SELECTOR_view,
 	SELECTOR_fade,
 	SELECTOR_play,
+	SELECTOR_handleEvent,
 	SELECTOR_test,
 	SELECTOR_get,
 	SELECTOR_has,
@@ -6124,28 +6126,29 @@ static const SciScriptPatcherEntry ramaSignatures[] = {
 
 // In room 35170, there is a CCTV control station with a joystick that must be
 // clicked and dragged to pan the camera. In order to enable dragging, on
-// mousedown, the vJoystick::handleEvent method calls vJoystick::doVerb(1),
+// mousedown, the `vJoystick::handleEvent` method calls `vJoystick::doVerb(1)`,
 // which enables the drag functionality of the joystick. However,
-// vJoystick::handleEvent then makes a super call to ShiversProp::handleEvent,
-// which calls vJoystick::doVerb(). This second call, which fails to pass an
-// argument, causes an uninitialized read off the stack for the first parameter.
-// In SSCI, this happens to work because the uninitialized value on the stack
-// happens to be 1. Disabling the super call avoids the bad doVerb call without
-// any apparent ill effect.
+// `vJoystick::handleEvent` then makes a super call to
+// `ShiversProp::handleEvent`, which calls `vJoystick::doVerb()`. This second
+// call, which fails to pass an argument, causes an uninitialized read off the
+// stack for the first parameter. In SSCI, this happens to work because the
+// uninitialized value on the stack happens to be 1. Disabling the super call
+// avoids the bad doVerb call without any apparent ill effect.
 // The same problem exists when trying to drag the volume & brightness sliders
 // in the main menu. These controls are also fixed by this patch.
-static const uint16 shiversSignatureSuperCall[] = {
+// Applies to at least: US English
+static const uint16 shiversEventSuperCallSignature[] = {
 	SIG_MAGICDWORD,
-	0x38, SIG_UINT16(0xa5),    // pushi handleEvent
-	0x78,                      // push1
-	0x8f, 0x01,                // lsp 1
-	0x59, 0x02,                // &rest 2
-	0x57, 0x7f, SIG_UINT16(6), // super ShiversProp[7f], 6
+	0x38, SIG_SELECTOR16(handleEvent), // pushi handleEvent
+	0x78,                              // push1
+	0x8f, 0x01,                        // lsp 1
+	0x59, 0x02,                        // &rest 2
+	0x57, 0x7f, SIG_UINT16(0x06),      // super ShiversProp[7f], 6
 	SIG_END
 };
 
-static const uint16 shiversPatchSuperCall[] = {
-	0x48,                      // ret
+static const uint16 shiversEventSuperCallPatch[] = {
+	0x48, // ret
 	PATCH_END
 };
 
@@ -6158,25 +6161,25 @@ static const uint16 shiversPatchSuperCall[] = {
 // but here it is a number instead). Other rooms make this same call with the
 // correct fade selector, so fix the selector here to match.
 // Applies to at least: English CD
-static const uint16 shiversGodsItemsIxupiPlaySoundSignature[] = {
+static const uint16 shiversGodsIxupiPlaySoundSignature[] = {
 	SIG_MAGICDWORD,
-	0x39, SIG_SELECTOR8(play),     // pushi 33
-	0x38, SIG_UINT16(0x06),        // pushi 0006
+	0x39, SIG_SELECTOR8(play), // pushi $33
+	0x38, SIG_UINT16(0x06),    // pushi 6
 	SIG_END
 };
 
-static const uint16 shiversGodsItemsIxupiPlaySoundPatch[] = {
-	0x38, PATCH_SELECTOR16(fade),  // pushi 00f3
-	0x39, 0x06,                    // pushi 06
+static const uint16 shiversGodsIxupiPlaySoundPatch[] = {
+	0x38, PATCH_SELECTOR16(fade), // pushi $f3
+	0x39, 0x06,                   // pushi 6
 	PATCH_END
 };
 
-//          script, description,                                      signature                        patch
+//          script, description,                                      signature                           patch
 static const SciScriptPatcherEntry shiversSignatures[] = {
-	{  true, 35170, "fix CCTV joystick interaction",               1, shiversSignatureSuperCall,     shiversPatchSuperCall },
-	{  true,   990, "fix volume & brightness sliders",             2, shiversSignatureSuperCall,     shiversPatchSuperCall },
-	{  true, 64908, "disable video benchmarking",                  1, sci2BenchmarkSignature,        sci2BenchmarkPatch },
-	{  true, 23090, "fix play call in room 23090",                 1, shiversGodsItemsIxupiPlaySoundSignature, shiversGodsItemsIxupiPlaySoundPatch },
+	{  true,   990, "fix volume & brightness sliders",             2, shiversEventSuperCallSignature,     shiversEventSuperCallPatch },
+	{  true, 23090, "fix bad Ixupi sound call",                    1, shiversGodsIxupiPlaySoundSignature, shiversGodsIxupiPlaySoundPatch },
+	{  true, 35170, "fix CCTV joystick interaction",               1, shiversEventSuperCallSignature,     shiversEventSuperCallPatch },
+	{  true, 64908, "disable video benchmarking",                  1, sci2BenchmarkSignature,             sci2BenchmarkPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };
 


Commit: d1c43b24ea3d0d6fa57ba6b374dc0a22427ec7fc
    https://github.com/scummvm/scummvm/commit/d1c43b24ea3d0d6fa57ba6b374dc0a22427ec7fc
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:09-05:00

Commit Message:
SCI32: Clean-up pass on GK1 script patches

* Make alignment of operation comments consistent
* Make patch descriptions consistent

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index ae999a7..4f3cdea 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -6192,13 +6192,13 @@ static const SciScriptPatcherEntry shiversSignatures[] = {
 // CPU-dependent in ScummVM).
 static const uint16 sq6SlowTransitionSignature1[] = {
 	SIG_MAGICDWORD,
-	0x38, SIG_UINT16(0x578), // pushi $0578
+	0x38, SIG_UINT16(0x578), // pushi $578
 	0x51, 0x33,              // class Styler
 	SIG_END
 };
 
 static const uint16 sq6SlowTransitionPatch1[] = {
-	0x38, SIG_UINT16(500), // pushi 500
+	0x38, SIG_UINT16(0x1f4), // pushi 500
 	PATCH_END
 };
 
@@ -6214,7 +6214,7 @@ static const uint16 sq6SlowTransitionSignature2[] = {
 };
 
 static const uint16 sq6SlowTransitionPatch2[] = {
-	0x38, SIG_UINT16(30), // pushi 30
+	0x38, SIG_UINT16(0x1e), // pushi 30
 	PATCH_END
 };
 
@@ -6233,15 +6233,15 @@ static const uint16 sq6BenchmarkSignature[] = {
 //          script, description,                                      signature                        patch
 static const SciScriptPatcherEntry sq6Signatures[] = {
 	{  true,     0, "fix slow transitions",                        1, sq6SlowTransitionSignature2,     sq6SlowTransitionPatch2 },
-	{  true,    15, "invalid array construction",                  1, sci21IntArraySignature,          sci21IntArrayPatch },
-	{  true,    22, "invalid array construction",                  1, sci21IntArraySignature,          sci21IntArrayPatch },
+	{  true,    15, "fix invalid array construction",              1, sci21IntArraySignature,          sci21IntArrayPatch },
+	{  true,    22, "fix invalid array construction",              1, sci21IntArraySignature,          sci21IntArrayPatch },
 	{  true,   410, "fix slow transitions",                        1, sq6SlowTransitionSignature2,     sq6SlowTransitionPatch2 },
-	{  true,   460, "invalid array construction",                  1, sci21IntArraySignature,          sci21IntArrayPatch },
+	{  true,   460, "fix invalid array construction",              1, sci21IntArraySignature,          sci21IntArrayPatch },
 	{  true,   500, "fix slow transitions",                        1, sq6SlowTransitionSignature1,     sq6SlowTransitionPatch1 },
-	{  true,   510, "invalid array construction",                  1, sci21IntArraySignature,          sci21IntArrayPatch },
+	{  true,   510, "fix invalid array construction",              1, sci21IntArraySignature,          sci21IntArrayPatch },
 	{  true, 64908, "disable video benchmarking",                  1, sq6BenchmarkSignature,           sci2BenchmarkPatch },
-	{  true, 64990, "increase number of save games",               1, sci2NumSavesSignature1,          sci2NumSavesPatch1 },
-	{  true, 64990, "increase number of save games",               1, sci2NumSavesSignature2,          sci2NumSavesPatch2 },
+	{  true, 64990, "increase number of save games (1/2)",         1, sci2NumSavesSignature1,          sci2NumSavesPatch1 },
+	{  true, 64990, "increase number of save games (2/2)",         1, sci2NumSavesSignature2,          sci2NumSavesPatch2 },
 	{  true, 64990, "disable change directory button",             1, sci2ChangeDirSignature,          sci2ChangeDirPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };


Commit: e400f1aec29ff0d4825c0aad75e56e22bfb56a2f
    https://github.com/scummvm/scummvm/commit/e400f1aec29ff0d4825c0aad75e56e22bfb56a2f
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:09-05:00

Commit Message:
SCI32: Clean-up pass on Torin script patches

* Convert selector literals to SIG_SELECTOR/PATCH_SELECTOR

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 4f3cdea..8a2800d 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -136,7 +136,7 @@ static const char *const selectorNameTable[] = {
 	"font",         // KQ7
 	"setScale",     // LSL6hires
 	"setScaler",    // LSL6hires
-	"readWord",     // LSL7, Phant1
+	"readWord",     // LSL7, Phant1, Torin
 	"flag",         // PQ4
 	"select",       // PQ4
 #endif
@@ -6277,14 +6277,14 @@ static const uint16 torinVolumeResetPatch1[] = {
 // Applies to at least: English CD
 static const uint16 torinVolumeResetSignature2[] = {
 	SIG_MAGICDWORD,
-	0x38, SIG_UINT16(0x20b), // pushi $020b
-	0x76,                    // push0
-	SIG_ADDTOOFFSET(6),      // advance file stream
-	0xa1, 0xe3,              // sag $e3 (music volume)
-	SIG_ADDTOOFFSET(10),     // advance file stream
-	0xa1, 0xe4,              // sag $e4 (sfx volume)
-	SIG_ADDTOOFFSET(10),     // advance file stream
-	0xa1, 0xe5,              // sag $e5 (speech volume)
+	0x38, SIG_SELECTOR16(readWord), // pushi $020b (readWord)
+	0x76,                           // push0
+	SIG_ADDTOOFFSET(6),             // advance file stream
+	0xa1, 0xe3,                     // sag $e3 (music volume)
+	SIG_ADDTOOFFSET(10),            // advance file stream
+	0xa1, 0xe4,                     // sag $e4 (sfx volume)
+	SIG_ADDTOOFFSET(10),            // advance file stream
+	0xa1, 0xe5,                     // sag $e5 (speech volume)
 	SIG_END
 };
 
@@ -6500,8 +6500,8 @@ static const uint16 torinPointSoft20700HeapPatch[] = {
 static const SciScriptPatcherEntry torinSignatures[] = {
 	{  true, 20600, "fix wrong boogle bag flag on fast-forward",   1, torinSeraglioBoogleFlagSignature,  torinSeraglioBoogleFlagPatch },
 	{  true, 20700, "fix bad heap in PointSoft release",           1, torinPointSoft20700HeapSignature,  torinPointSoft20700HeapPatch },
-	{  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, 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, torinLarry7NumSavesSignature,      torinLarry7NumSavesPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };


Commit: a9316560ab896fb7198b74f2ce8437177ddf0201
    https://github.com/scummvm/scummvm/commit/a9316560ab896fb7198b74f2ce8437177ddf0201
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-16T16:33:09-05:00

Commit Message:
SCI: Remove unused selector from script patcher selectors list

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 8a2800d..1de0342 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -99,7 +99,6 @@ static const char *const selectorNameTable[] = {
 	"localize",     // Freddy Pharkas
 	"put",          // Police Quest 1 VGA
 	"say",          // Quest For Glory 1 VGA
-	"contains",     // Quest For Glory 2
 	"solvePuzzle",  // Quest For Glory 3
 	"timesShownID", // Space Quest 1 VGA
 	"startText",    // King's Quest 6 CD / Laura Bow 2 CD for audio+text support
@@ -161,7 +160,6 @@ enum ScriptPatcherSelectors {
 	SELECTOR_localize,
 	SELECTOR_put,
 	SELECTOR_say,
-	SELECTOR_contains,
 	SELECTOR_solvePuzzle,
 	SELECTOR_timesShownID,
 	SELECTOR_startText,





More information about the Scummvm-git-logs mailing list