Add bit2 and bit3 options to debugger.

svn-id: r40231
This commit is contained in:
Travis Howell 2009-05-01 14:31:59 +00:00
parent 50ddc0daf0
commit a287eae15d
2 changed files with 50 additions and 0 deletions

View File

@ -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 <bitnum> <value>\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 <bitnum> <value>\n");
return true;
}
bool Debugger::Cmd_SetVar(int argc, const char **argv) {
uint var, value;
if (argc > 1) {

View File

@ -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);