diff options
-rw-r--r-- | engines/tsage/core.cpp | 18 | ||||
-rw-r--r-- | engines/tsage/core.h | 24 | ||||
-rw-r--r-- | engines/tsage/module.mk | 1 | ||||
-rw-r--r-- | engines/tsage/ringworld_demo.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/ringworld_demo.h | 8 | ||||
-rw-r--r-- | engines/tsage/ringworld_logic.cpp | 5 | ||||
-rw-r--r-- | engines/tsage/ringworld_logic.h | 2 | ||||
-rw-r--r-- | engines/tsage/scenes.cpp | 20 | ||||
-rw-r--r-- | engines/tsage/scenes.h | 23 |
9 files changed, 50 insertions, 55 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 917625142b..2f0536599a 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -3647,22 +3647,4 @@ void SceneHandler::saveListener(Serializer &ser) { warning("TODO: SceneHandler::saveListener"); } -/*--------------------------------------------------------------------------*/ - -void Game::execute() { - // Main game loop - bool activeFlag = false; - do { - // Process all currently atcive game handlers - activeFlag = false; - for (SynchronizedList<GameHandler *>::iterator i = _handlers.begin(); i != _handlers.end(); ++i) { - GameHandler *gh = *i; - if (gh->_lockCtr.getCtr() == 0) { - gh->execute(); - activeFlag = true; - } - } - } while (activeFlag && !_vm->getEventManager()->shouldQuit()); -} - } // End of namespace tSage diff --git a/engines/tsage/core.h b/engines/tsage/core.h index f984a72474..71130e5b0b 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -909,30 +909,6 @@ public: static void saveListener(Serializer &ser); }; -/*--------------------------------------------------------------------------*/ - -class Game { -protected: - SynchronizedList<GameHandler *> _handlers; - - static bool notLockedFn(GameHandler *g); - virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {} -public: - virtual ~Game() {} - - void addHandler(GameHandler *entry) { _handlers.push_back(entry); } - void removeHandler(GameHandler *entry) { _handlers.remove(entry); } - - void execute(); - virtual void start() = 0; - virtual void restart() {} - virtual void restartGame() {} - virtual void saveGame() {} - virtual void restoreGame() {} - virtual void quitGame() {} - virtual void endGame(int resNum, int lineNum) {} -}; - } // End of namespace tSage #endif diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk index 2f9194a9ba..aefc8b0992 100644 --- a/engines/tsage/module.mk +++ b/engines/tsage/module.mk @@ -1,6 +1,7 @@ MODULE := engines/tsage MODULE_OBJS := \ + blueforce_logic.o \ converse.o \ core.o \ debugger.o \ diff --git a/engines/tsage/ringworld_demo.cpp b/engines/tsage/ringworld_demo.cpp index f6e915b710..2dacea660a 100644 --- a/engines/tsage/ringworld_demo.cpp +++ b/engines/tsage/ringworld_demo.cpp @@ -34,7 +34,9 @@ void RingworldDemoGame::start() { _globals->_events.setCursor(CURSOR_NONE); } -void RingworldDemoGame::restart() { +Scene *RingworldDemoGame::createScene(int sceneNumber) { + // The demo only has a single scene, so ignore the scene number and always return it + return new RingworldDemoScene(); } /*-------------------------------------------------------------------------- diff --git a/engines/tsage/ringworld_demo.h b/engines/tsage/ringworld_demo.h index d72db9c9a4..8b69da8f43 100644 --- a/engines/tsage/ringworld_demo.h +++ b/engines/tsage/ringworld_demo.h @@ -32,15 +32,9 @@ namespace tSage { class RingworldDemoGame: public Game { -protected: - virtual void restart(); public: virtual void start(); - virtual void restartGame() {} - virtual void saveGame() {} - virtual void restoreGame() {} - virtual void quitGame() {} - virtual void endGame(int resNum, int lineNum) {} + virtual Scene *createScene(int sceneNumber); }; class RingworldDemoScene: public Scene { diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp index 9eba3bf00b..82331ba0e6 100644 --- a/engines/tsage/ringworld_logic.cpp +++ b/engines/tsage/ringworld_logic.cpp @@ -39,10 +39,7 @@ namespace tSage { -Scene *SceneFactory::createScene(int sceneNumber) { - if (_vm->getFeatures() & GF_DEMO) - return new RingworldDemoScene(); - +Scene *RingworldGame::createScene(int sceneNumber) { switch (sceneNumber) { /* Scene group 1 */ // Kziniti Palace (Introduction) diff --git a/engines/tsage/ringworld_logic.h b/engines/tsage/ringworld_logic.h index e3671e7fe2..6fa92fa043 100644 --- a/engines/tsage/ringworld_logic.h +++ b/engines/tsage/ringworld_logic.h @@ -451,6 +451,8 @@ public: virtual void restoreGame(); virtual void quitGame(); virtual void endGame(int resNum, int lineNum); + + virtual Scene *createScene(int sceneNumber); }; } // End of namespace tSage diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 8ff063668f..3741bdafd7 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -127,7 +127,7 @@ void SceneManager::sceneChange() { } Scene *SceneManager::getNewScene() { - return SceneFactory::createScene(_nextSceneNumber); + return _globals->_game->createScene(_nextSceneNumber); } void SceneManager::fadeInIfNecessary() { @@ -490,4 +490,22 @@ void Scene::setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent _zoomPercents[yEnd++] = minPercent; } +/*--------------------------------------------------------------------------*/ + +void Game::execute() { + // Main game loop + bool activeFlag = false; + do { + // Process all currently atcive game handlers + activeFlag = false; + for (SynchronizedList<GameHandler *>::iterator i = _handlers.begin(); i != _handlers.end(); ++i) { + GameHandler *gh = *i; + if (gh->_lockCtr.getCtr() == 0) { + gh->execute(); + activeFlag = true; + } + } + } while (activeFlag && !_vm->getEventManager()->shouldQuit()); +} + } // End of namespace tSage diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h index 7ef74b49c5..a5aacbacfa 100644 --- a/engines/tsage/scenes.h +++ b/engines/tsage/scenes.h @@ -108,6 +108,29 @@ public: static void loadNotifier(bool postFlag); }; +class Game { +protected: + SynchronizedList<GameHandler *> _handlers; + + static bool notLockedFn(GameHandler *g); + virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {} +public: + virtual ~Game() {} + + void addHandler(GameHandler *entry) { _handlers.push_back(entry); } + void removeHandler(GameHandler *entry) { _handlers.remove(entry); } + + void execute(); + virtual void start() = 0; + virtual void restart() {} + virtual void restartGame() {} + virtual void saveGame() {} + virtual void restoreGame() {} + virtual void quitGame() {} + virtual void endGame(int resNum, int lineNum) {} + virtual Scene *createScene(int sceneNumber) = 0; +}; + } // End of namespace tSage #endif |