[Scummvm-cvs-logs] SF.net SVN: scummvm:[50462] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Tue Jun 29 00:01:27 CEST 2010


Revision: 50462
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50462&view=rev
Author:   thebluegr
Date:     2010-06-28 22:01:26 +0000 (Mon, 28 Jun 2010)

Log Message:
-----------
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

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/selector.cpp
    scummvm/trunk/engines/sci/engine/selector.h
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/engine/selector.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/selector.cpp	2010-06-28 21:56:25 UTC (rev 50461)
+++ scummvm/trunk/engines/sci/engine/selector.cpp	2010-06-28 22:01:26 UTC (rev 50462)
@@ -161,7 +161,6 @@
 	FIND_SELECTOR(maxScale);
 	FIND_SELECTOR(vanishingX);
 	FIND_SELECTOR(vanishingY);
-	FIND_SELECTOR(init);
 	FIND_SELECTOR(iconIndex);
 
 #ifdef ENABLE_SCI32

Modified: scummvm/trunk/engines/sci/engine/selector.h
===================================================================
--- scummvm/trunk/engines/sci/engine/selector.h	2010-06-28 21:56:25 UTC (rev 50461)
+++ scummvm/trunk/engines/sci/engine/selector.h	2010-06-28 22:01:26 UTC (rev 50462)
@@ -103,8 +103,6 @@
 	// 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

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-06-28 21:56:25 UTC (rev 50461)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-06-28 22:01:26 UTC (rev 50462)
@@ -245,22 +245,17 @@
 		// 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;
 		}
 	}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list