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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Jun 10 10:11:39 CEST 2010


Revision: 49562
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49562&view=rev
Author:   thebluegr
Date:     2010-06-10 08:11:38 +0000 (Thu, 10 Jun 2010)

Log Message:
-----------
Removed the pointer to the game object from the EngineState class

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

Modified: scummvm/trunk/engines/sci/engine/kparse.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kparse.cpp	2010-06-10 07:48:32 UTC (rev 49561)
+++ scummvm/trunk/engines/sci/engine/kparse.cpp	2010-06-10 08:11:38 UTC (rev 49562)
@@ -118,7 +118,7 @@
 			s->r_acc = make_reg(0, 1);
 			writeSelectorValue(segMan, event, SELECTOR(claimed), 1);
 
-			invokeSelector(INV_SEL(s, s->_gameObj, syntaxFail, kStopOnInvalidSelector), 2, voc->parser_base, stringpos);
+			invokeSelector(INV_SEL(s, g_sci->getGameObject(), syntaxFail, kStopOnInvalidSelector), 2, voc->parser_base, stringpos);
 			/* Issue warning */
 
 			debugC(2, kDebugLevelParser, "Tree building failed");
@@ -141,7 +141,7 @@
 			debugC(2, kDebugLevelParser, "Word unknown: %s", error);
 			/* Issue warning: */
 
-			invokeSelector(INV_SEL(s, s->_gameObj, wordFail, kStopOnInvalidSelector), 2, voc->parser_base, stringpos);
+			invokeSelector(INV_SEL(s, g_sci->getGameObject(), wordFail, kStopOnInvalidSelector), 2, voc->parser_base, stringpos);
 			free(error);
 			return make_reg(0, 1); /* Tell them that it didn't work */
 		}

Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp	2010-06-10 07:48:32 UTC (rev 49561)
+++ scummvm/trunk/engines/sci/engine/state.cpp	2010-06-10 08:11:38 UTC (rev 49562)
@@ -85,8 +85,6 @@
 #endif
 
 	if (!isRestoring) {
-		_gameObj = NULL_REG;
-
 		_memorySegmentSize = 0;
 		_soundCmd = 0;
 
@@ -237,7 +235,7 @@
 	lang = K_LANG_ENGLISH;
 
 	if (_kernel->_selectorCache.printLang != -1) {
-		lang = (kLanguage)readSelectorValue(_gamestate->_segMan, _gamestate->_gameObj, SELECTOR(printLang));
+		lang = (kLanguage)readSelectorValue(_gamestate->_segMan, _gameObj, SELECTOR(printLang));
 
 		if ((getSciVersion() >= SCI_VERSION_1_1) || (lang == K_LANG_NONE)) {
 			// If language is set to none, we use the language from the game detector.
@@ -272,7 +270,7 @@
 			}
 
 			// Store language in printLang selector
-			writeSelectorValue(_gamestate->_segMan, _gamestate->_gameObj, SELECTOR(printLang), lang);
+			writeSelectorValue(_gamestate->_segMan, _gameObj, SELECTOR(printLang), lang);
 		}
 	}
 
@@ -284,7 +282,7 @@
 	kLanguage subLang = K_LANG_NONE;
 
 	if (_kernel->_selectorCache.subtitleLang != -1) {
-		subLang = (kLanguage)readSelectorValue(_gamestate->_segMan, _gamestate->_gameObj, SELECTOR(subtitleLang));
+		subLang = (kLanguage)readSelectorValue(_gamestate->_segMan, _gameObj, SELECTOR(subtitleLang));
 	}
 
 	kLanguage secondLang;

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2010-06-10 07:48:32 UTC (rev 49561)
+++ scummvm/trunk/engines/sci/engine/state.h	2010-06-10 08:11:38 UTC (rev 49562)
@@ -173,8 +173,6 @@
 	 */
 	void shrinkStackToBase();
 
-	reg_t _gameObj; /**< Pointer to the game object */
-
 	int gc_countdown; /**< Number of kernel calls until next gc */
 
 public:

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-06-10 07:48:32 UTC (rev 49561)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-06-10 08:11:38 UTC (rev 49562)
@@ -145,6 +145,7 @@
 
 	// Add the after market GM patches for the specified game, if they exist
 	_resMan->addNewGMPatch(getGameID());
+	_gameObj = _resMan->findGameObject();
 
 	SegManager *segMan = new SegManager(_resMan);
 
@@ -327,8 +328,6 @@
 
 	srand(g_system->getMillis()); // Initialize random number generator
 
-	_gamestate->_gameObj = _resMan->findGameObject();
-
 #ifdef USE_OLD_MUSIC_FUNCTIONS
 	if (_gamestate->sfx_init_flags & SFX_STATE_FLAG_NOSOUND)
 		initGameSound(0, _features->detectDoSoundType());
@@ -359,8 +358,8 @@
 	_gamestate->stack_base[1] = NULL_REG;
 
 	// Register the first element on the execution stack
-	if (!send_selector(_gamestate, _gamestate->_gameObj, _gamestate->_gameObj, _gamestate->stack_base, 2, _gamestate->stack_base)) {
-		_console->printObject(_gamestate->_gameObj);
+	if (!send_selector(_gamestate, _gameObj, _gameObj, _gamestate->stack_base, 2, _gamestate->stack_base)) {
+		_console->printObject(_gameObj);
 		error("initStackBaseWithSelector: error while registering the first selector in the call stack");
 	}
 

Modified: scummvm/trunk/engines/sci/sci.h
===================================================================
--- scummvm/trunk/engines/sci/sci.h	2010-06-10 07:48:32 UTC (rev 49561)
+++ scummvm/trunk/engines/sci/sci.h	2010-06-10 08:11:38 UTC (rev 49562)
@@ -161,6 +161,7 @@
 	inline EngineState *getEngineState() const { return _gamestate; }
 	inline Vocabulary *getVocabulary() const { return _vocabulary; }
 	inline EventManager *getEventManager() const { return _eventMan; }
+	inline reg_t getGameObject() const { return _gameObj; }
 
 	Common::String getSavegameName(int nr) const;
 	Common::String getSavegamePattern() const;
@@ -259,6 +260,7 @@
 	Kernel *_kernel;
 	Vocabulary *_vocabulary;
 	EventManager *_eventMan;
+	reg_t _gameObj; /**< Pointer to the game object */
 	Console *_console;
 	OSystem *_system;
 };


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