From 7c7e9b831fc8b250942170bc12cd9c54602ded48 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 10 May 2008 19:20:38 +0000 Subject: Implemented pausing of timers, this should fix some minor glitches. svn-id: r31985 --- engines/kyra/timer.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'engines/kyra/timer.h') diff --git a/engines/kyra/timer.h b/engines/kyra/timer.h index 0991f0a1b1..f668a88015 100644 --- a/engines/kyra/timer.h +++ b/engines/kyra/timer.h @@ -49,9 +49,11 @@ struct TimerEntry { class TimerManager { public: - TimerManager(KyraEngine *vm, OSystem *sys) : _vm(vm), _system(sys), _timers(), _nextRun(0) {} + TimerManager(KyraEngine *vm, OSystem *sys) : _vm(vm), _system(sys), _timers(), _nextRun(0), _isPaused(0), _pauseStart(0) {} ~TimerManager() { reset(); } + void pause(bool pause); + void reset(); void addTimer(uint8 id, TimerFunc *func, int countdown, bool enabled); @@ -82,10 +84,21 @@ private: Common::List _timers; uint32 _nextRun; + uint _isPaused; + uint32 _pauseStart; + typedef Common::List::iterator Iterator; typedef Common::List::const_iterator CIterator; }; +class PauseTimer { +public: + PauseTimer(TimerManager &timer) : _timer(timer) { _timer.pause(true); } + ~PauseTimer() { _timer.pause(false); } +private: + TimerManager &_timer; +}; + } // end of namespace Kyra #endif -- cgit v1.2.3