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

sluicebox 22204938+sluicebox at users.noreply.github.com
Sat Jun 27 21:58:05 UTC 2020


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

Summary:
675e070569 SCI: Script patch formatting
e2123c9022 SCI: Add KQ6 workaround for talking inventory


Commit: 675e070569cc2e66a851c62c5d6b53544d3049cf
    https://github.com/scummvm/scummvm/commit/675e070569cc2e66a851c62c5d6b53544d3049cf
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-06-27T14:34:30-07:00

Commit Message:
SCI: Script patch formatting

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 699aa28ace..a482d5b3ab 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -536,17 +536,17 @@ static const uint16 torinLarry7NumSavesPatch[] = {
 // Applies to: Most games that use Messager/Narrator
 // Responsible method: Narrator:say
 static const uint16 sciNarratorLockupSignature[] = {
-    0x67, SIG_ADDTOOFFSET(+1),          // pTos ticks
-    SIG_MAGICDWORD,
-    0x35, 0x3c,                         // ldi 3c
-    0x02,                               // add
-    0x36,                               // push
-    0x81, 0x58,                         // lag 58 [ game time ]
-    0x02,                               // add
-    0x65, SIG_ADDTOOFFSET(+1),          // aTop ticks [ ticks += 60 + game time ]
-    0x35, 0x01,                         // ldi 01 [ true ]
-    0x48,                               // ret
-    SIG_END
+	0x67, SIG_ADDTOOFFSET(+1),          // pTos ticks
+	SIG_MAGICDWORD,
+	0x35, 0x3c,                         // ldi 3c
+	0x02,                               // add
+	0x36,                               // push
+	0x81, 0x58,                         // lag 58 [ game time ]
+	0x02,                               // add
+	0x65, SIG_ADDTOOFFSET(+1),          // aTop ticks [ ticks += 60 + game time ]
+	0x35, 0x01,                         // ldi 01 [ true ]
+	0x48,                               // ret
+	SIG_END
 };
 
 static const uint16 sciNarratorLockupPatch[] = {
@@ -583,22 +583,22 @@ static const uint16 sciNarratorLockupLinePatch[] = {
 
 // ECO1 CD and SQ4 CD share an early Narrator:say variant
 static const uint16 ecoquest1Sq4CdNarratorLockupSignature[] = {
-    0x67, SIG_ADDTOOFFSET(+1),          // pTos ticks
-    SIG_MAGICDWORD,
-    0x35, 0x3c,                         // ldi 3c
-    0x02,                               // add
-    0x36,                               // push
-    0x81, 0x58,                         // lag 58 [ game time ]
-    0x02,                               // add
-    0x65, SIG_ADDTOOFFSET(+1),          // aTop ticks [ ticks += 60 + game time ]
-    0x63, SIG_ADDTOOFFSET(+1),          // pToa modeless
-    0x18,                               // not
-    0x31, SIG_ADDTOOFFSET(+1),          // bnt [ skip fastCast event handling ]
-    0x81, 0x54,                         // lag 54
-    0x31, SIG_ADDTOOFFSET(+1),          // bnt [ skip fastCast event handling ]
-    0x81, 0x54,                         // lag 54
-    0x31, SIG_ADDTOOFFSET(+1),          // bnt [ skip fastCast event handling ]
-    SIG_END
+	0x67, SIG_ADDTOOFFSET(+1),          // pTos ticks
+	SIG_MAGICDWORD,
+	0x35, 0x3c,                         // ldi 3c
+	0x02,                               // add
+	0x36,                               // push
+	0x81, 0x58,                         // lag 58 [ game time ]
+	0x02,                               // add
+	0x65, SIG_ADDTOOFFSET(+1),          // aTop ticks [ ticks += 60 + game time ]
+	0x63, SIG_ADDTOOFFSET(+1),          // pToa modeless
+	0x18,                               // not
+	0x31, SIG_ADDTOOFFSET(+1),          // bnt [ skip fastCast event handling ]
+	0x81, 0x54,                         // lag 54
+	0x31, SIG_ADDTOOFFSET(+1),          // bnt [ skip fastCast event handling ]
+	0x81, 0x54,                         // lag 54
+	0x31, SIG_ADDTOOFFSET(+1),          // bnt [ skip fastCast event handling ]
+	SIG_END
 };
 
 static const uint16 ecoquest1Sq4CdNarratorLockupPatch[] = {
@@ -1114,21 +1114,21 @@ static const uint16 ecoquest1PatchProphecyScroll[] = {
 // Responsible method: rm220:init
 // Fixes bug #10903
 static const uint16 ecoquest1SignatureEmptyApartmentMessages[] = {
-    SIG_MAGICDWORD,
-    0x54, 0x0c,                     // self 0c [ self setRegions: 51, addObstacle: ... ]
-    0x39, SIG_SELECTOR8(init),      // pushi init
-    0x76,                           // push0
-    0x59, 0x01,                     // &rest 01 [ unused by ApartmentRoom:init ]
-    0x57, 0x96, 0x04,               // super ApartmentRoom 04 [ super init: &rest ]
-    SIG_END
+	SIG_MAGICDWORD,
+	0x54, 0x0c,                     // self 0c [ self setRegions: 51, addObstacle: ... ]
+	0x39, SIG_SELECTOR8(init),      // pushi init
+	0x76,                           // push0
+	0x59, 0x01,                     // &rest 01 [ unused by ApartmentRoom:init ]
+	0x57, 0x96, 0x04,               // super ApartmentRoom 04 [ super init: &rest ]
+	SIG_END
 };
 
 static const uint16 ecoquest1PatchEmptyApartmentMessages[] = {
-    0x35, 0x01,                     // ldi 01 [ the room's noun ]
-    PATCH_ADDTOOFFSET(+3),
-    0xa1, 0xfa,                     // sag fa [ global250 = 1 ]
-    0x57, 0x96, 0x10,               // super ApartmentRoom 10 [ combine self and super ]
-    PATCH_END
+	0x35, 0x01,                     // ldi 01 [ the room's noun ]
+	PATCH_ADDTOOFFSET(+3),
+	0xa1, 0xfa,                     // sag fa [ global250 = 1 ]
+	0x57, 0x96, 0x10,               // super ApartmentRoom 10 [ combine self and super ]
+	PATCH_END
 };
 
 // The temple has a complex script bug in the CD version which can crash the
@@ -8877,7 +8877,7 @@ static const uint16 phant1CopyChaseFileSignature[] = {
 	0x85, 0x02,                     // lat 02
 	0x4a, SIG_UINT16(0x0004),       // send 04 [ temp2 data? ]
 	0x36,                           // push    [ "chase.dat" ]
-    0x43, 0x5d, SIG_UINT16(0x0006), // callk FileIO 06
+	0x43, 0x5d, SIG_UINT16(0x0006), // callk FileIO 06
 	SIG_END
 };
 


Commit: e2123c902296cc3f27e621002cf79a3bbc4b7d9a
    https://github.com/scummvm/scummvm/commit/e2123c902296cc3f27e621002cf79a3bbc4b7d9a
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-06-27T14:55:32-07:00

Commit Message:
SCI: Add KQ6 workaround for talking inventory

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


diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index a022944557..aae0d15eb9 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -95,6 +95,25 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
 			neededSleep = 60;
 		}
 		break;
+	case GID_KQ6: {
+		// KQ6 has talking inventory items that animate in the inventory window.
+		//  This is done with unthrottled inner loops which we replace with
+		//  calls to kGameIsRestarting so that the screen updates and responds
+		//  to input. Since this can happen in any room, we detect if the caller
+		//  is inventory script 907. See kq6PatchTalkingInventory.
+		if (s->_executionStack.size() >= 2) {
+			Common::List<ExecStack>::const_iterator iter = s->_executionStack.reverse_begin();
+			--iter; // skip this kernel call
+			if (iter->type == EXEC_STACK_TYPE_CALL) {
+				int callerScriptNumber = s->_segMan->getScript(iter->addr.pc.getSegment())->getScriptNumber();
+				if (callerScriptNumber == 907) {
+					s->_throttleTrigger = true;
+					neededSleep = 90; // talk animation interval
+				}
+			}
+		}
+		break;
+	}
 	case GID_LSL3:
 		// LSL3 calculates a machinespeed variable during game startup
 		// (right after the filthy questions). This one would go through w/o
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index a482d5b3ab..df39d82248 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -5017,6 +5017,35 @@ static const uint16 kq6PatchCassimaSecretPassage[] = {
 	PATCH_END
 };
 
+// WORKAROUND
+//
+// Dangling Participle and Rotten Tomato are inventory items that can talk, but
+//  their mouths are animated by inner loops that call kDrawCel with unthrottled
+//  inner inner loops that spin to create a delay between frames. This prevents
+//  updating the screen and responding to input. We replace the spin loops with
+//  calls to kGameIsRestarting, which detects and throttles these calls so that
+//  the speed is reasonable, the screen updates, and the game is responsive.
+//
+// Applies to: All versions
+// Responsible method: participle:doVerb, tomato:doVerb
+static const uint16 kq6SignatureTalkingInventory[] = {
+	0x35, 0x00,                         // ldi 00
+	0xa5, 0x01,                         // sat 01
+	0x8d, 0x01,                         // lst 01
+	SIG_MAGICDWORD,
+	0x34, SIG_UINT16(0x1b58),           // ldi 1b58
+	0x22,                               // lt? [ temp1 < 7000 ]
+	SIG_END
+};
+
+static const uint16 kq6PatchTalkingInventory[] = {
+	PATCH_ADDTOOFFSET(+2),
+	0x39, 0x00,                         // pushi 00
+	0x43, 0x2c, 0x00,                   // callk GameIsRestarting [ custom throttling ]
+	0x34, PATCH_UINT16(0x0000),         // ldi 0000 [ exit loop ]
+	PATCH_END
+};
+
 // Audio + subtitles support - SHARED! - used for King's Quest 6 and Laura Bow 2.
 //  This patch gets enabled when the user selects "both" in the ScummVM
 //  "Speech + Subtitles" menu. We currently use global[98d] to hold a kMemory
@@ -5468,6 +5497,7 @@ static const SciScriptPatcherEntry kq6Signatures[] = {
 	{  true,   800, "fix Cassima secret passage peephole",            1, kq6SignatureCassimaSecretPassage,         kq6PatchCassimaSecretPassage },
 	{  true,   907, "fix inventory stack leak",                       1, kq6SignatureInventoryStackFix,            kq6PatchInventoryStackFix },
 	{  true,   907, "fix hair detection for ribbon's look msg",       1, kq6SignatureLookRibbonFix,                kq6PatchLookRibbonFix },
+	{  true,   907, "talking inventory workaround",                   4, kq6SignatureTalkingInventory,             kq6PatchTalkingInventory },
 	{  true,   924, "CD/Mac: fix truncated messages",                 1, kq6SignatureTruncatedMessagesFix,         kq6PatchTruncatedMessagesFix },
 	{  true,   928, "Narrator lockup fix",                            1, sciNarratorLockupSignature,               sciNarratorLockupPatch },
 	// King's Quest 6 and Laura Bow 2 share basic patches for audio + text support




More information about the Scummvm-git-logs mailing list