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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Feb 17 15:14:27 CET 2008


Revision: 30895
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30895&view=rev
Author:   lordhoto
Date:     2008-02-17 06:14:26 -0800 (Sun, 17 Feb 2008)

Log Message:
-----------
Print instruction offset of script commands for debug output.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/script.cpp

Modified: scummvm/trunk/engines/kyra/script.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script.cpp	2008-02-17 14:06:18 UTC (rev 30894)
+++ scummvm/trunk/engines/kyra/script.cpp	2008-02-17 14:14:26 UTC (rev 30895)
@@ -186,6 +186,9 @@
 	if (!script->ip)
 		return false;
 
+	// Should be no Problem at all to cast to uint32 here, since that's the biggest ptrdiff the original
+	// would allow, of course that's not realistic to happen to be somewhere near the limit of uint32 anyway.
+	const uint32 instOffset = (uint32)((const byte*)script->ip - (const byte*)script->dataPtr->data);
 	int16 code = *script->ip++;
 	int16 opcode = (code >> 8) & 0x1F;
 
@@ -203,7 +206,7 @@
 	if (opcode > 18) {
 		error("Script unknown command: %d", opcode);
 	} else {
-		debugC(5, kDebugLevelScript, "%s([%d/%u])", _commands[opcode].desc, _parameter, (uint)_parameter);
+		debugC(5, kDebugLevelScript, "[0x%.08X] %s([%d/%u])", instOffset, _commands[opcode].desc, _parameter, (uint)_parameter);
 		(this->*(_commands[opcode].proc))(script);
 	}
 


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