aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/script_v2.cpp
diff options
context:
space:
mode:
authorRobert Crossfield2017-02-14 18:28:58 +1100
committerRobert Crossfield2017-02-14 18:28:58 +1100
commit9e07738b525f99eb30fb871296573d76e1135e8a (patch)
tree14fa93afcc2b68e422a28189c889e6def4da3945 /engines/scumm/script_v2.cpp
parent59d6feb9f89be24ffe27d24cc07c463dc7bfded0 (diff)
downloadscummvm-rg350-9e07738b525f99eb30fb871296573d76e1135e8a.tar.gz
scummvm-rg350-9e07738b525f99eb30fb871296573d76e1135e8a.tar.bz2
scummvm-rg350-9e07738b525f99eb30fb871296573d76e1135e8a.zip
SCUMM: Fix bug #4112. If you enter the lab while Dr. Fred has the power off, the power won't be turned back on as the script is killed
Diffstat (limited to 'engines/scumm/script_v2.cpp')
-rw-r--r--engines/scumm/script_v2.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp
index 756e0b44de..1814b00ca9 100644
--- a/engines/scumm/script_v2.cpp
+++ b/engines/scumm/script_v2.cpp
@@ -1192,7 +1192,28 @@ void ScummEngine_v2::o2_startScript() {
runScript(script, 0, 0, 0);
}
+// Helper functions for ManiacMansion workarounds
+#define MM_SCRIPT(script) (script + (_game.version == 0 ? 0 : 5))
+#define MM_VALUE(v0,v1) (_game.version == 0 ? v0 : v1)
+
void ScummEngine_v2::stopScriptCommon(int script) {
+
+ // WORKAROUND bug #4112: If you enter the lab while Dr. Fred has the powered turned off
+ // to repair the Zom-B-Matic, the script will be stopped and the power will never turn
+ // back on. This fix forces the power on, when the player enters the lab,
+ // if the script which turned it off is running
+ if (_game.id == GID_MANIAC && _roomResource == 4 && isScriptRunning(MM_SCRIPT(138))) {
+
+ if (vm.slot[_currentScript].number == MM_VALUE(130, 163)) {
+
+ if (script == MM_SCRIPT(138)) {
+
+ int obj = MM_VALUE(124, 157);
+ putState(obj, getState(obj) & ~kObjectState_08 );
+ }
+ }
+ }
+
if (_game.id == GID_MANIAC && _roomResource == 26 && vm.slot[_currentScript].number == 10001) {
// FIXME: Nasty hack for bug #915575
// Don't let the exit script for room 26 stop the script (116), when