From b913a3632d80dfed276c325de8cae622f35873ff Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Fri, 21 Jun 2019 09:35:23 +0530 Subject: HDB: Add time-keeping functions --- engines/hdb/hdb.cpp | 5 +++++ engines/hdb/hdb.h | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'engines/hdb') diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index 018e1e51dd..bea2c7ec7d 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -288,6 +288,11 @@ Common::Error HDBGame::run() { _drawMan->drawSky(); _map->draw(); _ai->processCines(); + + // Update Timer that's NOT used for in-game Timing + _prevTimeSlice = _timeSlice; + _timeSlice = g_system->getMillis(); + paint(); g_system->updateScreen(); diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h index ede41bae9e..b748101894 100644 --- a/engines/hdb/hdb.h +++ b/engines/hdb/hdb.h @@ -134,10 +134,31 @@ public: _actionMode = status; } + void resetTimer() { + _timePlayed = _timeSeconds = 0; + } + + uint16 getTime() { + return _timePlayed / 1000; + } + + uint16 getTimeSlice() { + return _timeSlice; + } + + uint16 getTimeSliceDelta() { + return _timeSlice - _prevTimeSlice; + } + bool _gameShutdown; Graphics::PixelFormat _format; private: + + uint32 _timePlayed; + uint32 _timeSlice, _prevTimeSlice; + uint32 _timeSeconds; + Console *_console; // Game Variables -- cgit v1.2.3