[Scummvm-cvs-logs] SF.net SVN: scummvm: [31215] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Mar 22 00:54:47 CET 2008


Revision: 31215
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31215&view=rev
Author:   lordhoto
Date:     2008-03-21 16:54:47 -0700 (Fri, 21 Mar 2008)

Log Message:
-----------
- improved timer information output in debugger
- fixed timer data loading

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/debugger.cpp
    scummvm/trunk/engines/kyra/timer.cpp
    scummvm/trunk/engines/kyra/timer.h

Modified: scummvm/trunk/engines/kyra/debugger.cpp
===================================================================
--- scummvm/trunk/engines/kyra/debugger.cpp	2008-03-21 21:07:34 UTC (rev 31214)
+++ scummvm/trunk/engines/kyra/debugger.cpp	2008-03-21 23:54:47 UTC (rev 31215)
@@ -179,8 +179,9 @@
 }
 
 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;
 }

Modified: scummvm/trunk/engines/kyra/timer.cpp
===================================================================
--- scummvm/trunk/engines/kyra/timer.cpp	2008-03-21 21:07:34 UTC (rev 31214)
+++ scummvm/trunk/engines/kyra/timer.cpp	2008-03-21 23:54:47 UTC (rev 31215)
@@ -38,7 +38,7 @@
 
 	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 @@
 	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 @@
 				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);

Modified: scummvm/trunk/engines/kyra/timer.h
===================================================================
--- scummvm/trunk/engines/kyra/timer.h	2008-03-21 21:07:34 UTC (rev 31214)
+++ scummvm/trunk/engines/kyra/timer.h	2008-03-21 23:54:47 UTC (rev 31215)
@@ -69,6 +69,7 @@
 	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);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list