diff options
author | Eugene Sandulenko | 2016-08-22 10:02:14 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-22 10:02:14 +0200 |
commit | f47ab0000f503b2d4fa138550cb6bd636aa7a3db (patch) | |
tree | efef002713e8170082f7dee7455a96c7cf77a141 | |
parent | fdb451bacaae8fdd5c3cf5a29502ac13163b511c (diff) | |
download | scummvm-rg350-f47ab0000f503b2d4fa138550cb6bd636aa7a3db.tar.gz scummvm-rg350-f47ab0000f503b2d4fa138550cb6bd636aa7a3db.tar.bz2 scummvm-rg350-f47ab0000f503b2d4fa138550cb6bd636aa7a3db.zip |
DIRECTOR: Lingo: Improved debug output
-rw-r--r-- | engines/director/lingo/lingo-codegen.cpp | 26 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 1 |
2 files changed, 18 insertions, 9 deletions
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index 32ddea47ac..9f3b1e26fa 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -55,20 +55,28 @@ void Lingo::execute(int pc) { for(_pc = pc; (*_currentScript)[_pc] != STOP && !_returning;) { Common::String instr = decodeInstruction(_pc); - debugC(1, kDebugLingoExec, "[%3d]: %s", _pc, instr.c_str()); - - Common::String stack("Stack: "); + if (debugChannelSet(5, kDebugLingoExec)) + printStack("Stack before: "); - for (uint i = 0; i < _stack.size(); i++) { - Datum d = _stack[i]; - d.toString(); - stack += Common::String::format("<%s> ", d.u.s->c_str()); - } - debugC(5, kDebugLingoExec, "%s", stack.c_str()); + debugC(1, kDebugLingoExec, "[%3d]: %s", _pc, instr.c_str()); _pc++; (*((*_currentScript)[_pc - 1]))(); + + if (debugChannelSet(5, kDebugLingoExec)) + printStack("Stack after: "); + } +} + +void Lingo::printStack(const char *s) { + Common::String stack(s); + + for (uint i = 0; i < _stack.size(); i++) { + Datum d = _stack[i]; + d.toString(); + stack += Common::String::format("<%s> ", d.u.s->c_str()); } + debugC(5, kDebugLingoExec, "%s", stack.c_str()); } Common::String Lingo::decodeInstruction(int pc, int *newPc) { diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 5f4eb78f78..b197abd9d7 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -175,6 +175,7 @@ public: void addCode(const char *code, ScriptType type, uint16 id); void executeScript(ScriptType type, uint16 id); + void printStack(const char *s); Common::String decodeInstruction(int pc, int *newPC = NULL); void processEvent(LEvent event, int entityId); |