diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp index c39f0e4d470..4930987af0c 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 cc47735e4c5..62bc3179cc7 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 c969a7f028c..0e63b5e2163 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 3ddc9fde06b..f86930a56e2 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 afcc0b22959..58dd305b9a2 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 543e8def373..10cfb5333b2 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();