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.
|
2003-07-28 01:44:38 +00:00
|
|
|
*
|
2007-05-31 20:28:29 +00:00
|
|
|
* Additional copyright for this file:
|
|
|
|
* Copyright (C) 1994-1998 Revolution Software Ltd.
|
|
|
|
*
|
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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-07-28 01:44:38 +00:00
|
|
|
*
|
2006-02-09 15:12:44 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2003-07-28 01:44:38 +00:00
|
|
|
*/
|
|
|
|
|
2006-02-12 19:57:23 +00:00
|
|
|
#ifndef SWORD2_CONSOLE_H
|
|
|
|
#define SWORD2_CONSOLE_H
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2006-09-16 16:58:27 +00:00
|
|
|
#include "gui/debugger.h"
|
2003-11-02 15:58:45 +00:00
|
|
|
#include "sword2/debug.h"
|
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
|
|
|
|
2006-09-16 16:58:27 +00:00
|
|
|
class Debugger : public GUI::Debugger {
|
2003-11-02 15:58:45 +00:00
|
|
|
private:
|
|
|
|
void varGet(int var);
|
|
|
|
void varSet(int var, int val);
|
|
|
|
|
|
|
|
bool _displayDebugText;
|
|
|
|
bool _displayWalkGrid;
|
|
|
|
bool _displayMouseMarker;
|
|
|
|
bool _displayTime;
|
|
|
|
bool _displayPlayerMarker;
|
|
|
|
bool _displayTextNumbers;
|
|
|
|
|
|
|
|
bool _rectFlicker;
|
|
|
|
|
|
|
|
int32 _startTime;
|
|
|
|
|
|
|
|
int32 _showVar[MAX_SHOWVARS];
|
|
|
|
|
2004-04-23 07:02:11 +00:00
|
|
|
byte _debugTextBlocks[MAX_DEBUG_TEXTS];
|
2003-11-02 15:58:45 +00:00
|
|
|
|
2005-02-22 07:37:50 +00:00
|
|
|
void clearDebugTextBlocks();
|
2003-11-02 15:58:45 +00:00
|
|
|
void makeDebugTextBlock(char *text, int16 x, int16 y);
|
|
|
|
|
|
|
|
void plotCrossHair(int16 x, int16 y, uint8 pen);
|
|
|
|
void drawRect(int16 x, int16 y, int16 x2, int16 y2, uint8 pen);
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
public:
|
2003-11-08 15:47:51 +00:00
|
|
|
Debugger(Sword2Engine *vm);
|
2003-10-26 15:42:49 +00:00
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
int16 _rectX1, _rectY1;
|
|
|
|
int16 _rectX2, _rectY2;
|
|
|
|
|
|
|
|
uint8 _draggingRectangle;
|
|
|
|
bool _definingRectangles;
|
|
|
|
|
|
|
|
bool _testingSnR;
|
|
|
|
|
2004-05-05 07:06:18 +00:00
|
|
|
int32 _speechScriptWaiting;
|
|
|
|
|
2003-11-02 15:58:45 +00:00
|
|
|
int32 _textNumber;
|
|
|
|
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
int32 _graphType;
|
|
|
|
int32 _graphAnimRes;
|
|
|
|
int32 _graphAnimPc;
|
|
|
|
uint32 _graphNoFrames;
|
2003-11-02 15:58:45 +00:00
|
|
|
|
2005-02-22 07:37:50 +00:00
|
|
|
void buildDebugText();
|
|
|
|
void drawDebugGraphics();
|
2003-11-02 15:58:45 +00:00
|
|
|
|
2010-12-07 18:54:21 +00:00
|
|
|
private:
|
2003-10-26 21:30:52 +00:00
|
|
|
virtual void preEnter();
|
|
|
|
virtual void postEnter();
|
2003-10-26 15:42:49 +00:00
|
|
|
|
2010-12-07 18:54:21 +00:00
|
|
|
private:
|
|
|
|
Sword2Engine *_vm;
|
|
|
|
|
2003-10-26 15:42:49 +00:00
|
|
|
// Commands
|
|
|
|
bool Cmd_Mem(int argc, const char **argv);
|
|
|
|
bool Cmd_Tony(int argc, const char **argv);
|
|
|
|
bool Cmd_Res(int argc, const char **argv);
|
2004-09-08 07:10:54 +00:00
|
|
|
bool Cmd_ResList(int argc, const char **argv);
|
2003-10-26 15:42:49 +00:00
|
|
|
bool Cmd_Starts(int argc, const char **argv);
|
|
|
|
bool Cmd_Start(int argc, const char **argv);
|
|
|
|
bool Cmd_Info(int argc, const char **argv);
|
|
|
|
bool Cmd_WalkGrid(int argc, const char **argv);
|
|
|
|
bool Cmd_Mouse(int argc, const char **argv);
|
|
|
|
bool Cmd_Player(int argc, const char **argv);
|
|
|
|
bool Cmd_ResLook(int argc, const char **argv);
|
|
|
|
bool Cmd_CurrentInfo(int argc, const char **argv);
|
|
|
|
bool Cmd_RunList(int argc, const char **argv);
|
|
|
|
bool Cmd_Kill(int argc, const char **argv);
|
|
|
|
bool Cmd_Nuke(int argc, const char **argv);
|
|
|
|
bool Cmd_Var(int argc, const char **argv);
|
|
|
|
bool Cmd_Rect(int argc, const char **argv);
|
|
|
|
bool Cmd_Clear(int argc, const char **argv);
|
|
|
|
bool Cmd_DebugOn(int argc, const char **argv);
|
|
|
|
bool Cmd_DebugOff(int argc, const char **argv);
|
|
|
|
bool Cmd_SaveRest(int argc, const char **argv);
|
|
|
|
bool Cmd_TimeOn(int argc, const char **argv);
|
|
|
|
bool Cmd_TimeOff(int argc, const char **argv);
|
|
|
|
bool Cmd_Text(int argc, const char **argv);
|
|
|
|
bool Cmd_ShowVar(int argc, const char **argv);
|
|
|
|
bool Cmd_HideVar(int argc, const char **argv);
|
|
|
|
bool Cmd_Version(int argc, const char **argv);
|
|
|
|
bool Cmd_AnimTest(int argc, const char **argv);
|
|
|
|
bool Cmd_TextTest(int argc, const char **argv);
|
|
|
|
bool Cmd_LineTest(int argc, const char **argv);
|
|
|
|
bool Cmd_Events(int argc, const char **argv);
|
|
|
|
bool Cmd_Sfx(int argc, const char **argv);
|
|
|
|
bool Cmd_English(int argc, const char **argv);
|
|
|
|
bool Cmd_Finnish(int argc, const char **argv);
|
|
|
|
bool Cmd_Polish(int argc, const char **argv);
|
2010-04-01 16:11:29 +00:00
|
|
|
bool Cmd_FxQueue(int argc, const char **argv);
|
2003-10-26 15:42:49 +00:00
|
|
|
};
|
2003-07-28 01:44:38 +00:00
|
|
|
|
2003-10-04 00:52:27 +00:00
|
|
|
} // End of namespace Sword2
|
|
|
|
|
2003-07-28 01:44:38 +00:00
|
|
|
#endif
|