Cleanup of the debugger commands, added some more commands, removed now obsolete debug code

svn-id: r30350
This commit is contained in:
Filippos Karapetis 2008-01-09 09:46:26 +00:00
parent c14d420141
commit b0f2e823e0
4 changed files with 28 additions and 79 deletions

View File

@ -251,16 +251,16 @@ Mickey_Console::Mickey_Console(PreAgiEngine *vm, Mickey *mickey) : PreAGI_Consol
_mickey = mickey;
DCmd_Register("curRoom", WRAP_METHOD(Mickey_Console, Cmd_CurRoom));
DCmd_Register("showPic", WRAP_METHOD(Mickey_Console, Cmd_ShowPic));
DCmd_Register("drawPic", WRAP_METHOD(Mickey_Console, Cmd_DrawPic));
DCmd_Register("drawObj", WRAP_METHOD(Mickey_Console, Cmd_DrawObj));
}
bool Mickey_Console::Cmd_CurRoom(int argc, const char **argv) {
_mickey->debugCurRoom();
return true;
}
bool Mickey_Console::Cmd_ShowPic(int argc, const char **argv) {
bool Mickey_Console::Cmd_DrawPic(int argc, const char **argv) {
if (argc != 2)
DebugPrintf("Usage: %s <Picture number>\n", argv[0]);
else
@ -268,6 +268,14 @@ bool Mickey_Console::Cmd_ShowPic(int argc, const char **argv) {
return true;
}
bool Mickey_Console::Cmd_DrawObj(int argc, const char **argv) {
if (argc != 2)
DebugPrintf("Usage: %s <Object number>\n", argv[0]);
else
_mickey->drawObj((ENUM_MSA_OBJECT)atoi(argv[1]), 0, 0);
return true;
}
Winnie_Console::Winnie_Console(PreAgiEngine *vm, Winnie *winnie) : PreAGI_Console(vm) {
_winnie = winnie;

View File

@ -103,7 +103,8 @@ private:
Mickey *_mickey;
bool Cmd_CurRoom(int argc, const char **argv);
bool Cmd_ShowPic(int argc, const char **argv);
bool Cmd_DrawPic(int argc, const char **argv);
bool Cmd_DrawObj(int argc, const char **argv);
};
class Winnie_Console : public PreAGI_Console {

View File

@ -637,27 +637,6 @@ void Mickey::playSound(ENUM_MSA_SOUND iSound) {
delete [] buffer;
}
void Mickey::debug() {
char szLine[41] = {0};
_vm->clearScreen(IDA_DEFAULT);
sprintf(szLine, IDS_MSA_DEBUG_ROOM, _game.iRoom);
_vm->drawStr(5, 10, IDA_DEFAULT, szLine);
if (_game.iRoom < IDI_MSA_MAX_PIC_ROOM) {
if (_game.iRmObj[_game.iRoom] != IDI_MSA_OBJECT_NONE) {
sprintf(szLine, IDS_MSA_DEBUG_OBJ, _game.iRmObj[_game.iRoom]);
_vm->drawStr(7, 10, IDA_DEFAULT, szLine);
}
} else {
sprintf(szLine, IDS_MSA_DEBUG_OBJ, 32);
_vm->drawStr(7, 10, IDA_DEFAULT, szLine);
}
_vm->_gfx->doUpdate();
_vm->_system->updateScreen(); // TODO: this should go in the game's main loop
}
// Graphics
void Mickey::drawObj(ENUM_MSA_OBJECT iObj, int x0, int y0) {
@ -789,25 +768,19 @@ void Mickey::drawRoom() {
int nObjs;
// Draw room picture
if (true) { // (!getDebug()) { // TODO
if (_game.iRoom == IDI_MSA_PIC_TITLE) {
drawPic(IDI_MSA_PIC_TITLE);
} else {
drawPic(_game.iRmPic[_game.iRoom]);
if (_game.iRoom == IDI_MSA_PIC_TITLE) {
drawPic(IDI_MSA_PIC_TITLE);
} else {
drawPic(_game.iRmPic[_game.iRoom]);
if (_game.iRoom == IDI_MSA_PIC_SHIP_CONTROLS) {
// Draw ship control room window
if (_game.fFlying) {
drawObj(IDI_MSA_OBJECT_W_SPACE, 0, 0);
} else {
drawObj((ENUM_MSA_OBJECT)(IDI_MSA_OBJECT_W_EARTH + _game.iPlanet), 0, 1);
}
if (_game.iRoom == IDI_MSA_PIC_SHIP_CONTROLS) {
// Draw ship control room window
if (_game.fFlying) {
drawObj(IDI_MSA_OBJECT_W_SPACE, 0, 0);
} else {
drawObj((ENUM_MSA_OBJECT)(IDI_MSA_OBJECT_W_EARTH + _game.iPlanet), 0, 1);
}
}
} else {
// Debug
drawPic(0);
debug();
}
// Draw room objects
@ -2077,41 +2050,14 @@ void Mickey::waitAnyKey(bool anim) {
}
}
// Debug
void Mickey::debug_DrawObjs() {
char szTitle[14] = {0};
for (int iObj = 0; iObj < IDI_MSA_MAX_OBJ; iObj++) {
drawPic(0);
drawObj((ENUM_MSA_OBJECT)iObj, 0, 0);
_vm->clearTextArea();
sprintf(szTitle, "Object %d", iObj);
_vm->drawStrMiddle(22, IDA_DEFAULT, szTitle);
_vm->drawStrMiddle(23, IDA_DEFAULT, (const char *)IDS_MSA_NAME_OBJ[iObj]);
waitAnyKey();
}
}
void Mickey::debug_DrawPics(){
char szTitle[14] = {0};
for (int iPic = 1; iPic <= IDI_MSA_MAX_PIC; iPic++) {
drawPic(iPic);
_vm->clearTextArea();
sprintf(szTitle, "Picture %d", iPic);
_vm->drawStrMiddle(22, IDA_DEFAULT, szTitle);
waitAnyKey();
}
}
// Console-related functions
void Mickey::debugCurRoom() {
_vm->_console->DebugPrintf("Current Room = %d\n", _game.iRoom);
if (_game.iRmObj[_game.iRoom] != IDI_MSA_OBJECT_NONE) {
_vm->_console->DebugPrintf("Object %d is in the room\n", _game.iRmObj[_game.iRoom]);
}
}
Mickey::Mickey(PreAgiEngine *vm) : _vm(vm) {

View File

@ -55,9 +55,6 @@ const char IDS_MSA_PLANETS[][10] = {
"PLUTO. ", "IO. ", "MARS. ", "OBERON. "
};
#define IDS_MSA_DEBUG_ROOM "Now in room #%d "
#define IDS_MSA_DEBUG_OBJ "There is object #%d "
// patch Mickey.exe offset 0x21E to value 0x01 to enable debug mode
const char IDS_MSA_INSERT_DISK[][40] = {
@ -741,6 +738,7 @@ public:
void debugCurRoom();
void drawPic(int);
void drawObj(ENUM_MSA_OBJECT, int, int);
protected:
PreAgiEngine *_vm;
@ -769,8 +767,6 @@ protected:
void printDatMessage(int);
void playNote(MSA_SND_NOTE);
void playSound(ENUM_MSA_SOUND);
void debug();
void drawObj(ENUM_MSA_OBJECT, int, int);
void drawRoomAnimation();
void drawRoom();
void drawLogo();
@ -789,8 +785,6 @@ protected:
void getItem(ENUM_MSA_ITEM);
void getXtal(int);
bool parse(int, int);
void debug_DrawObjs();
void debug_DrawPics();
void flipSwitch();
void waitAnyKey(bool anim = false);