2009-06-21 12:09:44 +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.
|
|
|
|
|
|
|
|
* 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$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Console module
|
|
|
|
|
|
|
|
#include "asylum/asylum.h"
|
|
|
|
#include "asylum/console.h"
|
|
|
|
|
|
|
|
namespace Asylum {
|
|
|
|
|
2009-12-04 03:14:07 +00:00
|
|
|
extern int32 g_debugPolygons;
|
|
|
|
extern int32 g_debugBarriers;
|
2009-06-22 11:54:06 +00:00
|
|
|
|
2009-06-21 12:09:44 +00:00
|
|
|
Console::Console(AsylumEngine *vm) : GUI::Debugger() {
|
|
|
|
_vm = vm;
|
|
|
|
|
|
|
|
DCmd_Register("video", WRAP_METHOD(Console, cmdPlayVideo));
|
2009-07-07 13:59:11 +00:00
|
|
|
DCmd_Register("script", WRAP_METHOD(Console, cmdRunScript));
|
|
|
|
DCmd_Register("scene", WRAP_METHOD(Console, cmdChangeScene));
|
2009-08-10 11:53:45 +00:00
|
|
|
DCmd_Register("flags", WRAP_METHOD(Console, cmdShowFlags));
|
2009-08-13 10:32:23 +00:00
|
|
|
DCmd_Register("toggle_flag", WRAP_METHOD(Console, cmdToggleFlag));
|
2009-08-13 13:57:52 +00:00
|
|
|
DCmd_Register("dump_action", WRAP_METHOD(Console, cmdDumpActionArea));
|
2009-06-21 12:09:44 +00:00
|
|
|
|
2009-07-08 19:39:48 +00:00
|
|
|
DVar_Register("showpolygons", &g_debugPolygons, DVAR_INT, 0);
|
|
|
|
DVar_Register("showbarriers", &g_debugBarriers, DVAR_INT, 0);
|
2009-06-21 12:09:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Console::~Console() {
|
|
|
|
}
|
|
|
|
|
2009-12-04 03:14:07 +00:00
|
|
|
bool Console::cmdDumpActionArea(int32 argc, const char **argv) {
|
2009-08-13 13:57:52 +00:00
|
|
|
|
|
|
|
if (argc == 2) {
|
|
|
|
// TODO Get an action area by index/id
|
|
|
|
} else {
|
2009-12-04 03:14:07 +00:00
|
|
|
for (int32 i = 0; i < _vm->scene()->worldstats()->numActions; i++) {
|
2009-09-19 17:43:35 +00:00
|
|
|
ActionArea *a = &_vm->scene()->worldstats()->actions[i];
|
2009-08-13 13:57:52 +00:00
|
|
|
printActionAreaStats(a);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Console::printActionAreaStats(ActionArea *a) {
|
|
|
|
DebugPrintf("id[%d] name[%s] field01[%d] field02[%d] field40[%d] field44[%d] flags[%d] \n"
|
2009-09-21 19:11:49 +00:00
|
|
|
"actionListIdx1[%d] actionListIdx2[%d] actionType[%d] field_7C[%d] polyIdx[%d]\n"
|
|
|
|
"field_84[%d] field_88[%d] soundResId[%d] field_90[%d] palette[%d] volume[%d]\n\n",
|
|
|
|
a->id,
|
|
|
|
a->name,
|
|
|
|
a->field01,
|
|
|
|
a->field02,
|
|
|
|
a->field_40,
|
|
|
|
a->field_44,
|
|
|
|
a->flags,
|
|
|
|
a->actionListIdx1,
|
|
|
|
a->actionListIdx2,
|
|
|
|
a->actionType,
|
|
|
|
//a->flagNums[10],
|
|
|
|
a->field_7C,
|
|
|
|
a->polyIdx,
|
|
|
|
a->field_84,
|
|
|
|
a->field_88,
|
|
|
|
a->soundResId,
|
|
|
|
a->field_90,
|
|
|
|
a->paletteValue,
|
|
|
|
//a->array[5],
|
|
|
|
a->volume);
|
2009-08-13 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2009-12-04 03:14:07 +00:00
|
|
|
bool Console::cmdShowFlags(int32 argc, const char **argv) {
|
|
|
|
for (int32 i = 0; i < 1512; i++) {
|
2009-09-19 14:25:43 +00:00
|
|
|
if (_vm->isGameFlagSet(i)) {
|
2009-08-10 11:53:45 +00:00
|
|
|
DebugPrintf("Game Flag %d is Active\n", i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-12-04 03:14:07 +00:00
|
|
|
bool Console::cmdToggleFlag(int32 argc, const char **argv) {
|
2009-08-13 10:32:23 +00:00
|
|
|
if (argc != 2 || atoi(argv[1]) > 1512 || atoi(argv[1]) < 0) {
|
|
|
|
DebugPrintf("Enter a value between 0 and 1512\n");
|
|
|
|
return true;
|
|
|
|
}
|
2009-09-19 14:25:43 +00:00
|
|
|
_vm->toggleGameFlag(atoi(argv[1]));
|
|
|
|
DebugPrintf("Flag %d == %d\n", atoi(argv[1]), _vm->isGameFlagSet(atoi(argv[1])));
|
2009-08-13 10:32:23 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-12-04 03:14:07 +00:00
|
|
|
bool Console::cmdPlayVideo(int32 argc, const char **argv) {
|
2009-06-21 12:09:44 +00:00
|
|
|
if (argc != 2) {
|
|
|
|
DebugPrintf("Usage %s <video number>\n", argv[0]);
|
|
|
|
return true;
|
|
|
|
}
|
2009-09-21 19:11:49 +00:00
|
|
|
|
2009-09-19 17:43:35 +00:00
|
|
|
_vm->scene()->actions()->delayedVideoIndex = atoi(argv[1]);
|
2009-06-21 12:09:44 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-12-04 03:14:07 +00:00
|
|
|
bool Console::cmdRunScript(int32 argc, const char **argv) {
|
2009-07-07 13:59:11 +00:00
|
|
|
if (argc != 2) {
|
|
|
|
DebugPrintf("Usage %s <script number>\n", argv[0]);
|
|
|
|
return true;
|
|
|
|
}
|
2009-11-27 14:36:27 +00:00
|
|
|
// FIXME push the script index into the script queue
|
|
|
|
//_vm->scene()->actions()->setScriptByIndex(atoi(argv[1]));
|
2009-07-07 13:59:11 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-12-04 03:14:07 +00:00
|
|
|
bool Console::cmdChangeScene(int32 argc, const char **argv) {
|
2009-07-07 13:59:11 +00:00
|
|
|
if (argc != 2) {
|
|
|
|
DebugPrintf("Usage %s <scene number>\n", argv[0]);
|
|
|
|
return true;
|
|
|
|
}
|
2009-09-21 19:11:49 +00:00
|
|
|
|
2009-07-09 11:11:30 +00:00
|
|
|
if (atoi(argv[1]) - 4 < 1 || atoi(argv[1]) - 4 >= 15) {
|
|
|
|
DebugPrintf("Attempt to SetupStartingInfo(%d); Invalid world\n", atoi(argv[1]));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-09-19 17:43:35 +00:00
|
|
|
_vm->scene()->actions()->delayedSceneIndex = atoi(argv[1]);
|
2009-11-27 14:36:27 +00:00
|
|
|
// FIXME push the script index into the script queue
|
|
|
|
// XXX is this right or should it be ws->actionListIdx???
|
|
|
|
//_vm->scene()->actions()->setScriptByIndex(0);
|
2009-07-07 13:59:11 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-06-21 12:09:44 +00:00
|
|
|
|
|
|
|
} // End of namespace Asulym
|