2012-10-14 02:43:29 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2014-02-18 01:34:21 +00:00
|
|
|
*
|
2012-10-14 02:43:29 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2014-02-18 01:34:21 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2012-10-14 02:43:29 +00:00
|
|
|
* GNU General Public License for more details.
|
2014-02-18 01:34:21 +00:00
|
|
|
*
|
2012-10-14 02:43:29 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "hopkins/debugger.h"
|
2013-02-15 21:20:24 +00:00
|
|
|
|
2012-10-14 02:43:29 +00:00
|
|
|
#include "hopkins/globals.h"
|
|
|
|
#include "hopkins/graphics.h"
|
|
|
|
#include "hopkins/hopkins.h"
|
|
|
|
|
|
|
|
namespace Hopkins {
|
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
Debugger::Debugger(HopkinsEngine *vm) : GUI::Debugger() {
|
|
|
|
_vm = vm;
|
2014-05-27 00:04:08 +00:00
|
|
|
registerCmd("continue", WRAP_METHOD(Debugger, cmdExit));
|
2014-05-27 00:04:08 +00:00
|
|
|
registerCmd("rects", WRAP_METHOD(Debugger, cmd_DirtyRects));
|
|
|
|
registerCmd("teleport", WRAP_METHOD(Debugger, cmd_Teleport));
|
|
|
|
registerCmd("show_room", WRAP_METHOD(Debugger, cmd_ShowCurrentRoom));
|
|
|
|
registerCmd("zones", WRAP_METHOD(Debugger, cmd_Zones));
|
|
|
|
registerCmd("lines", WRAP_METHOD(Debugger, cmd_Lines));
|
2012-10-14 02:43:29 +00:00
|
|
|
}
|
|
|
|
|
2013-03-03 03:36:38 +00:00
|
|
|
// Turns dirty rects on or off
|
|
|
|
bool Debugger::cmd_DirtyRects(int argc, const char **argv) {
|
|
|
|
if (argc != 2) {
|
2014-05-27 00:04:07 +00:00
|
|
|
debugPrintf("%s: [on | off]\n", argv[0]);
|
2013-03-03 03:36:38 +00:00
|
|
|
return true;
|
|
|
|
} else {
|
2013-04-10 08:27:06 +00:00
|
|
|
_vm->_graphicsMan->_showDirtyRects = !strcmp(argv[1], "on");
|
2013-03-03 03:36:38 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-29 06:50:07 +00:00
|
|
|
// Change room number
|
|
|
|
bool Debugger::cmd_Teleport(int argc, const char **argv) {
|
|
|
|
if (argc != 2) {
|
2014-05-27 00:04:07 +00:00
|
|
|
debugPrintf("%s: [Room number]\n", argv[0]);
|
2013-03-29 06:50:07 +00:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
_vm->_globals->_exitId = atoi(argv[1]);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2013-03-03 03:36:38 +00:00
|
|
|
|
2013-03-29 18:47:40 +00:00
|
|
|
// Display room number
|
|
|
|
bool Debugger::cmd_ShowCurrentRoom(int argc, const char **argv) {
|
2014-05-27 00:04:07 +00:00
|
|
|
debugPrintf("Current room: %d\n", _vm->_globals->_curRoomNum);
|
2013-03-29 18:47:40 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-05-10 07:33:03 +00:00
|
|
|
bool Debugger::cmd_Zones(int argc, const char **argv) {
|
|
|
|
if (argc != 2) {
|
2014-05-27 00:04:07 +00:00
|
|
|
debugPrintf("%s: [on | off]\n", argv[0]);
|
2013-05-10 07:33:03 +00:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
_vm->_graphicsMan->_showZones = !strcmp(argv[1], "on");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-12 22:04:55 +00:00
|
|
|
bool Debugger::cmd_Lines(int argc, const char **argv) {
|
|
|
|
if (argc != 2) {
|
2014-05-27 00:04:07 +00:00
|
|
|
debugPrintf("%s: [on | off]\n", argv[0]);
|
2013-05-12 22:04:55 +00:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
_vm->_graphicsMan->_showLines = !strcmp(argv[1], "on");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-22 13:02:34 +00:00
|
|
|
} // End of namespace Hopkins
|