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
This commit is contained in:
parent
32a192b79a
commit
58732b9df1
3 changed files with 9 additions and 17 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -244,23 +244,18 @@ Common::Error SciEngine::run() {
|
|||
// 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("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);
|
||||
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;
|
||||
} else {
|
||||
warning("Game has a menu but not a selector vocabulary, skipping menu initialization");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue