From ef14311c99ceab8680aae8faa7bcf4fc59cbdf2d Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Fri, 19 Oct 2007 20:27:10 +0000 Subject: Added new debugger command 'localflags' and changed Table object to provide debug info for it. svn-id: r29230 --- engines/parallaction/debug.cpp | 21 ++++++++++++++++++++- engines/parallaction/debug.h | 2 +- engines/parallaction/objects.cpp | 6 ++++++ engines/parallaction/objects.h | 3 +++ 4 files changed, 30 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp index 1f06cedce9..57d7e936d7 100644 --- a/engines/parallaction/debug.cpp +++ b/engines/parallaction/debug.cpp @@ -67,7 +67,7 @@ Debugger::Debugger(Parallaction *vm) DCmd_Register("jobs", WRAP_METHOD(Debugger, Cmd_Jobs)); DCmd_Register("zones", WRAP_METHOD(Debugger, Cmd_Zones)); DCmd_Register("animations", WRAP_METHOD(Debugger, Cmd_Animations)); - + DCmd_Register("localflags", WRAP_METHOD(Debugger, Cmd_LocalFlags)); } @@ -109,6 +109,25 @@ bool Debugger::Cmd_Location(int argc, const char **argv) { } +bool Debugger::Cmd_LocalFlags(int argc, const char **argv) { + + JobList::iterator b = _vm->_jobs.begin(); + JobList::iterator e = _vm->_jobs.end(); + + uint32 flags = _vm->_localFlags[_vm->_currentLocationIndex]; + + DebugPrintf("+------------------------------+---------+\n" + "| flag name | value |\n" + "+------------------------------+---------+\n"); + for (uint i = 0; i < _vm->_localFlagNames->count(); i++) { + const char *value = ((flags & (1 << i)) == 0) ? "OFF" : "ON"; + DebugPrintf("|%-30s|% -6s|\n", _vm->_localFlagNames->item(i), value); + } + DebugPrintf("+------------------------------+---------+\n"); + + return true; +} + bool Debugger::Cmd_Give(int argc, const char **argv) { if (argc == 1) { diff --git a/engines/parallaction/debug.h b/engines/parallaction/debug.h index 17b3fbb14f..b5bd0f68ad 100644 --- a/engines/parallaction/debug.h +++ b/engines/parallaction/debug.h @@ -25,7 +25,7 @@ protected: bool Cmd_Jobs(int argc, const char **argv); bool Cmd_Zones(int argc, const char **argv); bool Cmd_Animations(int argc, const char **argv); - + bool Cmd_LocalFlags(int argc, const char **argv); }; } // End of namespace Parallaction diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp index 20f7469457..3ada9d96be 100644 --- a/engines/parallaction/objects.cpp +++ b/engines/parallaction/objects.cpp @@ -381,6 +381,12 @@ void Table::clear() { _used = 0; } +const char *Table::item(uint index) const { + assert(index < _used); + return _data[index]; +} + + FixedTable::FixedTable(uint32 size, uint32 fixed) : Table(size), _numFixed(fixed) { } diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h index 41e8bbcf5d..742d0e4c90 100644 --- a/engines/parallaction/objects.h +++ b/engines/parallaction/objects.h @@ -442,6 +442,9 @@ public: notFound = 0 }; + uint count() const { return _used; } + const char *item(uint index) const; + virtual void addData(const char* s); virtual void clear(); virtual uint16 lookup(const char* s); -- cgit v1.2.3