aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-28 22:01:26 +0000
committerFilippos Karapetis2010-06-28 22:01:26 +0000
commit58732b9df1f0451f03c2ca01e0cab48314a360d3 (patch)
treec101b64e3fc01c9962b79f05004983e54cfb5e50 /engines/sci
parent32a192b79ab8ed37cf0bf6fca5bcaf9ef55b21a5 (diff)
downloadscummvm-rg350-58732b9df1f0451f03c2ca01e0cab48314a360d3.tar.gz
scummvm-rg350-58732b9df1f0451f03c2ca01e0cab48314a360d3.tar.bz2
scummvm-rg350-58732b9df1f0451f03c2ca01e0cab48314a360d3.zip
SCI: More changes to the code for loading from the launcher
- Added support for the LSL2 menu bar object - We no longer need a reference to the init() selector - it's always the first method of the menu bar object svn-id: r50462
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/selector.cpp1
-rw-r--r--engines/sci/engine/selector.h2
-rw-r--r--engines/sci/sci.cpp23
3 files changed, 9 insertions, 17 deletions
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp
index 155aa83883..00480743cc 100644
--- a/engines/sci/engine/selector.cpp
+++ b/engines/sci/engine/selector.cpp
@@ -161,7 +161,6 @@ void Kernel::mapSelectors() {
FIND_SELECTOR(maxScale);
FIND_SELECTOR(vanishingX);
FIND_SELECTOR(vanishingY);
- FIND_SELECTOR(init);
FIND_SELECTOR(iconIndex);
#ifdef ENABLE_SCI32
diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h
index 1fff7caac8..acb7912d8d 100644
--- a/engines/sci/engine/selector.h
+++ b/engines/sci/engine/selector.h
@@ -103,8 +103,6 @@ struct SelectorCache {
// perform
Selector moveDone; ///< used for DoBresen
- Selector init; ///< Used for menu initialization when loading from the launcher
-
// SCI1 selectors which have been moved a bit in SCI1.1, but otherwise static
Selector cantBeHere; ///< Checks for movement avoidance in SCI1+. Replaces canBeHere
Selector topString; ///< SCI1 scroll lists use this instead of lsTop
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index fd4c4e9137..46d33eda78 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -245,22 +245,17 @@ Common::Error SciEngine::run() {
// 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("TheMenuBar"); // LSL2
+ 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");
- }
+ // Reset abortScriptProcessing before initializing the game menu, so that the
+ // VM call performed by invokeSelector will actually run.
+ _gamestate->abortScriptProcessing = kAbortNone;
+ Object *menuBar = _gamestate->_segMan->getObject(menuBarObj);
+ // Invoke the first method (init) of the menuBar object
+ invokeSelector(_gamestate, menuBarObj, menuBar->getFuncSelector(0), 0, _gamestate->stack_base);
+ _gamestate->abortScriptProcessing = kAbortLoadGame;
}
}