diff options
author | Scott Percival | 2019-11-30 23:56:53 +0800 |
---|---|---|
committer | Scott Percival | 2019-12-02 21:57:10 +0800 |
commit | f1b0c10fe4f810527e73b58642eed0e512243ae0 (patch) | |
tree | 526417b5e4d8eb3265e05c2b9db94c95a1a5c458 /engines/director | |
parent | 473a2b7463bc44a2535c61e7efad2157120d2daf (diff) | |
download | scummvm-rg350-f1b0c10fe4f810527e73b58642eed0e512243ae0.tar.gz scummvm-rg350-f1b0c10fe4f810527e73b58642eed0e512243ae0.tar.bz2 scummvm-rg350-f1b0c10fe4f810527e73b58642eed0e512243ae0.zip |
DIRECTOR: Show code offsets for stack printouts in Lingo::execute
Diffstat (limited to 'engines/director')
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-codegen.cpp | 11 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 2 |
3 files changed, 8 insertions, 7 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 38bd6e4c3b..f823209b88 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -1003,7 +1003,7 @@ void Lingo::c_whencode() { Datum d; uint start = g_lingo->_pc; uint end = g_lingo->readInt() + start - 1; - Common::String eventname(g_lingo->readString()) + Common::String eventname(g_lingo->readString()); start = g_lingo->_pc; diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index c317e427d6..0e3904e89e 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -55,17 +55,18 @@ namespace Director { void Lingo::execute(uint pc) { for (_pc = pc; !_returning && (*_currentScript)[_pc] != STOP;) { Common::String instr = decodeInstruction(_currentScript, _pc); + uint current = _pc; if (debugChannelSet(5, kDebugLingoExec)) - printStack("Stack before: "); + printStack("Stack before: ", current); - debugC(1, kDebugLingoExec, "[%3d]: %s", _pc, instr.c_str()); + debugC(1, kDebugLingoExec, "[%3d]: %s", current, instr.c_str()); _pc++; (*((*_currentScript)[_pc - 1]))(); if (debugChannelSet(5, kDebugLingoExec)) - printStack("Stack after: "); + printStack("Stack after: ", current); if (_pc >= (*_currentScript).size()) { warning("Lingo::execute(): Bad PC (%d)", _pc); @@ -74,7 +75,7 @@ void Lingo::execute(uint pc) { } } -void Lingo::printStack(const char *s) { +void Lingo::printStack(const char *s, uint pc) { Common::String stack(s); for (uint i = 0; i < _stack.size(); i++) { @@ -82,7 +83,7 @@ void Lingo::printStack(const char *s) { d.toString(); stack += Common::String::format("<%s> ", d.u.s->c_str()); } - debugC(5, kDebugLingoExec, "%s", stack.c_str()); + debugC(5, kDebugLingoExec, "[%3d]: %s", pc, stack.c_str()); } Common::String Lingo::decodeInstruction(ScriptData *sd, uint pc, uint *newPc) { diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 125667189f..d434bdabac 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -172,7 +172,7 @@ public: void addCodeV4(Common::SeekableSubReadStreamEndian &stream, ScriptType type, uint16 id); void addNamesV4(Common::SeekableSubReadStreamEndian &stream); void executeScript(ScriptType type, uint16 id, uint16 function); - void printStack(const char *s); + void printStack(const char *s, uint pc); Common::String decodeInstruction(ScriptData *sd, uint pc, uint *newPC = NULL); void initBuiltIns(); |