aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}
}