From 7577e7548c50fac70090078266091caa2f1e0f4b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 28 Apr 2008 19:51:34 +0000 Subject: Fixed bug in TimerManager::update, this should fix tic-tac-toe game in kyra3. svn-id: r31763 --- engines/kyra/kyra_v3.cpp | 1 - engines/kyra/timer.cpp | 18 ++++++++++++------ engines/kyra/timer_v3.cpp | 1 + 3 files changed, 13 insertions(+), 7 deletions(-) (limited to 'engines') diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp index 1d38981db3..d6f68daf4f 100644 --- a/engines/kyra/kyra_v3.cpp +++ b/engines/kyra/kyra_v3.cpp @@ -1173,7 +1173,6 @@ void KyraEngine_v3::updateWithText() { //XXX updateSpecialSceneScripts(); updateCommandLine(); - //XXX musicUpdate(0); restorePage3(); diff --git a/engines/kyra/timer.cpp b/engines/kyra/timer.cpp index f275867516..1f25f88c97 100644 --- a/engines/kyra/timer.cpp +++ b/engines/kyra/timer.cpp @@ -99,17 +99,23 @@ void TimerManager::update() { _nextRun += 99999; for (Iterator pos = _timers.begin(); pos != _timers.end(); ++pos) { - if (pos->enabled && pos->countdown >= 0 && pos->nextRun <= _system->getMillis()) { - if (pos->func && pos->func->isValid()) - (*pos->func)(pos->id); + if (pos->enabled) - uint32 curTime = _system->getMillis(); - pos->lastUpdate = curTime; - pos->nextRun = curTime + pos->countdown * _vm->tickLength(); + if (pos->enabled && pos->countdown >= 0) { + if (pos->nextRun <= _system->getMillis()) { + if (pos->func && pos->func->isValid()) { + (*pos->func)(pos->id); + } + + uint32 curTime = _system->getMillis(); + pos->lastUpdate = curTime; + pos->nextRun = curTime + pos->countdown * _vm->tickLength(); + } _nextRun = MIN(_nextRun, pos->nextRun); } } + } void TimerManager::resync() { diff --git a/engines/kyra/timer_v3.cpp b/engines/kyra/timer_v3.cpp index 4ce73ceaec..5f93a00c8a 100644 --- a/engines/kyra/timer_v3.cpp +++ b/engines/kyra/timer_v3.cpp @@ -51,6 +51,7 @@ void KyraEngine_v3::timerRestoreCommandLine(int arg) { void KyraEngine_v3::timerRunSceneScript7(int arg) { debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v3::timerRunSceneScript7(%d)", arg); + _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); _sceneScriptState.regs[1] = _mouseX; _sceneScriptState.regs[2] = _mouseY; _sceneScriptState.regs[3] = 0; -- cgit v1.2.3