diff options
-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(); |