aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/timer.cpp
diff options
context:
space:
mode:
authorathrxx2011-07-18 01:22:58 +0200
committerJohannes Schickel2011-12-26 16:18:12 +0100
commit9140fd8e91882250e23e2e4b44bf3088f3da827a (patch)
tree37deb0048ed88ffff3995ab230535f92cb16842f /engines/kyra/timer.cpp
parentdb83458330310072c743d5acc7e1a470c888ec3b (diff)
downloadscummvm-rg350-9140fd8e91882250e23e2e4b44bf3088f3da827a.tar.gz
scummvm-rg350-9140fd8e91882250e23e2e4b44bf3088f3da827a.tar.bz2
scummvm-rg350-9140fd8e91882250e23e2e4b44bf3088f3da827a.zip
KYRA: (EOB) - implement party resting
Diffstat (limited to 'engines/kyra/timer.cpp')
-rw-r--r--engines/kyra/timer.cpp20
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();