[Scummvm-git-logs] scummvm master -> 9641a3608b17d7d19c4ea0956a41efea6e56ce34

sluicebox noreply at scummvm.org
Sat Dec 3 00:12:01 UTC 2022


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

Summary:
2d73220c13 SCI: Add media type to resource patch definitions
4d6c2f474e SCI: Fix LB2 CD museum actors facing wrong direction
b9df07b465 SCI: Fix LB2 Act 5 mummy coffin lockup
1c64c0c4c4 SCI: Fix LB2 CD mummy coffin animation glitch
60f04d4e7c SCI: Fix LB2 Act 5 timer crash
9641a3608b SCI Fix LB2 Act 5 trigger


Commit: 2d73220c136d103aa9837c2469b6a13f3055fca4
    https://github.com/scummvm/scummvm/commit/2d73220c136d103aa9837c2469b6a13f3055fca4
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-12-02T16:11:32-08:00

Commit Message:
SCI: Add media type to resource patch definitions

Changed paths:
    engines/sci/engine/workarounds.h
    engines/sci/resource/resource.cpp
    engines/sci/resource/resource_patcher.cpp
    engines/sci/resource/resource_patcher.h


diff --git a/engines/sci/engine/workarounds.h b/engines/sci/engine/workarounds.h
index 2fff741fe46..8951d2c15a8 100644
--- a/engines/sci/engine/workarounds.h
+++ b/engines/sci/engine/workarounds.h
@@ -121,7 +121,7 @@ enum SciMessageWorkaroundType {
 	MSG_WORKAROUND_EXTRACT      // use text from a different record, optionally a substring
 };
 
-enum SciMedia {
+enum SciMedia : uint {
 	SCI_MEDIA_ALL,
 	SCI_MEDIA_FLOPPY,
 	SCI_MEDIA_CD,
diff --git a/engines/sci/resource/resource.cpp b/engines/sci/resource/resource.cpp
index 04ddea1f9e4..d48206a4e4e 100644
--- a/engines/sci/resource/resource.cpp
+++ b/engines/sci/resource/resource.cpp
@@ -1017,7 +1017,7 @@ void ResourceManager::init() {
 	_currentDiscNo = 1;
 #endif
 	if (g_sci) {
-		_patcher = new ResourcePatcher(g_sci->getGameId(), g_sci->getLanguage());
+		_patcher = new ResourcePatcher(g_sci->getGameId(), g_sci->isCD(), g_sci->getPlatform(), g_sci->getLanguage());
 		addSource(_patcher);
 	} else {
 		_patcher = nullptr;
diff --git a/engines/sci/resource/resource_patcher.cpp b/engines/sci/resource/resource_patcher.cpp
index 3b4461df9c7..872c23781c9 100644
--- a/engines/sci/resource/resource_patcher.cpp
+++ b/engines/sci/resource/resource_patcher.cpp
@@ -22,6 +22,7 @@
 #include "common/scummsys.h"
 #include "common/textconsole.h"
 #include "sci/sci.h"
+#include "sci/engine/workarounds.h" // for SciMedia
 #include "sci/resource/resource.h"
 #include "sci/resource/resource_patcher.h"
 
@@ -487,25 +488,29 @@ static const byte torinPassageRussianPic61101[] = {
 #pragma mark Patch table
 
 static const GameResourcePatch resourcePatches[] = {
-	{ GID_LSL1,           Common::RU_RUS,   kResourceTypeSound,     205, lsl1RussianSound205,        false },
-	{ GID_LSL2,           Common::PL_POL,   kResourceTypeFont,        1, lsl2Lsl3PolishFont,         false },
-	{ GID_LSL2,           Common::PL_POL,   kResourceTypeFont,        7, lsl2Lsl3PolishFont,         false },
-	{ GID_LSL3,           Common::PL_POL,   kResourceTypeFont,        1, lsl2Lsl3PolishFont,         false },
-	{ GID_LSL3,           Common::PL_POL,   kResourceTypeFont,        9, lsl2Lsl3PolishFont,         false },
-	{ GID_PHANTASMAGORIA, Common::UNK_LANG, kResourceTypeView,    64001, phant1View64001Palette,     false },
-	{ GID_PQ4,            Common::EN_ANY,   kResourceTypeView,    10988, pq4EnhancedAudioToggleView, true  },
-	{ GID_QFG1VGA,        Common::UNK_LANG, kResourceTypePalette,   904, qfg1vgaPalette904,          false },
-	{ GID_TORIN,          Common::RU_RUS,   kResourceTypePic,     61101, torinPassageRussianPic61101,false }
+	{ GID_LSL1,           SCI_MEDIA_ALL,    Common::RU_RUS,   kResourceTypeSound,     205, lsl1RussianSound205,        false },
+	{ GID_LSL2,           SCI_MEDIA_ALL,    Common::PL_POL,   kResourceTypeFont,        1, lsl2Lsl3PolishFont,         false },
+	{ GID_LSL2,           SCI_MEDIA_ALL,    Common::PL_POL,   kResourceTypeFont,        7, lsl2Lsl3PolishFont,         false },
+	{ GID_LSL3,           SCI_MEDIA_ALL,    Common::PL_POL,   kResourceTypeFont,        1, lsl2Lsl3PolishFont,         false },
+	{ GID_LSL3,           SCI_MEDIA_ALL,    Common::PL_POL,   kResourceTypeFont,        9, lsl2Lsl3PolishFont,         false },
+	{ GID_PHANTASMAGORIA, SCI_MEDIA_ALL,    Common::UNK_LANG, kResourceTypeView,    64001, phant1View64001Palette,     false },
+	{ GID_PQ4,            SCI_MEDIA_CD,     Common::EN_ANY,   kResourceTypeView,    10988, pq4EnhancedAudioToggleView, true  },
+	{ GID_QFG1VGA,        SCI_MEDIA_ALL,    Common::UNK_LANG, kResourceTypePalette,   904, qfg1vgaPalette904,          false },
+	{ GID_TORIN,          SCI_MEDIA_ALL,    Common::RU_RUS,   kResourceTypePic,     61101, torinPassageRussianPic61101,false }
 };
 
 #pragma mark -
 #pragma mark ResourcePatcher
 
-ResourcePatcher::ResourcePatcher(const SciGameId gameId, const Common::Language gameLanguage) :
+ResourcePatcher::ResourcePatcher(const SciGameId gameId, const bool isCD, const Common::Platform platform, const Common::Language gameLanguage) :
 	ResourceSource(kSourceScummVM, "-scummvm-") {
 	for (int i = 0; i < ARRAYSIZE(resourcePatches); ++i) {
 		const GameResourcePatch &patch = resourcePatches[i];
 		if (patch.gameId == gameId &&
+			(patch.media == SCI_MEDIA_ALL ||
+			(patch.media == SCI_MEDIA_FLOPPY && !isCD) ||
+			(patch.media == SCI_MEDIA_CD && isCD) ||
+			(patch.media == SCI_MEDIA_MAC && platform == Common::kPlatformMacintosh && !isCD)) &&
 			(patch.gameLanguage == Common::UNK_LANG || patch.gameLanguage == gameLanguage)) {
 			_patches.push_back(patch);
 		}
diff --git a/engines/sci/resource/resource_patcher.h b/engines/sci/resource/resource_patcher.h
index dd306400763..83f2e266d7a 100644
--- a/engines/sci/resource/resource_patcher.h
+++ b/engines/sci/resource/resource_patcher.h
@@ -43,12 +43,19 @@ enum ResourcePatchOp {
 	kEndOfPatch
 };
 
+enum SciMedia : uint;
+
 struct GameResourcePatch {
 	/**
 	 * The game to patch.
 	 */
 	SciGameId gameId;
 
+	/**
+	 * The media to patch. Use SCI_MEDIA_ALL for all.
+	 */
+	SciMedia media;
+
 	/**
 	 * The language to patch. Use `Common::UNK_LANG` to apply the patch to all
 	 * languages.
@@ -82,7 +89,7 @@ struct GameResourcePatch {
  */
 class ResourcePatcher : public ResourceSource {
 public:
-	ResourcePatcher(const SciGameId gameId, const Common::Language gameLanguage);
+	ResourcePatcher(const SciGameId gameId, const bool isCD, const Common::Platform platform, const Common::Language gameLanguage);
 
 	~ResourcePatcher() override {}
 


Commit: 4d6c2f474eeffde6ded9383780b6920c2505b44f
    https://github.com/scummvm/scummvm/commit/4d6c2f474eeffde6ded9383780b6920c2505b44f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-12-02T16:11:32-08:00

Commit Message:
SCI: Fix LB2 CD museum actors facing wrong direction

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


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index c3d3e0fbb91..05c7d402997 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -9724,6 +9724,7 @@ static const uint16 laurabow2CDPatchFixYvetteTutResponse[] = {
 // We fix this by setting the correct loop in the CD version so that Wolf and
 //  O'Riley face the direction the scripts request like in the floppy versions.
 //  This patch is only enabled in the CD version since the scripts don't change.
+//  See also: resource patch lauraBow2CdView828
 //
 // Applies to: English CD
 // Responsible methods: sPartysOver:changeState, rm400:init, sHeimlichShoos:changeState
diff --git a/engines/sci/resource/resource_patcher.cpp b/engines/sci/resource/resource_patcher.cpp
index 872c23781c9..213f13af823 100644
--- a/engines/sci/resource/resource_patcher.cpp
+++ b/engines/sci/resource/resource_patcher.cpp
@@ -93,6 +93,28 @@ namespace Sci {
  */
 #define END kEndOfPatch
 
+#pragma mark -
+#pragma mark Laura Bow 2
+
+// LB2CD removed diagonal walking loops from the views of actors in the museum,
+//  but Sierra forgot to do this to the transparent placeholder view used when
+//  actors are in a different room. It remains 9 loops instead of 5 like the
+//  rest. The standing loop at the end is in position 8 instead of 4.
+//  This causes StopWalk to query the loop count when an actor is off screen
+//  and set their loop to an invalid index for their real view, causing all
+//  standing actors to appear to face north west instead of their real heading.
+//  Patching out diagonal loops 4-7 and using loop 8 as loop 4 fixes this.
+//  See also: script patch laurabow2CDPatchFixMuseumActorLoops
+static const byte lauraBow2CdView828[] = {
+	SKIP(0x02),
+	REPLACE(1, 0x05), // view header: 5 loops instead of 9
+	SKIP(0x51),
+	REPLACE(1, 0x08), // loop 4: 8 cels instead of 1
+	SKIP(0x09),
+	REPLACE_NUMBER(uint32, 0x01c2), // loop 4: offset to loop 8 cel data
+	END
+};
+
 #pragma mark -
 #pragma mark Leisure Suit Larry 1
 
@@ -488,6 +510,7 @@ static const byte torinPassageRussianPic61101[] = {
 #pragma mark Patch table
 
 static const GameResourcePatch resourcePatches[] = {
+	{ GID_LAURABOW2,      SCI_MEDIA_CD,     Common::UNK_LANG, kResourceTypeView,      828, lauraBow2CdView828,         false },
 	{ GID_LSL1,           SCI_MEDIA_ALL,    Common::RU_RUS,   kResourceTypeSound,     205, lsl1RussianSound205,        false },
 	{ GID_LSL2,           SCI_MEDIA_ALL,    Common::PL_POL,   kResourceTypeFont,        1, lsl2Lsl3PolishFont,         false },
 	{ GID_LSL2,           SCI_MEDIA_ALL,    Common::PL_POL,   kResourceTypeFont,        7, lsl2Lsl3PolishFont,         false },


Commit: b9df07b465f305f20f23662188a021cfaf324d8f
    https://github.com/scummvm/scummvm/commit/b9df07b465f305f20f23662188a021cfaf324d8f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-12-02T16:11:33-08:00

Commit Message:
SCI: Fix LB2 Act 5 mummy coffin lockup

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 05c7d402997..a61d08b1608 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -9977,6 +9977,54 @@ static const uint16 laurabow2PatchFixDaggerCaseError[] = {
 	PATCH_END
 };
 
+// During the act 5 chase, the game locks up if the player clicks on the open
+//  lid of the mummy coffin in room 454. The coffin can be left open from an
+//  earlier act. Clicking on the coffin works, but the lid has a different
+//  handler that evaluates conditions in the wrong order. If the lid is open
+//  then lid2:doVerb runs the script for earlier acts, sHandleTheCase, and that
+//  script doesn't call LB2:handsOn to enable input in act 5.
+//
+// We fix this by patching lid2:doVerb to evaluate act 5 conditions first. If
+//  those don't apply, then sHandleTheCase is called with its register set to
+//  open or close the coffin based on the lid state in global 115. Clicking on
+//  the lid now behaves like the rest of the coffin in act 5. This patch is in
+//  two parts to handle different instruction sizes in different versions.
+//
+// Applies to: All versions
+// Responsible method: lid2:doVerb
+static const uint16 laurabow2SignatureMummyCoffinLid1[] = {
+	SIG_MAGICDWORD,
+	0x81, 0x73,                         // lag 73 [ 0 if lid is closed, 1 if open ]
+	0x31, 0x12,                         // bnt 12 [ skip closing the lid ]
+	SIG_END
+};
+
+static const uint16 laurabow2PatchMummyCoffinLid1[] = {
+	0x35, 0x00,                         // ldi 00 [ disable the first lid condition ]
+	PATCH_END
+};
+
+static const uint16 laurabow2SignatureMummyCoffinLid2[] = {
+	0x38, SIG_ADDTOOFFSET(+2),          // pushi setScript
+	0x39, 0x03,                         // pushi 03
+	0x72, SIG_ADDTOOFFSET(+2),          // lofsa sHandleTheCase
+	0x36,                               // push
+	SIG_MAGICDWORD,
+	0x76,                               // push0
+	0x78,                               // push1 [ register = true (lid is closed) ]
+	0x81, 0x02,                         // lag 02
+	0x4a, 0x0a,                         // send 0a [ rm454 setScript: sHandleTheCase 0 1 ]
+	SIG_END
+};
+
+static const uint16 laurabow2PatchMummyCoffinLid2[] = {
+	PATCH_ADDTOOFFSET(+5),
+	0x74, PATCH_ADDTOOFFSET(+2),        // lofss sHandleTheCase
+	0x76,                               // push0
+	0xe9, 0x73,                         // -sg 73 [ register = false if open, true if closed ]
+	PATCH_END
+};
+
 // The crate room (room 460) in act 5 locks up the game if you enter from the
 //  elevator (room 660), swing the hanging crate, and then attempt to leave
 //  back through the elevator door.
@@ -10610,6 +10658,8 @@ static const SciScriptPatcherEntry laurabow2Signatures[] = {
 	{ false,   400, "CD: fix museum actor loops",                     4, laurabow2CDSignatureFixMuseumActorLoops1,       laurabow2CDPatchFixMuseumActorLoops1 },
 	{ false,   420, "CD: fix museum actor loops",                     1, laurabow2CDSignatureFixMuseumActorLoops1,       laurabow2CDPatchFixMuseumActorLoops1 },
 	{  true,   450, "Floppy: fix dagger case error",                  2, laurabow2SignatureFixDaggerCaseError,           laurabow2PatchFixDaggerCaseError },
+	{  true,   454, "CD/Floppy: fix coffin lockup 1/2",               1, laurabow2SignatureMummyCoffinLid1,              laurabow2PatchMummyCoffinLid1 },
+	{  true,   454, "CD/Floppy: fix coffin lockup 2/2",               1, laurabow2SignatureMummyCoffinLid2,              laurabow2PatchMummyCoffinLid2 },
 	{  true,   460, "CD/Floppy: fix crate room east door lockup",     1, laurabow2SignatureFixCrateRoomEastDoorLockup,   laurabow2PatchFixCrateRoomEastDoorLockup },
 	{ false,   500, "CD: fix museum actor loops",                     3, laurabow2CDSignatureFixMuseumActorLoops1,       laurabow2CDPatchFixMuseumActorLoops1 },
 	{  true,  2660, "CD/Floppy: fix elevator lockup",                 1, laurabow2SignatureFixElevatorLockup,            laurabow2PatchFixElevatorLockup },


Commit: 1c64c0c4c4260e126d5c224a29bf3e217779b0a5
    https://github.com/scummvm/scummvm/commit/1c64c0c4c4260e126d5c224a29bf3e217779b0a5
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-12-02T16:11:33-08:00

Commit Message:
SCI: Fix LB2 CD mummy coffin animation glitch

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 a61d08b1608..439f3767e0f 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -10025,6 +10025,42 @@ static const uint16 laurabow2PatchMummyCoffinLid2[] = {
 	PATCH_END
 };
 
+// When closing the lid of the empty mummy coffin in room 454, the animation
+//  glitches and shows the coffin closed before showing Laura re-close it.
+//  This only occurs in the CD version, but it's a script bug in all versions.
+//
+// sHandleTheCase attempts to run the coffin animation in reverse by setting
+//  ego:cel to the last cel of view 454 loop 3, but it calls ego:lastCel before
+//  setting the view, so instead it queries ego's normal view and sets the new
+//  cel to 7. In the floppy version the coffin loop has 11 cels and this mistake
+//  isn't noticeable, but the CD version changed the view to only have 3 cels,
+//  making 7 an invalid cel number. The Cycler script resets invalid cels to 0
+//  before jumping to the final cel and animating normally.
+//
+// We fix this by patching the CD version to use the correct last cel value.
+//
+// Applies to: English PC-CD
+// Responsible method: sHandleTheCase:changeState(0)
+static const uint16 laurabow2CDSignatureMummyCoffinClosingCel[] = {
+	0x63, 0x24,                         // pToa register
+	0x31, 0x04,                         // bnt 04
+	0x35, 0x00,                         // ldi 00
+	0x33, 0x08,                         // jmp 08
+	SIG_MAGICDWORD,
+	0x38, SIG_UINT16(0x0100),           // pushi lastCel [ CD selector ]
+	0x76,                               // push0
+	0x81, 0x00,                         // lag 00
+	0x4a, 0x04,                         // send 04 [ ego lastCel: ]
+	SIG_END
+};
+
+static const uint16 laurabow2CDPatchMummyCoffinClosingCel[] = {
+	PATCH_ADDTOOFFSET(+8),
+	0x35, 0x02,                         // ldi 02 [ last cel of view 454 loop 3 ]
+	0x33, 0x04,                         // jmp 04
+	PATCH_END
+};
+
 // The crate room (room 460) in act 5 locks up the game if you enter from the
 //  elevator (room 660), swing the hanging crate, and then attempt to leave
 //  back through the elevator door.
@@ -10660,6 +10696,7 @@ static const SciScriptPatcherEntry laurabow2Signatures[] = {
 	{  true,   450, "Floppy: fix dagger case error",                  2, laurabow2SignatureFixDaggerCaseError,           laurabow2PatchFixDaggerCaseError },
 	{  true,   454, "CD/Floppy: fix coffin lockup 1/2",               1, laurabow2SignatureMummyCoffinLid1,              laurabow2PatchMummyCoffinLid1 },
 	{  true,   454, "CD/Floppy: fix coffin lockup 2/2",               1, laurabow2SignatureMummyCoffinLid2,              laurabow2PatchMummyCoffinLid2 },
+	{  true,   454, "CD: fix coffin closing cel",                     1, laurabow2CDSignatureMummyCoffinClosingCel,      laurabow2CDPatchMummyCoffinClosingCel },
 	{  true,   460, "CD/Floppy: fix crate room east door lockup",     1, laurabow2SignatureFixCrateRoomEastDoorLockup,   laurabow2PatchFixCrateRoomEastDoorLockup },
 	{ false,   500, "CD: fix museum actor loops",                     3, laurabow2CDSignatureFixMuseumActorLoops1,       laurabow2CDPatchFixMuseumActorLoops1 },
 	{  true,  2660, "CD/Floppy: fix elevator lockup",                 1, laurabow2SignatureFixElevatorLockup,            laurabow2PatchFixElevatorLockup },


Commit: 60f04d4e7cadd57053871424419fb124b259435b
    https://github.com/scummvm/scummvm/commit/60f04d4e7cadd57053871424419fb124b259435b
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-12-02T16:11:34-08:00

Commit Message:
SCI: Fix LB2 Act 5 timer crash

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 439f3767e0f..cc97affb3ab 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -10310,6 +10310,41 @@ static const uint16 laurabow2PatchHandleArmorRoomEvents[] = {
 	PATCH_END
 };
 
+// During the act 5 chase, a script bug can cause infinite recursion and crash
+//  the armor hall with a stack overflow. Room 448 cues the global pursuitTimer
+//  to run the sHeKills script if the player returns without first hiding in the
+//  in the mummy coffin, but it doesn't stop the timer. If pursuitTimer expires
+//  during sHeKills then rm448:notify schedules sHeKills to run next, even if
+//  it's already the current room script. Setting a script's `next` property to
+//  itself causes Script:dispose to infinitely recurse when changing rooms, and
+//  sHeKills ends in room 99.
+//
+// We fix this by adding a test to rm448:notify to detect if sHeKills is already
+//  the current room script and ignore the notification.
+static const uint16 laurabow2SignatureAct5TimerCrash[] = {
+	0x31, 0x29,                         // bnt 29 [ ret ]
+	0x38, SIG_ADDTOOFFSET(+2),          // pushi script
+	0x76,                               // push0
+	0x81, 0x02,                         // lag 02
+	0x4a, 0x04,                         // send 04 [ rm448 script? ]
+	SIG_MAGICDWORD,
+	0x31, 0x13,                         // bnt 13
+	0x39, 0x41,                         // pushi next
+	0x78,                               // pushi1
+	0x72,                               // lofsa sHeKills
+	SIG_END
+};
+
+static const uint16 laurabow2PatchAct5TimerCrash[] = {
+	PATCH_ADDTOOFFSET(+2),
+	0x63, 0x12,                         // pToa script
+	0x31, 0x19,                         // bnt 19
+	0x74, PATCH_GETORIGINALUINT16(16),  // lofss sHeKills
+	0x1a,                               // eq?   [ script == sHeKills]
+	0x2f, 0x1f,                         // bt 1f [ ret ]
+	PATCH_END
+};
+
 // The "bugs with meat" in the basement hallway (room 600) can lockup the game
 //  if they appear while ego is leaving the room through one of the doors.
 //
@@ -10705,6 +10740,7 @@ static const SciScriptPatcherEntry laurabow2Signatures[] = {
 	{  true,    26, "Floppy: fix act 4 initialization",               1, laurabow2SignatureFixAct4Initialization,        laurabow2PatchFixAct4Initialization },
 	{  true,   440, "CD/Floppy: handle armor room events",            1, laurabow2SignatureHandleArmorRoomEvents,        laurabow2PatchHandleArmorRoomEvents },
 	{  true,   448, "CD/Floppy: handle armor hall room events",       1, laurabow2SignatureHandleArmorRoomEvents,        laurabow2PatchHandleArmorRoomEvents },
+	{  true,   448, "CD/Floppy: act 5 timer crash",                   1, laurabow2SignatureAct5TimerCrash,               laurabow2PatchAct5TimerCrash },
 	{  true,   600, "Floppy: fix bugs with meat",                     1, laurabow2FloppySignatureFixBugsWithMeat,        laurabow2FloppyPatchFixBugsWithMeat },
 	{  true,   600, "CD: fix bugs with meat",                         1, laurabow2CDSignatureFixBugsWithMeat,            laurabow2CDPatchFixBugsWithMeat },
 	{ false,   650, "CD: fix museum actor loops",                     1, laurabow2CDSignatureFixMuseumActorLoops2,       laurabow2CDPatchFixMuseumActorLoops2 },


Commit: 9641a3608b17d7d19c4ea0956a41efea6e56ce34
    https://github.com/scummvm/scummvm/commit/9641a3608b17d7d19c4ea0956a41efea6e56ce34
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-12-02T16:11:34-08:00

Commit Message:
SCI Fix LB2 Act 5 trigger

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 cc97affb3ab..497df9489f0 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -10276,6 +10276,45 @@ static const uint16 laurabow2PatchFixAct4Initialization[] = {
 	PATCH_END
 };
 
+// The act 5 trigger in Olympia's office is supposed to occur when exiting to
+//  room 510 but it can also occur just by looking at the Countess' body again.
+//  The close up of the Countess is also implemented as a room, but the trigger
+//  in rm520:newRoom only tests the act number and inventory. This prevents the
+//  game from being completed if the player picks up the grapes and looks at the
+//  Countess again to get the smelling salts.
+//
+// We fix this by adding a room 520 test to the act 5 trigger.
+//
+// Applies to: All versions
+// Responsible method: rm520:newRoom
+static const uint16 laurabow2SignatureAct5Trigger[] = {
+	0x31, 0x0c,                         // bnt 0c
+	0x38, SIG_ADDTOOFFSET(+2),          // pushi newRoom
+	0x78,                               // push1
+	0x8f, 0x01,                         // lsp 01
+	0x57, SIG_ADDTOOFFSET(+1), 0x06,    // super 06 [ LBRoom newRoom: roomNumber ]
+	SIG_MAGICDWORD,
+	0x32, SIG_UINT16(0x0059),           // jmp 0059 [ end of cond ]
+	0x89, 0x7b,                         // lsg 7b   [ act ]
+	0x35, 0x04,                         // ldi 04
+	0x1a,                               // eq?
+	SIG_ADDTOOFFSET(+0x4B),
+	0x38, SIG_ADDTOOFFSET(+2),          // pushi newRoom
+	0x78,                               // push1
+	0x8f, 0x01,                         // lsp 01
+	SIG_END
+};
+
+static const uint16 laurabow2PatchAct5Trigger[] = {
+	0x2f, 0x5c,                         // bt 0c [ LBRoom newRoom: roomNumber ]
+	0x8f, 0x01,                         // lsp 01
+	0x34, PATCH_UINT16(0x01fe),         // ldi 01fe
+	0x1a,                               // eq?      [ roomNumber == 510 ]
+	0x30, PATCH_UINT16(0x0008),         // bnt 0008 [ skip act 5 trigger ]
+	0x32, PATCH_UINT16(0x0000),         // jmp 0000 [ continue ]
+	PATCH_END
+};
+
 // The armor exhibit rooms (440 and 448) have event handlers that fail to handle
 //  all events, preventing messages from being displayed.
 //
@@ -10735,6 +10774,7 @@ static const SciScriptPatcherEntry laurabow2Signatures[] = {
 	{  true,   460, "CD/Floppy: fix crate room east door lockup",     1, laurabow2SignatureFixCrateRoomEastDoorLockup,   laurabow2PatchFixCrateRoomEastDoorLockup },
 	{ false,   500, "CD: fix museum actor loops",                     3, laurabow2CDSignatureFixMuseumActorLoops1,       laurabow2CDPatchFixMuseumActorLoops1 },
 	{  true,  2660, "CD/Floppy: fix elevator lockup",                 1, laurabow2SignatureFixElevatorLockup,            laurabow2PatchFixElevatorLockup },
+	{  true,   520, "CD/Floppy: act 5 trigger",                       1, laurabow2SignatureAct5Trigger,                  laurabow2PatchAct5Trigger },
 	{  true,   550, "CD/Floppy: fix back rub east entrance lockup",   1, laurabow2SignatureFixBackRubEastEntranceLockup, laurabow2PatchFixBackRubEastEntranceLockup },
 	{  true,   550, "CD/Floppy: fix disappearing desk items",         1, laurabow2SignatureFixDisappearingDeskItems,     laurabow2PatchFixDisappearingDeskItems },
 	{  true,    26, "Floppy: fix act 4 initialization",               1, laurabow2SignatureFixAct4Initialization,        laurabow2PatchFixAct4Initialization },




More information about the Scummvm-git-logs mailing list