2001-10-09 14:30:12 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
2003-03-06 21:46:56 +00:00
|
|
|
* Copyright (C) 2001-2003 The ScummVM project
|
2001-10-09 14:30: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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
2001-11-06 20:00:47 +00:00
|
|
|
* $Header$
|
2001-10-09 14:30:12 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
#ifndef SCUMM_H
|
|
|
|
#define SCUMM_H
|
|
|
|
|
2002-09-08 01:08:12 +00:00
|
|
|
#include "common/engine.h"
|
2002-11-06 16:01:36 +00:00
|
|
|
#include "common/gameDetector.h"
|
2002-09-13 12:20:55 +00:00
|
|
|
#include "common/file.h"
|
2002-12-24 16:10:31 +00:00
|
|
|
#include "common/map.h"
|
2003-05-15 21:57:38 +00:00
|
|
|
#include "common/rect.h"
|
2002-12-24 16:10:31 +00:00
|
|
|
#include "common/str.h"
|
|
|
|
#include "common/timer.h"
|
2002-12-01 14:57:50 +00:00
|
|
|
#include "common/util.h"
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-12-25 21:04:47 +00:00
|
|
|
class CharsetRenderer;
|
2002-04-12 10:34:46 +00:00
|
|
|
class GameDetector;
|
2002-07-05 17:00:18 +00:00
|
|
|
class NewGui;
|
2002-09-19 21:45:56 +00:00
|
|
|
class Dialog;
|
2002-12-15 00:39:33 +00:00
|
|
|
class ConsoleDialog;
|
2002-03-20 17:51:07 +00:00
|
|
|
class Scumm;
|
2002-04-14 18:13:08 +00:00
|
|
|
class IMuse;
|
2002-09-29 07:08:31 +00:00
|
|
|
class IMuseDigital;
|
2003-05-26 22:03:04 +00:00
|
|
|
class Player_V2;
|
2002-05-14 23:35:28 +00:00
|
|
|
class Actor;
|
2002-08-29 23:45:15 +00:00
|
|
|
class Sound;
|
2002-09-13 12:20:55 +00:00
|
|
|
class Bundle;
|
2002-12-15 00:39:33 +00:00
|
|
|
class ScummDebugger;
|
2002-12-11 01:25:15 +00:00
|
|
|
class Serializer;
|
2002-07-16 21:03:14 +00:00
|
|
|
struct FindObjectInRoom;
|
2003-06-05 02:44:18 +00:00
|
|
|
class BaseCostumeRenderer;
|
2002-03-06 19:58:06 +00:00
|
|
|
|
2002-12-24 16:10:31 +00:00
|
|
|
typedef ScummVM::Map<ScummVM::String, int> ObjectIDMap;
|
|
|
|
|
2002-08-18 17:48:18 +00:00
|
|
|
// Use g_scumm from error() ONLY
|
2002-04-12 10:34:46 +00:00
|
|
|
extern Scumm *g_scumm;
|
|
|
|
|
2001-11-14 18:40:39 +00:00
|
|
|
/* System Wide Constants */
|
|
|
|
enum {
|
2003-05-28 18:13:30 +00:00
|
|
|
NUM_SCRIPT_SLOT = 80,
|
2001-11-26 19:57:57 +00:00
|
|
|
NUM_LOCALSCRIPT = 60,
|
2003-05-18 23:46:30 +00:00
|
|
|
NUM_SENTENCE = 6,
|
2001-11-26 19:57:57 +00:00
|
|
|
NUM_SHADOW_PALETTE = 8,
|
2002-08-25 18:40:23 +00:00
|
|
|
KEY_SET_OPTIONS = 3456 // WinCE
|
2001-11-14 18:40:39 +00:00
|
|
|
};
|
2001-10-26 17:34:50 +00:00
|
|
|
|
2003-05-20 20:42:28 +00:00
|
|
|
enum ObjectClass {
|
|
|
|
kObjectClassNeverClip = 20,
|
|
|
|
kObjectClassAlwaysClip = 21,
|
|
|
|
kObjectClassIgnoreBoxes = 22,
|
|
|
|
kObjectClassYFlip = 29,
|
|
|
|
kObjectClassXFlip = 30,
|
|
|
|
kObjectClassPlayer = 31, // Actor is controlled by the player
|
|
|
|
kObjectClassUntouchable = 32
|
|
|
|
};
|
|
|
|
|
2002-11-06 16:44:57 +00:00
|
|
|
#include "gfx.h"
|
|
|
|
#include "boxes.h"
|
|
|
|
|
2001-12-11 13:34:15 +00:00
|
|
|
struct MemBlkHeader {
|
|
|
|
uint32 size;
|
|
|
|
};
|
|
|
|
|
2002-11-29 15:13:49 +00:00
|
|
|
struct VerbSlot;
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-12-25 21:42:22 +00:00
|
|
|
struct ObjectData {
|
2002-12-26 20:37:49 +00:00
|
|
|
uint32 OBIMoffset;
|
|
|
|
uint32 OBCDoffset;
|
2002-04-19 08:21:56 +00:00
|
|
|
int16 walk_x, walk_y;
|
2001-11-11 16:54:45 +00:00
|
|
|
uint16 obj_nr;
|
|
|
|
int16 x_pos;
|
|
|
|
int16 y_pos;
|
2001-11-26 19:57:57 +00:00
|
|
|
uint16 width;
|
2001-11-11 16:54:45 +00:00
|
|
|
uint16 height;
|
|
|
|
byte actordir;
|
|
|
|
byte parent;
|
|
|
|
byte parentstate;
|
2001-11-26 19:57:57 +00:00
|
|
|
byte state;
|
2001-11-11 16:54:45 +00:00
|
|
|
byte fl_object_index;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ScriptSlot {
|
|
|
|
uint32 offs;
|
|
|
|
int32 delay;
|
|
|
|
uint16 number;
|
2002-08-25 11:35:13 +00:00
|
|
|
uint16 delayFrameCount;
|
2003-05-19 11:31:35 +00:00
|
|
|
bool freezeResistant, recursive;
|
|
|
|
bool didexec;
|
2001-11-11 16:54:45 +00:00
|
|
|
byte status;
|
2001-11-12 20:50:36 +00:00
|
|
|
byte where;
|
2003-05-19 11:31:35 +00:00
|
|
|
byte freezeCount;
|
2001-11-11 16:54:45 +00:00
|
|
|
byte cutsceneOverride;
|
|
|
|
};
|
2001-10-10 10:02:33 +00:00
|
|
|
|
2001-11-11 16:54:45 +00:00
|
|
|
struct NestedScript {
|
|
|
|
uint16 number;
|
2001-11-12 20:50:36 +00:00
|
|
|
uint8 where;
|
2001-11-11 16:54:45 +00:00
|
|
|
uint8 slot;
|
|
|
|
};
|
2003-01-16 00:40:19 +00:00
|
|
|
|
|
|
|
struct BlastText {
|
|
|
|
int16 xpos, ypos;
|
2003-05-15 22:30:32 +00:00
|
|
|
ScummVM::Rect rect;
|
2003-01-16 00:40:19 +00:00
|
|
|
byte color;
|
|
|
|
byte charset;
|
|
|
|
bool center;
|
|
|
|
byte text[256];
|
|
|
|
};
|
|
|
|
|
2001-11-05 19:21:49 +00:00
|
|
|
enum ResTypes {
|
2001-11-10 19:12:32 +00:00
|
|
|
rtFirst = 1,
|
2001-11-05 19:21:49 +00:00
|
|
|
rtRoom = 1,
|
|
|
|
rtScript = 2,
|
|
|
|
rtCostume = 3,
|
|
|
|
rtSound = 4,
|
|
|
|
rtInventory = 5,
|
|
|
|
rtCharset = 6,
|
|
|
|
rtString = 7,
|
|
|
|
rtVerb = 8,
|
|
|
|
rtActorName = 9,
|
|
|
|
rtBuffer = 10,
|
|
|
|
rtScaleTable = 11,
|
|
|
|
rtTemp = 12,
|
|
|
|
rtFlObject = 13,
|
|
|
|
rtMatrix = 14,
|
|
|
|
rtBox = 15,
|
|
|
|
rtObjectName = 16,
|
2002-07-04 15:48:17 +00:00
|
|
|
rtRoomScripts = 17,
|
|
|
|
rtLast = 17,
|
|
|
|
rtNumTypes = 18
|
2001-11-12 20:50:36 +00:00
|
|
|
};
|
2001-11-05 19:21:49 +00:00
|
|
|
|
2002-07-13 14:07:37 +00:00
|
|
|
enum {
|
|
|
|
LIGHTMODE_dark = 0,
|
|
|
|
LIGHTMODE_actor_base = 1,
|
|
|
|
LIGHTMODE_screen = 2,
|
|
|
|
LIGHTMODE_flashlight = 4,
|
|
|
|
LIGHTMODE_actor_color = 8
|
|
|
|
};
|
|
|
|
|
2001-11-14 20:09:39 +00:00
|
|
|
enum {
|
|
|
|
MBS_LEFT_CLICK = 0x8000,
|
|
|
|
MBS_RIGHT_CLICK = 0x4000,
|
2002-07-13 11:56:04 +00:00
|
|
|
MBS_MOUSE_MASK = (MBS_LEFT_CLICK | MBS_RIGHT_CLICK),
|
2001-11-14 20:09:39 +00:00
|
|
|
MBS_MAX_KEY = 0x0200
|
|
|
|
};
|
|
|
|
|
2003-03-01 22:04:48 +00:00
|
|
|
enum ScummGameId {
|
|
|
|
GID_TENTACLE = GID_SCUMM_FIRST,
|
|
|
|
GID_MONKEY2,
|
|
|
|
GID_INDY4,
|
|
|
|
GID_MONKEY,
|
|
|
|
GID_SAMNMAX,
|
|
|
|
GID_MONKEY_EGA,
|
|
|
|
GID_LOOM256,
|
|
|
|
GID_ZAK256,
|
|
|
|
GID_INDY3_256,
|
2003-04-06 19:41:34 +00:00
|
|
|
GID_INDY3,
|
2003-03-01 22:04:48 +00:00
|
|
|
GID_LOOM,
|
|
|
|
GID_FT,
|
|
|
|
GID_DIG,
|
|
|
|
GID_MONKEY_VGA,
|
|
|
|
GID_CMI,
|
|
|
|
GID_MANIAC,
|
|
|
|
GID_ZAK,
|
2003-06-02 18:15:09 +00:00
|
|
|
GID_MANIAC64,
|
|
|
|
GID_ZAK64,
|
2003-03-01 22:04:48 +00:00
|
|
|
GID_PUTTDEMO
|
|
|
|
};
|
|
|
|
|
2001-11-05 19:21:49 +00:00
|
|
|
#define _maxRooms res.num[rtRoom]
|
|
|
|
#define _maxScripts res.num[rtScript]
|
|
|
|
#define _maxCostumes res.num[rtCostume]
|
|
|
|
#define _maxInventoryItems res.num[rtInventory]
|
|
|
|
#define _maxCharsets res.num[rtCharset]
|
|
|
|
#define _maxStrings res.num[rtString]
|
|
|
|
#define _maxVerbs res.num[rtVerb]
|
|
|
|
#define _maxActorNames res.num[rtActorName]
|
|
|
|
#define _maxBuffer res.num[rtBuffer]
|
|
|
|
#define _maxScaleTable res.num[rtScaleTable]
|
|
|
|
#define _maxTemp res.num[rtTemp]
|
|
|
|
#define _maxFLObject res.num[rtFlObject]
|
|
|
|
#define _maxMatrixes res.num[rtMatrix]
|
|
|
|
#define _maxBoxes res.num[rtBox]
|
|
|
|
|
|
|
|
#define _baseRooms res.address[rtRoom]
|
|
|
|
#define _baseScripts res.address[rtScript]
|
|
|
|
#define _baseInventoryItems res.address[rtInventory]
|
|
|
|
#define _baseFLObject res.address[rtFlObject]
|
|
|
|
#define _baseArrays res.address[rtString]
|
|
|
|
|
|
|
|
#define _roomFileOffsets res.roomoffs[rtRoom]
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
#define ARRAY_HDR_SIZE 6
|
|
|
|
struct ArrayHeader {
|
|
|
|
int16 dim1_size;
|
|
|
|
int16 type;
|
|
|
|
int16 dim2_size;
|
|
|
|
byte data[1];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SentenceTab {
|
2003-04-28 03:13:49 +00:00
|
|
|
byte verb;
|
2003-05-22 14:10:20 +00:00
|
|
|
byte preposition;
|
2003-05-16 02:16:59 +00:00
|
|
|
uint16 objectA;
|
|
|
|
uint16 objectB;
|
2002-12-09 01:27:40 +00:00
|
|
|
uint8 freezeCount;
|
2001-10-16 10:01:48 +00:00
|
|
|
};
|
|
|
|
|
2002-09-22 01:17:53 +00:00
|
|
|
// TODO / FIXME: next time save game format changes, Fingolfin would like to
|
|
|
|
// revise StringTab. In particular, all t_* fields can be removed, making some
|
|
|
|
// code a bit cleaner & easier to understand.
|
2001-10-16 10:01:48 +00:00
|
|
|
struct StringTab {
|
2001-11-07 18:10:52 +00:00
|
|
|
int16 t_xpos, t_ypos;
|
|
|
|
int16 t_right;
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 xpos, ypos;
|
2001-11-07 18:10:52 +00:00
|
|
|
int16 right;
|
|
|
|
byte color, t_color;
|
|
|
|
byte charset, t_charset;
|
|
|
|
bool center, t_center;
|
|
|
|
bool overhead, t_overhead;
|
2002-07-13 11:56:04 +00:00
|
|
|
bool no_talk_anim, t_no_talk_anim;
|
2001-10-16 10:01:48 +00:00
|
|
|
};
|
|
|
|
|
2001-11-12 20:50:36 +00:00
|
|
|
enum WhereIsObject {
|
|
|
|
WIO_NOT_FOUND = -1,
|
|
|
|
WIO_INVENTORY = 0,
|
|
|
|
WIO_ROOM = 1,
|
|
|
|
WIO_GLOBAL = 2,
|
|
|
|
WIO_LOCAL = 3,
|
2002-03-10 07:48:01 +00:00
|
|
|
WIO_FLOBJECT = 4
|
2001-11-12 20:50:36 +00:00
|
|
|
};
|
|
|
|
|
2001-12-27 17:51:58 +00:00
|
|
|
enum MouseButtonStatus {
|
|
|
|
msDown = 1,
|
2002-03-10 07:48:01 +00:00
|
|
|
msClicked = 2
|
|
|
|
};
|
|
|
|
|
2003-05-30 22:57:19 +00:00
|
|
|
struct LangIndexNode {
|
2003-05-30 23:24:29 +00:00
|
|
|
char tag[12+1];
|
2003-02-14 16:01:55 +00:00
|
|
|
int32 offset;
|
|
|
|
};
|
|
|
|
|
2002-08-14 10:18:03 +00:00
|
|
|
class Scumm : public Engine {
|
2003-02-08 00:38:17 +00:00
|
|
|
friend class ScummDebugger;
|
2003-03-17 12:32:46 +00:00
|
|
|
friend class SmushPlayer;
|
2003-03-07 15:38:11 +00:00
|
|
|
void errorString(const char *buf_input, char *buf_output);
|
2002-03-20 17:51:07 +00:00
|
|
|
public:
|
2002-04-12 21:26:59 +00:00
|
|
|
/* Put often used variables at the top.
|
|
|
|
* That results in a shorter form of the opcode
|
|
|
|
* on some architectures. */
|
2002-04-14 18:13:08 +00:00
|
|
|
IMuse *_imuse;
|
2002-09-29 07:08:31 +00:00
|
|
|
IMuseDigital *_imuseDigital;
|
2003-05-26 22:03:04 +00:00
|
|
|
Player_V2 *_playerV2;
|
2003-06-04 23:03:23 +00:00
|
|
|
|
|
|
|
uint32 _features; // Should only be accessed for reading (TODO enforce it compiler-wise with making it private and creating an accessor)
|
|
|
|
void setFeatures (uint32 newFeatures); // Changes the features set. This allows some gamewide stuff to be precalculated/prepared (ie CostumeRenderer)
|
|
|
|
|
2002-04-12 21:26:59 +00:00
|
|
|
VerbSlot *_verbs;
|
|
|
|
ObjectData *_objs;
|
|
|
|
ScummDebugger *_debugger;
|
2003-02-08 01:27:21 +00:00
|
|
|
Bundle *_bundle;
|
|
|
|
Sound *_sound;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
|
|
|
struct {
|
2001-11-10 19:12:32 +00:00
|
|
|
byte mode[rtNumTypes];
|
|
|
|
uint16 num[rtNumTypes];
|
|
|
|
uint32 tags[rtNumTypes];
|
|
|
|
const char *name[rtNumTypes];
|
|
|
|
byte **address[rtNumTypes];
|
|
|
|
byte *flags[rtNumTypes];
|
|
|
|
byte *roomno[rtNumTypes];
|
|
|
|
uint32 *roomoffs[rtNumTypes];
|
2001-10-09 14:30:12 +00:00
|
|
|
} res;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
uint32 cutScenePtr[5];
|
|
|
|
byte cutSceneScript[5];
|
|
|
|
int16 cutSceneData[5];
|
|
|
|
int16 cutSceneScriptIndex;
|
|
|
|
byte cutSceneStackPointer;
|
2001-10-26 17:34:50 +00:00
|
|
|
ScriptSlot slot[NUM_SCRIPT_SLOT];
|
2001-10-09 14:30:12 +00:00
|
|
|
NestedScript nest[15];
|
2003-01-15 16:23:04 +00:00
|
|
|
int32 localvar[NUM_SCRIPT_SLOT][26];
|
2001-10-09 14:30:12 +00:00
|
|
|
} vm;
|
|
|
|
|
2003-02-08 01:27:21 +00:00
|
|
|
// Constructor / Destructor
|
|
|
|
Scumm(GameDetector *detector, OSystem *syst);
|
|
|
|
virtual ~Scumm();
|
2002-03-21 00:40:18 +00:00
|
|
|
|
2003-02-08 01:27:21 +00:00
|
|
|
// Init functions
|
2002-12-29 19:54:11 +00:00
|
|
|
void scummInit();
|
|
|
|
void initScummVars();
|
2003-02-08 01:27:21 +00:00
|
|
|
virtual void setupScummVars();
|
2002-12-29 19:54:11 +00:00
|
|
|
|
2003-02-08 01:27:21 +00:00
|
|
|
// Startup functions
|
|
|
|
void main();
|
|
|
|
void parseCommandLine(int argc, char **argv);
|
|
|
|
void showHelpAndExit();
|
|
|
|
bool detectGame();
|
2002-12-29 19:54:11 +00:00
|
|
|
void launch();
|
|
|
|
void go();
|
|
|
|
|
2003-02-08 01:27:21 +00:00
|
|
|
// Scumm main loop
|
|
|
|
void mainRun();
|
|
|
|
int scummLoop(int delta);
|
2003-03-06 17:58:13 +00:00
|
|
|
|
2003-02-08 01:27:21 +00:00
|
|
|
// Event handling
|
2003-03-17 12:32:46 +00:00
|
|
|
void parseEvents();
|
2002-12-29 19:54:11 +00:00
|
|
|
void waitForTimer(int msec_delay);
|
2003-02-08 01:27:21 +00:00
|
|
|
void processKbd();
|
|
|
|
int checkKeyHit();
|
|
|
|
void convertKeysToClicks();
|
|
|
|
int getKeyInput();
|
2003-05-13 23:33:01 +00:00
|
|
|
void clearClickedStatus();
|
2002-12-29 19:54:11 +00:00
|
|
|
|
2003-02-08 01:27:21 +00:00
|
|
|
// Misc utility functions
|
|
|
|
void checkRange(int max, int min, int no, const char *str);
|
|
|
|
const char *getExeName() const { return _exe_name; }
|
2003-05-24 22:17:45 +00:00
|
|
|
const char *getGameDataPath() const;
|
2003-02-08 01:27:21 +00:00
|
|
|
|
|
|
|
// Cursor/palette
|
2002-12-29 19:54:11 +00:00
|
|
|
void updateCursor();
|
|
|
|
void animateCursor();
|
|
|
|
void updatePalette();
|
|
|
|
|
2002-03-25 12:26:37 +00:00
|
|
|
/* _insane vars */
|
2002-12-25 16:55:43 +00:00
|
|
|
int _smushFrameRate;
|
2002-10-08 00:29:32 +00:00
|
|
|
bool _insaneState;
|
|
|
|
bool _videoFinished;
|
2003-03-17 12:32:46 +00:00
|
|
|
bool _smushPlay;
|
2002-03-25 12:26:37 +00:00
|
|
|
|
2003-06-02 02:25:24 +00:00
|
|
|
void pauseGame();
|
|
|
|
void restart();
|
|
|
|
void shutDown();
|
2002-03-20 17:51:07 +00:00
|
|
|
void setOptions(void);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2003-04-30 13:23:31 +00:00
|
|
|
#ifdef __PALM_OS__
|
|
|
|
bool _quit; // try to exit properly
|
|
|
|
#endif
|
2002-09-19 21:45:56 +00:00
|
|
|
// GUI
|
|
|
|
NewGui *_newgui;
|
|
|
|
|
|
|
|
Dialog *_pauseDialog;
|
|
|
|
Dialog *_optionsDialog;
|
|
|
|
Dialog *_saveLoadDialog;
|
2002-12-27 00:38:32 +00:00
|
|
|
// Debugger access this one, too...
|
2002-12-15 00:39:33 +00:00
|
|
|
ConsoleDialog *_debuggerDialog;
|
2002-09-19 21:45:56 +00:00
|
|
|
|
2002-11-10 14:59:15 +00:00
|
|
|
int runDialog(Dialog *dialog);
|
2002-09-19 21:45:56 +00:00
|
|
|
void pauseDialog();
|
|
|
|
void saveloadDialog();
|
|
|
|
void optionsDialog();
|
2003-01-02 10:36:17 +00:00
|
|
|
char displayError(bool showCancel, const char *message, ...);
|
2002-09-19 21:45:56 +00:00
|
|
|
|
2003-02-08 00:38:17 +00:00
|
|
|
protected:
|
2003-02-08 01:27:21 +00:00
|
|
|
byte _fastMode;
|
2003-01-16 12:47:34 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Random number generation */
|
2002-12-01 14:57:50 +00:00
|
|
|
RandomSource _rnd;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2003-02-08 00:38:17 +00:00
|
|
|
public:
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Core variable definitions */
|
|
|
|
byte _gameId;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Core class/array definitions */
|
2001-10-26 17:34:50 +00:00
|
|
|
Gdi gdi;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2003-02-08 00:38:17 +00:00
|
|
|
protected:
|
2003-05-13 23:42:41 +00:00
|
|
|
Actor *_actors; // Has _numActors elements
|
2002-03-20 17:51:07 +00:00
|
|
|
|
|
|
|
uint16 *_inventory;
|
|
|
|
uint16 *_newNames;
|
2003-02-08 00:38:17 +00:00
|
|
|
public:
|
2003-05-08 15:48:50 +00:00
|
|
|
// VAR is a wrapper around scummVar, which attempts to include additional
|
|
|
|
// useful information should an illegal var access be detected.
|
|
|
|
#define VAR(x) scummVar(x, #x, __FILE__, __LINE__)
|
2003-05-24 22:17:45 +00:00
|
|
|
int32& scummVar(byte var, const char *varName, const char *file, int line)
|
2003-05-08 15:48:50 +00:00
|
|
|
{
|
2003-05-13 23:33:01 +00:00
|
|
|
if (var == 0xFF) {
|
2003-05-08 15:48:50 +00:00
|
|
|
warning("Illegal access to variable %s in file %s, line %d", varName, file, line);
|
2003-05-13 23:33:01 +00:00
|
|
|
// Return a fake memory location, so that at least no innocent variable
|
|
|
|
// gets overwritten.
|
|
|
|
static int32 fake;
|
|
|
|
fake = 0;
|
|
|
|
return fake;
|
|
|
|
}
|
2003-05-08 15:48:50 +00:00
|
|
|
return _scummVars[var];
|
|
|
|
}
|
|
|
|
|
2003-02-08 00:38:17 +00:00
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
int16 _varwatch;
|
2003-05-08 15:48:50 +00:00
|
|
|
int32 *_scummVars;
|
2002-03-20 17:51:07 +00:00
|
|
|
byte *_bitVars;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Global resource tables */
|
|
|
|
int _numVariables, _numBitVariables, _numLocalObjects;
|
|
|
|
int _numGlobalObjects, _numArray, _numVerbs, _numFlObject;
|
|
|
|
int _numInventory, _numRooms, _numScripts, _numSounds;
|
2003-02-08 00:38:17 +00:00
|
|
|
int _numCharsets, _numNewNames, _numGlobalScripts;
|
2003-05-13 23:42:41 +00:00
|
|
|
int _numActors;
|
2003-02-08 00:38:17 +00:00
|
|
|
public:
|
|
|
|
int _numCostumes; // FIXME - should be protected, used by Actor::remapActorPalette
|
2003-06-05 02:44:18 +00:00
|
|
|
|
|
|
|
BaseCostumeRenderer* _bcr;
|
2003-02-08 00:38:17 +00:00
|
|
|
|
2002-10-11 08:35:12 +00:00
|
|
|
char *_audioNames;
|
|
|
|
int32 _numAudioNames;
|
|
|
|
|
2003-02-08 00:38:17 +00:00
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Current objects - can go in their respective classes */
|
|
|
|
byte _curActor;
|
|
|
|
int _curVerb;
|
|
|
|
int _curVerbSlot;
|
|
|
|
int _curPalIndex;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2003-05-24 22:17:45 +00:00
|
|
|
public:
|
|
|
|
byte _currentRoom; // FIXME - should be protected but Actor::isInCurrentRoom uses it
|
|
|
|
int _roomResource; // FIXME - should be protected but Sound::pauseSounds uses it
|
2003-02-08 00:38:17 +00:00
|
|
|
bool _egoPositioned; // Used by Actor::putActor, hence public
|
2003-05-24 22:17:45 +00:00
|
|
|
|
2003-02-08 00:38:17 +00:00
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
int _keyPressed;
|
2001-10-09 14:30:12 +00:00
|
|
|
uint16 _lastKeyHit;
|
|
|
|
|
2003-05-15 22:41:35 +00:00
|
|
|
ScummVM::Point _mouse;
|
|
|
|
ScummVM::Point _virtualMouse;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2003-05-13 23:33:01 +00:00
|
|
|
uint16 _mouseButStat;
|
|
|
|
byte _leftBtnPressed, _rightBtnPressed;
|
2001-11-05 19:21:49 +00:00
|
|
|
|
2003-05-13 23:33:01 +00:00
|
|
|
int _bootParam; // The bootparam, to be passed to the script 1, the bootscript
|
|
|
|
|
|
|
|
// Various options useful for debugging
|
|
|
|
bool _dumpScripts;
|
|
|
|
bool _hexdumpScripts;
|
|
|
|
bool _showStack;
|
|
|
|
uint16 _debugMode;
|
2001-11-09 18:54:15 +00:00
|
|
|
|
2003-05-24 22:17:45 +00:00
|
|
|
// Save/Load class - some of this may be GUI
|
2002-03-20 17:51:07 +00:00
|
|
|
byte _saveLoadFlag, _saveLoadSlot;
|
2002-12-13 03:23:17 +00:00
|
|
|
uint32 _lastSaveTime;
|
2002-03-20 17:51:07 +00:00
|
|
|
bool _saveLoadCompatible;
|
2001-11-09 18:54:15 +00:00
|
|
|
char _saveLoadName[32];
|
|
|
|
|
2002-12-17 01:15:13 +00:00
|
|
|
bool saveState(int slot, bool compat, SaveFileManager *mgr);
|
|
|
|
bool loadState(int slot, bool compat, SaveFileManager *mgr);
|
2003-03-06 17:58:13 +00:00
|
|
|
bool saveState(int slot, bool compat) {
|
2002-12-17 01:15:13 +00:00
|
|
|
SaveFileManager *mgr = _system->get_savefile_manager();
|
|
|
|
bool result = saveState(slot, compat, mgr);
|
|
|
|
delete mgr;
|
|
|
|
return result;
|
|
|
|
}
|
2003-03-06 17:58:13 +00:00
|
|
|
bool loadState(int slot, bool compat) {
|
2002-12-17 01:15:13 +00:00
|
|
|
SaveFileManager *mgr = _system->get_savefile_manager();
|
|
|
|
bool result = loadState(slot, compat, mgr);
|
|
|
|
delete mgr;
|
|
|
|
return result;
|
|
|
|
}
|
2002-12-13 03:23:17 +00:00
|
|
|
void saveOrLoad(Serializer *s, uint32 savegameVersion);
|
2003-05-24 22:17:45 +00:00
|
|
|
void saveLoadResource(Serializer *ser, int type, int index);
|
|
|
|
void makeSavegameName(char *out, int slot, bool compatible);
|
2001-11-14 18:40:39 +00:00
|
|
|
|
2003-02-08 01:27:21 +00:00
|
|
|
public:
|
2002-12-17 01:15:13 +00:00
|
|
|
bool getSavegameName(int slot, char *desc, SaveFileManager *mgr);
|
|
|
|
void listSavegames(bool *marks, int num, SaveFileManager *mgr);
|
2003-02-08 01:27:21 +00:00
|
|
|
|
|
|
|
void requestSave(int slot, const char *name);
|
|
|
|
void requestLoad(int slot);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-02-08 01:27:21 +00:00
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Heap and memory management */
|
|
|
|
uint32 _maxHeapThreshold, _minHeapThreshold;
|
|
|
|
void lock(int type, int i);
|
|
|
|
void unlock(int type, int i);
|
2003-02-06 21:32:20 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Script VM - should be in Script class */
|
|
|
|
uint32 _localScriptList[NUM_LOCALSCRIPT];
|
2003-05-21 16:28:02 +00:00
|
|
|
const byte *_scriptPointer, *_scriptOrgPointer;
|
2002-03-20 17:51:07 +00:00
|
|
|
byte _opcode, _numNestedScripts, _currentScript;
|
|
|
|
uint16 _curExecScript;
|
|
|
|
byte **_lastCodePtr;
|
|
|
|
int _resultVarNumber, _scummStackPos;
|
2002-12-25 14:46:39 +00:00
|
|
|
int _localParamList[16], _scummStack[150];
|
2003-02-08 01:27:21 +00:00
|
|
|
int _keyScriptKey, _keyScriptNo;
|
2002-03-20 17:51:07 +00:00
|
|
|
|
2002-12-16 12:12:31 +00:00
|
|
|
virtual void setupOpcodes() = 0;
|
2003-05-14 20:37:53 +00:00
|
|
|
virtual void executeOpcode(byte i) = 0;
|
|
|
|
virtual const char *getOpcodeDesc(byte i) = 0;
|
2002-12-16 12:12:31 +00:00
|
|
|
|
2002-12-25 14:46:39 +00:00
|
|
|
void initializeLocals(int slot, int *vars);
|
2002-03-20 17:51:07 +00:00
|
|
|
int getScriptSlot();
|
2003-02-06 21:32:20 +00:00
|
|
|
|
2003-05-13 23:33:01 +00:00
|
|
|
void startScene(int room, Actor *a, int b);
|
|
|
|
void startManiac();
|
|
|
|
|
2003-02-06 21:32:20 +00:00
|
|
|
public:
|
2003-05-19 11:31:35 +00:00
|
|
|
void runScript(int script, bool freezeResistant, bool recursive, int *lvarptr);
|
2003-05-20 20:58:26 +00:00
|
|
|
void stopScript(int script);
|
2003-05-24 22:17:45 +00:00
|
|
|
bool isScriptRunning(int script); // FIXME - should be protected, used by Sound::startTalkSound
|
2003-02-06 21:32:20 +00:00
|
|
|
|
|
|
|
protected:
|
2003-05-24 22:17:45 +00:00
|
|
|
void runObjectScript(int script, int entry, bool freezeResistant, bool recursive, int *vars);
|
2002-03-20 17:51:07 +00:00
|
|
|
void runScriptNested(int script);
|
2003-05-24 22:17:45 +00:00
|
|
|
void executeScript();
|
2002-03-20 17:51:07 +00:00
|
|
|
void updateScriptPtr();
|
2003-05-24 22:17:45 +00:00
|
|
|
void runHook(int i);
|
|
|
|
void checkAndRunSentenceScript();
|
|
|
|
void runExitScript();
|
|
|
|
void runEntryScript();
|
|
|
|
void runAllScripts();
|
|
|
|
void freezeScripts(int scr);
|
|
|
|
void unfreezeScripts();
|
|
|
|
|
|
|
|
bool isScriptInUse(int script);
|
|
|
|
bool isRoomScriptRunning(int script);
|
|
|
|
|
|
|
|
void killAllScriptsExceptCurrent();
|
|
|
|
void killScriptsAndResources();
|
|
|
|
void decreaseScriptDelay(int amount);
|
|
|
|
|
|
|
|
void stopObjectCode();
|
|
|
|
void stopObjectScript(int script);
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void getScriptBaseAddress();
|
|
|
|
void getScriptEntryPoint();
|
2003-05-24 22:17:45 +00:00
|
|
|
int getVerbEntrypoint(int obj, int entry);
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
byte fetchScriptByte();
|
2002-12-23 00:23:36 +00:00
|
|
|
virtual uint fetchScriptWord();
|
|
|
|
virtual int fetchScriptWordSigned();
|
2002-03-20 17:51:07 +00:00
|
|
|
void ignoreScriptWord() { fetchScriptWord(); }
|
|
|
|
void ignoreScriptByte() { fetchScriptByte(); }
|
2003-05-04 02:27:22 +00:00
|
|
|
virtual void getResultPos();
|
2002-03-20 17:51:07 +00:00
|
|
|
void setResult(int result);
|
|
|
|
void push(int a);
|
|
|
|
int pop();
|
2003-05-13 23:33:01 +00:00
|
|
|
virtual int readVar(uint var);
|
2002-12-23 18:30:12 +00:00
|
|
|
virtual void writeVar(uint var, int value);
|
2002-03-20 17:51:07 +00:00
|
|
|
|
2003-05-20 20:58:26 +00:00
|
|
|
void beginCutscene(int *args);
|
2002-03-20 17:51:07 +00:00
|
|
|
void endCutscene();
|
2003-05-20 20:58:26 +00:00
|
|
|
void abortCutscene();
|
2002-03-20 17:51:07 +00:00
|
|
|
void beginOverride();
|
|
|
|
void endOverride();
|
2003-05-24 22:17:45 +00:00
|
|
|
|
2002-12-28 01:57:19 +00:00
|
|
|
void copyScriptString(byte *dst);
|
|
|
|
int resStrLen(const byte *src) const;
|
2002-03-20 17:51:07 +00:00
|
|
|
void doSentence(int c, int b, int a);
|
2002-12-16 12:12:31 +00:00
|
|
|
void setStringVars(int i);
|
2002-03-20 17:51:07 +00:00
|
|
|
|
|
|
|
/* Should be in Resource class */
|
|
|
|
byte _encbyte;
|
2002-09-10 07:34:27 +00:00
|
|
|
File _fileHandle;
|
2002-03-20 17:51:07 +00:00
|
|
|
uint32 _fileOffset;
|
2003-05-13 23:33:01 +00:00
|
|
|
int _resourceHeaderSize;
|
2002-10-28 09:03:02 +00:00
|
|
|
char *_exe_name; // This is the name we use for opening resource files
|
|
|
|
char *_game_name; // This is the game the user calls it, so use for saving
|
2002-03-20 17:51:07 +00:00
|
|
|
bool _dynamicRoomOffsets;
|
|
|
|
byte _resourceMapper[128];
|
|
|
|
uint32 _allocatedSize;
|
|
|
|
byte _expire_counter;
|
2003-05-16 16:09:16 +00:00
|
|
|
byte *_HEV7RoomOffsets;
|
2002-03-16 05:33:25 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void allocateArrays();
|
2001-10-09 14:30:12 +00:00
|
|
|
void openRoom(int room);
|
2002-12-22 21:58:16 +00:00
|
|
|
void closeRoom();
|
2001-10-09 14:30:12 +00:00
|
|
|
void deleteRoomOffsets();
|
|
|
|
void readRoomsOffsets();
|
2003-01-02 10:36:17 +00:00
|
|
|
void askForDisk(const char *filename, int disknum);
|
2001-10-09 14:30:12 +00:00
|
|
|
bool openResourceFile(const char *filename);
|
2003-02-08 00:38:17 +00:00
|
|
|
|
2003-05-21 18:09:49 +00:00
|
|
|
void loadPtrToResource(int type, int i, const byte *ptr);
|
2001-10-09 14:30:12 +00:00
|
|
|
void readResTypeList(int id, uint32 tag, const char *name);
|
2002-04-26 14:13:39 +00:00
|
|
|
char *resTypeFromId(int id);
|
2001-10-09 14:30:12 +00:00
|
|
|
void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode);
|
|
|
|
byte *createResource(int type, int index, uint32 size);
|
2003-03-07 21:38:46 +00:00
|
|
|
int loadResource(int type, int i);
|
2002-03-20 17:51:07 +00:00
|
|
|
void nukeResource(int type, int i);
|
2003-03-07 21:38:46 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
bool isGlobInMemory(int type, int index);
|
|
|
|
bool isResourceLoaded(int type, int index);
|
2001-10-09 14:30:12 +00:00
|
|
|
byte *getResourceAddress(int type, int i);
|
2001-10-24 20:12:52 +00:00
|
|
|
byte *getStringAddress(int i);
|
2002-04-21 19:38:00 +00:00
|
|
|
byte *getStringAddressVar(int i);
|
2001-10-09 14:30:12 +00:00
|
|
|
void ensureResourceLoaded(int type, int i);
|
|
|
|
int getResourceRoomNr(int type, int index);
|
2003-03-07 21:38:46 +00:00
|
|
|
|
|
|
|
protected:
|
2001-10-09 14:30:12 +00:00
|
|
|
int readSoundResource(int type, int index);
|
2002-09-21 13:48:03 +00:00
|
|
|
int readSoundResourceSmallHeader(int type, int index);
|
2001-11-05 19:21:49 +00:00
|
|
|
void setResourceCounter(int type, int index, byte flag);
|
2002-09-25 03:04:28 +00:00
|
|
|
bool validateResource(const char *str, int type, int index);
|
2002-03-20 17:51:07 +00:00
|
|
|
void increaseResourceCounter();
|
|
|
|
bool isResourceInUse(int type, int i);
|
|
|
|
void initRoomSubBlocks();
|
2003-01-26 10:57:01 +00:00
|
|
|
void clearRoomObjects();
|
2002-03-20 17:51:07 +00:00
|
|
|
void loadRoomObjects();
|
2002-12-26 21:50:13 +00:00
|
|
|
void loadRoomObjectsSmall();
|
2003-04-12 02:09:00 +00:00
|
|
|
void loadRoomObjectsOldBundle();
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void readArrayFromIndexFile();
|
2003-03-07 21:38:46 +00:00
|
|
|
virtual void readMAXS();
|
2002-03-23 22:03:35 +00:00
|
|
|
virtual void readIndexFile();
|
2002-03-25 02:09:05 +00:00
|
|
|
virtual void loadCharset(int i);
|
2002-03-20 17:51:07 +00:00
|
|
|
void nukeCharset(int i);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2003-03-07 21:38:46 +00:00
|
|
|
int _lastLoadedRoom;
|
|
|
|
public:
|
2003-05-28 20:01:47 +00:00
|
|
|
const byte *findResourceData(uint32 tag, const byte *ptr);
|
2003-05-26 13:14:57 +00:00
|
|
|
int getResourceDataSize(const byte *ptr) const;
|
2003-05-28 20:01:47 +00:00
|
|
|
void dumpResource(const char *tag, int index, const byte *ptr, int length = -1);
|
2003-03-06 17:58:13 +00:00
|
|
|
|
2003-03-07 21:38:46 +00:00
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
int getArrayId();
|
|
|
|
void nukeArray(int a);
|
|
|
|
int defineArray(int a, int b, int c, int d);
|
|
|
|
int readArray(int array, int index, int base);
|
|
|
|
void writeArray(int array, int index, int base, int value);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void resourceStats();
|
|
|
|
void expireResources(uint32 size);
|
|
|
|
void freeResources();
|
|
|
|
void destroy();
|
|
|
|
|
2003-03-07 21:38:46 +00:00
|
|
|
public:
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Should be in Object class */
|
|
|
|
byte OF_OWNER_ROOM;
|
|
|
|
int getInventorySlot();
|
|
|
|
void SamInventoryHack(int obj); // FIXME: Sam and Max hack
|
|
|
|
int findInventory(int owner, int index);
|
|
|
|
int getInventoryCount(int owner);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2003-05-13 23:33:01 +00:00
|
|
|
protected:
|
|
|
|
byte *_objectOwnerTable, *_objectRoomTable, *_objectStateTable;
|
|
|
|
ObjectIDMap _objectIDMap;
|
|
|
|
byte _numObjectsInRoom;
|
|
|
|
|
2003-05-28 20:01:47 +00:00
|
|
|
void setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL);
|
2002-03-20 17:51:07 +00:00
|
|
|
void removeObjectFromRoom(int obj);
|
|
|
|
void loadFlObject(uint object, uint room);
|
|
|
|
void nukeFlObjects(int min, int max);
|
|
|
|
int findFlObjectSlot();
|
2003-01-12 07:30:17 +00:00
|
|
|
int findLocalObjectSlot();
|
2002-03-20 17:51:07 +00:00
|
|
|
void addObjectToInventory(uint obj, uint room);
|
|
|
|
void fixObjectFlags();
|
2003-05-13 23:33:01 +00:00
|
|
|
public:
|
|
|
|
bool getClass(int obj, int cls); // Used in actor.cpp, hence public
|
|
|
|
protected:
|
2001-10-09 14:30:12 +00:00
|
|
|
void putClass(int obj, int cls, bool set);
|
|
|
|
int getState(int obj);
|
|
|
|
void putState(int obj, int state);
|
2002-03-20 17:51:07 +00:00
|
|
|
void setObjectState(int obj, int state, int x, int y);
|
2001-10-09 14:30:12 +00:00
|
|
|
int getOwner(int obj);
|
|
|
|
void putOwner(int obj, int owner);
|
2002-03-20 17:51:07 +00:00
|
|
|
void setOwnerOf(int obj, int owner);
|
|
|
|
void clearOwnerOf(int obj);
|
2001-11-26 19:57:57 +00:00
|
|
|
int getObjectRoom(int obj);
|
2002-03-20 17:51:07 +00:00
|
|
|
int getObjX(int obj);
|
|
|
|
int getObjY(int obj);
|
2002-07-16 18:51:27 +00:00
|
|
|
void getObjectXYPos(int object, int &x, int &y) { int dir; getObjectXYPos(object, x, y, dir); }
|
|
|
|
void getObjectXYPos(int object, int &x, int &y, int &dir);
|
2002-03-20 17:51:07 +00:00
|
|
|
int getObjOldDir(int obj);
|
|
|
|
int getObjNewDir(int obj);
|
|
|
|
int getObjectIndex(int object);
|
|
|
|
int whereIsObject(int object);
|
|
|
|
int findObject(int x, int y);
|
|
|
|
void findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint object, uint room);
|
2003-05-13 23:33:01 +00:00
|
|
|
public:
|
|
|
|
int getObjectOrActorXY(int object, int &x, int &y); // Used in actor.cpp, hence public
|
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
int getObjActToObjActDist(int a, int b); // Not sure how to handle
|
2003-05-31 12:17:58 +00:00
|
|
|
const byte *getObjOrActorName(int obj); // these three..
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void addObjectToDrawQue(int object);
|
|
|
|
void clearDrawObjectQueue();
|
|
|
|
void processDrawQue();
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
uint32 getOBCDOffs(int object);
|
|
|
|
byte *getOBCDFromObject(int obj);
|
|
|
|
int getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e, int f);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
|
|
|
|
2003-02-08 00:38:17 +00:00
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Should be in Verb class */
|
2002-05-07 18:44:34 +00:00
|
|
|
uint16 _verbMouseOver;
|
2003-05-13 23:33:01 +00:00
|
|
|
int _inventoryOffset;
|
|
|
|
int8 _userPut;
|
2003-05-21 07:22:43 +00:00
|
|
|
uint16 _userState;
|
2003-05-13 23:33:01 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void redrawVerbs();
|
|
|
|
void checkExecVerbs();
|
|
|
|
void verbMouseOver(int verb);
|
|
|
|
int checkMouseOver(int x, int y);
|
|
|
|
void drawVerb(int verb, int mode);
|
|
|
|
void runInputScript(int a, int cmd, int mode);
|
|
|
|
void restoreVerbBG(int verb);
|
2002-08-14 09:53:34 +00:00
|
|
|
void drawVerbBitmap(int verb, int x, int y);
|
2001-10-09 14:30:12 +00:00
|
|
|
int getVerbSlot(int id, int mode);
|
|
|
|
void killVerb(int slot);
|
2001-11-06 20:00:47 +00:00
|
|
|
void setVerbObject(uint room, uint object, uint verb);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2003-05-30 14:29:07 +00:00
|
|
|
|
2003-06-04 21:45:29 +00:00
|
|
|
// TODO: This should be moved into Scumm_v2 if possible
|
2003-05-30 14:29:07 +00:00
|
|
|
ScummVM::Rect v2_mouseover_boxes[7];
|
|
|
|
int8 v2_mouseover_box;
|
|
|
|
|
|
|
|
void initV2MouseOver();
|
|
|
|
void checkV2MouseOver(ScummVM::Point pos);
|
2003-05-21 10:13:06 +00:00
|
|
|
void checkV2Inventory(int x, int y);
|
2003-05-21 09:29:24 +00:00
|
|
|
void redrawV2Inventory();
|
|
|
|
|
2003-02-08 00:38:17 +00:00
|
|
|
public:
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Should be in Actor class */
|
2003-05-23 12:48:50 +00:00
|
|
|
Actor *derefActor(int id, const char *errmsg = 0);
|
2001-10-09 14:30:12 +00:00
|
|
|
Actor *derefActorSafe(int id, const char *errmsg);
|
2001-10-09 19:02:28 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
uint32 *_classData;
|
2001-10-09 19:02:28 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
int getAngleFromPos(int x, int y);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-05-24 22:17:45 +00:00
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
void walkActors();
|
|
|
|
void playActorSounds();
|
2003-05-30 00:55:21 +00:00
|
|
|
void setActorRedrawFlags();
|
2003-05-24 22:17:45 +00:00
|
|
|
void showActors();
|
2002-03-20 17:51:07 +00:00
|
|
|
void resetActorBgs();
|
|
|
|
void processActors();
|
2003-02-27 10:17:29 +00:00
|
|
|
void processUpperActors();
|
2002-03-20 17:51:07 +00:00
|
|
|
int getActorFromPos(int x, int y);
|
|
|
|
|
|
|
|
bool isCostumeInUse(int i);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-05-24 22:17:45 +00:00
|
|
|
public:
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Actor talking stuff */
|
|
|
|
byte _actorToPrintStrFor;
|
|
|
|
int _sentenceNum;
|
2003-05-18 23:46:30 +00:00
|
|
|
SentenceTab _sentence[NUM_SENTENCE];
|
2002-09-22 01:17:53 +00:00
|
|
|
StringTab _string[6];
|
2003-05-25 00:47:36 +00:00
|
|
|
int16 _talkDelay;
|
2002-03-20 17:51:07 +00:00
|
|
|
void actorTalk();
|
2003-02-08 01:27:21 +00:00
|
|
|
void stopTalk();
|
|
|
|
|
|
|
|
// Costume class
|
|
|
|
void cost_decodeData(Actor *a, int frame, uint usemask);
|
|
|
|
int cost_frameToAnim(Actor *a, int frame);
|
2002-04-12 10:34:46 +00:00
|
|
|
|
2003-02-08 01:27:21 +00:00
|
|
|
// Akos Class
|
2003-05-28 20:01:47 +00:00
|
|
|
bool akos_increaseAnims(const byte *akos, Actor *a);
|
|
|
|
bool akos_increaseAnim(Actor *a, int i, const byte *aksq, const uint16 *akfo, int numakfo);
|
2002-04-12 10:34:46 +00:00
|
|
|
void akos_queCommand(byte cmd, Actor *a, int param_1, int param_2);
|
|
|
|
bool akos_compare(int a, int b, byte cmd);
|
|
|
|
void akos_decodeData(Actor *a, int frame, uint usemask);
|
|
|
|
int akos_frameToAnim(Actor *a, int frame);
|
|
|
|
bool akos_hasManyDirections(Actor *a);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Should be in Graphics class? */
|
|
|
|
uint16 _screenB, _screenH;
|
2003-05-25 00:47:36 +00:00
|
|
|
int _roomHeight, _roomWidth;
|
|
|
|
public:
|
|
|
|
int _screenHeight, _screenWidth;
|
2002-03-20 17:51:07 +00:00
|
|
|
VirtScreen virtscr[4]; // Virtual screen areas
|
|
|
|
CameraData camera; // 'Camera' - viewport
|
2003-05-25 00:47:36 +00:00
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
ColorCycle _colorCycle[16]; // Palette cycles
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
uint32 _ENCD_offs, _EXCD_offs;
|
2002-12-08 16:14:29 +00:00
|
|
|
uint32 _CLUT_offs;
|
2002-03-20 17:51:07 +00:00
|
|
|
uint32 _IM00_offs, _PALS_offs;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-05-14 18:14:16 +00:00
|
|
|
//ender: fullscreen
|
2003-02-08 02:00:22 +00:00
|
|
|
bool _fullRedraw, _BgNeedsRedraw, _verbRedraw;
|
2002-03-20 17:51:07 +00:00
|
|
|
bool _screenEffectFlag, _completeScreenRedraw;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-12-04 22:31:36 +00:00
|
|
|
struct {
|
|
|
|
int hotspotX, hotspotY, width, height;
|
|
|
|
byte animate, animateIndex;
|
|
|
|
int8 state;
|
|
|
|
} _cursor;
|
2002-12-25 03:48:27 +00:00
|
|
|
byte _grabbedCursor[8192];
|
2002-12-04 13:36:27 +00:00
|
|
|
byte _currentCursor;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
byte _newEffect, _switchRoomEffect2, _switchRoomEffect;
|
|
|
|
bool _doEffect;
|
2002-08-19 17:23:48 +00:00
|
|
|
|
2002-11-10 17:19:43 +00:00
|
|
|
struct {
|
|
|
|
int x, y, w, h;
|
|
|
|
byte *buffer;
|
2003-05-15 22:48:06 +00:00
|
|
|
uint16 xStrips, yStrips;
|
|
|
|
bool isDrawn;
|
2002-11-10 17:19:43 +00:00
|
|
|
} _flashlight;
|
2003-06-04 21:45:29 +00:00
|
|
|
|
|
|
|
StripTable *_roomStrips;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void getGraphicsPerformance();
|
|
|
|
void initScreens(int a, int b, int w, int h);
|
2002-10-20 01:02:52 +00:00
|
|
|
void initVirtScreen(int slot, int number, int top, int width, int height, bool twobufs, bool scrollable);
|
2002-04-23 23:58:31 +00:00
|
|
|
void initBGBuffers(int height);
|
2003-05-28 20:01:47 +00:00
|
|
|
void initCycl(const byte *ptr); // Color cycle
|
2002-04-19 15:02:16 +00:00
|
|
|
|
2002-04-19 13:57:18 +00:00
|
|
|
void createSpecialPalette(int16 a, int16 b, int16 c, int16 d, int16 e, int16 colorMin, int16 colorMax);
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void drawObject(int obj, int arg);
|
|
|
|
void drawRoomObjects(int arg);
|
|
|
|
void drawRoomObject(int i, int arg);
|
|
|
|
void drawBox(int x, int y, int x2, int y2, int color);
|
|
|
|
|
2003-05-15 22:30:32 +00:00
|
|
|
void restoreBG(ScummVM::Rect rect, byte backColor = 0);
|
2002-03-20 17:51:07 +00:00
|
|
|
void redrawBGStrip(int start, int num);
|
2002-04-17 20:34:10 +00:00
|
|
|
void redrawBGAreas();
|
2001-11-05 19:21:49 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void cameraMoved();
|
|
|
|
void setCameraAtEx(int at);
|
2003-05-29 12:55:28 +00:00
|
|
|
virtual void setCameraAt(int pos_x, int pos_y);
|
|
|
|
virtual void setCameraFollows(Actor *a);
|
2003-05-29 23:44:24 +00:00
|
|
|
virtual void moveCamera();
|
|
|
|
virtual void panCameraTo(int x, int y);
|
2003-05-15 21:57:38 +00:00
|
|
|
void clampCameraPos(ScummVM::Point *pt);
|
2003-05-29 12:55:28 +00:00
|
|
|
void actorFollowCamera(int act);
|
2001-11-06 20:00:47 +00:00
|
|
|
|
2003-05-28 20:01:47 +00:00
|
|
|
const byte *getPalettePtr();
|
2003-05-03 20:49:53 +00:00
|
|
|
void setupEGAPalette();
|
2003-06-05 17:22:15 +00:00
|
|
|
void setupC64Palette();
|
2002-03-20 17:51:07 +00:00
|
|
|
void setPalette(int pal);
|
2003-05-26 13:14:57 +00:00
|
|
|
void setPaletteFromPtr(const byte *ptr);
|
2002-03-20 17:51:07 +00:00
|
|
|
void setPaletteFromRes();
|
|
|
|
void setPalColor(int index, int r, int g, int b);
|
|
|
|
void setDirtyColors(int min, int max);
|
2003-05-28 20:01:47 +00:00
|
|
|
const byte *findPalInPals(const byte *pal, int index);
|
2002-03-20 17:51:07 +00:00
|
|
|
void swapPalColors(int a, int b);
|
2002-09-23 15:43:29 +00:00
|
|
|
void copyPalColor(int dst, int src);
|
2002-03-20 17:51:07 +00:00
|
|
|
void cyclePalette();
|
|
|
|
void stopCycle(int i);
|
2002-09-13 11:54:59 +00:00
|
|
|
void palManipulateInit(int start, int end, int string_id, int time);
|
2002-03-20 17:51:07 +00:00
|
|
|
void palManipulate();
|
2003-05-25 00:47:36 +00:00
|
|
|
public:
|
|
|
|
int remapPaletteColor(int r, int g, int b, uint threshold); // Used by Actor::remapActorPalette
|
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
void moveMemInPalRes(int start, int end, byte direction);
|
2002-12-09 02:14:17 +00:00
|
|
|
void setupShadowPalette(int slot, int redScale, int greenScale, int blueScale, int startColor, int endColor);
|
|
|
|
void setupShadowPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor);
|
|
|
|
void darkenPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor);
|
2003-03-13 02:23:55 +00:00
|
|
|
void desaturatePalette(int hueScale, int satScale, int lightScale, int startColor, int endColor);
|
2001-11-06 20:00:47 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void setCursor(int cursor);
|
|
|
|
void setCursorImg(uint img, uint room, uint imgindex);
|
2003-04-26 13:28:34 +00:00
|
|
|
void setCursorHotspot(int x, int y);
|
2002-03-20 17:51:07 +00:00
|
|
|
void grabCursor(int x, int y, int w, int h);
|
|
|
|
void grabCursor(byte *ptr, int width, int height);
|
|
|
|
void makeCursorColorTransparent(int a);
|
2002-12-04 22:31:36 +00:00
|
|
|
void setupCursor() { _cursor.animate = 1; }
|
2001-11-06 20:00:47 +00:00
|
|
|
void decompressDefaultCursor(int index);
|
2003-05-28 20:01:47 +00:00
|
|
|
void useIm01Cursor(const byte *im, int w, int h);
|
|
|
|
void useBompCursor(const byte *im, int w, int h);
|
2001-11-06 21:41:56 +00:00
|
|
|
|
2001-11-07 18:10:52 +00:00
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
public:
|
2003-01-14 10:06:56 +00:00
|
|
|
void updateDirtyRect(int virt, int left, int right, int top, int bottom, int dirtybit);
|
2003-05-25 00:47:36 +00:00
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
void drawDirtyScreenParts();
|
|
|
|
void updateDirtyScreen(int slot);
|
2001-11-09 18:54:15 +00:00
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
public:
|
2002-03-20 17:51:07 +00:00
|
|
|
VirtScreen *findVirtScreen(int y);
|
2003-06-01 14:30:26 +00:00
|
|
|
byte *getMaskBuffer(int x, int y, int z);
|
2003-02-08 01:27:21 +00:00
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
protected:
|
2002-08-19 17:23:48 +00:00
|
|
|
void drawFlashlight();
|
|
|
|
|
2002-07-13 14:07:37 +00:00
|
|
|
void fadeIn(int effect);
|
2002-08-19 17:23:48 +00:00
|
|
|
void fadeOut(int effect);
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void unkScreenEffect5(int a);
|
2002-08-31 21:23:28 +00:00
|
|
|
void unkScreenEffect6();
|
2002-08-31 13:29:10 +00:00
|
|
|
void transitionEffect(int a);
|
|
|
|
void dissolveEffect(int width, int height);
|
|
|
|
void scrollEffect(int dir);
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2003-05-26 13:14:57 +00:00
|
|
|
void blit(byte *dst, const byte *src, int w, int h);
|
2002-08-31 19:26:04 +00:00
|
|
|
|
2002-11-06 14:19:50 +00:00
|
|
|
// bomp
|
2003-05-25 00:47:36 +00:00
|
|
|
public:
|
2003-05-28 21:28:30 +00:00
|
|
|
byte *_bompActorPalettePtr;
|
2003-06-01 13:09:30 +00:00
|
|
|
void drawBomp(const BompDrawData &bd, bool mirror);
|
2002-11-06 15:29:49 +00:00
|
|
|
|
2003-05-30 19:00:33 +00:00
|
|
|
protected:
|
2003-02-08 02:00:22 +00:00
|
|
|
bool _shakeEnabled;
|
2002-03-20 17:51:07 +00:00
|
|
|
uint _shakeFrame;
|
2003-02-08 02:00:22 +00:00
|
|
|
void setShake(int mode);
|
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
public:
|
2002-03-20 17:51:07 +00:00
|
|
|
int _screenStartStrip, _screenEndStrip;
|
|
|
|
int _screenLeft, _screenTop;
|
2003-01-16 00:40:19 +00:00
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
protected:
|
2003-01-16 00:40:19 +00:00
|
|
|
int _blastObjectQueuePos;
|
|
|
|
BlastObject _blastObjectQueue[128];
|
|
|
|
|
|
|
|
int _blastTextQueuePos;
|
2003-01-19 03:25:59 +00:00
|
|
|
BlastText _blastTextQueue[32]; // FIXME - how many blast texts can there be at once?
|
2003-01-16 00:40:19 +00:00
|
|
|
|
2003-06-02 23:18:52 +00:00
|
|
|
void enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center);
|
2003-01-16 00:40:19 +00:00
|
|
|
void drawBlastTexts();
|
2003-04-07 16:04:30 +00:00
|
|
|
void removeBlastTexts();
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-11-06 15:29:49 +00:00
|
|
|
void enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth,
|
2002-12-26 21:50:13 +00:00
|
|
|
int objectHeight, int scaleX, int scaleY, int image, int mode);
|
2003-01-16 00:40:19 +00:00
|
|
|
void clearEnqueue() { _blastObjectQueuePos = 0; }
|
2002-04-21 21:20:32 +00:00
|
|
|
void drawBlastObjects();
|
|
|
|
void drawBlastObject(BlastObject *eo);
|
|
|
|
void removeBlastObjects();
|
|
|
|
void removeBlastObject(BlastObject *eo);
|
2001-11-14 18:40:39 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
int _drawObjectQueNr;
|
|
|
|
byte _drawObjectQue[200];
|
2002-09-24 15:46:09 +00:00
|
|
|
byte _palManipStart, _palManipEnd;
|
|
|
|
uint16 _palManipCounter;
|
|
|
|
byte *_palManipPalette;
|
|
|
|
byte *_palManipIntermediatePal;
|
2002-12-15 23:40:37 +00:00
|
|
|
|
2003-01-14 10:06:56 +00:00
|
|
|
/* For each of the 410 screen strips, gfxUsageBits contains a
|
|
|
|
* bitmask. The lower 80 bits each correspond to one actor and
|
|
|
|
* signify if any part of that actor is currently contained in
|
|
|
|
* that strip.
|
|
|
|
*
|
|
|
|
* If the leftmost bit is set, the strip (background) is dirty
|
|
|
|
* needs to be redrawn.
|
|
|
|
*
|
|
|
|
* The second leftmost bit is set by removeBlastObject() and
|
|
|
|
* restoreBG(), but I'm not yet sure why.
|
2002-12-15 23:40:37 +00:00
|
|
|
*/
|
2003-01-14 10:06:56 +00:00
|
|
|
uint32 gfxUsageBits[410 * 3];
|
2002-12-15 23:40:37 +00:00
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
void upgradeGfxUsageBits();
|
|
|
|
void setGfxUsageBit(int strip, int bit);
|
|
|
|
void clearGfxUsageBit(int strip, int bit);
|
|
|
|
bool testGfxUsageBit(int strip, int bit);
|
|
|
|
bool testGfxAnyUsageBits(int strip);
|
|
|
|
bool testGfxOtherUsageBits(int strip, int bit);
|
|
|
|
|
|
|
|
public:
|
|
|
|
byte _proc_special_palette[256];
|
2002-03-20 17:51:07 +00:00
|
|
|
byte *_shadowPalette;
|
2003-05-25 00:47:36 +00:00
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
int _shadowPaletteSize;
|
2002-11-06 15:29:49 +00:00
|
|
|
byte _currentPalette[3 * 256];
|
2002-04-19 15:02:16 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
int _palDirtyMin, _palDirtyMax;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-08-14 20:43:56 +00:00
|
|
|
byte _haveMsg;
|
|
|
|
bool _useTalkAnims;
|
|
|
|
uint16 _defaultTalkDelay;
|
|
|
|
bool _use_adlib;
|
|
|
|
int tempMusic;
|
|
|
|
int _saveSound;
|
2003-05-25 00:47:36 +00:00
|
|
|
public:
|
|
|
|
bool _silentDigitalImuse, _noDigitalSamples;
|
|
|
|
int current_cd_sound; // Used in class Sound
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Walkbox / Navigation class */
|
2002-03-22 03:30:57 +00:00
|
|
|
int _maxBoxVertexHeap, _boxPathVertexHeapIndex, _boxMatrixItem;
|
2002-12-29 21:14:28 +00:00
|
|
|
byte *_boxPathVertexHeap, *_boxMatrixPtr1, *_boxMatrixPtr3;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
public:
|
2002-03-20 17:51:07 +00:00
|
|
|
uint16 _extraBoxFlags[65];
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
byte getNumBoxes();
|
|
|
|
byte *getBoxMatrixBaseAddr();
|
|
|
|
int getPathToDestBox(byte from, byte to);
|
|
|
|
void getGates(int trap1, int trap2, ScummVM::Point gateA[2], ScummVM::Point gateB[2]);
|
|
|
|
bool inBoxQuickReject(int box, int x, int y, int threshold);
|
|
|
|
AdjustBoxResult getClosestPtOnBox(int box, int x, int y);
|
|
|
|
int getSpecialBox(int param1, int param2);
|
|
|
|
|
|
|
|
void setBoxFlags(int box, int val);
|
|
|
|
void setBoxScale(int box, int b);
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
bool checkXYInBoxBounds(int box, int x, int y);
|
|
|
|
uint distanceFromPt(int x, int y, int ptx, int pty);
|
|
|
|
void getBoxCoordinates(int boxnum, BoxCoords *bc);
|
|
|
|
byte getMaskFromBox(int box);
|
|
|
|
Box *getBoxBaseAddr(int box);
|
|
|
|
byte getBoxFlags(int box);
|
|
|
|
int getBoxScale(int box);
|
2003-03-06 17:58:13 +00:00
|
|
|
|
2003-01-13 01:29:45 +00:00
|
|
|
int getScale(int box, int x, int y);
|
|
|
|
void setScaleItem(int slot, int a, int b, int c, int d);
|
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
protected:
|
2003-01-13 01:29:45 +00:00
|
|
|
// V8 scaling stuff: should be in V8 class
|
|
|
|
struct ScaleSlot {
|
|
|
|
int x1, y1, scale1;
|
|
|
|
int x2, y2, scale2;
|
|
|
|
};
|
|
|
|
ScaleSlot _scaleSlots[20]; // FIXME - not sure if this limit is right, but based on my observations it is
|
|
|
|
void setScaleSlot(int slot, int x1, int y1, int scale1, int x2, int y2, int scale2);
|
2003-01-13 14:04:41 +00:00
|
|
|
void setBoxScaleSlot(int box, int slot);
|
2003-01-13 01:29:45 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void createBoxMatrix();
|
2003-05-25 00:47:36 +00:00
|
|
|
void addToBoxMatrix(byte b);
|
|
|
|
PathNode *unkMatrixProc2(PathVertex *vtx, int i);
|
|
|
|
void *addToBoxVertexHeap(int size);
|
|
|
|
PathVertex *addPathVertex();
|
|
|
|
bool areBoxesNeighbours(int i, int j);
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* String class */
|
2002-12-25 21:04:47 +00:00
|
|
|
CharsetRenderer *_charset;
|
2002-03-20 17:51:07 +00:00
|
|
|
byte _charsetColor;
|
2003-05-25 00:47:36 +00:00
|
|
|
public:
|
2002-12-26 00:21:19 +00:00
|
|
|
byte _charsetColorMap[16];
|
2003-05-25 00:47:36 +00:00
|
|
|
protected:
|
2002-04-26 18:52:33 +00:00
|
|
|
byte _charsetData[15][16];
|
2002-12-25 21:04:47 +00:00
|
|
|
|
2002-12-26 00:21:19 +00:00
|
|
|
int _charsetBufPos;
|
|
|
|
byte _charsetBuffer[512];
|
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
public:
|
2003-05-13 23:33:01 +00:00
|
|
|
bool _noSubtitles; // Whether to skip all subtitles
|
2003-05-25 00:47:36 +00:00
|
|
|
protected:
|
2002-12-26 00:21:19 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void initCharset(int charset);
|
|
|
|
void restoreCharsetBg();
|
2003-05-25 00:47:36 +00:00
|
|
|
public:
|
2003-05-15 21:31:03 +00:00
|
|
|
bool hasCharsetMask(int left, int top, int right, int bottom);
|
2003-05-25 00:47:36 +00:00
|
|
|
protected:
|
2002-03-20 17:51:07 +00:00
|
|
|
void CHARSET_1();
|
2003-05-13 23:33:01 +00:00
|
|
|
void drawString(int a);
|
2003-05-21 16:28:02 +00:00
|
|
|
const byte *addMessageToStack(const byte *msg);
|
2002-09-16 23:48:42 +00:00
|
|
|
void addIntToStack(int var);
|
|
|
|
void addVerbToStack(int var);
|
|
|
|
void addNameToStack(int var);
|
|
|
|
void addStringToStack(int var);
|
2002-03-20 17:51:07 +00:00
|
|
|
void unkMessage1();
|
|
|
|
void unkMessage2();
|
2003-05-25 00:47:36 +00:00
|
|
|
public:
|
|
|
|
void clearMsgQueue(); // Used by Actor::putActor
|
|
|
|
protected:
|
2002-12-25 21:04:47 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
int _numInMsgStack;
|
2002-12-25 21:04:47 +00:00
|
|
|
byte *_msgPtrToAdd;
|
2003-05-21 16:28:02 +00:00
|
|
|
const byte *_messagePtr;
|
2002-03-20 17:51:07 +00:00
|
|
|
bool _keepText;
|
2003-05-25 20:38:44 +00:00
|
|
|
public:
|
2003-05-13 23:33:01 +00:00
|
|
|
uint16 _language;
|
2003-05-25 20:38:44 +00:00
|
|
|
protected:
|
2002-09-17 09:18:47 +00:00
|
|
|
bool _existLanguageFile;
|
|
|
|
char *_languageBuffer;
|
2003-05-30 22:57:19 +00:00
|
|
|
LangIndexNode *_languageIndex;
|
2003-05-30 23:24:29 +00:00
|
|
|
int _languageIndexSize;
|
2003-02-02 12:50:56 +00:00
|
|
|
byte _transText[500];
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
void loadLanguageBundle();
|
|
|
|
public:
|
|
|
|
void translateText(const byte *text, byte *trans_buff); // Used by class ScummDialog
|
2003-06-04 14:37:43 +00:00
|
|
|
|
|
|
|
// Somewhat hackish stuff for 2 byte support (Chinese/Japanese/Korean)
|
|
|
|
bool _CJKMode;
|
|
|
|
int _2byteHeight;
|
|
|
|
int _2byteWidth;
|
|
|
|
byte *get2byteCharPtr(int idx);
|
|
|
|
|
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
protected:
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
#if defined(SCUMM_LITTLE_ENDIAN)
|
2002-10-21 13:23:25 +00:00
|
|
|
uint32 fileReadDword() { return _fileHandle.readUint32LE(); }
|
2002-03-20 17:51:07 +00:00
|
|
|
#elif defined(SCUMM_BIG_ENDIAN)
|
2002-10-21 13:23:25 +00:00
|
|
|
uint32 fileReadDword() { return _fileHandle.readUint32BE(); }
|
2002-03-20 17:51:07 +00:00
|
|
|
#endif
|
2001-11-27 17:56:04 +00:00
|
|
|
|
2003-05-25 00:47:36 +00:00
|
|
|
public:
|
2003-01-14 10:06:56 +00:00
|
|
|
|
2002-12-16 12:12:31 +00:00
|
|
|
/* Scumm Vars */
|
2003-01-29 04:38:55 +00:00
|
|
|
byte VAR_LANGUAGE;
|
2002-12-21 12:34:17 +00:00
|
|
|
byte VAR_KEYPRESS;
|
2002-12-16 12:12:31 +00:00
|
|
|
byte VAR_EGO;
|
|
|
|
byte VAR_CAMERA_POS_X;
|
|
|
|
byte VAR_HAVE_MSG;
|
|
|
|
byte VAR_ROOM;
|
|
|
|
byte VAR_OVERRIDE;
|
|
|
|
byte VAR_MACHINE_SPEED;
|
|
|
|
byte VAR_ME;
|
|
|
|
byte VAR_NUM_ACTOR;
|
|
|
|
byte VAR_CURRENT_LIGHTS;
|
2002-12-31 17:28:51 +00:00
|
|
|
byte VAR_CURRENTDRIVE; // How about merging this with VAR_CURRENTDISK?
|
2002-12-26 01:15:25 +00:00
|
|
|
byte VAR_CURRENTDISK;
|
2002-12-16 12:12:31 +00:00
|
|
|
byte VAR_TMR_1;
|
|
|
|
byte VAR_TMR_2;
|
|
|
|
byte VAR_TMR_3;
|
2003-05-01 00:04:05 +00:00
|
|
|
byte VAR_MUSIC_TIMER;
|
2002-12-16 12:12:31 +00:00
|
|
|
byte VAR_ACTOR_RANGE_MIN;
|
|
|
|
byte VAR_ACTOR_RANGE_MAX;
|
|
|
|
byte VAR_CAMERA_MIN_X;
|
|
|
|
byte VAR_CAMERA_MAX_X;
|
|
|
|
byte VAR_TIMER_NEXT;
|
|
|
|
byte VAR_VIRT_MOUSE_X;
|
|
|
|
byte VAR_VIRT_MOUSE_Y;
|
|
|
|
byte VAR_ROOM_RESOURCE;
|
|
|
|
byte VAR_LAST_SOUND;
|
|
|
|
byte VAR_CUTSCENEEXIT_KEY;
|
|
|
|
byte VAR_OPTIONS_KEY;
|
|
|
|
byte VAR_TALK_ACTOR;
|
|
|
|
byte VAR_CAMERA_FAST_X;
|
|
|
|
byte VAR_SCROLL_SCRIPT;
|
|
|
|
byte VAR_ENTRY_SCRIPT;
|
|
|
|
byte VAR_ENTRY_SCRIPT2;
|
|
|
|
byte VAR_EXIT_SCRIPT;
|
|
|
|
byte VAR_EXIT_SCRIPT2;
|
|
|
|
byte VAR_VERB_SCRIPT;
|
|
|
|
byte VAR_SENTENCE_SCRIPT;
|
|
|
|
byte VAR_HOOK_SCRIPT;
|
|
|
|
byte VAR_CUTSCENE_START_SCRIPT;
|
|
|
|
byte VAR_CUTSCENE_END_SCRIPT;
|
|
|
|
byte VAR_CHARINC;
|
|
|
|
byte VAR_WALKTO_OBJ;
|
|
|
|
byte VAR_DEBUGMODE;
|
|
|
|
byte VAR_HEAPSPACE;
|
|
|
|
byte VAR_RESTART_KEY;
|
|
|
|
byte VAR_PAUSE_KEY;
|
|
|
|
byte VAR_MOUSE_X;
|
|
|
|
byte VAR_MOUSE_Y;
|
|
|
|
byte VAR_TIMER;
|
|
|
|
byte VAR_TMR_4;
|
|
|
|
byte VAR_SOUNDCARD;
|
|
|
|
byte VAR_VIDEOMODE;
|
|
|
|
byte VAR_SAVELOADDIALOG_KEY;
|
|
|
|
byte VAR_FIXEDDISK;
|
|
|
|
byte VAR_CURSORSTATE;
|
|
|
|
byte VAR_USERPUT;
|
|
|
|
byte VAR_SOUNDRESULT;
|
|
|
|
byte VAR_TALKSTOP_KEY;
|
|
|
|
byte VAR_59;
|
2003-03-06 17:58:13 +00:00
|
|
|
|
2002-12-16 12:12:31 +00:00
|
|
|
byte VAR_SOUNDPARAM;
|
|
|
|
byte VAR_SOUNDPARAM2;
|
|
|
|
byte VAR_SOUNDPARAM3;
|
|
|
|
byte VAR_MOUSEPRESENT;
|
|
|
|
byte VAR_PERFORMANCE_1;
|
|
|
|
byte VAR_PERFORMANCE_2;
|
|
|
|
byte VAR_ROOM_FLAG;
|
|
|
|
byte VAR_GAME_LOADED;
|
|
|
|
byte VAR_NEW_ROOM;
|
|
|
|
byte VAR_VERSION;
|
|
|
|
|
|
|
|
byte VAR_V5_TALK_STRING_Y;
|
|
|
|
|
|
|
|
byte VAR_V6_SCREEN_WIDTH;
|
|
|
|
byte VAR_V6_SCREEN_HEIGHT;
|
|
|
|
byte VAR_V6_EMSSPACE;
|
|
|
|
byte VAR_V6_RANDOM_NR;
|
|
|
|
|
|
|
|
byte VAR_STRING2DRAW;
|
|
|
|
byte VAR_CAMERA_POS_Y;
|
|
|
|
|
|
|
|
byte VAR_CAMERA_MIN_Y;
|
|
|
|
byte VAR_CAMERA_MAX_Y;
|
|
|
|
byte VAR_CAMERA_THRESHOLD_X;
|
|
|
|
byte VAR_CAMERA_THRESHOLD_Y;
|
|
|
|
byte VAR_CAMERA_SPEED_X;
|
|
|
|
byte VAR_CAMERA_SPEED_Y;
|
|
|
|
byte VAR_CAMERA_ACCEL_X;
|
|
|
|
byte VAR_CAMERA_ACCEL_Y;
|
|
|
|
|
|
|
|
byte VAR_CAMERA_DEST_X;
|
|
|
|
|
|
|
|
byte VAR_CAMERA_DEST_Y;
|
|
|
|
|
|
|
|
byte VAR_CAMERA_FOLLOWED_ACTOR;
|
|
|
|
|
|
|
|
byte VAR_LEFTBTN_DOWN;
|
|
|
|
byte VAR_RIGHTBTN_DOWN;
|
|
|
|
byte VAR_LEFTBTN_HOLD;
|
|
|
|
byte VAR_RIGHTBTN_HOLD;
|
2002-12-29 15:29:12 +00:00
|
|
|
byte VAR_MOUSE_BUTTONS;
|
2003-01-01 02:56:22 +00:00
|
|
|
byte VAR_MOUSE_HOLD;
|
2003-05-13 17:51:56 +00:00
|
|
|
byte VAR_SAVELOAD_SCRIPT;
|
|
|
|
byte VAR_SAVELOAD_SCRIPT2;
|
2002-12-16 12:12:31 +00:00
|
|
|
|
|
|
|
byte VAR_DEFAULT_TALK_DELAY;
|
|
|
|
byte VAR_CHARSET_MASK;
|
|
|
|
|
|
|
|
byte VAR_CUSTOMSCALETABLE;
|
|
|
|
byte VAR_V6_SOUNDMODE;
|
2003-05-17 06:14:08 +00:00
|
|
|
|
2003-05-18 23:37:44 +00:00
|
|
|
byte VAR_CHARCOUNT;
|
2003-05-17 18:42:31 +00:00
|
|
|
byte VAR_VERB_ALLOWED;
|
|
|
|
byte VAR_ACTIVE_VERB;
|
|
|
|
byte VAR_ACTIVE_OBJECT1;
|
|
|
|
byte VAR_ACTIVE_OBJECT2;
|
2003-05-17 06:14:08 +00:00
|
|
|
byte VAR_CLICK_AREA;
|
2002-12-16 12:12:31 +00:00
|
|
|
};
|
|
|
|
|
2002-08-31 13:29:10 +00:00
|
|
|
// This is a constant lookup table of reverse bit masks
|
2001-10-09 14:30:12 +00:00
|
|
|
extern const byte revBitMask[8];
|
2002-04-17 20:34:10 +00:00
|
|
|
|
2002-07-22 18:11:48 +00:00
|
|
|
/* Direction conversion functions (between old dir and new dir format) */
|
|
|
|
int newDirToOldDir(int dir);
|
|
|
|
int oldDirToNewDir(int dir);
|
|
|
|
|
|
|
|
int normalizeAngle(int angle);
|
|
|
|
int fromSimpleDir(int dirtype, int dir);
|
|
|
|
int toSimpleDir(int dirtype, int dir);
|
|
|
|
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
#endif
|