[Scummvm-git-logs] scummvm master -> 68e51663fdd9f3534f9ea8a5bf36a874590cc025

bluegr noreply at scummvm.org
Mon Apr 28 07:17:02 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:
68e51663fd SCUMM: MONKEY1: Make the Jolly Roger enhancement work on the floppy VGA release


Commit: 68e51663fdd9f3534f9ea8a5bf36a874590cc025
    https://github.com/scummvm/scummvm/commit/68e51663fdd9f3534f9ea8a5bf36a874590cc025
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2025-04-28T10:16:59+03:00

Commit Message:
SCUMM: MONKEY1: Make the Jolly Roger enhancement work on the floppy VGA release

AFAIK, the English VGA floppy release of Monkey1 is the only official
release which tried to fix the continuity error with the Joller Roger.

The enhancement I added a couple of years ago reused the change they
made to the entry script of room 87. But this change is incomplete,
as it didn't take care of removing the Jolly Roger from the screen
once it's been displayed for the first time at the start of Part II.

So, fix the official fix, by making sure to always remove the flag
from the screen, if not right at the start of Part II.

(The irony being that the release where I took this game fix was the
only one where it wouldn't properly work.)

Reported by eriktorbjorn, thanks!

Changed paths:
    engines/scumm/script_v5.cpp
    engines/scumm/scumm_v5.h


diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp
index a2b670abbe7..f28bfa0b5e4 100644
--- a/engines/scumm/script_v5.cpp
+++ b/engines/scumm/script_v5.cpp
@@ -441,24 +441,9 @@ void ScummEngine_v5::o5_actorOps() {
 	Actor *a = derefActor(act, "o5_actorOps");
 	int i, j;
 
-	// WORKAROUND: There's a continuity error in Monkey 1, in that the Jolly Roger should
-	// only appear in the first scene showing the Sea Monkey in the middle of the sea,
-	// since Guybrush must have picked it for the two other ship cutscenes to happen.
-	//
-	// Some official releases appear to have a fix for this (e.g. the English floppy VGA
-	// version), but most releases don't. The fixed release would check whether the
-	// script describing that "the crew begins to plan their voyage" is running in order
-	// to display the flag, so we just reuse this check. The Ultimate Talkie also fixed
-	// this, but in a different way which doesn't look as portable between releases.
-	if ((_game.id == GID_MONKEY_EGA || _game.id == GID_MONKEY_VGA || (_game.id == GID_MONKEY && !(_game.features & GF_ULTIMATE_TALKIE))) &&
-		_roomResource == 87 && vm.slot[_currentScript].number == 10002 && act == 9 &&
-		enhancementEnabled(kEnhVisualChanges)) {
-		const int scriptNr = (_game.version == 5) ? 122 : 119;
-		if (!isScriptRunning(scriptNr)) {
-			a->putActor(0);
-			stopObjectCode();
-			return;
-		}
+	if (workaroundMonkey1JollyRoger(_opcode, a->_number)) {
+		stopObjectCode();
+		return;
 	}
 
 	while ((_opcode = fetchScriptByte()) != 0xFF) {
@@ -1477,7 +1462,8 @@ void ScummEngine_v5::o5_getRandomNr() {
 
 void ScummEngine_v5::o5_isScriptRunning() {
 	getResultPos();
-	setResult(isScriptRunning(getVarOrDirectByte(PARAM_1)));
+	int scriptNr = getVarOrDirectByte(PARAM_1);
+	setResult(isScriptRunning(scriptNr));
 
 	// WORKAROUND bug #346 (also occurs in original): Object stopped with active cutscene
 	// In script 204 room 25 (Cannibal Village) a crash can occur when you are
@@ -1504,6 +1490,8 @@ void ScummEngine_v5::o5_isScriptRunning() {
 			}
 		}
 	}
+
+	(void)workaroundMonkey1JollyRoger(_opcode, scriptNr);
 }
 
 void ScummEngine_v5::o5_getVerbEntrypoint() {
@@ -3775,4 +3763,48 @@ void ScummEngine_v5::workaroundLoomHetchelDoubleHead(Actor *a, int act) {
 	}
 }
 
+bool ScummEngine_v5::workaroundMonkey1JollyRoger(byte callerOpcode, int arg) {
+	// WORKAROUND: There's a continuity error in Monkey 1, in that the Jolly Roger should
+	// only appear in the *first* scene showing the Sea Monkey in the middle of the sea,
+	// since Guybrush must have picked it for the two other ship cutscenes to happen.
+	//
+	// Most (all?) releases are impacted by this; the English floppy VGA release made a
+	// change to check whether the script describing that "the crew begins to plan their
+	// voyage" is running before displaying the flag, but it's an incomplete fix, as it'd
+	// also need to remove the flag from the room, once it's been shown for the first time.
+	// We fix both issues.
+	if ((_game.id == GID_MONKEY_EGA || _game.id == GID_MONKEY_VGA || (_game.id == GID_MONKEY && !(_game.features & GF_ULTIMATE_TALKIE))) &&
+		_roomResource == 87 && _currentScript != 0xFF && vm.slot[_currentScript].number == 10002 &&
+		enhancementEnabled(kEnhVisualChanges)) {
+		// The script that's only run the first time the flag is shown
+		const int defaultExpectedScriptNr = (_game.version == 5) ? 122 : 119;
+		// Jolly Roger actor number
+		const int defaultExpectedActNr = 9;
+		int scriptNr = -1, actNr = -1;
+
+		if (callerOpcode == 0x13) {
+			// called before o5_actorOps is done
+			actNr = arg;
+			scriptNr = defaultExpectedScriptNr;
+		} else if (callerOpcode == 0x68) {
+			// called after o5_isScriptRunning is done
+			scriptNr = arg;
+			actNr = defaultExpectedActNr;
+		}
+
+		// Unmet conditions; abort any workaround attempt
+		if (scriptNr != defaultExpectedScriptNr || actNr != defaultExpectedActNr)
+			return false;
+
+		// Remove the Jolly Roger from the screen, if not right at the start of Part II
+		Actor *a = derefActorSafe(actNr, "workaroundMonkey1JollyRoger");
+		if (a && !isScriptRunning(scriptNr)) {
+			a->putActor(0);
+			return true;
+		}
+	}
+
+	return false;
+}
+
 } // End of namespace Scumm
diff --git a/engines/scumm/scumm_v5.h b/engines/scumm/scumm_v5.h
index e170ac0e89d..116877df5d7 100644
--- a/engines/scumm/scumm_v5.h
+++ b/engines/scumm/scumm_v5.h
@@ -94,6 +94,7 @@ protected:
 	void injectMISESpeech();
 
 	void workaroundLoomHetchelDoubleHead(Actor *a, int act);
+	bool workaroundMonkey1JollyRoger(byte callerOpcode, int arg);
 
 	/**
 	 * Fetch the next script word, then if cond is *false*, perform a relative jump.




More information about the Scummvm-git-logs mailing list