From 8d59006bd7ed3ea00e84649d316139da4fa37408 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Mon, 28 Jul 2008 08:25:06 +0000 Subject: [PATCH] Some instrumentation for script debugging. svn-id: r33359 --- engines/parallaction/exec.h | 6 ++---- engines/parallaction/exec_br.cpp | 5 +++-- engines/parallaction/exec_ns.cpp | 5 +++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/parallaction/exec.h b/engines/parallaction/exec.h index 887d6be5268..9ac343dc62b 100644 --- a/engines/parallaction/exec.h +++ b/engines/parallaction/exec.h @@ -143,10 +143,6 @@ public: ~CommandExec_br(); }; - - - - class ProgramExec { protected: struct ParallactionStruct2 { @@ -157,6 +153,8 @@ protected: bool suspend; } _ctxt; + const char **_instructionNames; + OpcodeSet _opcodes; uint16 _modCounter; diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp index ef671b1e0ed..9376aa57efe 100644 --- a/engines/parallaction/exec_br.cpp +++ b/engines/parallaction/exec_br.cpp @@ -61,8 +61,6 @@ namespace Parallaction { #define INST_STOP 30 #define INST_ENDSCRIPT 31 - - #define SetOpcodeTable(x) table = &x; typedef Common::Functor0Mem OpcodeV1; @@ -73,6 +71,8 @@ typedef Common::Functor0Mem OpcodeV2; #define INSTRUCTION_OPCODE(op) table->push_back(new OpcodeV2(this, &ProgramExec_br::instOp_##op)) #define DECLARE_INSTRUCTION_OPCODE(op) void ProgramExec_br::instOp_##op() +extern const char *_instructionNamesRes_br[]; + void Parallaction_br::setupSubtitles(char *s, char *s2, int y) { debugC(5, kDebugExec, "setupSubtitles(%s, %s, %i)", s, s2, y); @@ -602,6 +602,7 @@ void ProgramExec_br::init() { } ProgramExec_br::ProgramExec_br(Parallaction_br *vm) : ProgramExec_ns(vm), _vm(vm) { + _instructionNames = _instructionNamesRes_br; } ProgramExec_br::~ProgramExec_br() { diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index e596f2e971d..fee215289b0 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -61,7 +61,7 @@ typedef Common::Functor0Mem OpcodeV2; #define INSTRUCTION_OPCODE(op) table->push_back(new OpcodeV2(this, &ProgramExec_ns::instOp_##op)) #define DECLARE_INSTRUCTION_OPCODE(op) void ProgramExec_ns::instOp_##op() - +extern const char *_instructionNamesRes_ns[]; DECLARE_INSTRUCTION_OPCODE(on) { @@ -394,7 +394,7 @@ void ProgramExec::runScripts(ProgramList::iterator first, ProgramList::iterator (*it)->_status = kProgramRunning; - debugC(9, kDebugExec, "Animation: %s, instruction: %i", a->_name, (*inst)->_index); //_instructionNamesRes[(*inst)->_index - 1]); + debugC(9, kDebugExec, "anim: %s, inst[%02i]: %s", a->_name, (*inst)->_index, _instructionNames[(*inst)->_index - 1]); _ctxt.inst = inst; _ctxt.anim = AnimationPtr(a); @@ -755,6 +755,7 @@ void ProgramExec_ns::init() { } ProgramExec_ns::ProgramExec_ns(Parallaction_ns *vm) : _vm(vm) { + _instructionNames = _instructionNamesRes_ns; } ProgramExec_ns::~ProgramExec_ns() {