aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2008-02-09 22:07:51 +0000
committerNicola Mettifogo2008-02-09 22:07:51 +0000
commitcf724e889ce551082a1c3e443b11e9523f068e8d (patch)
tree5c7a3c53744d39fb4bdb9bbf3563e5dc9e39e710
parentbc257fc37809981e4189f30603ffaa7df7343e26 (diff)
downloadscummvm-rg350-cf724e889ce551082a1c3e443b11e9523f068e8d.tar.gz
scummvm-rg350-cf724e889ce551082a1c3e443b11e9523f068e8d.tar.bz2
scummvm-rg350-cf724e889ce551082a1c3e443b11e9523f068e8d.zip
Added new debug command to dump scripts execution status.
svn-id: r30840
-rw-r--r--engines/parallaction/debug.cpp22
-rw-r--r--engines/parallaction/debug.h1
-rw-r--r--engines/parallaction/exec_br.cpp1
-rw-r--r--engines/parallaction/exec_ns.cpp3
-rw-r--r--engines/parallaction/objects.cpp1
-rw-r--r--engines/parallaction/objects.h7
6 files changed, 35 insertions, 0 deletions
diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp
index c39f0e4d47..4930987af0 100644
--- a/engines/parallaction/debug.cpp
+++ b/engines/parallaction/debug.cpp
@@ -46,6 +46,7 @@ Debugger::Debugger(Parallaction *vm)
DCmd_Register("locations", WRAP_METHOD(Debugger, Cmd_Locations));
DCmd_Register("gfxobjects", WRAP_METHOD(Debugger, Cmd_GfxObjects));
DCmd_Register("set", WRAP_METHOD(Debugger, Cmd_Set));
+ DCmd_Register("programs", WRAP_METHOD(Debugger, Cmd_Programs));
}
@@ -216,4 +217,25 @@ bool Debugger::Cmd_Set(int argc, const char** argv) {
return true;
}
+bool Debugger::Cmd_Programs(int argc, const char** argv) {
+
+ ProgramList::iterator b = _vm->_programs.begin();
+ ProgramList::iterator e = _vm->_programs.end();
+
+ const char *status[] = { "idle", "running", "completed" };
+
+ int i = 1;
+
+ DebugPrintf("+---+--------------------+----------+\n"
+ "| # | bound animation | status |\n"
+ "+---+--------------------+----------+\n");
+ for ( ; b != e; b++, i++) {
+ Program *p = *b;
+ DebugPrintf("|%3i|%-20s|%-10s|\n", i, p->_anim->_name, status[p->_status] );
+ }
+ DebugPrintf("+---+--------------------+---------+\n");
+
+ return true;
+}
+
} // namespace Parallaction
diff --git a/engines/parallaction/debug.h b/engines/parallaction/debug.h
index cc47735e4c..62bc3179cc 100644
--- a/engines/parallaction/debug.h
+++ b/engines/parallaction/debug.h
@@ -30,6 +30,7 @@ protected:
bool Cmd_GfxObjects(int argc, const char **argv);
bool Cmd_GfxFeature(int argc, const char** argv);
bool Cmd_Set(int argc, const char** argv);
+ bool Cmd_Programs(int argc, const char** argv);
};
} // End of namespace Parallaction
diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index c969a7f028..0e63b5e216 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -489,6 +489,7 @@ DECLARE_INSTRUCTION_OPCODE(endscript) {
if ((_instRunCtxt.anim->_flags & kFlagsLooping) == 0) {
_instRunCtxt.anim->_flags &= ~kFlagsActing;
runCommands(_instRunCtxt.anim->_commands, _instRunCtxt.anim);
+ _instRunCtxt.program->_status = kProgramDone;
}
_instRunCtxt.program->_ip = _instRunCtxt.program->_instructions.begin();
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index 3ddc9fde06..f86930a56e 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -180,6 +180,7 @@ DECLARE_INSTRUCTION_OPCODE(endscript) {
if ((_instRunCtxt.anim->_flags & kFlagsLooping) == 0) {
_instRunCtxt.anim->_flags &= ~kFlagsActing;
runCommands(_instRunCtxt.anim->_commands, _instRunCtxt.anim);
+ _instRunCtxt.program->_status = kProgramDone;
}
_instRunCtxt.program->_ip = _instRunCtxt.program->_instructions.begin();
@@ -386,6 +387,8 @@ void Parallaction_ns::runScripts() {
InstructionList::iterator inst = (*it)->_ip;
while (((*inst)->_index != INST_SHOW) && (a->_flags & kFlagsActing)) {
+ (*it)->_status = kProgramRunning;
+
debugC(9, kDebugExec, "Animation: %s, instruction: %s", a->_name, _instructionNamesRes[(*inst)->_index - 1]);
_instRunCtxt.inst = inst;
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp
index afcc0b2295..58dd305b9a 100644
--- a/engines/parallaction/objects.cpp
+++ b/engines/parallaction/objects.cpp
@@ -85,6 +85,7 @@ Program::Program() {
_loopCounter = 0;
_locals = new LocalVariable[NUM_LOCALS];
_numLocals = 0;
+ _status = kProgramIdle;
}
Program::~Program() {
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index 543e8def37..10cfb5333b 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -363,6 +363,11 @@ struct Instruction {
};
+enum {
+ kProgramIdle, // awaiting execution
+ kProgramRunning, // running
+ kProgramDone // execution completed
+};
struct Program {
Animation *_anim;
@@ -377,6 +382,8 @@ struct Program {
InstructionList::iterator _loopStart;
InstructionList _instructions;
+ uint32 _status;
+
Program();
~Program();