aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorrichiesams2013-08-05 10:26:23 -0500
committerrichiesams2013-08-05 10:26:23 -0500
commitcefb0253ae93dc97e73a83145e314caf7e5f2885 (patch)
treec844caa9062b5ef882258539db8c368e0766d41e /engines
parent65b5a2797b29dc4c0ca9a1bd2bd2e92083deb081 (diff)
downloadscummvm-rg350-cefb0253ae93dc97e73a83145e314caf7e5f2885.tar.gz
scummvm-rg350-cefb0253ae93dc97e73a83145e314caf7e5f2885.tar.bz2
scummvm-rg350-cefb0253ae93dc97e73a83145e314caf7e5f2885.zip
ZVISION: Change _pausedTime to be a reference to when time was paused, instead of accumulation of time
Diffstat (limited to 'engines')
-rw-r--r--engines/zvision/clock.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/engines/zvision/clock.cpp b/engines/zvision/clock.cpp
index 2324d395c3..fe322525f8 100644
--- a/engines/zvision/clock.cpp
+++ b/engines/zvision/clock.cpp
@@ -39,15 +39,14 @@ Clock::Clock(OSystem *system)
void Clock::update() {
uint32 currentTime = _system->getMillis();
- _deltaTime = currentTime - _lastTime - _pausedTime;
- if (_deltaTime < 0) {
- _deltaTime = 0;
- }
+ _deltaTime = (currentTime - _lastTime);
if (_paused) {
- _pausedTime += _deltaTime;
- } else if (_pausedTime > 0) {
- _pausedTime = 0;
+ _deltaTime -= (currentTime - _pausedTime);
+ }
+
+ if (_deltaTime < 0) {
+ _deltaTime = 0;
}
_lastTime = currentTime;
@@ -55,12 +54,14 @@ void Clock::update() {
void Clock::start() {
if (_paused) {
+ _lastTime = _system->getMillis();
_paused = false;
}
}
void Clock::stop() {
if (!_paused) {
+ _pausedTime = _system->getMillis();
_paused = true;
}
}