diff options
author | Paul Gilbert | 2016-04-08 18:49:57 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-04-08 18:49:57 -0400 |
commit | c5b73db7b9704a18c9c250f01c2eec8104b3713e (patch) | |
tree | 4e02b06817749698f70c4bbe167773fce6015e1c | |
parent | b27d57c25bdbb4c4f69eaefc6ce7c79f03526abe (diff) | |
download | scummvm-rg350-c5b73db7b9704a18c9c250f01c2eec8104b3713e.tar.gz scummvm-rg350-c5b73db7b9704a18c9c250f01c2eec8104b3713e.tar.bz2 scummvm-rg350-c5b73db7b9704a18c9c250f01c2eec8104b3713e.zip |
TITANIC: Implement onIdle method for regular game updates
-rw-r--r-- | engines/titanic/events.cpp | 19 | ||||
-rw-r--r-- | engines/titanic/events.h | 5 |
2 files changed, 24 insertions, 0 deletions
diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index 038bc8b83b..d6f12f5c7d 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -86,6 +86,9 @@ bool Events::checkForNextFrameCounter() { ++_frameCounter; _priorFrameTime = milli; + // Handle any idle updates + onIdle(); + // Give time to the debugger _vm->_debugger->onFrame(); @@ -102,6 +105,22 @@ uint32 Events::getTicksCount() const { return g_system->getMillis(); } +void Events::onIdle() { + if (!_vm->_window->_inputAllowed) + return; + CGameManager *gameManager = _vm->_window->_gameManager; + if (!gameManager) + return; + + // Let the game manager perform any game updates + gameManager->update(); + + if (gameManager->_gameState._field20) { + // Game needs to shut down + _vm->quitGame(); + } +} + #define HANDLE_MESSAGE(METHOD) if (_vm->_window->_inputAllowed) { \ _vm->_window->_gameManager->_inputTranslator.METHOD(_specialButtons, Point(_mousePos.x, _mousePos.y)); \ _vm->_window->mouseChanged(); \ diff --git a/engines/titanic/events.h b/engines/titanic/events.h index fe2c75166d..f85a3d9272 100644 --- a/engines/titanic/events.h +++ b/engines/titanic/events.h @@ -55,6 +55,11 @@ private: */ bool checkForNextFrameCounter(); + /** + * Called to handle any regular updates the game requires + */ + void onIdle(); + void mouseMove(); void leftButtonDown(); void leftButtonUp(); |