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 | |
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
-rw-r--r-- | engines/scumm/he/intern_he.h | 3 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 24 |
2 files changed, 27 insertions, 0 deletions
diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h index c6abac3ecc..72c3e38e65 100644 --- a/engines/scumm/he/intern_he.h +++ b/engines/scumm/he/intern_he.h @@ -56,9 +56,11 @@ public: Common::Rect _actorClipOverride; // HE specific int _heTimers[16]; + uint32 _pauseStartTime; int getHETimer(int timer); void setHETimer(int timer); + void pauseHETimers(bool pause); public: ScummEngine_v60he(OSystem *syst, const DetectorResult &dr); @@ -94,6 +96,7 @@ protected: Common::WriteStream *openSaveFileForAppending(const byte *fileName); void deleteSaveFile(const byte *fileName); void renameSaveFile(const byte *from, const byte *to); + void pauseEngineIntern(bool pause); Common::SeekableReadStream *openSaveFileForReading(int slot, bool compat, Common::String &fileName); Common::WriteStream *openSaveFileForWriting(int slot, bool compat, Common::String &fileName); 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(); } |