diff options
author | Filippos Karapetis | 2010-06-10 08:11:38 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-06-10 08:11:38 +0000 |
commit | 0ab7c908bb3971a74bb1c8848d6f59f161464ad1 (patch) | |
tree | 25e87d47ef767d392990315c313a9c442c67a6f8 /engines/sci | |
parent | 50c1f4e545dde784341eebf6eb8cd6d3ce0751b7 (diff) | |
download | scummvm-rg350-0ab7c908bb3971a74bb1c8848d6f59f161464ad1.tar.gz scummvm-rg350-0ab7c908bb3971a74bb1c8848d6f59f161464ad1.tar.bz2 scummvm-rg350-0ab7c908bb3971a74bb1c8848d6f59f161464ad1.zip |
Removed the pointer to the game object from the EngineState class
svn-id: r49562
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kparse.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/state.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 2 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 7 | ||||
-rw-r--r-- | engines/sci/sci.h | 2 |
5 files changed, 10 insertions, 13 deletions
diff --git a/engines/sci/engine/kparse.cpp b/engines/sci/engine/kparse.cpp index 785ff39d22..465bc177a0 100644 --- a/engines/sci/engine/kparse.cpp +++ b/engines/sci/engine/kparse.cpp @@ -118,7 +118,7 @@ reg_t kParse(EngineState *s, int argc, reg_t *argv) { 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 @@ reg_t kParse(EngineState *s, int argc, reg_t *argv) { 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 */ } diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 8860666bef..716f948ce6 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -85,8 +85,6 @@ void EngineState::reset(bool isRestoring) { #endif if (!isRestoring) { - _gameObj = NULL_REG; - _memorySegmentSize = 0; _soundCmd = 0; @@ -237,7 +235,7 @@ kLanguage SciEngine::getSciLanguage() { 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 @@ kLanguage SciEngine::getSciLanguage() { } // Store language in printLang selector - writeSelectorValue(_gamestate->_segMan, _gamestate->_gameObj, SELECTOR(printLang), lang); + writeSelectorValue(_gamestate->_segMan, _gameObj, SELECTOR(printLang), lang); } } @@ -284,7 +282,7 @@ Common::String SciEngine::strSplit(const char *str, const char *sep) { 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; diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index aaeb8c49ee..32da83b162 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -173,8 +173,6 @@ public: */ void shrinkStackToBase(); - reg_t _gameObj; /**< Pointer to the game object */ - int gc_countdown; /**< Number of kernel calls until next gc */ public: diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 537ec4bef0..fad4e8c4e8 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -145,6 +145,7 @@ Common::Error SciEngine::run() { // 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 @@ bool SciEngine::initGame() { 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 @@ void SciEngine::initStackBaseWithSelector(Selector selector) { _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"); } diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 4e6be667f1..4096019a86 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -161,6 +161,7 @@ public: 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 @@ private: Kernel *_kernel; Vocabulary *_vocabulary; EventManager *_eventMan; + reg_t _gameObj; /**< Pointer to the game object */ Console *_console; OSystem *_system; }; |