diff options
author | Ben Castricum | 2016-08-27 20:22:41 +0200 |
---|---|---|
committer | Ben Castricum | 2016-08-30 09:09:21 +0200 |
commit | 940bb41526da8e16889effc803f029128043b5d8 (patch) | |
tree | fdd04ad74b1be8fa1bf527b23ae912a81674cd82 /engines/scumm/scumm.cpp | |
parent | b9b96e8991bcdd4e61dc56b7d0a5afc4d80d225d (diff) | |
download | scummvm-rg350-940bb41526da8e16889effc803f029128043b5d8.tar.gz scummvm-rg350-940bb41526da8e16889effc803f029128043b5d8.tar.bz2 scummvm-rg350-940bb41526da8e16889effc803f029128043b5d8.zip |
SCUMM HE: Compensate timers for pauses, fixes bug #6352
Diffstat (limited to 'engines/scumm/scumm.cpp')
-rw-r--r-- | engines/scumm/scumm.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 72c6909f8c..107228453e 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -2589,6 +2589,30 @@ void ScummEngine_v60he::setHETimer(int timer) { _heTimers[timer] = _system->getMillis(); } +void ScummEngine_v60he::pauseHETimers(bool pause) { + // The HE timers rely on system time which of course doesn't pause when + // the engine does. By adding the elapsed time we compensate for this. + // Fixes bug #6352 + if (pause) { + // Pauses can be layered, we only need the start of the first + if (!_pauseStartTime) + _pauseStartTime = _system->getMillis(); + } else { + int elapsedTime = _system->getMillis() - _pauseStartTime; + for (int i = 0; i < ARRAYSIZE(_heTimers); i++) { + if (_heTimers[i] != 0) + _heTimers[i] += elapsedTime; + } + _pauseStartTime = 0; + } +} + +void ScummEngine_v60he::pauseEngineIntern(bool pause) { + pauseHETimers(pause); + + ScummEngine::pauseEngineIntern(pause); +} + void ScummEngine::pauseGame() { pauseDialog(); } |