2007-05-30 21:56:52 +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.
|
2007-01-14 21:29:12 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "common/system.h"
|
|
|
|
|
2007-05-13 14:38:05 +00:00
|
|
|
#include "parallaction/parallaction.h"
|
2007-05-06 08:52:27 +00:00
|
|
|
#include "parallaction/debug.h"
|
|
|
|
|
2007-01-14 21:29:12 +00:00
|
|
|
namespace Parallaction {
|
|
|
|
|
|
|
|
|
|
|
|
const char *_jobDescriptions[] = {
|
2007-05-13 12:38:29 +00:00
|
|
|
"draw label",
|
|
|
|
"draw mouse",
|
|
|
|
"delayed label deletion || show inventory",
|
|
|
|
"draw animations",
|
|
|
|
"NONE",
|
|
|
|
"NONE",
|
|
|
|
"NONE",
|
|
|
|
"NONE",
|
|
|
|
"NONE",
|
|
|
|
"NONE",
|
|
|
|
"NONE",
|
|
|
|
"NONE",
|
|
|
|
"NONE",
|
|
|
|
"NONE",
|
|
|
|
"NONE",
|
|
|
|
"delayed label deletion || run scripts || erase animations",
|
|
|
|
"NONE",
|
|
|
|
"put item || pickup item",
|
|
|
|
"toggle door",
|
|
|
|
"walk",
|
|
|
|
"erase label || hide inventory",
|
|
|
|
"erase mouse"
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
|
2007-05-06 08:52:27 +00:00
|
|
|
Debugger::Debugger(Parallaction *vm)
|
|
|
|
: GUI::Debugger() {
|
|
|
|
_vm = vm;
|
|
|
|
|
|
|
|
DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
|
2007-05-12 19:29:20 +00:00
|
|
|
DCmd_Register("location", WRAP_METHOD(Debugger, Cmd_Location));
|
|
|
|
DCmd_Register("give", WRAP_METHOD(Debugger, Cmd_Give));
|
2007-05-13 12:38:29 +00:00
|
|
|
DCmd_Register("jobs", WRAP_METHOD(Debugger, Cmd_Jobs));
|
|
|
|
DCmd_Register("zones", WRAP_METHOD(Debugger, Cmd_Zones));
|
|
|
|
DCmd_Register("animations", WRAP_METHOD(Debugger, Cmd_Animations));
|
2007-10-19 20:27:10 +00:00
|
|
|
DCmd_Register("localflags", WRAP_METHOD(Debugger, Cmd_LocalFlags));
|
2007-11-01 17:40:25 +00:00
|
|
|
DCmd_Register("locations", WRAP_METHOD(Debugger, Cmd_Locations));
|
2007-05-13 12:38:29 +00:00
|
|
|
|
2007-05-06 08:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Debugger::preEnter() {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Debugger::postEnter() {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Debugger::Cmd_Location(int argc, const char **argv) {
|
|
|
|
|
2007-09-22 18:45:43 +00:00
|
|
|
const char *character = _vm->_char.getName();
|
2007-11-14 22:24:26 +00:00
|
|
|
const char *location = _vm->_location._name;
|
|
|
|
|
|
|
|
char tmp[PATH_LEN];
|
2007-05-06 08:52:27 +00:00
|
|
|
|
|
|
|
switch (argc) {
|
|
|
|
case 3:
|
|
|
|
character = const_cast<char*>(argv[2]);
|
2007-05-12 19:29:20 +00:00
|
|
|
location = const_cast<char*>(argv[1]);
|
2007-11-14 22:24:26 +00:00
|
|
|
sprintf(tmp, "%s.%s", location, character);
|
|
|
|
_vm->scheduleLocationSwitch(tmp);
|
2007-05-12 19:29:20 +00:00
|
|
|
break;
|
2007-05-06 08:52:27 +00:00
|
|
|
|
|
|
|
case 2:
|
|
|
|
location = const_cast<char*>(argv[1]);
|
2007-11-14 22:24:26 +00:00
|
|
|
_vm->scheduleLocationSwitch(location);
|
2007-05-06 08:52:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
DebugPrintf("location <location name> [character name]\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2007-01-14 21:29:12 +00:00
|
|
|
}
|
|
|
|
|
2007-11-01 17:40:25 +00:00
|
|
|
bool Debugger::Cmd_Locations(int argc, const char **argv) {
|
|
|
|
|
|
|
|
DebugPrintf("+------------------------------+---------+\n"
|
|
|
|
"| location name | flags |\n"
|
|
|
|
"+------------------------------+---------+\n");
|
|
|
|
for (uint i = 0; i < _vm->_numLocations; i++) {
|
|
|
|
DebugPrintf("|%-30s| %08x|\n", _vm->_locationNames[i], _vm->_localFlags[i]);
|
|
|
|
}
|
|
|
|
DebugPrintf("+------------------------------+---------+\n");
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2007-10-19 20:27:10 +00:00
|
|
|
bool Debugger::Cmd_LocalFlags(int argc, const char **argv) {
|
|
|
|
|
|
|
|
JobList::iterator b = _vm->_jobs.begin();
|
|
|
|
JobList::iterator e = _vm->_jobs.end();
|
|
|
|
|
|
|
|
uint32 flags = _vm->_localFlags[_vm->_currentLocationIndex];
|
|
|
|
|
|
|
|
DebugPrintf("+------------------------------+---------+\n"
|
|
|
|
"| flag name | value |\n"
|
|
|
|
"+------------------------------+---------+\n");
|
|
|
|
for (uint i = 0; i < _vm->_localFlagNames->count(); i++) {
|
|
|
|
const char *value = ((flags & (1 << i)) == 0) ? "OFF" : "ON";
|
2007-10-19 21:26:35 +00:00
|
|
|
DebugPrintf("|%-30s| %-6s|\n", _vm->_localFlagNames->item(i), value);
|
2007-10-19 20:27:10 +00:00
|
|
|
}
|
|
|
|
DebugPrintf("+------------------------------+---------+\n");
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-05-06 08:52:27 +00:00
|
|
|
bool Debugger::Cmd_Give(int argc, const char **argv) {
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2007-05-06 08:52:27 +00:00
|
|
|
if (argc == 1) {
|
|
|
|
DebugPrintf("give <item name>\n");
|
|
|
|
} else {
|
|
|
|
int index = _vm->_objectsNames->lookup(argv[1]);
|
2007-08-13 23:17:17 +00:00
|
|
|
if (index != Table::notFound)
|
2007-05-06 08:52:27 +00:00
|
|
|
_vm->addInventoryItem(index + 4);
|
|
|
|
else
|
|
|
|
DebugPrintf("invalid item name '%s'\n", argv[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2007-05-13 12:38:29 +00:00
|
|
|
|
|
|
|
bool Debugger::Cmd_Jobs(int argc, const char **argv) {
|
|
|
|
|
|
|
|
JobList::iterator b = _vm->_jobs.begin();
|
|
|
|
JobList::iterator e = _vm->_jobs.end();
|
|
|
|
|
|
|
|
DebugPrintf("+---+-------------------------------------------------------------+\n"
|
|
|
|
"|tag| description |\n"
|
|
|
|
"+---+-------------------------------------------------------------+\n");
|
|
|
|
for ( ; b != e; b++) {
|
2007-09-02 15:17:41 +00:00
|
|
|
DebugPrintf("|%3i| %-60s|\n", (*b)->_job->_tag, _jobDescriptions[(*b)->_job->_tag] );
|
2007-05-13 12:38:29 +00:00
|
|
|
}
|
|
|
|
DebugPrintf("+---+-------------------------------------------------------------+\n");
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Debugger::Cmd_Zones(int argc, const char **argv) {
|
|
|
|
|
|
|
|
ZoneList::iterator b = _vm->_zones.begin();
|
|
|
|
ZoneList::iterator e = _vm->_zones.end();
|
|
|
|
|
|
|
|
DebugPrintf("+--------------------+---+---+---+---+--------+--------+\n"
|
|
|
|
"| name | l | t | r | b | type | flag |\n"
|
|
|
|
"+--------------------+---+---+---+---+--------+--------+\n");
|
|
|
|
for ( ; b != e; b++) {
|
|
|
|
Zone *z = *b;
|
|
|
|
DebugPrintf("|%-20s|%3i|%3i|%3i|%3i|%8x|%8x|\n", z->_label._text, z->_left, z->_top, z->_right, z->_bottom, z->_type, z->_flags );
|
|
|
|
}
|
|
|
|
DebugPrintf("+--------------------+---+---+---+---+--------+--------+\n");
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Debugger::Cmd_Animations(int argc, const char **argv) {
|
|
|
|
|
|
|
|
AnimationList::iterator b = _vm->_animations.begin();
|
|
|
|
AnimationList::iterator e = _vm->_animations.end();
|
|
|
|
|
|
|
|
DebugPrintf("+--------------------+---+---+---+---+--------+--------+\n"
|
|
|
|
"| name | x | y | z | f | type | flag | \n"
|
|
|
|
"+--------------------+---+---+---+---+--------+--------+\n");
|
|
|
|
for ( ; b != e; b++) {
|
|
|
|
Animation *a = *b;
|
|
|
|
DebugPrintf("|%-20s|%3i|%3i|%3i|%3i|%8x|%8x|\n", a->_label._text, a->_left, a->_top, a->_z, a->_frame, a->_type, a->_flags );
|
|
|
|
}
|
|
|
|
DebugPrintf("+--------------------+---+---+---+---+--------+--------+\n");
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-01-14 21:29:12 +00:00
|
|
|
} // namespace Parallaction
|