diff options
Diffstat (limited to 'engines/kyra/timer.cpp')
-rw-r--r-- | engines/kyra/timer.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/engines/kyra/timer.cpp b/engines/kyra/timer.cpp index 2ab2b621f3..4722966cad 100644 --- a/engines/kyra/timer.cpp +++ b/engines/kyra/timer.cpp @@ -129,6 +129,26 @@ void TimerManager::update() { } } +void TimerManager::manualAdvance(uint32 millis) { + uint32 curTime = _system->getMillis(); + for (Iterator pos = _timers.begin(); pos != _timers.end(); ++pos) { + if (pos->enabled == 1 && pos->countdown >= 0) { + pos->nextRun -= curTime; + while (pos->nextRun <= millis) { + if (pos->func && pos->func->isValid()) + (*pos->func)(pos->id); + + pos->lastUpdate = curTime; + pos->nextRun = pos->countdown * _vm->tickLength(); + millis -= pos->nextRun; + } + pos->nextRun += curTime; + _nextRun = MIN(_nextRun, pos->nextRun); + } + } + +} + void TimerManager::resync() { const uint32 curTime = _isPaused ? _pauseStart : _system->getMillis(); |