aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-24 07:54:02 +0000
committerFilippos Karapetis2010-06-24 07:54:02 +0000
commitbbb29e2650bf9b51818e710fb177b6b19894c1fe (patch)
treee318effa99e5ef37e36bf1558094a6518841027a /engines
parentf65c4f988639b1ba5e6b2a95174aef3ec7fd8941 (diff)
downloadscummvm-rg350-bbb29e2650bf9b51818e710fb177b6b19894c1fe.tar.gz
scummvm-rg350-bbb29e2650bf9b51818e710fb177b6b19894c1fe.tar.bz2
scummvm-rg350-bbb29e2650bf9b51818e710fb177b6b19894c1fe.zip
Fixed script 140 in the Island of Dr. Brain by adding a workaround for it inside op_link
svn-id: r50203
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/vm.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 350734f8fc..de04c49ef7 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -757,6 +757,9 @@ void run_vm(EngineState *s, bool restoring) {
int old_executionStackBase = s->executionStackBase;
// Used to detect the stack bottom, for "physical" returns
const byte *code_buf = NULL; // (Avoid spurious warning)
+ // Used for a workaround in op_link below, in order to avoid string matching (which can
+ // be slow if used in the game script interpreter)
+ bool isIslandOfDrBrain = (g_sci->getGameId() == "islandbrain");
if (!local_script) {
error("run_vm(): program counter gone astray (local_script pointer is null)");
@@ -1128,8 +1131,15 @@ void run_vm(EngineState *s, bool restoring) {
break;
case op_link: // 0x1f (31)
- for (int i = 0; i < opparams[0]; i++)
- s->xs->sp[i] = NULL_REG;
+ if (local_script->_nr == 140 && isIslandOfDrBrain) {
+ // WORKAROUND for The Island of Dr. Brain, room 140.
+ // Script 140 runs in an endless loop if we set its
+ // variables to 0 here.
+ } else {
+ for (int i = 0; i < opparams[0]; i++)
+ s->xs->sp[i] = NULL_REG;
+ }
+
s->xs->sp += opparams[0];
break;