From f334797caa7ab377b2b9be0d6b9115ae263facdc Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Thu, 9 Nov 2006 10:41:29 +0000 Subject: Add debugger command, to allow object flag vlaues to be altered. svn-id: r24663 --- engines/agos/debugger.cpp | 36 ++++++++++++++++++++++++++++++++++++ engines/agos/debugger.h | 1 + 2 files changed, 37 insertions(+) diff --git a/engines/agos/debugger.cpp b/engines/agos/debugger.cpp index 485eac4483..f0d6d9a53b 100644 --- a/engines/agos/debugger.cpp +++ b/engines/agos/debugger.cpp @@ -41,6 +41,7 @@ Debugger::Debugger(AGOSEngine *vm) DCmd_Register("voice", WRAP_METHOD(Debugger, Cmd_PlayVoice)); DCmd_Register("bit", WRAP_METHOD(Debugger, Cmd_SetBit)); DCmd_Register("var", WRAP_METHOD(Debugger, Cmd_SetVar)); + DCmd_Register("obj", WRAP_METHOD(Debugger, Cmd_SetObjectFlag)); DCmd_Register("sub", WRAP_METHOD(Debugger, Cmd_StartSubroutine)); } @@ -162,6 +163,41 @@ bool Debugger::Cmd_SetVar(int argc, const char **argv) { return true; } +bool Debugger::Cmd_SetObjectFlag(int argc, const char **argv) { + uint obj, prop, value; + if (argc > 2) { + obj = atoi(argv[1]); + prop = atoi(argv[2]); + + if (obj >= 1 && obj < _vm->_itemArraySize) { + SubObject *o = (SubObject *)_vm->findChildOfType(_vm->derefItem(obj), 2); + if (o != NULL) { + if (o->objectFlags & (1 << prop) && prop < 16) { + uint offs = _vm->getOffsetOfChild2Param(o, 1 << prop); + if (argc > 3) { + value = atoi(argv[3]); + o->objectFlagValue[offs] = value; + DebugPrintf("Object %d Flag %d set to %d\n", obj, prop, value); + } else { + value = o->objectFlagValue[offs]; + DebugPrintf("Object %d Flag %d is %d\n", obj, prop, value); + } + } else { + DebugPrintf("Object flag out of range\n"); + } + } else { + DebugPrintf("Item isn't an object\n"); + } + } else { + DebugPrintf("Item out of range (1 - %d)\n", _vm->_itemArraySize - 1); + } + } else { + DebugPrintf("Syntax: obj \n"); + } + + return true; +} + bool Debugger::Cmd_StartSubroutine(int argc, const char **argv) { if (argc > 1) { uint subroutine = atoi(argv[1]); diff --git a/engines/agos/debugger.h b/engines/agos/debugger.h index fc1ae748ac..78791649de 100644 --- a/engines/agos/debugger.h +++ b/engines/agos/debugger.h @@ -47,6 +47,7 @@ protected: bool Cmd_PlayVoice(int argc, const char **argv); bool Cmd_SetBit(int argc, const char **argv); bool Cmd_SetVar(int argc, const char **argv); + bool Cmd_SetObjectFlag(int argc, const char **argv); bool Cmd_StartSubroutine(int argc, const char **argv); }; -- cgit v1.2.3