diff options
author | Max Horn | 2010-01-30 19:08:00 +0000 |
---|---|---|
committer | Max Horn | 2010-01-30 19:08:00 +0000 |
commit | 87856c545c5b46a0d6062cf4f953e7ee4e0e2d8e (patch) | |
tree | ecf5b7f032dab841d1c146d148ca5d5ec93a851e /engines | |
parent | 4f4b559d1cf9ecabe7d395428e14518ee7ed664d (diff) | |
download | scummvm-rg350-87856c545c5b46a0d6062cf4f953e7ee4e0e2d8e.tar.gz scummvm-rg350-87856c545c5b46a0d6062cf4f953e7ee4e0e2d8e.tar.bz2 scummvm-rg350-87856c545c5b46a0d6062cf4f953e7ee4e0e2d8e.zip |
SCI: Don't mess with save_slot just to be able to decide whether we already honored a load request or not
svn-id: r47726
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/vm.cpp | 12 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 9 |
2 files changed, 12 insertions, 9 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 06cfc0b6b0..af57bb88e9 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -46,6 +46,7 @@ const reg_t SIGNAL_REG = {0, SIGNAL_OFFSET}; //#define VM_DEBUG_SEND ScriptState scriptState; // FIXME: Avoid non-const global vars +int g_loadFromLauncher; // FIXME: Avoid non-const global vars int script_abort_flag = 0; // Set to 1 to abort execution. Set to 2 to force a replay afterwards // FIXME: Avoid non-const global vars int script_step_counter = 0; // Counts the number of steps executed // FIXME: Avoid non-const global vars @@ -543,11 +544,6 @@ void run_vm(EngineState *s, int restoring) { reg_t r_temp; // Temporary register StackPtr s_temp; // Temporary stack pointer int16 opparams[4]; // opcode parameters - bool loadFromLauncher = ConfMan.hasKey("save_slot") ? true : false; - if (loadFromLauncher) { - if (ConfMan.getInt("save_slot") < 0) - loadFromLauncher = false; // already loaded - } scriptState.restAdjust = s->restAdjust; // &rest adjusts the parameter count by this value @@ -1042,13 +1038,11 @@ void run_vm(EngineState *s, int restoring) { //warning("callk %s", kfun.orig_name.c_str()); // TODO: SCI2/SCI2.1+ equivalent, once saving/loading works in SCI2/SCI2.1+ - if (loadFromLauncher && opparams[0] == 0x8) { + if (g_loadFromLauncher >= 0 && opparams[0] == 0x8) { // A game is being loaded from the launcher, and kDisplay is called, all initialization has taken // place (i.e. menus have been constructed etc). Therefore, inject a kRestoreGame call // here, instead of the requested function. - int saveSlot = ConfMan.getInt("save_slot"); - ConfMan.setInt("save_slot", -1); // invalidate slot - loadFromLauncher = false; + int saveSlot = g_loadFromLauncher; if (saveSlot < 0) error("Requested to load invalid save slot"); // should never happen, really diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 20a0b1af2e..980b04ed61 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -50,6 +50,8 @@ namespace Sci { +extern int g_loadFromLauncher; + class GfxDriver; SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc) @@ -215,6 +217,13 @@ Common::Error SciEngine::run() { debug("Emulating SCI version %s\n", getSciVersionDesc(getSciVersion()).c_str()); + // Check whether loading a savestate was requested + if (ConfMan.hasKey("save_slot")) { + g_loadFromLauncher = ConfMan.getInt("save_slot"); + } else { + g_loadFromLauncher = -1; + } + game_run(&_gamestate); // Run the game game_exit(_gamestate); |