aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-06-25 20:16:47 +0000
committerMax Horn2003-06-25 20:16:47 +0000
commit3351f4257b56118a87901f491e74af4fd952c0b7 (patch)
tree3e5682d1ccdb99ea9d5b396e58c448a5e9c1082a /scumm
parent5a6c3109a0034812077468c76858dfb6a4d4e33a (diff)
downloadscummvm-rg350-3351f4257b56118a87901f491e74af4fd952c0b7.tar.gz
scummvm-rg350-3351f4257b56118a87901f491e74af4fd952c0b7.tar.bz2
scummvm-rg350-3351f4257b56118a87901f491e74af4fd952c0b7.zip
cleanup
svn-id: r8647
Diffstat (limited to 'scumm')
-rw-r--r--scumm/script.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/scumm/script.cpp b/scumm/script.cpp
index 8275b8c941..57eb81e49f 100644
--- a/scumm/script.cpp
+++ b/scumm/script.cpp
@@ -323,26 +323,29 @@ void Scumm::runScriptNested(int script) {
nest->number = 0xFF;
nest->where = 0xFF;
} else {
+ // Store information about the currently running script
slot = &vm.slot[_currentScript];
nest->number = slot->number;
nest->where = slot->where;
nest->slot = _currentScript;
}
- if (++_numNestedScripts > ARRAYSIZE(vm.nest))
+ _numNestedScripts++;
+
+ if (_numNestedScripts > ARRAYSIZE(vm.nest))
error("Too many nested scripts");
_currentScript = script;
-
getScriptBaseAddress();
getScriptEntryPoint();
executeScript();
_numNestedScripts--;
- nest = &vm.nest[_numNestedScripts];
-
if (nest->number != 0xFF) {
+ // Try to resume the script which called us, if its status has not changed
+ // since it invoked us. In particular, we only resume it if it hasn't been
+ // stopped in the meantime, and if it did not already move on.
slot = &vm.slot[nest->slot];
if (slot->number == nest->number && slot->where == nest->where &&
slot->status != ssDead && slot->freezeCount == 0) {