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

sluicebox 22204938+sluicebox at users.noreply.github.com
Sun Jan 31 21:00:24 UTC 2021


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

Summary:
40fbf7be48 SCI: Process ScummVM Quit events during kMenuSelect
7095ed66c5 SCI: Fix KQ4 missing waterfall view
518226146d SCI: Fix kGetTime 12-hour formatting
f033ffca9d SCI: Fix KQ6 time-of-day lettuce bug


Commit: 40fbf7be480494f81a8b78e7ce7634ea51ad276b
    https://github.com/scummvm/scummvm/commit/40fbf7be480494f81a8b78e7ce7634ea51ad276b
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-01-31T12:43:16-08:00

Commit Message:
SCI: Process ScummVM Quit events during kMenuSelect

Fixes engine not being able to quit while the SCI menu bar
has keyboard focus.

Changed paths:
    engines/sci/graphics/menu.cpp


diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp
index 4433cd2b2c..4503145db7 100644
--- a/engines/sci/graphics/menu.cpp
+++ b/engines/sci/graphics/menu.cpp
@@ -934,6 +934,9 @@ GuiMenuItemEntry *GfxMenu::interactiveWithKeyboard() {
 			g_sci->sleep(2500 / 1000);
 			break;
 
+		case kSciEventQuit:
+			return NULL;
+
 		default:
 			break;
 		}


Commit: 7095ed66c5ec40ef5969902cd93c7f6c63d49059
    https://github.com/scummvm/scummvm/commit/7095ed66c5ec40ef5969902cd93c7f6c63d49059
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-01-31T12:43:16-08:00

Commit Message:
SCI: Fix KQ4 missing waterfall view

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 a422f770e5..c3c9f70aae 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -4543,8 +4543,40 @@ static const uint16 kq4PatchFallDownStairs[] = {
 	PATCH_END
 };
 
+// KQ4 1.003.006 is missing view 653 and crashes room 24 outside the waterfall.
+//  In the original this only occurred at high CPU speeds. View 653 animates the
+//  river's current, which was first added in this version, but it's only loaded
+//  when the game's speed test detects a fast machine. Sierra later released a
+//  KQ4FIX patch with the missing view and included it in subsequent versions.
+//  We fix this by not initializing view 653 when it's not present.
+//
+// Applies to: PC and Atari ST 1.003.006
+// Responsible method: Room24:init
+static const uint16 kq4SignatureMissingWaterfallView[] = {
+	0x39, SIG_SELECTOR8(new),       // pushi new
+	0x76,                           // push0
+	0x51, SIG_ADDTOOFFSET(+1),      // class Prop
+	0x4a, 0x04,                     // send 04 [ Prop new: ]
+	0xa3, 0x0c,                     // sal 0c  [ local12 = new Prop ]
+	SIG_ADDTOOFFSET(+14),
+	0x39, SIG_SELECTOR8(view),      // pushi view
+	SIG_MAGICDWORD,
+	0x78,                           // push1
+	0x38, SIG_UINT16(0x028d),       // pusi 028d
+	SIG_ADDTOOFFSET(+83),
+	0x83, 0x0d,                     // lal 0d
+	0x4a, 0x34,                     // send 34 [ local13 ... view: 653 ... ]
+	SIG_END
+};
+
+static const uint16 kq4PatchMissingWaterfallView[] = {
+	0x33, 0x72,                     // jmp 72 [ skip missing view (local12 and local13) ]
+	PATCH_END
+};
+
 //          script, description,                                      signature                                 patch
 static const SciScriptPatcherEntry kq4Signatures[] = {
+	{ false,    24, "missing waterfall view",                      1, kq4SignatureMissingWaterfallView,         kq4PatchMissingWaterfallView },
 	{  true,    90, "fall down stairs",                            1, kq4SignatureFallDownStairs,               kq4PatchFallDownStairs },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };
@@ -20763,6 +20795,11 @@ void ScriptPatcher::processScript(uint16 scriptNr, SciSpan<byte> scriptData) {
 					enablePatch(signatureTable, "subtitle patch compatibility");
 				}
 				break;
+			case GID_KQ4:
+				if (!g_sci->getResMan()->testResource(ResourceId(kResourceTypeView, 653))) {
+					enablePatch(signatureTable, "missing waterfall view");
+				}
+				break;
 			case GID_KQ5:
 				if (g_sci->_features->useAltWinGMSound()) {
 					// See the explanation in the kq5SignatureWinGMSignals comment


Commit: 518226146d556bf6d4768cc540954bd17b6dea89
    https://github.com/scummvm/scummvm/commit/518226146d556bf6d4768cc540954bd17b6dea89
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-01-31T12:43:16-08:00

Commit Message:
SCI: Fix kGetTime 12-hour formatting

SSCI sets hours 0 and 12 to 12, not 0.
Fixes clock display in Hoyle4 and Hoyle5.

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


diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 53735241b4..6868041b1b 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -260,7 +260,11 @@ reg_t kGetTime(EngineState *s, int argc, reg_t *argv) {
 		debugC(kDebugLevelTime, "GetTime(elapsed) returns %d", retval);
 		break;
 	case KGETTIME_TIME_12HOUR :
-		retval = ((loc_time.tm_hour % 12) << 12) | (loc_time.tm_min << 6) | (loc_time.tm_sec);
+		loc_time.tm_hour %= 12;
+		if (loc_time.tm_hour == 0) {
+			loc_time.tm_hour = 12;
+		}
+		retval = (loc_time.tm_hour << 12) | (loc_time.tm_min << 6) | (loc_time.tm_sec);
 		debugC(kDebugLevelTime, "GetTime(12h) returns %d", retval);
 		break;
 	case KGETTIME_TIME_24HOUR :


Commit: f033ffca9dc11900358e31d8fa7e3bd77fc820a4
    https://github.com/scummvm/scummvm/commit/f033ffca9dc11900358e31d8fa7e3bd77fc820a4
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-01-31T12:43:17-08:00

Commit Message:
SCI: Fix KQ6 time-of-day lettuce bug

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 c3c9f70aae..f9bd15db24 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -126,6 +126,7 @@ static const char *const selectorNameTable[] = {
 	"givePoints",   // King's Quest 6
 	"has",          // King's Quest 6, GK1
 	"modeless",     // King's Quest 6 CD
+	"message",      // King's Quest 6
 	"cycler",       // Space Quest 4 / system selector
 	"setCel",       // Space Quest 4, Phant2, GK1
 	"addToPic",     // Space Quest 4
@@ -249,6 +250,7 @@ enum ScriptPatcherSelectors {
 	SELECTOR_givePoints,
 	SELECTOR_has,
 	SELECTOR_modeless,
+	SELECTOR_message,
 	SELECTOR_cycler,
 	SELECTOR_setCel,
 	SELECTOR_addToPic,
@@ -5108,6 +5110,71 @@ static const uint16 kq6CDPatchWallFlowerDanceFix[] = {
 	PATCH_END
 };
 
+// Attempting to pick a second head of frozen lettuce accidentally succeeds or
+//  fails depending on the time of day in real life.
+//
+// Upon picking the lettuce it starts to melt. After 150 seconds it's half
+//  melted, after 300 seconds it's a puddle, and after 450 seconds it disappears
+//  from inventory. When trying to pick a second head while one is inventory,
+//  lettuce:doVerb attempts to figure out if the lettuce is melted enough to
+//  replace or if it should say that Alexander already has frozen lettuce.
+//  The script's logic is:
+//
+//    if (kGetTime(1) - global157) < 150 then don't replace lettuce
+//
+// The first problem is that this code is outdated. Global 157 is never set, but
+//  presumably it was the original timer implementation before lettuceTimer.
+//  This code is supposed to test an elapsed time period, but since global 157
+//  is always zero, instead it's an accidental test of the current clock time.
+//  The second problem is that this is a signed comparison and kGetTime(1) is
+//  unsigned with the hour as the upper four bits. When the current clock time
+//  is between 8:00 and 12:59 (am or pm) then kGetTime(1) appears negative and
+//  the lettuce can never be replaced. During the other 14 hours of the day the
+//  lettuce can always be replaced, even if it's frozen.
+//
+// We fix this by replacing the time test with the correct frozen lettuce test.
+//
+// Applies to: All versions
+// Responsible method: lettuce:doVerb
+static const uint16 kq6SignatureSecondLettuceFix[] = {
+	0x31, 0x12,                         // bnt 12 [ skip message if clock hour < 8 (unintentional) ]
+	0x38, SIG_SELECTOR16(say),          // pushi say
+	SIG_ADDTOOFFSET(+15),
+	0x78,                               // push1
+	0x78,                               // push1
+	0x43, 0x42, 0x02,                   // callk GetTime 02
+	0x36,                               // push
+	0x81, 0x9d,                         // lag 9d [ always zero ]
+	0x04,                               // sub
+	0x36,                               // push
+	SIG_MAGICDWORD,
+	0x34, SIG_UINT16(0x012c),           // ldi 012c
+	0x22,                               // lt? [ (kGetTime(1) - global157) < 300 ]
+	0x31, 0x0a,                         // bnt 0a [ pick lettuce ]
+	0x78,                               // push1
+	0x7c,                               // pushSelf
+	0x46, SIG_UINT16(0x01e3),           // calle 01e3 ... [ pick lettuce ]
+	SIG_END
+};
+
+static const uint16 kq6PatchSecondLettuceFix[] = {
+	0x33, 0x12,                         // jmp 12 [ skip to correct lettuce logic ]
+	PATCH_ADDTOOFFSET(+18),
+	0x39, PATCH_SELECTOR8(at),          // pushi at
+	0x78,                               // push1
+	0x39, 0x15,                         // pushi 15
+	0x81, 0x09,                         // lag 09
+	0x4a, 0x06,                         // send 06 [ KqInv at: 21 ]
+	0x39, PATCH_SELECTOR8(message),     // pushi message
+	0x76,                               // push0
+	0x4a, 0x04,                         // send 04  [ lettuce message? ]
+	0x39, 0x34,                         // pushi 34 [ frozen ]
+	0x1a,                               // eq?      [ is lettuce frozen? ]
+	0x2f, 0xdb,                         // bt db    [ "Alexander already has a frozen head of lettuce." ]
+	0x33, 0x05,                         // jmp 05   [ pick lettuce ]
+	PATCH_END
+};
+
 // In room 300 at the bottom of the logic cliffs, clicking Walk while Alexander
 //  randomly wobbles on lower steps causes him to float around the room. Scripts
 //  attempt to prevent this by ignoring Walk when ego:view is 301 and ego:loop
@@ -6080,6 +6147,7 @@ static const SciScriptPatcherEntry kq6Signatures[] = {
 	{  true,   406, "fix catacombs dark room inventory",              1, kq6SignatureDarkRoomInventory,            kq6PatchDarkRoomInventory },
 	{  true,   407, "fix catacombs room message",                     1, kq6SignatureRoom407LookMessage,           kq6PatchRoom407LookMessage },
 	{  true,   480, "CD: fix wallflower dance",                       1, kq6CDSignatureWallFlowerDanceFix,         kq6CDPatchWallFlowerDanceFix },
+	{  true,   480, "fix picking second lettuce",                     1, kq6SignatureSecondLettuceFix,             kq6PatchSecondLettuceFix },
 	{  true,   480, "fix getting baby tears",                         1, kq6SignatureGetBabyTears,                 kq6PatchGetBabyTears },
 	{  true,   481, "fix duplicate baby cry",                         1, kq6SignatureDuplicateBabyCry,             kq6PatchDuplicateBabyCry },
 	{  true,   481, "fix duplicate baby tears point",                 1, kq6SignatureDuplicateBabyTearsPoint,      kq6PatchDuplicateBabyTearsPoint },




More information about the Scummvm-git-logs mailing list