From 9140fd8e91882250e23e2e4b44bf3088f3da827a Mon Sep 17 00:00:00 2001 From: athrxx Date: Mon, 18 Jul 2011 01:22:58 +0200 Subject: KYRA: (EOB) - implement party resting --- engines/kyra/timer.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'engines/kyra/timer.cpp') 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(); -- cgit v1.2.3