1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "hopkins/debugger.h"
24 
25 #include "hopkins/globals.h"
26 #include "hopkins/graphics.h"
27 #include "hopkins/hopkins.h"
28 
29 namespace Hopkins {
30 
Debugger(HopkinsEngine * vm)31 Debugger::Debugger(HopkinsEngine *vm) : GUI::Debugger() {
32 	_vm = vm;
33 	registerCmd("continue", WRAP_METHOD(Debugger, cmdExit));
34 	registerCmd("rects", WRAP_METHOD(Debugger, cmd_DirtyRects));
35 	registerCmd("teleport", WRAP_METHOD(Debugger, cmd_Teleport));
36 	registerCmd("show_room", WRAP_METHOD(Debugger, cmd_ShowCurrentRoom));
37 	registerCmd("zones", WRAP_METHOD(Debugger, cmd_Zones));
38 	registerCmd("lines", WRAP_METHOD(Debugger, cmd_Lines));
39 }
40 
41 // Turns dirty rects on or off
cmd_DirtyRects(int argc,const char ** argv)42 bool Debugger::cmd_DirtyRects(int argc, const char **argv) {
43 	if (argc != 2) {
44 		debugPrintf("%s: [on | off]\n", argv[0]);
45 		return true;
46 	} else {
47 		_vm->_graphicsMan->_showDirtyRects = !strcmp(argv[1], "on");
48 		return false;
49 	}
50 }
51 
52 // Change room number
cmd_Teleport(int argc,const char ** argv)53 bool Debugger::cmd_Teleport(int argc, const char **argv) {
54 	if (argc != 2) {
55 		debugPrintf("%s: [Room number]\n", argv[0]);
56 		return true;
57 	} else {
58 		_vm->_globals->_exitId = atoi(argv[1]);
59 		return false;
60 	}
61 }
62 
63 // Display room number
cmd_ShowCurrentRoom(int argc,const char ** argv)64 bool Debugger::cmd_ShowCurrentRoom(int argc, const char **argv) {
65 	debugPrintf("Current room: %d\n", _vm->_globals->_curRoomNum);
66 	return true;
67 }
68 
cmd_Zones(int argc,const char ** argv)69 bool Debugger::cmd_Zones(int argc, const char **argv) {
70 if (argc != 2) {
71 		debugPrintf("%s: [on | off]\n", argv[0]);
72 		return true;
73 	} else {
74 		_vm->_graphicsMan->_showZones = !strcmp(argv[1], "on");
75 		return false;
76 	}
77 }
78 
cmd_Lines(int argc,const char ** argv)79 bool Debugger::cmd_Lines(int argc, const char **argv) {
80 	if (argc != 2) {
81 		debugPrintf("%s: [on | off]\n", argv[0]);
82 		return true;
83 	} else {
84 		_vm->_graphicsMan->_showLines = !strcmp(argv[1], "on");
85 		return false;
86 	}
87 }
88 
89 
90 } // End of namespace Hopkins
91