[Scummvm-cvs-logs] SF.net SVN: scummvm:[54730] scummvm/trunk/engines/scumm/script_v2.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Dec 2 01:27:46 CET 2010


Revision: 54730
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54730&view=rev
Author:   fingolfin
Date:     2010-12-02 00:27:46 +0000 (Thu, 02 Dec 2010)

Log Message:
-----------
SCUMM: Workaround for bug #1447058, a race condition in the game scripts

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/script_v2.cpp

Modified: scummvm/trunk/engines/scumm/script_v2.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_v2.cpp	2010-12-02 00:27:26 UTC (rev 54729)
+++ scummvm/trunk/engines/scumm/script_v2.cpp	2010-12-02 00:27:46 UTC (rev 54730)
@@ -1141,6 +1141,44 @@
 			return;
 	}
 
+	// WORKAROUND bug #1447058: In Maniac Mansion, when the door bell
+	// rings, then this normally causes Ted Edison to leave his room.
+	// This is controlled by script 87. On the other hand, when the
+	// player enters Ted's room while Ted is in it, then Ted captures
+	// the player and puts his active ego into the cellar prison.
+	//
+	// Unfortunately, the two events can collide: If the cutscene is
+	// playing in which Ted captures the player (controlled by script
+	// 88) and simultaneously the door bell rings (due to package
+	// delivery...) then this leads to an assertion (in ScummVM, due to
+	// its stricter validity checking), or to unexpected / strange
+	// behavior (in the original engine). The script writers apparently
+	// anticipated the possibility of the door bell ringing: Before
+	// script 91 starts script 88, it explicitly stops script 87.
+	// Unfortunately, this is not quite enough, as script 87 can be
+	// started while script 88 is already running -- specifically, by
+	// the package delivery sequence.
+	//
+	// Now, one can easily suppress this particular assertion, but then
+	// one still gets odd behavior: Ted is in the process of
+	// incarcerating the player, when the door bell rings; Ted promptly
+	// leaves to get the package, leaving the player alone (!), but then
+	// moments later we cut to the cellar, where Ted just put the
+	// player. That seems weird and irrational (the Edisons may be mad,
+	// but they are not stupid when it comes to putting people into
+	// their dungeon ;)
+	//
+	// To avoid this, we use a somewhat more elaborate workaround: If
+	// script 88 or 89 are running (which control the capture resp.
+	// imprisonment of the player), then any attempt to start script 87
+	// (which makes Ted go answer the door bell) is simply ignored. This
+	// way, the door bell still chimes, but Ted ignores it.
+	if (_game.id == GID_MANIAC && script == 87) {
+		if (isScriptRunning(88) || isScriptRunning(89)) {
+			return;
+		}
+	}
+
 	runScript(script, 0, 0, 0);
 }
 
@@ -1478,10 +1516,10 @@
 }
 
 void ScummEngine_v2::o2_chainScript() {
-	int data = getVarOrDirectByte(PARAM_1);
+	int script = getVarOrDirectByte(PARAM_1);
 	stopScript(vm.slot[_currentScript].number);
 	_currentScript = 0xFF;
-	runScript(data, 0, 0, 0);
+	runScript(script, 0, 0, 0);
 }
 
 void ScummEngine_v2::o2_pickupObject() {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list