2005-01-17 10:57:15 +00:00
|
|
|
/* Copyright (C) 1994-1998 Revolution Software Ltd.
|
|
|
|
* Copyright (C) 2003-2005 The ScummVM project
|
2003-07-28 01:44:38 +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*/
|
|
|
|
|
2003-11-16 14:18:29 +00:00
|
|
|
#include "common/stdafx.h"
|
2003-10-28 19:51:30 +00:00
|
|
|
#include "sword2/sword2.h"
|
|
|
|
#include "sword2/defs.h"
|
2004-02-05 14:19:07 +00:00
|
|
|
#include "sword2/console.h"
|
|
|
|
#include "sword2/logic.h"
|
|
|
|
#include "sword2/maketext.h"
|
2004-11-14 15:00:01 +00:00
|
|
|
#include "sword2/memory.h"
|
2005-02-19 14:02:16 +00:00
|
|
|
#include "sword2/mouse.h"
|
2004-02-05 14:19:07 +00:00
|
|
|
#include "sword2/resman.h"
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
#include "sword2/sound.h"
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 21:30:52 +00:00
|
|
|
#include "common/debugger.cpp"
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
namespace Sword2 {
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-11-08 15:47:51 +00:00
|
|
|
Debugger::Debugger(Sword2Engine *vm)
|
2003-11-02 02:18:16 +00:00
|
|
|
: Common::Debugger<Debugger>() {
|
2003-11-08 15:47:51 +00:00
|
|
|
_vm = vm;
|
2003-10-26 15:42:49 +00:00
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
memset(_debugTextBlocks, 0, sizeof(_debugTextBlocks));
|
|
|
|
memset(_showVar, 0, sizeof(_showVar));
|
|
|
|
|
|
|
|
_displayDebugText = false; // "INFO"
|
|
|
|
_displayWalkGrid = false; // "WALKGRID"
|
|
|
|
_displayMouseMarker = false; // "MOUSE"
|
|
|
|
_displayTime = false; // "TIME"
|
|
|
|
_displayPlayerMarker = false; // "PLAYER"
|
|
|
|
_displayTextNumbers = false; // "TEXT"
|
|
|
|
|
|
|
|
_definingRectangles = false; // "RECT"
|
|
|
|
_draggingRectangle = 0; // 0 = waiting to start new rect
|
|
|
|
// 1 = currently dragging a rectangle
|
|
|
|
|
|
|
|
_rectX1 = _rectY1 = 0;
|
|
|
|
_rectX2 = _rectY2 = 0;
|
|
|
|
_rectFlicker = false;
|
|
|
|
|
|
|
|
_testingSnR = false; // "SAVEREST" - for system to kill all
|
|
|
|
// object resources (except player) in
|
|
|
|
// fnAddHuman()
|
|
|
|
|
2004-05-05 07:06:18 +00:00
|
|
|
_speechScriptWaiting = 0; // The id of whoever we're waiting for
|
|
|
|
// in a speech script. See fnTheyDo(),
|
|
|
|
// fnTheyDoWeWait(), fnWeWait(), and
|
|
|
|
// fnTimedWait().
|
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
_startTime = 0; // "TIMEON" & "TIMEOFF" - system start
|
|
|
|
// time
|
|
|
|
|
|
|
|
_textNumber = 0; // Current system text line number
|
|
|
|
|
|
|
|
_playerGraphicNoFrames = 0; // No. of frames in currently displayed
|
|
|
|
// anim
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
// Register commands
|
|
|
|
|
|
|
|
DCmd_Register("continue", &Debugger::Cmd_Exit);
|
|
|
|
DCmd_Register("exit", &Debugger::Cmd_Exit);
|
|
|
|
DCmd_Register("quit", &Debugger::Cmd_Exit);
|
|
|
|
DCmd_Register("q", &Debugger::Cmd_Exit);
|
|
|
|
DCmd_Register("help", &Debugger::Cmd_Help);
|
|
|
|
DCmd_Register("mem", &Debugger::Cmd_Mem);
|
|
|
|
DCmd_Register("tony", &Debugger::Cmd_Tony);
|
|
|
|
DCmd_Register("res", &Debugger::Cmd_Res);
|
2004-09-08 07:10:54 +00:00
|
|
|
DCmd_Register("reslist", &Debugger::Cmd_ResList);
|
2003-10-26 15:42:49 +00:00
|
|
|
DCmd_Register("starts", &Debugger::Cmd_Starts);
|
|
|
|
DCmd_Register("start", &Debugger::Cmd_Start);
|
|
|
|
DCmd_Register("s", &Debugger::Cmd_Start);
|
|
|
|
DCmd_Register("info", &Debugger::Cmd_Info);
|
|
|
|
DCmd_Register("walkgrid", &Debugger::Cmd_WalkGrid);
|
|
|
|
DCmd_Register("mouse", &Debugger::Cmd_Mouse);
|
|
|
|
DCmd_Register("player", &Debugger::Cmd_Player);
|
|
|
|
DCmd_Register("reslook", &Debugger::Cmd_ResLook);
|
|
|
|
DCmd_Register("cur", &Debugger::Cmd_CurrentInfo);
|
|
|
|
DCmd_Register("runlist", &Debugger::Cmd_RunList);
|
|
|
|
DCmd_Register("kill", &Debugger::Cmd_Kill);
|
|
|
|
DCmd_Register("nuke", &Debugger::Cmd_Nuke);
|
|
|
|
DCmd_Register("var", &Debugger::Cmd_Var);
|
|
|
|
DCmd_Register("rect", &Debugger::Cmd_Rect);
|
|
|
|
DCmd_Register("clear", &Debugger::Cmd_Clear);
|
|
|
|
DCmd_Register("debugon", &Debugger::Cmd_DebugOn);
|
2004-05-01 10:24:47 +00:00
|
|
|
DCmd_Register("debugoff", &Debugger::Cmd_DebugOff);
|
2003-10-26 15:42:49 +00:00
|
|
|
DCmd_Register("saverest", &Debugger::Cmd_SaveRest);
|
|
|
|
DCmd_Register("timeon", &Debugger::Cmd_TimeOn);
|
|
|
|
DCmd_Register("timeoff", &Debugger::Cmd_TimeOff);
|
|
|
|
DCmd_Register("text", &Debugger::Cmd_Text);
|
|
|
|
DCmd_Register("showvar", &Debugger::Cmd_ShowVar);
|
|
|
|
DCmd_Register("hidevar", &Debugger::Cmd_HideVar);
|
|
|
|
DCmd_Register("version", &Debugger::Cmd_Version);
|
|
|
|
DCmd_Register("animtest", &Debugger::Cmd_AnimTest);
|
|
|
|
DCmd_Register("texttest", &Debugger::Cmd_TextTest);
|
|
|
|
DCmd_Register("linetest", &Debugger::Cmd_LineTest);
|
|
|
|
DCmd_Register("events", &Debugger::Cmd_Events);
|
|
|
|
DCmd_Register("sfx", &Debugger::Cmd_Sfx);
|
|
|
|
DCmd_Register("english", &Debugger::Cmd_English);
|
|
|
|
DCmd_Register("finnish", &Debugger::Cmd_Finnish);
|
|
|
|
DCmd_Register("polish", &Debugger::Cmd_Polish);
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
|
|
|
|
2003-11-16 14:18:29 +00:00
|
|
|
void Debugger::varGet(int var) {
|
2004-03-17 09:03:15 +00:00
|
|
|
DebugPrintf("%d\n", Logic::_scriptVars[var]);
|
2003-11-16 14:18:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Debugger::varSet(int var, int val) {
|
2004-03-17 09:03:15 +00:00
|
|
|
DebugPrintf("was %d, ", Logic::_scriptVars[var]);
|
|
|
|
Logic::_scriptVars[var] = val;
|
|
|
|
DebugPrintf("now %d\n", Logic::_scriptVars[var]);
|
2003-11-16 14:18:29 +00:00
|
|
|
}
|
|
|
|
|
2003-10-26 21:30:52 +00:00
|
|
|
void Debugger::preEnter() {
|
|
|
|
// Pause sound output
|
2003-12-01 07:47:54 +00:00
|
|
|
if (_vm->_sound) {
|
|
|
|
_vm->_sound->pauseFx();
|
|
|
|
_vm->_sound->pauseSpeech();
|
|
|
|
_vm->_sound->pauseMusic();
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
|
|
|
|
2003-10-26 21:30:52 +00:00
|
|
|
void Debugger::postEnter() {
|
2003-12-01 07:47:54 +00:00
|
|
|
if (_vm->_sound) {
|
|
|
|
// Resume previous sound state
|
|
|
|
_vm->_sound->unpauseFx();
|
|
|
|
_vm->_sound->unpauseSpeech();
|
|
|
|
_vm->_sound->unpauseMusic();
|
|
|
|
}
|
|
|
|
|
2005-02-19 14:02:16 +00:00
|
|
|
if (_vm->_mouse) {
|
2003-12-01 07:47:54 +00:00
|
|
|
// Restore old mouse cursor
|
2005-02-19 14:02:16 +00:00
|
|
|
_vm->_mouse->drawMouse();
|
2003-12-01 07:47:54 +00:00
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
|
|
|
|
2004-03-29 06:37:46 +00:00
|
|
|
// Now the fun stuff: Commands
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Exit(int argc, const char **argv) {
|
|
|
|
_detach_now = true;
|
|
|
|
return false;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Help(int argc, const char **argv) {
|
2004-03-29 06:37:46 +00:00
|
|
|
// console normally has 78 line width
|
2003-10-26 15:42:49 +00:00
|
|
|
// wrap around nicely
|
2004-03-29 06:37:46 +00:00
|
|
|
int width = 0;
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Commands are:\n");
|
2004-03-29 06:37:46 +00:00
|
|
|
for (int i = 0 ; i < _dcmd_count ; i++) {
|
|
|
|
int size = strlen(_dcmds[i].name) + 1;
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2004-03-29 06:37:46 +00:00
|
|
|
if (width + size >= 75) {
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
width = size;
|
|
|
|
} else
|
|
|
|
width += size;
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("%s ", _dcmds[i].name);
|
2003-10-26 15:42:49 +00:00
|
|
|
}
|
|
|
|
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
|
|
|
|
2005-02-22 07:37:50 +00:00
|
|
|
static int compare_blocks(const void *p1, const void *p2) {
|
|
|
|
const MemBlock *m1 = *(const MemBlock * const *) p1;
|
|
|
|
const MemBlock *m2 = *(const MemBlock * const *) p2;
|
|
|
|
|
|
|
|
if (m1->size < m2->size)
|
|
|
|
return 1;
|
|
|
|
if (m1->size > m2->size)
|
|
|
|
return -1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Mem(int argc, const char **argv) {
|
2005-02-22 07:37:50 +00:00
|
|
|
int16 numBlocks = _vm->_memory->getNumBlocks();
|
|
|
|
MemBlock *memBlocks = _vm->_memory->getMemBlocks();
|
|
|
|
|
|
|
|
MemBlock **blocks = (MemBlock **) malloc(numBlocks * sizeof(MemBlock));
|
|
|
|
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
for (i = 0, j = 0; i < MAX_MEMORY_BLOCKS; i++) {
|
|
|
|
if (memBlocks[i].ptr)
|
|
|
|
blocks[j++] = &memBlocks[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
qsort(blocks, numBlocks, sizeof(MemBlock *), compare_blocks);
|
|
|
|
|
|
|
|
DebugPrintf(" size id res type name\n");
|
|
|
|
DebugPrintf("---------------------------------------------------------------------------\n");
|
|
|
|
|
|
|
|
for (i = 0; i < numBlocks; i++) {
|
|
|
|
StandardHeader *head = (StandardHeader *) blocks[i]->ptr;
|
|
|
|
const char *type;
|
|
|
|
|
|
|
|
switch (head->fileType) {
|
|
|
|
case ANIMATION_FILE:
|
|
|
|
type = "ANIMATION_FILE";
|
|
|
|
break;
|
|
|
|
case SCREEN_FILE:
|
|
|
|
type = "SCREEN_FILE";
|
|
|
|
break;
|
|
|
|
case GAME_OBJECT:
|
|
|
|
type = "GAME_OBJECT";
|
|
|
|
break;
|
|
|
|
case WALK_GRID_FILE:
|
|
|
|
type = "WALK_GRID_FILE";
|
|
|
|
break;
|
|
|
|
case GLOBAL_VAR_FILE:
|
|
|
|
type = "GLOBAL_VAR_FILE";
|
|
|
|
break;
|
|
|
|
case PARALLAX_FILE_null:
|
|
|
|
type = "PARALLAX_FILE_null";
|
|
|
|
break;
|
|
|
|
case RUN_LIST:
|
|
|
|
type = "RUN_LIST";
|
|
|
|
break;
|
|
|
|
case TEXT_FILE:
|
|
|
|
type = "TEXT_FILE";
|
|
|
|
break;
|
|
|
|
case SCREEN_MANAGER:
|
|
|
|
type = "SCREEN_MANAGER";
|
|
|
|
break;
|
|
|
|
case MOUSE_FILE:
|
|
|
|
type = "MOUSE_FILE";
|
|
|
|
break;
|
|
|
|
case WAV_FILE:
|
|
|
|
type = "WAV_FILE";
|
|
|
|
break;
|
|
|
|
case ICON_FILE:
|
|
|
|
type = "ICON_FILE";
|
|
|
|
break;
|
|
|
|
case PALETTE_FILE:
|
|
|
|
type = "PALETTE_FILE";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
type = "<unknown>";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
DebugPrintf("%9ld %-3d %-4d %-20s %s\n", blocks[i]->size, blocks[i]->id, blocks[i]->uid, type, head->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
free(blocks);
|
|
|
|
|
|
|
|
DebugPrintf("---------------------------------------------------------------------------\n");
|
|
|
|
DebugPrintf("%9ld\n", _vm->_memory->getTotAlloc());
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Tony(int argc, const char **argv) {
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("What about him?\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Res(int argc, const char **argv) {
|
2005-02-22 07:37:50 +00:00
|
|
|
uint32 numClusters = _vm->_resman->getNumClusters();
|
|
|
|
|
|
|
|
if (!numClusters) {
|
|
|
|
DebugPrintf("Argh! No resources!\n");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
ResourceFile *resFiles = _vm->_resman->getResFiles();
|
|
|
|
|
|
|
|
for (uint i = 0; i < numClusters; i++) {
|
|
|
|
DebugPrintf("%-20s ", resFiles[i].fileName);
|
|
|
|
if (!(resFiles[i].cd & LOCAL_PERM)) {
|
|
|
|
switch (resFiles[i].cd & 3) {
|
|
|
|
case BOTH:
|
|
|
|
DebugPrintf("CD 1 & 2\n");
|
|
|
|
break;
|
|
|
|
case CD1:
|
|
|
|
DebugPrintf("CD 1\n");
|
|
|
|
break;
|
|
|
|
case CD2:
|
|
|
|
DebugPrintf("CD 2\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DebugPrintf("CD 3? Huh?!\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
DebugPrintf("HD\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
DebugPrintf("%d resources\n", _vm->_resman->getNumResFiles());
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2004-09-08 07:10:54 +00:00
|
|
|
bool Debugger::Cmd_ResList(int argc, const char **argv) {
|
|
|
|
// By default, list only resources that are being held open.
|
|
|
|
uint minCount = 1;
|
|
|
|
|
|
|
|
if (argc > 1)
|
|
|
|
minCount = atoi(argv[1]);
|
|
|
|
|
2005-02-22 07:37:50 +00:00
|
|
|
uint32 numResFiles = _vm->_resman->getNumResFiles();
|
|
|
|
Resource *resList = _vm->_resman->getResList();
|
|
|
|
|
|
|
|
for (uint i = 0; i < numResFiles; i++) {
|
|
|
|
if (resList[i].ptr && resList[i].refCount >= minCount) {
|
|
|
|
StandardHeader *head = (StandardHeader *) resList[i].ptr;
|
|
|
|
DebugPrintf("%-4d: %-35s refCount: %-3d\n", i, head->name, resList[i].refCount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-08 07:10:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Starts(int argc, const char **argv) {
|
2005-02-22 07:37:50 +00:00
|
|
|
uint32 numStarts = _vm->getNumStarts();
|
|
|
|
|
|
|
|
if (!numStarts) {
|
|
|
|
DebugPrintf("Sorry - no startup positions registered?\n");
|
|
|
|
|
|
|
|
uint32 numScreenManagers = _vm->getNumScreenManagers();
|
|
|
|
|
|
|
|
if (!numScreenManagers)
|
|
|
|
DebugPrintf("There is a problem with startup.inf\n");
|
|
|
|
else
|
|
|
|
DebugPrintf(" (%d screen managers found in startup.inf)\n", numScreenManagers);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
StartUp *startList = _vm->getStartList();
|
|
|
|
|
|
|
|
for (uint i = 0; i < numStarts; i++)
|
|
|
|
DebugPrintf("%d (%s)\n", i, startList[i].description);
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-09-27 11:02:58 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Start(int argc, const char **argv) {
|
|
|
|
uint8 pal[4] = { 255, 255, 255, 0 };
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
if (argc != 2) {
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Usage: %s number\n", argv[0]);
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
|
|
|
|
2005-02-22 07:37:50 +00:00
|
|
|
uint32 numStarts = _vm->getNumStarts();
|
|
|
|
|
|
|
|
if (!numStarts) {
|
|
|
|
DebugPrintf("Sorry - there are no startups!\n");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
int start = atoi(argv[1]);
|
|
|
|
|
|
|
|
if (start < 0 || start >= (int) numStarts) {
|
|
|
|
DebugPrintf("Not a legal start position\n");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
DebugPrintf("Running start %d\n", start);
|
|
|
|
|
|
|
|
_vm->runStart(start);
|
2005-02-19 14:02:16 +00:00
|
|
|
_vm->_screen->setPalette(187, 1, pal, RDPAL_INSTANT);
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Debugger::Cmd_Info(int argc, const char **argv) {
|
2003-11-02 15:58:45 +00:00
|
|
|
_displayDebugText = !_displayDebugText;
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
if (_displayDebugText)
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Info text on\n");
|
2003-09-27 11:02:58 +00:00
|
|
|
else
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Info Text off\n");
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_WalkGrid(int argc, const char **argv) {
|
2003-11-02 15:58:45 +00:00
|
|
|
_displayWalkGrid = !_displayWalkGrid;
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
if (_displayWalkGrid)
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Walk-grid display on\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
else
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Walk-grid display off\n");
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Mouse(int argc, const char **argv) {
|
2003-11-02 15:58:45 +00:00
|
|
|
_displayMouseMarker = !_displayMouseMarker;
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
if (_displayMouseMarker)
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Mouse marker on\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
else
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Mouse marker off\n");
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Player(int argc, const char **argv) {
|
2003-11-02 15:58:45 +00:00
|
|
|
_displayPlayerMarker = !_displayPlayerMarker;
|
2003-10-26 15:42:49 +00:00
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
if (_displayPlayerMarker)
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Player feet marker on\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
else
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Player feet marker off\n");
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_ResLook(int argc, const char **argv) {
|
2005-02-22 07:37:50 +00:00
|
|
|
if (argc != 2) {
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Usage: %s number\n", argv[0]);
|
2005-02-22 07:37:50 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
int res = atoi(argv[1]);
|
|
|
|
uint32 numResFiles = _vm->_resman->getNumResFiles();
|
|
|
|
|
|
|
|
if (res < 0 || res >= (int) numResFiles) {
|
|
|
|
DebugPrintf("Illegal resource %d. There are %d resources, 0-%d.\n",
|
|
|
|
res, numResFiles, numResFiles - 1);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_vm->_resman->checkValid(res)) {
|
|
|
|
DebugPrintf("%d is a null & void resource number\n", res);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Open up the resource and take a look inside!
|
|
|
|
StandardHeader *file_header = (StandardHeader *) _vm->_resman->openResource(res);
|
|
|
|
|
|
|
|
switch (file_header->fileType) {
|
|
|
|
case ANIMATION_FILE:
|
|
|
|
DebugPrintf("<anim> %s\n", file_header->name);
|
|
|
|
break;
|
|
|
|
case SCREEN_FILE:
|
|
|
|
DebugPrintf("<layer> %s\n", file_header->name);
|
|
|
|
break;
|
|
|
|
case GAME_OBJECT:
|
|
|
|
DebugPrintf("<game object> %s\n", file_header->name);
|
|
|
|
break;
|
|
|
|
case WALK_GRID_FILE:
|
|
|
|
DebugPrintf("<walk grid> %s\n", file_header->name);
|
|
|
|
break;
|
|
|
|
case GLOBAL_VAR_FILE:
|
|
|
|
DebugPrintf("<global variables> %s\n", file_header->name);
|
|
|
|
break;
|
|
|
|
case PARALLAX_FILE_null:
|
|
|
|
DebugPrintf("<parallax file NOT USED!> %s\n", file_header->name);
|
|
|
|
break;
|
|
|
|
case RUN_LIST:
|
|
|
|
DebugPrintf("<run list> %s\n", file_header->name);
|
|
|
|
break;
|
|
|
|
case TEXT_FILE:
|
|
|
|
DebugPrintf("<text file> %s\n", file_header->name);
|
|
|
|
break;
|
|
|
|
case SCREEN_MANAGER:
|
|
|
|
DebugPrintf("<screen manager> %s\n", file_header->name);
|
|
|
|
break;
|
|
|
|
case MOUSE_FILE:
|
|
|
|
DebugPrintf("<mouse pointer> %s\n", file_header->name);
|
|
|
|
break;
|
|
|
|
case ICON_FILE:
|
|
|
|
DebugPrintf("<menu icon> %s\n", file_header->name);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DebugPrintf("unrecognised fileType %d\n", file_header->fileType);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_resman->closeResource(res);
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_CurrentInfo(int argc, const char **argv) {
|
2005-02-22 07:37:50 +00:00
|
|
|
// prints general stuff about the screen, etc.
|
|
|
|
ScreenInfo *screenInfo = _vm->_screen->getScreenInfo();
|
|
|
|
|
|
|
|
if (screenInfo->background_layer_id) {
|
|
|
|
DebugPrintf("background layer id %d\n", screenInfo->background_layer_id);
|
|
|
|
DebugPrintf("%d wide, %d high\n", screenInfo->screen_wide, screenInfo->screen_deep);
|
|
|
|
DebugPrintf("%d normal layers\n", screenInfo->number_of_layers);
|
|
|
|
|
|
|
|
Cmd_RunList(argc, argv);
|
|
|
|
} else
|
|
|
|
DebugPrintf("No screen\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_RunList(int argc, const char **argv) {
|
2005-02-22 07:37:50 +00:00
|
|
|
uint32 *game_object_list;
|
|
|
|
StandardHeader *file_header;
|
|
|
|
|
|
|
|
uint32 runList = _vm->_logic->getRunList();
|
|
|
|
|
|
|
|
if (runList) {
|
|
|
|
game_object_list = (uint32 *) (_vm->_resman->openResource(runList) + sizeof(StandardHeader));
|
|
|
|
|
|
|
|
DebugPrintf("Runlist number %d\n", runList);
|
|
|
|
|
|
|
|
for (int i = 0; game_object_list[i]; i++) {
|
|
|
|
file_header = (StandardHeader *) _vm->_resman->openResource(game_object_list[i]);
|
|
|
|
DebugPrintf("%d %s\n", game_object_list[i], file_header->name);
|
|
|
|
_vm->_resman->closeResource(game_object_list[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_resman->closeResource(runList);
|
|
|
|
} else
|
|
|
|
DebugPrintf("No run list set\n");
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Kill(int argc, const char **argv) {
|
2005-02-22 07:37:50 +00:00
|
|
|
if (argc != 2) {
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Usage: %s number\n", argv[0]);
|
2005-02-22 07:37:50 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
int res = atoi(argv[1]);
|
|
|
|
uint32 numResFiles = _vm->_resman->getNumResFiles();
|
|
|
|
|
|
|
|
if (res < 0 || res >= (int) numResFiles) {
|
|
|
|
DebugPrintf("Illegal resource %d. There are %d resources, 0-%d.\n",
|
|
|
|
res, numResFiles, numResFiles - 1);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
Resource *resList = _vm->_resman->getResList();
|
|
|
|
|
|
|
|
if (!resList[res].ptr) {
|
|
|
|
DebugPrintf("Resource %d is not in memory\n", res);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (resList[res].refCount) {
|
|
|
|
DebugPrintf("Resource %d is open - cannot remove\n", res);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_resman->remove(res);
|
|
|
|
DebugPrintf("Trashed %d\n", res);
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Nuke(int argc, const char **argv) {
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Killing all resources except variable file and player object\n");
|
2003-11-16 14:18:29 +00:00
|
|
|
_vm->_resman->killAll(true);
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Var(int argc, const char **argv) {
|
|
|
|
switch (argc) {
|
|
|
|
case 2:
|
2003-11-02 15:58:45 +00:00
|
|
|
varGet(atoi(argv[1]));
|
2003-10-26 15:42:49 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2003-11-02 15:58:45 +00:00
|
|
|
varSet(atoi(argv[1]), atoi(argv[2]));
|
2003-10-26 15:42:49 +00:00
|
|
|
break;
|
|
|
|
default:
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Usage: %s number value\n", argv[0]);
|
2003-10-26 15:42:49 +00:00
|
|
|
break;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Rect(int argc, const char **argv) {
|
2004-05-09 13:32:04 +00:00
|
|
|
uint32 filter = _vm->setEventFilter(0);
|
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
_definingRectangles = !_definingRectangles;
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2004-05-09 13:32:04 +00:00
|
|
|
if (_definingRectangles) {
|
|
|
|
_vm->setEventFilter(filter & ~(RD_LEFTBUTTONUP | RD_RIGHTBUTTONUP));
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Mouse rectangles enabled\n");
|
2004-05-09 13:32:04 +00:00
|
|
|
} else {
|
|
|
|
_vm->setEventFilter(filter | RD_LEFTBUTTONUP | RD_RIGHTBUTTONUP);
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Mouse rectangles disabled\n");
|
2004-05-09 13:32:04 +00:00
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
_draggingRectangle = 0;
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Clear(int argc, const char **argv) {
|
2003-11-16 14:18:29 +00:00
|
|
|
_vm->_resman->killAllObjects(true);
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_DebugOn(int argc, const char **argv) {
|
2003-11-02 15:58:45 +00:00
|
|
|
_displayDebugText = true;
|
|
|
|
_displayWalkGrid = true;
|
|
|
|
_displayMouseMarker = true;
|
|
|
|
_displayPlayerMarker = true;
|
|
|
|
_displayTextNumbers = true;
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Enabled all on-screen debug info\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
2003-09-27 11:02:58 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_DebugOff(int argc, const char **argv) {
|
2003-11-02 15:58:45 +00:00
|
|
|
_displayDebugText = false;
|
|
|
|
_displayWalkGrid = false;
|
|
|
|
_displayMouseMarker = false;
|
|
|
|
_displayPlayerMarker = false;
|
|
|
|
_displayTextNumbers = false;
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Disabled all on-screen debug info\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_SaveRest(int argc, const char **argv) {
|
2003-11-02 15:58:45 +00:00
|
|
|
_testingSnR = !_testingSnR;
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
if (_testingSnR)
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Enabled S&R logic_script stability checking\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
else
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Disabled S&R logic_script stability checking\n");
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_TimeOn(int argc, const char **argv) {
|
|
|
|
if (argc == 2)
|
2004-09-28 20:19:37 +00:00
|
|
|
_startTime = _vm->_system->getMillis() - atoi(argv[1]) * 1000;
|
2003-11-02 15:58:45 +00:00
|
|
|
else if (_startTime == 0)
|
2004-09-28 20:19:37 +00:00
|
|
|
_startTime = _vm->_system->getMillis();
|
2003-11-02 15:58:45 +00:00
|
|
|
_displayTime = true;
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Timer display on\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_TimeOff(int argc, const char **argv) {
|
2003-11-02 15:58:45 +00:00
|
|
|
_displayTime = false;
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Timer display off\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Text(int argc, const char **argv) {
|
2003-11-02 15:58:45 +00:00
|
|
|
_displayTextNumbers = !_displayTextNumbers;
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
if (_displayTextNumbers)
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Text numbers on\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
else
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Text numbers off\n");
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_ShowVar(int argc, const char **argv) {
|
2003-09-27 11:02:58 +00:00
|
|
|
int32 showVarNo = 0;
|
2003-07-28 01:44:38 +00:00
|
|
|
int32 varNo;
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
if (argc != 2) {
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Usage: %s number\n", argv[0]);
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
varNo = atoi(argv[1]);
|
|
|
|
|
2003-09-27 11:02:58 +00:00
|
|
|
// search for a spare slot in the watch-list, but also watch out for
|
|
|
|
// this variable already being in the list
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
while (showVarNo < MAX_SHOWVARS && _showVar[showVarNo] != 0 && _showVar[showVarNo] != varNo)
|
2003-07-28 01:44:38 +00:00
|
|
|
showVarNo++;
|
|
|
|
|
2003-09-27 11:02:58 +00:00
|
|
|
// if we've found a spare slot or the variable's already there
|
|
|
|
if (showVarNo < MAX_SHOWVARS) {
|
2003-11-02 15:58:45 +00:00
|
|
|
if (_showVar[showVarNo] == 0) {
|
2003-09-27 11:02:58 +00:00
|
|
|
// empty slot - add it to the list at this slot
|
2003-11-02 15:58:45 +00:00
|
|
|
_showVar[showVarNo] = varNo;
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("var(%d) added to the watch-list\n", varNo);
|
2003-09-27 11:02:58 +00:00
|
|
|
} else
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("var(%d) already in the watch-list!\n", varNo);
|
2003-09-27 11:02:58 +00:00
|
|
|
} else
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Sorry - no more allowed - hide one or extend the system watch-list\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
|
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
2003-09-27 11:02:58 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_HideVar(int argc, const char **argv) {
|
2003-09-27 11:02:58 +00:00
|
|
|
int32 showVarNo = 0;
|
2003-07-28 01:44:38 +00:00
|
|
|
int32 varNo;
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
if (argc != 2) {
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Usage: %s number\n", argv[0]);
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
varNo = atoi(argv[1]);
|
|
|
|
|
2003-09-27 11:02:58 +00:00
|
|
|
// search for 'varNo' in the watch-list
|
2003-11-02 15:58:45 +00:00
|
|
|
while (showVarNo < MAX_SHOWVARS && _showVar[showVarNo] != varNo)
|
2003-07-28 01:44:38 +00:00
|
|
|
showVarNo++;
|
|
|
|
|
2003-09-27 11:02:58 +00:00
|
|
|
if (showVarNo < MAX_SHOWVARS) {
|
|
|
|
// We've found 'varNo' in the list - clear this slot
|
2003-11-02 15:58:45 +00:00
|
|
|
_showVar[showVarNo] = 0;
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("var(%d) removed from watch-list\n", varNo);
|
2003-09-27 11:02:58 +00:00
|
|
|
} else
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Sorry - can't find var(%d) in the list\n", varNo);
|
2003-10-26 15:42:49 +00:00
|
|
|
|
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Version(int argc, const char **argv) {
|
2004-03-29 06:37:46 +00:00
|
|
|
// This function used to print more information, but nothing we
|
|
|
|
// particularly care about.
|
2003-10-26 15:42:49 +00:00
|
|
|
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("\"Broken Sword II\" (c) Revolution Software 1997.\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-09-27 11:02:58 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_AnimTest(int argc, const char **argv) {
|
|
|
|
if (argc != 2) {
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Usage: %s value\n", argv[0]);
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
// Automatically do "s 32" to run the animation testing start script
|
2005-02-22 07:37:50 +00:00
|
|
|
_vm->runStart(32);
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
// Same as typing "VAR 912 <value>" at the console
|
2003-11-02 15:58:45 +00:00
|
|
|
varSet(912, atoi(argv[1]));
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Setting flag 'system_testing_anims'\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Debugger::Cmd_TextTest(int argc, const char **argv) {
|
|
|
|
if (argc != 2) {
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Usage: %s value\n", argv[0]);
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
// Automatically do "s 33" to run the text/speech testing start script
|
2005-02-22 07:37:50 +00:00
|
|
|
_vm->runStart(33);
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
// Same as typing "VAR 1230 <value>" at the console
|
2003-11-02 15:58:45 +00:00
|
|
|
varSet(1230, atoi(argv[1]));
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
_displayTextNumbers = true;
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Setting flag 'system_testing_text'\n");
|
|
|
|
DebugPrintf("Text numbers on\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
2003-09-27 11:02:58 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_LineTest(int argc, const char **argv) {
|
|
|
|
if (argc != 3) {
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Usage: %s value1 value2\n", argv[0]);
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
2003-10-26 15:42:49 +00:00
|
|
|
|
|
|
|
// Automatically do "s 33" to run the text/speech testing start script
|
2005-02-22 07:37:50 +00:00
|
|
|
_vm->runStart(33);
|
2003-10-26 15:42:49 +00:00
|
|
|
|
|
|
|
// Same as typing "VAR 1230 <value>" at the console
|
2003-11-02 15:58:45 +00:00
|
|
|
varSet(1230, atoi(argv[1]));
|
2003-10-26 15:42:49 +00:00
|
|
|
|
|
|
|
// Same as typing "VAR 1264 <value>" at the console
|
2003-11-02 15:58:45 +00:00
|
|
|
varSet(1264, atoi(argv[2]));
|
2003-10-26 15:42:49 +00:00
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
_displayTextNumbers = true;
|
2003-10-26 15:42:49 +00:00
|
|
|
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Setting flag 'system_testing_text'\n");
|
|
|
|
DebugPrintf("Setting flag 'system_test_line_no'\n");
|
|
|
|
DebugPrintf("Text numbers on\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
2003-09-27 11:02:58 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Events(int argc, const char **argv) {
|
2005-02-22 07:37:50 +00:00
|
|
|
EventUnit *eventList = _vm->_logic->getEventList();
|
|
|
|
|
|
|
|
DebugPrintf("EVENT LIST:\n");
|
|
|
|
|
|
|
|
for (uint32 i = 0; i < MAX_events; i++) {
|
|
|
|
if (eventList[i].id) {
|
|
|
|
byte buf[NAME_LEN];
|
|
|
|
uint32 target = eventList[i].id;
|
|
|
|
uint32 script = eventList[i].interact_id;
|
|
|
|
|
|
|
|
DebugPrintf("slot %2d: id = %s (%d)\n", i, _vm->fetchObjectName(target, buf), target);
|
|
|
|
DebugPrintf(" script = %s (%d) pos %d\n", _vm->fetchObjectName(script / 65536, buf), script / 65536, script % 65536);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
2003-09-27 11:02:58 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Sfx(int argc, const char **argv) {
|
2003-11-08 15:47:51 +00:00
|
|
|
_vm->_wantSfxDebug = !_vm->_wantSfxDebug;
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-11-08 15:47:51 +00:00
|
|
|
if (_vm->_wantSfxDebug)
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("SFX logging activated\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
else
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("SFX logging deactivated\n");
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_English(int argc, const char **argv) {
|
2003-11-08 15:47:51 +00:00
|
|
|
_vm->initialiseFontResourceFlags(DEFAULT_TEXT);
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Default fonts selected\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Finnish(int argc, const char **argv) {
|
2003-11-08 15:47:51 +00:00
|
|
|
_vm->initialiseFontResourceFlags(FINNISH_TEXT);
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Finnish fonts selected\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
2003-07-28 01:44:38 +00:00
|
|
|
}
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Debugger::Cmd_Polish(int argc, const char **argv) {
|
2003-11-08 15:47:51 +00:00
|
|
|
_vm->initialiseFontResourceFlags(POLISH_TEXT);
|
2003-10-26 21:30:52 +00:00
|
|
|
DebugPrintf("Polish fonts selected\n");
|
2003-10-26 15:42:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-04 00:52:27 +00:00
|
|
|
} // End of namespace Sword2
|