aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2008-02-17 14:14:26 +0000
committerJohannes Schickel2008-02-17 14:14:26 +0000
commit5b31fe75d4cf8cc7c6c0272d660ebf07a49916bd (patch)
tree77762fea0297ae0834f27bf953cf7db56ca132e0
parent90d04815bd14b24027c006a63b7352e461038885 (diff)
downloadscummvm-rg350-5b31fe75d4cf8cc7c6c0272d660ebf07a49916bd.tar.gz
scummvm-rg350-5b31fe75d4cf8cc7c6c0272d660ebf07a49916bd.tar.bz2
scummvm-rg350-5b31fe75d4cf8cc7c6c0272d660ebf07a49916bd.zip
Print instruction offset of script commands for debug output.
svn-id: r30895
-rw-r--r--engines/kyra/script.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/kyra/script.cpp b/engines/kyra/script.cpp
index 9f241c3d00..5558a397e4 100644
--- a/engines/kyra/script.cpp
+++ b/engines/kyra/script.cpp
@@ -186,6 +186,9 @@ bool ScriptHelper::runScript(ScriptState *script) {
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 @@ bool ScriptHelper::runScript(ScriptState *script) {
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);
}