diff options
-rwxr-xr-x | engines/pegasus/timers.cpp | 9 | ||||
-rwxr-xr-x | engines/pegasus/timers.h | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/engines/pegasus/timers.cpp b/engines/pegasus/timers.cpp index a5cfa44a45..49071a2936 100755 --- a/engines/pegasus/timers.cpp +++ b/engines/pegasus/timers.cpp @@ -67,6 +67,7 @@ TimeBase::TimeBase(const TimeScale preferredScale) { _stopScale = 1; _master = 0; _pausedRate = 0; + _pauseStart = 0; ((PegasusEngine *)g_engine)->addTimeBase(this); } @@ -118,6 +119,7 @@ void TimeBase::pause() { _pausedRate = getRate(); stop(); _paused = true; + _pauseStart = g_system->getMillis(); } } @@ -125,6 +127,9 @@ void TimeBase::resume() { if (_paused) { setRate(_pausedRate); _paused = false; + + if (isRunning()) + _lastMillis += g_system->getMillis() - _pauseStart; } } @@ -200,9 +205,9 @@ void TimeBase::setMasterTimeBase(TimeBase *tb) { void TimeBase::updateTime() { if (_lastMillis == 0) { - _lastMillis = g_engine->getTotalPlayTime(); + _lastMillis = g_system->getMillis(); } else { - uint32 curTime = g_engine->getTotalPlayTime(); + uint32 curTime = g_system->getMillis(); if (_lastMillis == curTime) // No change return; diff --git a/engines/pegasus/timers.h b/engines/pegasus/timers.h index 5c96b6dda3..1dd32de3c9 100755 --- a/engines/pegasus/timers.h +++ b/engines/pegasus/timers.h @@ -120,7 +120,7 @@ protected: uint32 _flags; Common::Rational _time; - uint32 _lastMillis; + uint32 _lastMillis, _pauseStart; private: Common::Rational getEffectiveRate() const; |