[Scummvm-git-logs] scummvm master -> 046356c85a060545e677483e39e2a07fa571f300

sluicebox noreply at scummvm.org
Mon Jan 9 01:01:31 UTC 2023


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

Summary:
046356c85a SCI: Convert LSL1 polygon workaround to script patch


Commit: 046356c85a060545e677483e39e2a07fa571f300
    https://github.com/scummvm/scummvm/commit/046356c85a060545e677483e39e2a07fa571f300
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-01-08T17:01:01-08:00

Commit Message:
SCI: Convert LSL1 polygon workaround to script patch

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


diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 1b7a1a2dd29..8f30b15bd75 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -1168,7 +1168,6 @@ static Vertex *merge_point(PathfindingState *s, const Common::Point &v) {
  */
 static Polygon *convert_polygon(EngineState *s, reg_t polygon) {
 	SegManager *segMan = s->_segMan;
-	int i;
 	reg_t points = readSelector(segMan, polygon, SELECTOR(points));
 	int size = readSelectorValue(segMan, polygon, SELECTOR(size));
 
@@ -1200,21 +1199,9 @@ static Polygon *convert_polygon(EngineState *s, reg_t polygon) {
 		return nullptr;
 	}
 
-	int skip = 0;
-
-	// WORKAROUND: broken polygon in lsl1sci, room 350, after opening elevator
-	// Polygon has 17 points but size is set to 19
-	if ((size == 19) && g_sci->getGameId() == GID_LSL1) {
-		if ((s->currentRoomNumber() == 350)
-		&& (readPoint(pointList, 18) == Common::Point(108, 137))) {
-			debug(1, "Applying fix for broken polygon in lsl1sci, room 350");
-			size = 17;
-		}
-	}
-
 	Polygon *poly = new Polygon(readSelectorValue(segMan, polygon, SELECTOR(type)));
 
-	for (i = skip; i < size; i++) {
+	for (int i = 0; i < size; i++) {
 		Vertex *vertex = new Vertex(readPoint(pointList, i));
 		poly->vertices.insertHead(vertex);
 	}
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index a98cc81ab26..520fe54912d 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -8228,8 +8228,33 @@ static const SciScriptPatcherEntry longbowSignatures[] = {
 };
 
 // ===========================================================================
-// Leisure Suit Larry 1 (Spanish)
+// Leisure Suit Larry 1
+
+// Pushing the penthouse elevator button in room 350 causes a broken polygon to
+//  be used for pathfinding. openObstacle:points is set to a local array of 17
+//  points but its size property is incorrectly set to 19. We fix the size so
+//  that the interpreter doesn't use the wrong values for pathfinding.
 //
+// Applies to: All versions
+// Responsible method: rm350:init
+static const uint16 larry1SignatureElevatorPolygon[] = {
+	SIG_MAGICDWORD,
+	0x5b, 0x02, 0x1f,                // lea 02 1f
+	0x36,                            // push
+	0x39, SIG_SELECTOR8(size),       // pushi size
+	0x78,                            // push1
+	0x39, 0x13,                      // pushi 13 [ incorrect size ]
+	0x72, SIG_ADDTOOFFSET(+2),       // lofsa openObstacle
+	0x4a, 0x0c,                      // send 0c [ openObstacle points: @local31 size: 19 ]
+	SIG_END
+};
+
+static const uint16 larry1PatchElevatorPolygon[] = {
+	PATCH_ADDTOOFFSET(+7),
+	0x39, 0x11,                      // pushi 11 [ correct size ]
+	PATCH_END
+};
+
 // It seems originally the Spanish version of Larry 1 used some beta code at
 // least for the man wearing a barrel, who walks around in front of the casino.
 // The script inside the resource files even uses a class, that does not exist
@@ -8345,10 +8370,11 @@ static const uint16 larry1PatchBuyApple[] = {
 	PATCH_END
 };
 
-//          script, description,                                signature                     patch
+//          script, description,                                signature                       patch
 static const SciScriptPatcherEntry larry1Signatures[] = {
-	{  true,   300, "Spanish: buy apple from barrel man",    1, larry1SignatureBuyApple,      larry1PatchBuyApple },
-	{  true,   803, "disable speed test",                    1, sci01SpeedTestLocalSignature, sci01SpeedTestLocalPatch },
+	{  true,   300, "Spanish: buy apple from barrel man",    1, larry1SignatureBuyApple,        larry1PatchBuyApple },
+	{  true,   350, "elevator polygon size",                 1, larry1SignatureElevatorPolygon, larry1PatchElevatorPolygon },
+	{  true,   803, "disable speed test",                    1, sci01SpeedTestLocalSignature,   sci01SpeedTestLocalPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };
 




More information about the Scummvm-git-logs mailing list