diff options
author | Paul Gilbert | 2014-02-24 00:38:49 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-02-24 00:38:49 -0500 |
commit | 4c867aa62fea19f2bff7d3aa632b340aae110306 (patch) | |
tree | fe2cdea63210f67b2b7506ec9549d5a6dc7e4121 /engines/mads | |
parent | 37b788b7ddb679f32653be326ae96ad9132feb1f (diff) | |
download | scummvm-rg350-4c867aa62fea19f2bff7d3aa632b340aae110306.tar.gz scummvm-rg350-4c867aa62fea19f2bff7d3aa632b340aae110306.tar.bz2 scummvm-rg350-4c867aa62fea19f2bff7d3aa632b340aae110306.zip |
MADS: Shift some fields and methods to Dialogs and Game classes
Diffstat (limited to 'engines/mads')
-rw-r--r-- | engines/mads/dialogs.cpp | 2 | ||||
-rw-r--r-- | engines/mads/dialogs.h | 4 | ||||
-rw-r--r-- | engines/mads/game.cpp | 20 | ||||
-rw-r--r-- | engines/mads/game.h | 18 | ||||
-rw-r--r-- | engines/mads/nebular/dialogs_nebular.h | 10 | ||||
-rw-r--r-- | engines/mads/nebular/game_nebular.cpp | 4 | ||||
-rw-r--r-- | engines/mads/nebular/game_nebular.h | 2 | ||||
-rw-r--r-- | engines/mads/scene.cpp | 17 | ||||
-rw-r--r-- | engines/mads/scene.h | 11 |
9 files changed, 44 insertions, 44 deletions
diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index fd42eb5db0..c865e048da 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -333,7 +333,7 @@ void MessageDialog::show() { Dialogs *Dialogs::init(MADSEngine *vm) { if (vm->getGameID() == GType_RexNebular) - return new Dialogs(vm); + return new Nebular::DialogsNebular(vm); error("Unknown game"); } diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index f77590deee..a915ed3452 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -174,7 +174,7 @@ enum DialogId { }; class Dialogs { -private: +protected: MADSEngine *_vm; Dialogs(MADSEngine *vm); @@ -183,6 +183,8 @@ public: public: Common::Point _defaultPosition; DialogId _pendingDialog; + + virtual void showDialog() = 0; }; } // End of namespace MADS diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 14dbcde01f..4e0be59122 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -75,7 +75,7 @@ void Game::run() { _statusFlag = _scene._sectionNum != 1; _vm->_dialogs->_pendingDialog = DIALOG_DIFFICULTY; - showDialog(); + _vm->_dialogs->showDialog(); _vm->_dialogs->_pendingDialog = DIALOG_NONE; _vm->_events->freeCursors(); @@ -138,7 +138,7 @@ void Game::sectionLoop() { _player._stepEnabled = true; _player._visible = true; _vm->_dialogs->_defaultPosition = Common::Point(-1, -1); - _scene.addVisitedScene(_scene._nextSceneId); + addVisitedScene(_scene._nextSceneId); // TODO: main section loop logic goes here @@ -151,7 +151,7 @@ void Game::sectionLoop() { // Check whether to show a dialog if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globalFlags[5]) { _scene.releasePlayerSprites(); - showDialog(); + _vm->_dialogs->showDialog(); _vm->_dialogs->_pendingDialog = DIALOG_NONE; } } @@ -213,6 +213,20 @@ void Game::loadResourceSequence(const Common::String prefix, int v) { warning("TODO: loadResourceSequence"); } +void Game::addVisitedScene(int sceneId) { + if (!visitedScenesExists(sceneId)) + _visitedScenes.push_back(sceneId); +} + +bool Game::visitedScenesExists(int sceneId) { + for (int i = 0; i < _visitedScenes.size(); ++i) { + if (_visitedScenes[i] == sceneId) + return true; + } + + return false; +} + /*------------------------------------------------------------------------*/ void InventoryObject::load(Common::SeekableReadStream &f) { diff --git a/engines/mads/game.h b/engines/mads/game.h index 58b6ff968a..e2b8deede5 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -95,6 +95,16 @@ private: * Inner game loop for executing gameplay within a game section */ void sectionLoop(); + + /** + * Returns true if a given Scene Id exists in the listed of previously visited scenes. + */ + bool visitedScenesExists(int sceneId); + + /** + * Adds a scene Id to the list of previously visited scenes, if it doesn't already exist + */ + void addVisitedScene(int sceneId); protected: MADSEngine *_vm; MSurface *_surface; @@ -107,13 +117,14 @@ protected: int _saveSlot; int _statusFlag; SectionHandler *_sectionHandler; + Common::Array<int> _visitedScenes; + byte *_quotes; int _v1; int _v2; int _v3; int _v4; int _v5; int _v6; - byte *_quotes; /** * Constructor @@ -156,11 +167,6 @@ protected: virtual void initialiseGlobals() = 0; /** - * Show a game dialog - */ - virtual void showDialog() = 0; - - /** * Set up the section handler specific to each section */ virtual void setSectionHandler() = 0; diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index 53f377ae0a..d4e4fe921e 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -31,6 +31,16 @@ namespace MADS { namespace Nebular { +class DialogsNebular: public Dialogs { + friend class Dialogs; +protected: + DialogsNebular(MADSEngine *vm): Dialogs(vm) {} +public: + virtual void showDialog() { + warning("TODO: showDialog"); + } +}; + struct HOGANUS { int _bookId; int _pageNum; diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 2e27eaea0f..6e2b77d477 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -152,10 +152,6 @@ void GameNebular::initialiseGlobals() { loadResourceSequence("ROX", 1); } -void GameNebular::showDialog() { - warning("TODO: showDialog"); -} - void GameNebular::setSectionHandler() { delete _sectionHandler; diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 31bd4ae2b2..9232b26969 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -39,8 +39,6 @@ protected: virtual void initialiseGlobals(); - virtual void showDialog(); - virtual void setSectionHandler(); }; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 46190d12be..406c3cc616 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -34,7 +34,6 @@ Scene::Scene(MADSEngine *vm): _vm(vm) { _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; - _vocabCount = 0; _vocabBuffer = nullptr; _sceneLogic = nullptr; } @@ -81,7 +80,7 @@ void Scene::clearDynamicHotspots() { void Scene::clearVocab() { freeVocab(); - _vocabCount = 0; + _activeVocabs.clear(); } void Scene::freeVocab() { @@ -105,20 +104,6 @@ int Scene::activeVocabIndexOf(int vocabId) { return -1; } -void Scene::addVisitedScene(int sceneId) { - if (!visitedScenesExists(sceneId)) - _visitedScenes.push_back(sceneId); -} - -bool Scene::visitedScenesExists(int sceneId) { - for (int i = 0; i < _visitedScenes.size(); ++i) { - if (_visitedScenes[i] == sceneId) - return true; - } - - return false; -} - void Scene::loadScene() { delete _sceneLogic; diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 9f4f392289..775517b2e6 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -136,10 +136,6 @@ private: */ int activeVocabIndexOf(int vocabId); - /** - * Returns true if a given Scene Id exists in the listed of previously visited scenes. - */ - bool visitedScenesExists(int sceneId); protected: MADSEngine *_vm; public: @@ -157,9 +153,7 @@ public: Common::Array<DynamicHotspot> _dynamicHotspots; bool _dynamicHotspotsChanged; byte *_vocabBuffer; - int _vocabCount; Common::Array<int> _activeVocabs; - Common::Array<int> _visitedScenes; /** * Constructor @@ -203,11 +197,6 @@ public: void addActiveVocab(int vocabId); /** - * Add a scene to the visited scene list if it doesn't already exist - */ - void addVisitedScene(int sceneId); - - /** * Loads the scene logic for a given scene */ void loadScene(); |