diff --git a/engines/agos/debugger.cpp b/engines/agos/debugger.cpp index 578475bf783..071aaf236d0 100644 --- a/engines/agos/debugger.cpp +++ b/engines/agos/debugger.cpp @@ -42,6 +42,8 @@ Debugger::Debugger(AGOSEngine *vm) DCmd_Register("sound", WRAP_METHOD(Debugger, Cmd_PlaySound)); DCmd_Register("voice", WRAP_METHOD(Debugger, Cmd_PlayVoice)); DCmd_Register("bit", WRAP_METHOD(Debugger, Cmd_SetBit)); + DCmd_Register("bit2", WRAP_METHOD(Debugger, Cmd_SetBit2)); + DCmd_Register("bit3", WRAP_METHOD(Debugger, Cmd_SetBit2)); DCmd_Register("var", WRAP_METHOD(Debugger, Cmd_SetVar)); DCmd_Register("obj", WRAP_METHOD(Debugger, Cmd_SetObjectFlag)); DCmd_Register("sub", WRAP_METHOD(Debugger, Cmd_StartSubroutine)); @@ -146,6 +148,52 @@ bool Debugger::Cmd_SetBit(int argc, const char **argv) { return true; } +bool Debugger::Cmd_SetBit2(int argc, const char **argv) { + uint bit, value; + if (argc > 2) { + bit = atoi(argv[1]); + value = atoi(argv[2]); + if (value == 0) { + _vm->_bitArrayTwo[bit / 16] &= ~(1 << (bit & 15)); + DebugPrintf("Set bit2 %d to %d\n", bit, value); + } else if (value == 1) { + _vm->_bitArrayTwo[bit / 16] |= (1 << (bit & 15)); + DebugPrintf("Set bit2 %d to %d\n", bit, value); + } else + DebugPrintf("Bit2 value out of range (0 - 1)\n"); + } else if (argc > 1) { + bit = atoi(argv[1]); + value = (_vm->_bitArrayTwo[bit / 16] & (1 << (bit & 15))) != 0; + DebugPrintf("Bit2 %d is %d\n", bit, value); + } else + DebugPrintf("Syntax: bit2 \n"); + + return true; +} + +bool Debugger::Cmd_SetBit3(int argc, const char **argv) { + uint bit, value; + if (argc > 2) { + bit = atoi(argv[1]); + value = atoi(argv[2]); + if (value == 0) { + _vm->_bitArrayThree[bit / 16] &= ~(1 << (bit & 15)); + DebugPrintf("Set bit3 %d to %d\n", bit, value); + } else if (value == 1) { + _vm->_bitArrayThree[bit / 16] |= (1 << (bit & 15)); + DebugPrintf("Set bit3 %d to %d\n", bit, value); + } else + DebugPrintf("Bit3 value out of range (0 - 1)\n"); + } else if (argc > 1) { + bit = atoi(argv[1]); + value = (_vm->_bitArrayThree[bit / 16] & (1 << (bit & 15))) != 0; + DebugPrintf("Bit3 %d is %d\n", bit, value); + } else + DebugPrintf("Syntax: bit3 \n"); + + return true; +} + bool Debugger::Cmd_SetVar(int argc, const char **argv) { uint var, value; if (argc > 1) { diff --git a/engines/agos/debugger.h b/engines/agos/debugger.h index 0dc5d4fe183..277378a2780 100644 --- a/engines/agos/debugger.h +++ b/engines/agos/debugger.h @@ -48,6 +48,8 @@ protected: bool Cmd_PlaySound(int argc, const char **argv); bool Cmd_PlayVoice(int argc, const char **argv); bool Cmd_SetBit(int argc, const char **argv); + bool Cmd_SetBit2(int argc, const char **argv); + bool Cmd_SetBit3(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);