[Scummvm-git-logs] scummvm master -> 920513eecd955d3a11c53f6d47d4931d14cd374c

dwatteau noreply at scummvm.org
Sun Apr 13 21:17:21 UTC 2025


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

Summary:
920513eecd SCUMM: Fix notEqualZero regression for V2 and below


Commit: 920513eecd955d3a11c53f6d47d4931d14cd374c
    https://github.com/scummvm/scummvm/commit/920513eecd955d3a11c53f6d47d4931d14cd374c
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2025-04-13T23:16:07+02:00

Commit Message:
SCUMM: Fix notEqualZero regression for V2 and below

The enhancement from commit d06c6006f6a86ad86c97a16fe58e07b7ff28c242
changed o5_notEqualZero() so that the variable number being read by
getVar() could be examined, which is required in this context.

But doing so made notEqualZero use the getVar() call from V3 and
later in V1-V2 games as well, breaking Maniac Mansion or Zak with
fatal errors such as "ERROR: (45:4:0x1F7): variable (reading) 10269
is out of bounds (0,799)".

This hopefully fixes notEqualZero, by only applying this getVar()
"local override" when running Monkey1 (which is always v4 or v5).

Changed paths:
    engines/scumm/script_v5.cpp


diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp
index 6cbd44b51e1..89f1e7bb9b3 100644
--- a/engines/scumm/script_v5.cpp
+++ b/engines/scumm/script_v5.cpp
@@ -1749,16 +1749,22 @@ void ScummEngine_v5::o5_notEqualZero() {
 			}
 		}
 	} else {
-		int var = fetchScriptWord();
-		a = readVar(var);
-
 		// WORKAROUND: There is a message for when Guybrush first
 		// enters the hold where he remarks that the whole thing reeks
 		// of monkeys. But the way it's scripted, the message is only
 		// shown if it has already been shown.
 
-		if ((_game.id == GID_MONKEY || _game.id == GID_MONKEY_VGA || _game.id == GID_MONKEY_EGA) && _roomResource == 8 && vm.slot[_currentScript].number == 10002 && var == 0x8000 + 321 && enhancementEnabled(kEnhRestoredContent)) {
-			a = !a;
+		if ((_game.id == GID_MONKEY || _game.id == GID_MONKEY_VGA || _game.id == GID_MONKEY_EGA) && _roomResource == 8 && vm.slot[_currentScript].number == 10002) {
+			// A local getVar(), where the var number can be examined first.
+			// Taking take to limit this to Monkey1, so that the proper getVar()
+			// implementation still gets called for v2 and below.
+			int var = fetchScriptWord();
+			a = readVar(var);
+
+			if (var == 0x8000 + 321 && enhancementEnabled(kEnhRestoredContent))
+				a = !a;
+		} else {
+			a = getVar();
 		}
 	}
 




More information about the Scummvm-git-logs mailing list