aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-08 21:21:19 +0000
committerFilippos Karapetis2010-06-08 21:21:19 +0000
commiteafc63e57266d690b177bf34fa593e37d8cf320f (patch)
tree0a4541607c76c2111eb658218fd9cb86b44aa00f /engines/sci/engine
parent6474eaa1b293b24db51d2a14ef345c7c853a26e1 (diff)
downloadscummvm-rg350-eafc63e57266d690b177bf34fa593e37d8cf320f.tar.gz
scummvm-rg350-eafc63e57266d690b177bf34fa593e37d8cf320f.tar.bz2
scummvm-rg350-eafc63e57266d690b177bf34fa593e37d8cf320f.zip
Cleanup
svn-id: r49521
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/savegame.cpp3
-rw-r--r--engines/sci/engine/state.cpp16
-rw-r--r--engines/sci/engine/vm.cpp18
3 files changed, 16 insertions, 21 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index d6111146bd..8dedf3bae9 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -856,9 +856,6 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
s->_sound.sfx_exit();
#endif
- // Set exec stack base to zero
- s->execution_stack_base = 0;
-
// Now copy all current state information
#ifdef USE_OLD_MUSIC_FUNCTIONS
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 849f1f3c89..0c021863c0 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -91,20 +91,22 @@ void EngineState::reset(bool isRestoring) {
_memorySegmentSize = 0;
_soundCmd = 0;
- execution_stack_base = 0;
- _executionStackPosChanged = false;
-
_fileHandles.resize(5);
- r_acc = NULL_REG;
- restAdjust = 0;
- r_prev = NULL_REG;
-
stack_base = 0;
stack_top = 0;
abortScriptProcessing = kAbortNone;
}
+ execution_stack_base = 0;
+ _executionStackPosChanged = false;
+
+ restAdjust = 0;
+ restAdjustCur = 0;
+
+ r_acc = NULL_REG;
+ r_prev = NULL_REG;
+
last_wait_time = 0;
gc_countdown = 0;
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 5cb333db3c..d7e3c794b3 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1713,7 +1713,6 @@ void game_run(EngineState **_s) {
if (s->abortScriptProcessing == kAbortRestartGame) {
s->abortScriptProcessing = kAbortNone;
- s->_executionStack.clear();
s->_executionStackPosChanged = false;
script_init_engine(s);
@@ -1726,17 +1725,14 @@ void game_run(EngineState **_s) {
send_selector(s, s->_gameObj, s->_gameObj, s->stack_base, 2, s->stack_base);
s->gameWasRestarted = true;
-
+ } else if (s->abortScriptProcessing == kAbortLoadGame) {
+ s->abortScriptProcessing = kAbortNone;
+ debugC(2, kDebugLevelVM, "Restarting with replay()");
+ // Restart with replay
+ _init_stack_base_with_selector(s, g_sci->getKernel()->_selectorCache.replay);
+ send_selector(s, s->_gameObj, s->_gameObj, s->stack_base, 2, s->stack_base);
} else {
- if (s->abortScriptProcessing == kAbortLoadGame) {
- s->abortScriptProcessing = kAbortNone;
- debugC(2, kDebugLevelVM, "Restarting with replay()");
- s->_executionStack.clear();
- // Restart with replay
- _init_stack_base_with_selector(s, g_sci->getKernel()->_selectorCache.replay);
- send_selector(s, s->_gameObj, s->_gameObj, s->stack_base, 2, s->stack_base);
- } else
- break; // exit loop
+ break; // exit loop
}
} while (true);