diff options
author | Johannes Schickel | 2008-03-21 23:54:47 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-03-21 23:54:47 +0000 |
commit | 5107404089c1572f690f90fa3880c2170c20056c (patch) | |
tree | 2f35fb7fa808c394a4d7c35e8af378f7deb71e45 /engines/kyra | |
parent | 2a4aa9c379ba218a768e7ad052ec8b1b365b0ad1 (diff) | |
download | scummvm-rg350-5107404089c1572f690f90fa3880c2170c20056c.tar.gz scummvm-rg350-5107404089c1572f690f90fa3880c2170c20056c.tar.bz2 scummvm-rg350-5107404089c1572f690f90fa3880c2170c20056c.zip |
- improved timer information output in debugger
- fixed timer data loading
svn-id: r31215
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/debugger.cpp | 3 | ||||
-rw-r--r-- | engines/kyra/timer.cpp | 14 | ||||
-rw-r--r-- | engines/kyra/timer.h | 1 |
3 files changed, 16 insertions, 2 deletions
diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp index e2523b71cc..462e15bb75 100644 --- a/engines/kyra/debugger.cpp +++ b/engines/kyra/debugger.cpp @@ -179,8 +179,9 @@ bool Debugger_v1::cmd_queryFlag(int argc, const char **argv) { } bool Debugger_v1::cmd_listTimers(int argc, const char **argv) { + DebugPrintf("Current time: %-8u\n", g_system->getMillis()); for (int i = 0; i < _vm->timer()->count(); i++) - DebugPrintf("Timer %-2i: Active: %-3s Countdown: %-6i\n", i, _vm->timer()->isEnabled(i) ? "Yes" : "No", _vm->timer()->getDelay(i)); + DebugPrintf("Timer %-2i: Active: %-3s Countdown: %-6i %-8u\n", i, _vm->timer()->isEnabled(i) ? "Yes" : "No", _vm->timer()->getDelay(i), _vm->timer()->getNextRun(i)); return true; } diff --git a/engines/kyra/timer.cpp b/engines/kyra/timer.cpp index c0f47111c6..dce4ad26d0 100644 --- a/engines/kyra/timer.cpp +++ b/engines/kyra/timer.cpp @@ -38,7 +38,7 @@ struct TimerResync : public Common::UnaryFunction<TimerEntry&, void> { void operator()(TimerEntry &entry) const { if (entry.lastUpdate < 0) { - if ((entry.lastUpdate + _curTime) <= 0) + if ((uint32)(ABS(entry.lastUpdate)) >= entry.countdown * _tickLength) entry.nextRun = 0; else entry.nextRun = _curTime + entry.lastUpdate + entry.countdown * _tickLength; @@ -164,6 +164,17 @@ int32 TimerManager::getDelay(uint8 id) const { return -1; } +uint32 TimerManager::getNextRun(uint8 id) const { + debugC(9, kDebugLevelTimer, "TimerManager::getNextRun(%d)", id); + + CIterator timer = Common::find_if(_timers.begin(), _timers.end(), TimerEqual(id)); + if (timer != _timers.end()) + return timer->nextRun; + + warning("TimerManager::getNextRun: No timer %d", id); + return 0xFFFFFFFF; +} + bool TimerManager::isEnabled(uint8 id) const { debugC(9, kDebugLevelTimer, "TimerManager::isEnabled(%d)", id); @@ -232,6 +243,7 @@ void TimerManager::loadDataFromFile(Common::InSaveFile *file, int version) { timer->enabled = file->readByte(); timer->countdown = file->readSint32BE(); timer->lastUpdate = file->readSint32BE(); + debug("%d %d", id, timer->lastUpdate); } else { warning("Loading timer data for non existing timer %d", id); file->seek(7, SEEK_CUR); diff --git a/engines/kyra/timer.h b/engines/kyra/timer.h index 2c0251ffb7..d3d6f6834d 100644 --- a/engines/kyra/timer.h +++ b/engines/kyra/timer.h @@ -69,6 +69,7 @@ public: void setCountdown(uint8 id, int32 countdown); void setDelay(uint8 id, int32 countdown); int32 getDelay(uint8 id) const; + uint32 getNextRun(uint8 id) const; bool isEnabled(uint8 id) const; void enable(uint8 id); |