diff options
| author | Filippos Karapetis | 2010-06-27 23:20:08 +0000 |
|---|---|---|
| committer | Filippos Karapetis | 2010-06-27 23:20:08 +0000 |
| commit | 048ceb73d36e4729cb9c8dde292043c32a554234 (patch) | |
| tree | b060e72c936d24063c5d2ea243c6a677f18f8bf1 /engines/sci/sci.cpp | |
| parent | a887d4898db9c954f29972e8bfb5155659069e4b (diff) | |
| download | scummvm-rg350-048ceb73d36e4729cb9c8dde292043c32a554234.tar.gz scummvm-rg350-048ceb73d36e4729cb9c8dde292043c32a554234.tar.bz2 scummvm-rg350-048ceb73d36e4729cb9c8dde292043c32a554234.zip | |
SCI: Removed the hack for loading games from the launcher from run_vm(). This is now done on startup. This should fix loading from the launcher for LSL6
svn-id: r50406
Diffstat (limited to 'engines/sci/sci.cpp')
| -rw-r--r-- | engines/sci/sci.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 8a41d74b7f..9a80420a12 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -306,9 +306,30 @@ Common::Error SciEngine::run() { // Check whether loading a savestate was requested if (ConfMan.hasKey("save_slot")) { - _gamestate->loadFromLauncher = ConfMan.getInt("save_slot"); - } else { - _gamestate->loadFromLauncher = -1; + reg_t restoreArgv[2] = { NULL_REG, make_reg(0, ConfMan.getInt("save_slot")) }; // special call (argv[0] is NULL) + kRestoreGame(_gamestate, 2, restoreArgv); + + // Initialize the game menu, if there is one. + // This is not done when loading, so we must do it manually. + reg_t menuBarObj = _gamestate->_segMan->findObjectByName("MenuBar"); + if (menuBarObj.isNull()) + menuBarObj = _gamestate->_segMan->findObjectByName("menuBar"); // LSL6 + if (!menuBarObj.isNull()) { + // Game menus are found in SCI0-SCI01 games (but not in demos), which had a selector vocabulary, + // thus the following code should always work (at least theoretically). + // The init selector is being moved around in all games, thus adding it to the list of static + // selectors can be tricky. An alternative way would be to call the first method of the + // MenuBar object (which is init), but this will require refactoring. + if (_kernel->_selectorCache.init != -1) { + // Reset abortScriptProcessing before initializing the game menu, so that the + // VM call performed by invokeSelector will actually run. + _gamestate->abortScriptProcessing = kAbortNone; + invokeSelector(_gamestate, menuBarObj, SELECTOR(init), 0, _gamestate->stack_base); + _gamestate->abortScriptProcessing = kAbortLoadGame; + } else { + warning("Game has a menu but not a selector vocabulary, skipping menu initialization"); + } + } } runGame(); |
