2001-10-09 14:30:12 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
|
|
|
*
|
|
|
|
* 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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "scummsys.h"
|
2002-03-22 03:30:57 +00:00
|
|
|
#include "system.h"
|
2002-04-19 11:12:27 +00:00
|
|
|
#include "sound/mixer.h"
|
2002-04-27 16:58:29 +00:00
|
|
|
#include "config-file.h"
|
2002-03-23 20:34:47 +00:00
|
|
|
|
2002-03-14 14:45:04 +00:00
|
|
|
#define SCUMMVM_VERSION "0.2.0 devel"
|
2002-04-20 04:09:02 +00:00
|
|
|
#define SCUMMVM_CVS "042002"
|
2002-02-03 20:41:23 +00:00
|
|
|
|
2001-10-09 14:30:12 +00:00
|
|
|
#define SWAP(a,b) do{int tmp=a; a=b; b=tmp; } while(0)
|
2001-12-01 17:06:13 +00:00
|
|
|
#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-04-12 10:34:46 +00:00
|
|
|
class GameDetector;
|
2002-04-12 21:26:59 +00:00
|
|
|
class Gui;
|
2002-03-20 17:51:07 +00:00
|
|
|
class Scumm;
|
2002-04-14 18:13:08 +00:00
|
|
|
class IMuse;
|
2001-10-09 14:30:12 +00:00
|
|
|
struct Actor;
|
2002-03-22 03:30:57 +00:00
|
|
|
struct ScummDebugger;
|
|
|
|
struct Serializer;
|
2002-03-06 19:58:06 +00:00
|
|
|
|
2001-10-09 14:30:12 +00:00
|
|
|
typedef void (Scumm::*OpcodeProc)();
|
|
|
|
|
2002-04-12 10:34:46 +00:00
|
|
|
/* Use this one from error() ONLY */
|
|
|
|
extern Scumm *g_scumm;
|
|
|
|
|
2001-11-14 18:40:39 +00:00
|
|
|
/* System Wide Constants */
|
|
|
|
enum {
|
2002-04-21 21:58:21 +00:00
|
|
|
#ifdef _WIN32_WCE
|
|
|
|
SAMPLES_PER_SEC = 11025,
|
|
|
|
#else
|
2001-11-14 18:40:39 +00:00
|
|
|
SAMPLES_PER_SEC = 22050,
|
2002-04-21 21:58:21 +00:00
|
|
|
#endif
|
2001-11-14 18:40:39 +00:00
|
|
|
BITS_PER_SAMPLE = 16,
|
|
|
|
NUM_MIXER = 4,
|
2002-05-05 17:44:39 +00:00
|
|
|
NUM_SCRIPT_SLOT = 40,
|
2001-11-26 19:57:57 +00:00
|
|
|
NUM_LOCALSCRIPT = 60,
|
|
|
|
NUM_SHADOW_PALETTE = 8,
|
2002-03-14 14:45:04 +00:00
|
|
|
MAX_ACTORS = 30,
|
|
|
|
KEY_SET_OPTIONS = 3456 // WinCE
|
2001-11-14 18:40:39 +00:00
|
|
|
};
|
2001-10-26 17:34:50 +00:00
|
|
|
|
2002-03-16 18:03:28 +00:00
|
|
|
/* Script status type (slot.status) */
|
|
|
|
enum {
|
|
|
|
ssDead = 0,
|
|
|
|
ssPaused = 1,
|
|
|
|
ssRunning = 2
|
2002-03-14 08:04:21 +00:00
|
|
|
};
|
2002-03-09 00:56:22 +00:00
|
|
|
|
2002-04-12 21:26:59 +00:00
|
|
|
extern const uint16 many_direction_tab[18];
|
|
|
|
extern const int16 many_direction_tab_2[16];
|
|
|
|
extern const int bit_table[16];
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-03-08 17:05:09 +00:00
|
|
|
struct ScummPoint {
|
2001-10-09 14:30:12 +00:00
|
|
|
int x,y;
|
|
|
|
};
|
|
|
|
|
2001-12-11 13:34:15 +00:00
|
|
|
struct MemBlkHeader {
|
|
|
|
uint32 size;
|
|
|
|
};
|
|
|
|
|
2002-03-10 17:33:04 +00:00
|
|
|
#if !defined(__GNUC__)
|
|
|
|
#pragma START_PACK_STRUCTS
|
|
|
|
#endif
|
|
|
|
|
2001-12-11 13:34:15 +00:00
|
|
|
struct ResHdr {
|
|
|
|
uint32 tag, size;
|
2001-11-14 19:33:10 +00:00
|
|
|
} GCC_PACK;
|
2001-10-10 10:02:33 +00:00
|
|
|
|
2001-12-11 13:34:15 +00:00
|
|
|
#define RES_DATA(x) (((byte*)x) + sizeof(ResHdr))
|
2002-04-17 20:34:10 +00:00
|
|
|
#define RES_SIZE(x) ( READ_BE_UINT32_UNALIGNED(&((ResHdr*)x)->size) )
|
2001-12-11 13:34:15 +00:00
|
|
|
|
|
|
|
|
2001-10-09 14:30:12 +00:00
|
|
|
struct RoomHeader {
|
2002-03-05 20:13:47 +00:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
uint32 version;
|
|
|
|
uint16 width,height;
|
|
|
|
uint16 numObjects;
|
2002-03-08 23:05:41 +00:00
|
|
|
} GCC_PACK v7;
|
2002-03-05 20:13:47 +00:00
|
|
|
struct {
|
|
|
|
uint16 width,height;
|
|
|
|
uint16 numObjects;
|
2002-03-08 23:05:41 +00:00
|
|
|
} GCC_PACK old;
|
|
|
|
} GCC_PACK;
|
2001-11-14 19:33:10 +00:00
|
|
|
} GCC_PACK;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2001-10-23 19:51:50 +00:00
|
|
|
struct CodeHeader {
|
|
|
|
union {
|
|
|
|
struct {
|
2002-03-05 20:43:26 +00:00
|
|
|
uint16 obj_id;
|
2001-10-23 19:51:50 +00:00
|
|
|
byte x,y,w,h;
|
|
|
|
byte flags;
|
|
|
|
byte parent;
|
2002-04-19 08:21:56 +00:00
|
|
|
int16 walk_x;
|
|
|
|
int16 walk_y;
|
2001-10-23 19:51:50 +00:00
|
|
|
byte actordir;
|
2002-03-08 23:05:41 +00:00
|
|
|
} GCC_PACK v5;
|
2001-10-23 19:51:50 +00:00
|
|
|
|
|
|
|
struct {
|
2002-03-05 20:43:26 +00:00
|
|
|
uint16 obj_id;
|
2001-10-23 19:51:50 +00:00
|
|
|
int16 x, y;
|
|
|
|
uint16 w,h;
|
|
|
|
byte flags, parent;
|
2001-11-06 20:00:47 +00:00
|
|
|
uint16 unk1;
|
2001-10-23 19:51:50 +00:00
|
|
|
uint16 unk2;
|
|
|
|
byte actordir;
|
2002-03-08 23:05:41 +00:00
|
|
|
} GCC_PACK v6;
|
2002-03-05 20:43:26 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
uint32 version;
|
|
|
|
uint16 obj_id;
|
|
|
|
byte parent;
|
|
|
|
byte parentstate;
|
2002-03-08 23:05:41 +00:00
|
|
|
} GCC_PACK v7;
|
2002-03-05 20:43:26 +00:00
|
|
|
|
2002-03-08 23:05:41 +00:00
|
|
|
} GCC_PACK;
|
2001-11-14 19:33:10 +00:00
|
|
|
} GCC_PACK;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2001-11-26 19:57:57 +00:00
|
|
|
struct ImageHeader { /* file format */
|
2002-03-05 21:03:32 +00:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
uint16 obj_id;
|
|
|
|
uint16 unk[5];
|
|
|
|
uint16 width;
|
|
|
|
uint16 height;
|
|
|
|
uint16 unk_2;
|
|
|
|
struct {
|
|
|
|
int16 x,y;
|
2002-03-08 23:05:41 +00:00
|
|
|
} GCC_PACK hotspot[15];
|
|
|
|
} GCC_PACK old;
|
2002-03-05 21:03:32 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
uint32 version;
|
|
|
|
uint16 obj_id;
|
|
|
|
uint16 unk[1];
|
|
|
|
int16 x_pos,y_pos;
|
|
|
|
uint16 width,height;
|
|
|
|
byte unk2[3];
|
|
|
|
byte actordir;
|
|
|
|
uint16 unk_2;
|
|
|
|
struct {
|
|
|
|
int16 x,y;
|
2002-03-08 23:05:41 +00:00
|
|
|
} GCC_PACK hotspot[15];
|
|
|
|
} GCC_PACK v7;
|
|
|
|
} GCC_PACK;
|
2001-11-14 19:33:10 +00:00
|
|
|
} GCC_PACK;
|
2002-03-10 17:33:04 +00:00
|
|
|
|
|
|
|
#if !defined(__GNUC__)
|
|
|
|
#pragma END_PACK_STRUCTS
|
|
|
|
#endif
|
2001-10-10 10:02:33 +00:00
|
|
|
|
2001-11-11 16:54:45 +00:00
|
|
|
struct VerbSlot {
|
|
|
|
int16 x,y;
|
|
|
|
int16 right, bottom;
|
|
|
|
int16 oldleft, oldtop, oldright,oldbottom;
|
|
|
|
uint8 verbid;
|
|
|
|
uint8 color,hicolor,dimcolor,bkcolor,type;
|
|
|
|
uint8 charset_nr,curmode;
|
|
|
|
uint8 saveid;
|
|
|
|
uint8 key;
|
|
|
|
bool center;
|
|
|
|
uint8 field_1B;
|
|
|
|
uint16 imgindex;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ObjectData {
|
|
|
|
public:
|
|
|
|
uint32 offs_obim_to_room;
|
|
|
|
uint32 offs_obcd_to_room;
|
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 CostumeData {
|
2001-11-26 19:57:57 +00:00
|
|
|
byte active[16];
|
2001-11-11 16:54:45 +00:00
|
|
|
uint16 animCounter1;
|
|
|
|
byte animCounter2;
|
2001-11-26 19:57:57 +00:00
|
|
|
uint16 stopped;
|
|
|
|
uint16 curpos[16];
|
|
|
|
uint16 start[16];
|
|
|
|
uint16 end[16];
|
|
|
|
uint16 frame[16];
|
2001-11-11 16:54:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ActorWalkData {
|
2002-05-10 15:41:35 +00:00
|
|
|
int16 destx,desty; // Final destination
|
2001-11-11 16:54:45 +00:00
|
|
|
byte destbox;
|
2001-11-26 19:57:57 +00:00
|
|
|
int16 destdir;
|
2001-11-11 16:54:45 +00:00
|
|
|
byte curbox;
|
2002-05-10 15:41:35 +00:00
|
|
|
int16 x,y; // Current position
|
|
|
|
int16 newx,newy; // Next position on our way to the destination
|
2001-11-11 16:54:45 +00:00
|
|
|
int32 XYFactor, YXFactor;
|
|
|
|
uint16 xfrac,yfrac;
|
2002-03-18 22:48:57 +00:00
|
|
|
int point3x, point3y;
|
2001-11-11 16:54:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ScriptSlot {
|
|
|
|
uint32 offs;
|
|
|
|
int32 delay;
|
|
|
|
uint16 number;
|
|
|
|
uint16 newfield;
|
|
|
|
byte status;
|
2001-11-12 20:50:36 +00:00
|
|
|
byte where;
|
2001-11-11 16:54:45 +00:00
|
|
|
byte unk1,unk2,freezeCount,didexec;
|
|
|
|
byte cutsceneOverride;
|
|
|
|
byte unk5;
|
|
|
|
};
|
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;
|
|
|
|
};
|
|
|
|
|
2001-10-10 10:02:33 +00:00
|
|
|
enum {
|
|
|
|
sleByte = 1,
|
2001-10-16 10:01:48 +00:00
|
|
|
sleUint8 = 1,
|
2001-11-05 19:21:49 +00:00
|
|
|
sleInt8 = 1,
|
2001-10-10 10:02:33 +00:00
|
|
|
sleInt16 = 2,
|
|
|
|
sleUint16 = 3,
|
|
|
|
sleInt32 = 4,
|
|
|
|
sleUint32 = 5
|
|
|
|
};
|
2001-10-09 14:30:12 +00:00
|
|
|
|
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,
|
2001-11-10 19:12:32 +00:00
|
|
|
rtLast = 16,
|
2002-03-10 17:33:04 +00:00
|
|
|
rtNumTypes = 17
|
2001-11-12 20:50:36 +00:00
|
|
|
};
|
2001-11-05 19:21:49 +00:00
|
|
|
|
2001-11-12 20:50:36 +00:00
|
|
|
enum {
|
|
|
|
OF_OWNER_MASK = 0x0F,
|
|
|
|
OF_STATE_MASK = 0xF0,
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2001-11-12 20:50:36 +00:00
|
|
|
OF_STATE_SHL = 4
|
2001-11-05 19:21:49 +00:00
|
|
|
};
|
|
|
|
|
2001-11-14 20:09:39 +00:00
|
|
|
enum {
|
|
|
|
MBS_LEFT_CLICK = 0x8000,
|
|
|
|
MBS_RIGHT_CLICK = 0x4000,
|
|
|
|
MBS_MOUSE_MASK = (MBS_LEFT_CLICK|MBS_RIGHT_CLICK),
|
|
|
|
MBS_MAX_KEY = 0x0200
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
RF_LOCK = 0x80,
|
|
|
|
RF_USAGE = 0x7F,
|
|
|
|
RF_USAGE_MAX = RF_USAGE
|
|
|
|
};
|
|
|
|
|
2001-11-26 19:57:57 +00:00
|
|
|
enum MoveFlags {
|
|
|
|
MF_NEW_LEG = 1,
|
|
|
|
MF_IN_LEG = 2,
|
|
|
|
MF_TURN = 4,
|
2002-03-10 17:33:04 +00:00
|
|
|
MF_LAST_LEG = 8
|
2001-11-26 19:57:57 +00:00
|
|
|
};
|
|
|
|
|
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
|
|
|
|
|
|
|
struct CharsetRenderer {
|
|
|
|
Scumm *_vm;
|
|
|
|
int _top;
|
|
|
|
int _drawTop;
|
|
|
|
int _left, _left2;
|
|
|
|
byte _center;
|
2001-10-09 18:35:02 +00:00
|
|
|
int _right;
|
2001-10-09 14:30:12 +00:00
|
|
|
byte _color;
|
|
|
|
bool _hasMask;
|
2001-10-26 17:34:50 +00:00
|
|
|
bool _blitAlso;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
|
|
|
int _strLeft, _strRight, _strTop, _strBottom;
|
|
|
|
byte _curId;
|
2001-11-07 18:10:52 +00:00
|
|
|
|
|
|
|
int _xpos2, _ypos2;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-01-02 11:50:28 +00:00
|
|
|
int _bufPos;
|
2001-10-09 14:30:12 +00:00
|
|
|
byte _unk12,_disableOffsX;
|
|
|
|
byte *_ptr;
|
|
|
|
byte _unk2, _bpp;
|
|
|
|
byte _invNumBits;
|
|
|
|
uint32 _charOffs;
|
|
|
|
byte *_charPtr;
|
|
|
|
int _width, _height;
|
|
|
|
int _offsX,_offsY;
|
|
|
|
byte _bitMask, _revBitMask;
|
|
|
|
int _bottom;
|
|
|
|
int _virtScreenHeight;
|
|
|
|
|
|
|
|
byte _ignoreCharsetMask;
|
|
|
|
|
2001-10-26 17:34:50 +00:00
|
|
|
byte *_backbuff_ptr, *_bgbak_ptr;
|
2001-10-09 14:30:12 +00:00
|
|
|
byte *_mask_ptr;
|
2001-12-04 10:44:33 +00:00
|
|
|
byte *_dest_ptr;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
|
|
|
byte _colorMap[16];
|
2002-02-26 04:09:11 +00:00
|
|
|
byte _buffer[512];
|
2001-10-09 14:30:12 +00:00
|
|
|
|
|
|
|
void drawBits();
|
|
|
|
void printChar(int chr);
|
2002-02-16 19:03:14 +00:00
|
|
|
void printCharOld(int chr);
|
2002-03-19 14:39:02 +00:00
|
|
|
int getSpacing(char chr);
|
2001-10-09 14:30:12 +00:00
|
|
|
int getStringWidth(int a, byte *str, int pos);
|
|
|
|
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
|
|
|
|
};
|
|
|
|
|
2001-12-27 17:51:58 +00:00
|
|
|
struct LoadedCostume {
|
2001-10-09 14:30:12 +00:00
|
|
|
byte *_ptr;
|
|
|
|
byte *_dataptr;
|
2001-12-27 17:51:58 +00:00
|
|
|
byte _numColors;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CostumeRenderer {
|
|
|
|
Scumm *_vm;
|
|
|
|
|
|
|
|
LoadedCostume _loaded;
|
|
|
|
|
|
|
|
byte *_shadow_table;
|
|
|
|
|
2001-10-09 14:30:12 +00:00
|
|
|
byte *_frameptr;
|
|
|
|
byte *_srcptr;
|
2001-10-26 17:34:50 +00:00
|
|
|
byte *_bgbak_ptr, *_backbuff_ptr, *_mask_ptr, *_mask_ptr_dest;
|
2001-10-09 14:30:12 +00:00
|
|
|
int _actorX, _actorY;
|
|
|
|
byte _zbuf;
|
|
|
|
uint _scaleX, _scaleY;
|
|
|
|
int _xmove, _ymove;
|
|
|
|
bool _mirror;
|
|
|
|
byte _maskval;
|
|
|
|
byte _shrval;
|
|
|
|
byte _width2;
|
|
|
|
int _width;
|
|
|
|
byte _height2;
|
|
|
|
int _height;
|
|
|
|
int _xpos, _ypos;
|
2001-12-27 17:51:58 +00:00
|
|
|
|
|
|
|
uint _outheight;
|
2001-10-09 14:30:12 +00:00
|
|
|
int _scaleIndexXStep;
|
|
|
|
int _scaleIndexYStep;
|
|
|
|
byte _scaleIndexX; /* must wrap at 256*/
|
|
|
|
byte _scaleIndexY, _scaleIndexYTop;
|
|
|
|
int _left,_right;
|
|
|
|
int _dir2;
|
|
|
|
int _top,_bottom;
|
|
|
|
int _ypostop;
|
|
|
|
int _ypitch;
|
|
|
|
byte _docontinue;
|
|
|
|
int _imgbufoffs;
|
|
|
|
byte _repcolor;
|
|
|
|
byte _replen;
|
|
|
|
byte _palette[32];
|
|
|
|
byte _transEffect[0x100];
|
|
|
|
|
|
|
|
void proc6();
|
|
|
|
void proc5();
|
|
|
|
void proc4();
|
|
|
|
void proc3();
|
|
|
|
void proc2();
|
|
|
|
void proc1();
|
2002-04-19 12:38:03 +00:00
|
|
|
void proc_special(Actor *a, byte mask);
|
2001-10-09 14:30:12 +00:00
|
|
|
byte mainRoutine(Actor *a, int slot, int frame);
|
|
|
|
void ignorePakCols(int num);
|
|
|
|
|
|
|
|
byte drawOneSlot(Actor *a, int slot);
|
|
|
|
byte drawCostume(Actor *a);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Actor {
|
2001-10-09 18:35:02 +00:00
|
|
|
int x,y,top,bottom;
|
|
|
|
int elevation;
|
|
|
|
uint width;
|
2001-10-09 14:30:12 +00:00
|
|
|
byte number;
|
2001-11-26 19:57:57 +00:00
|
|
|
uint16 facing;
|
2001-10-16 10:01:48 +00:00
|
|
|
uint16 costume;
|
2001-10-09 14:30:12 +00:00
|
|
|
byte room;
|
|
|
|
byte talkColor;
|
|
|
|
byte scalex,scaley;
|
2001-10-16 10:01:48 +00:00
|
|
|
byte charset;
|
2001-11-26 19:57:57 +00:00
|
|
|
int16 newDirection;
|
2001-10-09 14:30:12 +00:00
|
|
|
byte moving;
|
|
|
|
byte ignoreBoxes;
|
2001-11-27 17:56:04 +00:00
|
|
|
byte forceClip;
|
2001-10-09 14:30:12 +00:00
|
|
|
byte initFrame,walkFrame,standFrame,talkFrame1,talkFrame2;
|
|
|
|
bool needRedraw, needBgReset,costumeNeedsInit,visible;
|
2001-12-27 17:51:58 +00:00
|
|
|
byte shadow_mode;
|
2001-11-26 19:57:57 +00:00
|
|
|
bool flip;
|
2001-10-09 18:35:02 +00:00
|
|
|
uint speedx,speedy;
|
2001-11-26 19:57:57 +00:00
|
|
|
byte frame;
|
2001-10-09 14:30:12 +00:00
|
|
|
byte walkbox;
|
|
|
|
byte mask;
|
|
|
|
byte animProgress, animSpeed;
|
2001-10-16 10:01:48 +00:00
|
|
|
int16 new_1,new_2;
|
2001-11-26 19:57:57 +00:00
|
|
|
uint16 talk_script, walk_script;
|
2001-10-16 10:01:48 +00:00
|
|
|
byte new_3;
|
2001-12-27 17:51:58 +00:00
|
|
|
int8 layer;
|
2001-10-09 14:30:12 +00:00
|
|
|
ActorWalkData walkdata;
|
2001-11-26 19:57:57 +00:00
|
|
|
int16 animVariable[16];
|
|
|
|
uint16 sound[8];
|
2001-10-09 14:30:12 +00:00
|
|
|
CostumeData cost;
|
2001-11-26 19:57:57 +00:00
|
|
|
byte palette[64];
|
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 {
|
|
|
|
byte unk5;
|
|
|
|
byte unk2;
|
|
|
|
uint16 unk4;
|
|
|
|
uint16 unk3;
|
|
|
|
byte unk;
|
|
|
|
byte pad;
|
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
bool no_talk_anim,t_no_talk_anim;
|
2001-10-16 10:01:48 +00:00
|
|
|
};
|
|
|
|
|
2001-10-23 19:51:50 +00:00
|
|
|
enum GameId {
|
|
|
|
GID_TENTACLE = 1,
|
|
|
|
GID_MONKEY2 = 2,
|
|
|
|
GID_INDY4 = 3,
|
|
|
|
GID_MONKEY = 4,
|
2001-10-24 20:12:52 +00:00
|
|
|
GID_SAMNMAX = 5,
|
2002-02-12 18:20:37 +00:00
|
|
|
GID_MONKEY_EGA = 6,
|
|
|
|
GID_LOOM256 = 7,
|
|
|
|
GID_ZAK256 = 8,
|
|
|
|
GID_INDY3_256 = 9,
|
|
|
|
GID_LOOM = 10,
|
2002-02-23 23:23:28 +00:00
|
|
|
GID_FT = 11,
|
2002-04-12 10:34:46 +00:00
|
|
|
GID_DIG = 12,
|
2002-04-25 03:37:56 +00:00
|
|
|
GID_MONKEY_VGA = 13,
|
2002-04-12 10:34:46 +00:00
|
|
|
/* Simon the Sorcerer */
|
2002-04-25 03:37:56 +00:00
|
|
|
GID_SIMON_FIRST = 14,
|
2002-04-12 10:34:46 +00:00
|
|
|
GID_SIMON_LAST = GID_SIMON_FIRST+3,
|
2001-10-23 19:51:50 +00:00
|
|
|
};
|
|
|
|
|
2001-11-26 19:57:57 +00:00
|
|
|
enum GameFeatures {
|
|
|
|
GF_NEW_OPCODES = 1,
|
|
|
|
GF_AFTER_V6 = 2,
|
|
|
|
GF_AFTER_V7 = 4,
|
|
|
|
GF_HAS_ROOMTABLE = GF_AFTER_V7,
|
|
|
|
GF_USE_KEY = 8,
|
2001-12-27 17:51:58 +00:00
|
|
|
GF_NEW_COSTUMES = GF_AFTER_V7,
|
2001-11-26 19:57:57 +00:00
|
|
|
GF_USE_ANGLES = GF_AFTER_V7,
|
2001-12-04 21:44:41 +00:00
|
|
|
GF_DRAWOBJ_OTHER_ORDER = 16,
|
2001-11-26 19:57:57 +00:00
|
|
|
|
|
|
|
GF_DEFAULT = GF_USE_KEY,
|
2002-02-12 18:20:37 +00:00
|
|
|
|
|
|
|
GF_SMALL_HEADER = 32,
|
2002-03-09 00:56:22 +00:00
|
|
|
GF_EXTERNAL_CHARSET = GF_SMALL_HEADER,
|
|
|
|
GF_SMALL_NAMES = 64,
|
|
|
|
GF_OLD_BUNDLE = 128,
|
2002-02-12 18:20:37 +00:00
|
|
|
GF_16COLOR = 256,
|
|
|
|
GF_OLD256 = 512,
|
2002-02-12 22:25:41 +00:00
|
|
|
GF_AUDIOTRACKS = 1024,
|
2002-04-13 18:34:11 +00:00
|
|
|
GF_NO_SCALLING = 2048,
|
|
|
|
GF_ADLIB_DEFAULT = 4096,
|
2002-04-17 04:35:04 +00:00
|
|
|
GF_AMIGA = 8192
|
2001-11-26 19:57:57 +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
|
|
|
|
};
|
|
|
|
|
2002-03-22 03:30:57 +00:00
|
|
|
#include "gfx.h"
|
2002-03-21 16:12:02 +00:00
|
|
|
#include "boxes.h"
|
2002-03-22 03:30:57 +00:00
|
|
|
#include "akos.h"
|
|
|
|
#include "smush.h"
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
class Scumm {
|
|
|
|
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. */
|
|
|
|
OSystem *_system;
|
2002-04-14 18:13:08 +00:00
|
|
|
IMuse *_imuse;
|
2002-04-12 21:26:59 +00:00
|
|
|
Gui *_gui;
|
|
|
|
uint32 _features;
|
|
|
|
VerbSlot *_verbs;
|
|
|
|
ObjectData *_objs;
|
|
|
|
ScummDebugger *_debugger;
|
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];
|
2001-11-07 18:10:52 +00:00
|
|
|
int16 localvar[NUM_SCRIPT_SLOT][17];
|
2001-10-09 14:30:12 +00:00
|
|
|
} vm;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
int16 x,y;
|
|
|
|
} mouse;
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Init functions, etc*/
|
|
|
|
byte _fastMode;
|
|
|
|
char *getGameName();
|
2002-03-25 17:45:55 +00:00
|
|
|
Scumm(); // constructor
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-04-17 20:23:45 +00:00
|
|
|
/* video buffer */
|
2002-04-17 20:34:10 +00:00
|
|
|
byte *_videoBuffer;
|
2002-04-17 20:23:45 +00:00
|
|
|
|
|
|
|
/* system call object */
|
2002-03-21 00:40:18 +00:00
|
|
|
|
|
|
|
/* Scumm main loop */
|
|
|
|
|
|
|
|
void mainRun();
|
|
|
|
int delta; // global time
|
|
|
|
|
2002-03-25 12:26:37 +00:00
|
|
|
/* _insane vars */
|
|
|
|
|
|
|
|
int _insaneFlag;
|
2002-03-25 14:22:09 +00:00
|
|
|
int _insaneState;
|
|
|
|
int videoFinished;
|
2002-03-25 12:26:37 +00:00
|
|
|
|
2002-03-20 22:58:41 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void scummInit();
|
2002-03-21 00:40:18 +00:00
|
|
|
void scummMain(int argc, char **argv); // is it still used ?
|
2002-03-20 17:51:07 +00:00
|
|
|
int scummLoop(int delta);
|
|
|
|
void initScummVars();
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void pauseGame(bool user);
|
|
|
|
void shutDown(int i);
|
|
|
|
void setOptions(void);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void main();
|
|
|
|
void parseCommandLine(int argc, char **argv);
|
|
|
|
void showHelpAndExit();
|
|
|
|
bool detectGame();
|
|
|
|
void processKbd();
|
|
|
|
void clear_fullRedraw();
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
int checkKeyHit();
|
|
|
|
void convertKeysToClicks();
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Random number generation */
|
|
|
|
uint32 _randSeed1, _randSeed2;
|
|
|
|
void initRandSeeds();
|
|
|
|
uint getRandomNumber(uint max);
|
|
|
|
uint getRandomNumberRng(uint min, uint max);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Core variable definitions */
|
|
|
|
byte _gameId;
|
|
|
|
const char *_gameText;
|
|
|
|
char *_gameDataPath;
|
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
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
Actor actor[MAX_ACTORS];
|
|
|
|
|
|
|
|
uint16 *_inventory;
|
|
|
|
byte *_arrays;
|
|
|
|
uint16 *_newNames;
|
|
|
|
int16 *_vars;
|
|
|
|
int16 _varwatch;
|
|
|
|
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;
|
|
|
|
int _numCharsets, _numCostumes, _numNewNames, _numGlobalScripts;
|
|
|
|
int NUM_ACTORS;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Current objects - can go in their respective classes */
|
|
|
|
byte _curActor;
|
|
|
|
int _curVerb;
|
|
|
|
int _curVerbSlot;
|
|
|
|
int _curPalIndex;
|
|
|
|
byte _currentRoom;
|
|
|
|
VirtScreen *_curVirtScreen;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
bool _egoPositioned;
|
|
|
|
int _xPos, _yPos, _dir;
|
|
|
|
int _keyPressed;
|
2001-10-09 14:30:12 +00:00
|
|
|
uint16 _lastKeyHit;
|
2002-03-20 17:51:07 +00:00
|
|
|
uint16 _mouseButStat;
|
|
|
|
byte _leftBtnPressed, _rightBtnPressed;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
int16 _virtual_mouse_x, _virtual_mouse_y, _bootParam;
|
|
|
|
uint16 _debugMode, _currentDrive, _soundCardType;
|
|
|
|
byte _mousePresent;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Not sure where this stuff goes */
|
|
|
|
byte isMaskActiveAt(int l, int t, int r, int b, byte *mem);
|
|
|
|
void startScene(int room, Actor *a, int b);
|
|
|
|
void setupScummVarsOld(); // Both of these will simply be one
|
|
|
|
void setupScummVarsNew(); // 'setupScummVars' in each Scumm_Vx
|
|
|
|
byte *_objectOwnerTable, *_objectRoomTable, *_objectStateTable;
|
|
|
|
byte _numObjectsInRoom;
|
|
|
|
int8 _userPut;
|
|
|
|
int _resourceHeaderSize;
|
|
|
|
void unkRoomFunc3(int a, int b, int c, int d, int e);
|
|
|
|
void unkRoomFunc4(int a, int b, int c, int d, int e);
|
|
|
|
void setScaleItem(int slot, int a, int b, int c, int d);
|
|
|
|
void clearClickedStatus();
|
|
|
|
void startManiac();
|
2001-11-05 19:21:49 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* GUI class */
|
|
|
|
void drawString(int a);
|
|
|
|
int getKeyInput(int a);
|
2001-11-09 18:54:15 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Save/Load class - some of this may be GUI */
|
|
|
|
byte _saveLoadFlag, _saveLoadSlot;
|
2002-04-27 04:31:25 +00:00
|
|
|
bool _doAutosave;
|
2002-03-20 17:51:07 +00:00
|
|
|
bool _saveLoadCompatible;
|
2001-11-09 18:54:15 +00:00
|
|
|
char _saveLoadName[32];
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
bool saveState(int slot, bool compat);
|
|
|
|
bool loadState(int slot, bool compat);
|
|
|
|
void saveOrLoad(Serializer *s);
|
2001-11-14 18:40:39 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
bool getSavegameName(int slot, char *desc);
|
|
|
|
void makeSavegameName(char *out, int slot, bool compatible);
|
|
|
|
void saveLoadResource(Serializer *ser, int type, int index);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Heap and memory management */
|
|
|
|
uint32 _maxHeapThreshold, _minHeapThreshold;
|
|
|
|
void checkRange(int max, int min, int no, const char *str);
|
|
|
|
void lock(int type, int i);
|
|
|
|
void unlock(int type, int i);
|
|
|
|
void heapClear(int mode);
|
|
|
|
void unkHeapProc2(int a, int b);
|
2002-03-16 05:33:25 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Script VM - should be in Script class */
|
|
|
|
uint32 _localScriptList[NUM_LOCALSCRIPT];
|
|
|
|
byte *_scriptPointer, *_scriptOrgPointer, *_scriptPointerStart;
|
|
|
|
byte _opcode, _numNestedScripts, _currentScript;
|
|
|
|
uint16 _curExecScript;
|
|
|
|
const OpcodeProc *_opcodes;
|
|
|
|
const char* *_opcodes_lookup;
|
|
|
|
byte **_lastCodePtr;
|
|
|
|
int _resultVarNumber, _scummStackPos;
|
|
|
|
int16 _localParamList[16], _scummStack[150];
|
|
|
|
|
|
|
|
OpcodeProc getOpcode(int i) { return _opcodes[i]; }
|
|
|
|
void initializeLocals(int slot, int16 *vars);
|
|
|
|
int getScriptSlot();
|
|
|
|
void runScript(int script, int a, int b, int16 *lvarptr);
|
|
|
|
void stopScriptNr(int script);
|
|
|
|
void runScriptNested(int script);
|
|
|
|
void executeScript();
|
|
|
|
void updateScriptPtr();
|
|
|
|
void getScriptBaseAddress();
|
|
|
|
void getScriptEntryPoint();
|
|
|
|
byte fetchScriptByte();
|
|
|
|
int fetchScriptWord();
|
|
|
|
void ignoreScriptWord() { fetchScriptWord(); }
|
|
|
|
void ignoreScriptByte() { fetchScriptByte(); }
|
2002-03-31 08:35:42 +00:00
|
|
|
int getVarOrDirectWord(byte mask);
|
|
|
|
int getVarOrDirectByte(byte mask);
|
2002-03-20 17:51:07 +00:00
|
|
|
void getResultPos();
|
|
|
|
void setResult(int result);
|
|
|
|
int readVar(uint var);
|
|
|
|
void writeVar(uint var, int value);
|
|
|
|
void push(int a);
|
|
|
|
int pop();
|
|
|
|
void runHook(int i);
|
|
|
|
bool isScriptInUse(int script);
|
|
|
|
int getStringLen(byte *ptr);
|
|
|
|
|
|
|
|
void freezeScripts(int scr);
|
|
|
|
void unfreezeScripts();
|
|
|
|
void runAllScripts();
|
|
|
|
void setupOpcodes();
|
|
|
|
void setupOpcodes2();
|
|
|
|
void cutscene(int16 *args);
|
|
|
|
void endCutscene();
|
|
|
|
void exitCutscene();
|
|
|
|
void runExitScript();
|
|
|
|
void runEntryScript();
|
|
|
|
|
|
|
|
void beginOverride();
|
|
|
|
void endOverride();
|
|
|
|
void killScriptsAndResources();
|
|
|
|
void checkAndRunVar33();
|
|
|
|
void decreaseScriptDelay(int amount);
|
|
|
|
bool isScriptRunning(int script);
|
|
|
|
bool isRoomScriptRunning(int script);
|
|
|
|
void arrayop_1(int a, byte *ptr);
|
|
|
|
void copyString(byte *dst, byte *src, int len);
|
|
|
|
void doSentence(int c, int b, int a);
|
|
|
|
int popRoomAndObj(int *room);
|
|
|
|
int getWordVararg(int16 *ptr);
|
|
|
|
void decodeParseString();
|
|
|
|
void decodeParseString2(int a, int b);
|
|
|
|
|
|
|
|
/* Script VM or Object class? */
|
|
|
|
void stopObjectCode();
|
|
|
|
void stopObjectScript(int script);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Should be in Resource class */
|
|
|
|
byte _encbyte;
|
|
|
|
void *_fileHandle;
|
|
|
|
char *_resFilePrefix, *_resFilePath;
|
|
|
|
uint32 _fileOffset;
|
|
|
|
char *_exe_name;
|
|
|
|
bool _dynamicRoomOffsets;
|
|
|
|
byte _resourceMapper[128];
|
|
|
|
uint32 _allocatedSize;
|
|
|
|
byte _expire_counter;
|
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);
|
|
|
|
void deleteRoomOffsets();
|
|
|
|
void readRoomsOffsets();
|
2001-10-23 19:51:50 +00:00
|
|
|
void askForDisk(const char *filename);
|
2001-10-09 14:30:12 +00:00
|
|
|
bool openResourceFile(const char *filename);
|
2002-03-20 17:51:07 +00:00
|
|
|
void loadPtrToResource(int type, int i, 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);
|
2002-03-20 17:51:07 +00:00
|
|
|
void nukeResource(int type, int i);
|
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 loadResource(int type, int i);
|
|
|
|
int getResourceRoomNr(int type, int index);
|
|
|
|
int readSoundResource(int type, int index);
|
2001-11-05 19:21:49 +00:00
|
|
|
void setResourceCounter(int type, int index, byte flag);
|
2001-10-09 14:30:12 +00:00
|
|
|
void validateResource(const char *str, int type, int index);
|
2002-03-20 17:51:07 +00:00
|
|
|
void increaseResourceCounter();
|
|
|
|
bool isResourceInUse(int type, int i);
|
|
|
|
bool isResourceLoaded(int type, int index);
|
|
|
|
void initRoomSubBlocks();
|
|
|
|
void loadRoomObjects();
|
|
|
|
void loadRoomObjectsSmall();
|
|
|
|
void readArrayFromIndexFile();
|
|
|
|
void readMAXS();
|
2002-04-21 19:38:00 +00:00
|
|
|
uint32 isGlobInMemory(int type, int index);
|
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
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
bool fileReadFailed(void *handle);
|
|
|
|
void clearFileReadFailed(void *handle);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
int _lastLoadedRoom, _roomResource;
|
|
|
|
byte _resFilePathId, _fileReadFailed;
|
|
|
|
byte *findResourceData(uint32 tag, byte *ptr);
|
|
|
|
int getResourceDataSize(byte *ptr);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
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();
|
|
|
|
void dumpResource(char *tag, int index, byte *ptr);
|
|
|
|
|
|
|
|
|
|
|
|
/* Should be in Object class */
|
|
|
|
byte OF_OWNER_ROOM;
|
|
|
|
struct FindObjectInRoom {
|
|
|
|
CodeHeader *cdhd;
|
|
|
|
byte *obcd;
|
|
|
|
ImageHeader *imhd;
|
|
|
|
byte *obim;
|
|
|
|
byte *roomptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum FindObjectWhat {
|
|
|
|
foCodeHeader = 1,
|
|
|
|
foImageHeader = 2,
|
|
|
|
foCheckAlreadyLoaded = 4
|
|
|
|
};
|
|
|
|
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
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void setupRoomObject(ObjectData *od, byte *room);
|
|
|
|
void removeObjectFromRoom(int obj);
|
|
|
|
void loadFlObject(uint object, uint room);
|
|
|
|
void nukeFlObjects(int min, int max);
|
|
|
|
int findFlObjectSlot();
|
|
|
|
void addObjectToInventory(uint obj, uint room);
|
|
|
|
void fixObjectFlags();
|
2001-10-09 14:30:12 +00:00
|
|
|
bool getClass(int obj, int cls);
|
|
|
|
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);
|
|
|
|
void getObjectXYPos(int object);
|
|
|
|
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);
|
|
|
|
int getObjectOrActorXY(int object); // Object and Actor...
|
|
|
|
int getObjActToObjActDist(int a, int b); // Not sure how to handle
|
|
|
|
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
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Should be in Costume class */
|
|
|
|
void loadCostume(LoadedCostume *lc, int costume);
|
|
|
|
void cost_setPalette(CostumeRenderer *cr, byte *palette);
|
|
|
|
void cost_setFacing(CostumeRenderer *cr, Actor *a);
|
|
|
|
void cost_setCostume(CostumeRenderer *cr, int costume);
|
|
|
|
byte cost_increaseAnims(LoadedCostume *lc, Actor *a);
|
|
|
|
byte cost_increaseAnim(LoadedCostume *lc, Actor *a, int slot);
|
|
|
|
void cost_decodeData(Actor *a, int frame, uint usemask);
|
|
|
|
int cost_frameToAnim(Actor *a, int frame);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Should be in Verb class */
|
2002-05-07 18:44:34 +00:00
|
|
|
uint16 _verbMouseOver;
|
|
|
|
int _inventoryOffset;
|
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);
|
|
|
|
void drawVerbBitmap(int vrb, int x, int y);
|
2001-10-09 14:30:12 +00:00
|
|
|
int getVerbEntrypoint(int obj, int entry);
|
|
|
|
int getVerbSlot(int id, int mode);
|
|
|
|
void killVerb(int slot);
|
2001-10-16 10:01:48 +00:00
|
|
|
void runVerbCode(int script, int entry, int a, int b, int16 *vars);
|
2001-11-06 20:00:47 +00:00
|
|
|
void setVerbObject(uint room, uint object, uint verb);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Should be in Sound class */
|
2002-04-19 15:02:16 +00:00
|
|
|
union {
|
|
|
|
SoundMixer _mixer[1];
|
|
|
|
uint32 xxxx_1;
|
|
|
|
};
|
|
|
|
//SoundMixer _mixer[1];
|
2002-04-14 18:13:08 +00:00
|
|
|
|
|
|
|
// MixerChannel _mixer_channel[NUM_MIXER];
|
2002-03-20 17:51:07 +00:00
|
|
|
byte _sfxMode;
|
2002-04-13 18:34:11 +00:00
|
|
|
bool _use_adlib;
|
2002-03-20 17:51:07 +00:00
|
|
|
int16 _sound_volume_master, _sound_volume_music, _sound_volume_sfx;
|
|
|
|
int _saveSound;
|
|
|
|
void *_sfxFile;
|
|
|
|
uint16 _soundParam,_soundParam2,_soundParam3;
|
|
|
|
uint32 _talk_sound_a, _talk_sound_b;
|
|
|
|
byte _talk_sound_mode;
|
|
|
|
bool _mouthSyncMode;
|
|
|
|
bool _endOfMouthSync;
|
|
|
|
uint16 _mouthSyncTimes[52];
|
|
|
|
uint _curSoundPos;
|
2002-05-05 17:44:39 +00:00
|
|
|
int current_cd_sound, _cd_loops, _cd_frame, _cd_track, _cd_end;
|
2002-04-20 04:09:02 +00:00
|
|
|
|
2002-04-19 21:06:50 +00:00
|
|
|
int tempMusic;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-04-17 20:23:45 +00:00
|
|
|
#ifdef COMPRESSED_SOUND_FILE
|
|
|
|
|
|
|
|
#define CACHE_TRACKS 10
|
|
|
|
|
|
|
|
/* used for mp3 CD music */
|
|
|
|
|
2002-04-28 14:01:40 +00:00
|
|
|
int _current_cache;
|
2002-04-17 20:23:45 +00:00
|
|
|
int _cached_tracks[CACHE_TRACKS];
|
|
|
|
struct mad_header _mad_header[CACHE_TRACKS];
|
|
|
|
long _mp3_size[CACHE_TRACKS];
|
|
|
|
FILE* _mp3_tracks[CACHE_TRACKS];
|
2002-04-27 07:42:14 +00:00
|
|
|
int _mp3_index;
|
2002-04-28 14:01:40 +00:00
|
|
|
bool _mp3_cd_playing;
|
2002-04-17 20:23:45 +00:00
|
|
|
|
|
|
|
int getCachedTrack(int track);
|
2002-04-24 07:19:00 +00:00
|
|
|
int playMP3CDTrack(int track, int num_loops, int start, int delay);
|
2002-04-28 14:01:40 +00:00
|
|
|
int stopMP3CD();
|
|
|
|
int updateMP3CD();
|
|
|
|
int pollMP3CD();
|
2002-04-17 20:23:45 +00:00
|
|
|
#endif
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
int16 _soundQuePos, _soundQue[0x100];
|
|
|
|
byte _soundQue2Pos, _soundQue2[10];
|
|
|
|
bool _soundsPaused, _soundsPaused2;
|
2002-04-21 21:58:21 +00:00
|
|
|
bool _soundVolumePreset;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void setupSound();
|
|
|
|
void processSoundQues();
|
|
|
|
void playSound(int sound);
|
|
|
|
void stopAllSounds();
|
|
|
|
void stopSound(int sound);
|
|
|
|
bool isSoundInQueue(int sound);
|
|
|
|
void clearSoundQue();
|
|
|
|
void talkSound(uint32 a, uint32 b, int mode);
|
|
|
|
void processSfxQueues();
|
2002-04-22 08:16:16 +00:00
|
|
|
int startTalkSound(uint32 a, uint32 b, int mode);
|
2002-03-20 17:51:07 +00:00
|
|
|
void stopTalkSound();
|
|
|
|
bool isMouthSyncOff(uint pos);
|
2002-04-22 08:16:16 +00:00
|
|
|
int startSfxSound(void *file, int size);
|
2002-03-20 17:51:07 +00:00
|
|
|
void *openSfxFile();
|
|
|
|
void addSoundToQueue(int sound);
|
|
|
|
void addSoundToQueue2(int sound);
|
|
|
|
void soundKludge(int16 *list);
|
2002-04-07 18:46:50 +00:00
|
|
|
MP3OffsetTable *offset_table; // SO3 MP3 compressed audio
|
2002-03-20 17:51:07 +00:00
|
|
|
int num_sound_effects; // SO3 MP3 compressed audio
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-04-29 08:28:27 +00:00
|
|
|
BundleAudioTable *bundle_table; // DIG/CMI bundles
|
2002-03-20 17:51:07 +00:00
|
|
|
void pauseSounds(bool pause);
|
|
|
|
bool isSfxFinished();
|
2002-04-08 13:55:03 +00:00
|
|
|
void playBundleSound(char *sound);
|
2002-04-29 08:28:27 +00:00
|
|
|
void decompressBundleSound(int index);
|
2002-04-22 08:16:16 +00:00
|
|
|
int playSfxSound(void *sound, uint32 size, uint rate);
|
2002-04-22 11:36:41 +00:00
|
|
|
int playSfxSound_MP3(void *sound, uint32 size);
|
2002-03-20 17:51:07 +00:00
|
|
|
void stopSfxSound();
|
2001-10-10 10:02:33 +00:00
|
|
|
|
2002-04-22 08:16:16 +00:00
|
|
|
int _talkChannel; /* Mixer channel actor is talking on */
|
2002-03-20 17:51:07 +00:00
|
|
|
bool _useTalkAnims;
|
|
|
|
uint16 _defaultTalkDelay;
|
|
|
|
byte _haveMsg;
|
|
|
|
int isSoundRunning(int a);
|
2001-10-10 10:02:33 +00:00
|
|
|
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Should be in Actor class */
|
|
|
|
Actor *derefActor(int id) {return &actor[id];}
|
2001-10-09 14:30:12 +00:00
|
|
|
Actor *derefActorSafe(int id, const char *errmsg);
|
2002-03-20 17:51:07 +00:00
|
|
|
Actor *getFirstActor() {return actor;}
|
|
|
|
void putActor(Actor *a, int x, int y, byte room);
|
|
|
|
void hideActor(Actor *a);
|
|
|
|
void showActor(Actor *a);
|
|
|
|
void showActors();
|
2001-10-09 19:02:28 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void initActor(Actor *a, int mode);
|
|
|
|
void setActorWalkSpeed(Actor *a, uint speed1, uint speed2);
|
|
|
|
int calcMovementFactor(Actor *a, int newx, int newy);
|
|
|
|
int actorWalkStep(Actor *a);
|
|
|
|
int remapDirection(Actor *a, int dir);
|
|
|
|
void setupActorScale(Actor *a);
|
|
|
|
void stopActorMoving(Actor *a);
|
|
|
|
uint32 *_classData;
|
|
|
|
void startWalkAnim(Actor *a, int cmd, int angle);
|
|
|
|
void startAnimActor(Actor *a, int frame);
|
|
|
|
void setActorBox(Actor *a, int box);
|
2001-10-09 19:02:28 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
int newDirToOldDir(int dir);
|
|
|
|
int oldDirToNewDir(int dir);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
static int normalizeAngle(int angle);
|
|
|
|
int getAngleFromPos(int x, int y);
|
|
|
|
static int fromSimpleDir(int dirtype, int dir);
|
|
|
|
static int toSimpleDir(int dirtype, int dir);
|
|
|
|
static int numSimpleDirDirections(int dirType);
|
|
|
|
int updateActorDirection(Actor *a);
|
|
|
|
void startAnimActorEx(Actor *a, int frame, int direction);
|
|
|
|
int getProgrDirChange(Actor *a, int mode);
|
|
|
|
void initActorCostumeData(Actor *a);
|
2002-05-10 13:45:32 +00:00
|
|
|
void setActorDirection(Actor *a, int direction);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
int getActorXYPos(Actor *a);
|
|
|
|
void adjustActorPos(Actor *a);
|
|
|
|
void turnToDirection(Actor *a, int newdir);
|
|
|
|
AdjustBoxResult adjustXYToBeInBox(Actor *a, int x, int y, int pathfrom);
|
|
|
|
void walkActors();
|
|
|
|
void playActorSounds();
|
|
|
|
void walkActor(Actor *a);
|
|
|
|
void setActorRedrawFlags();
|
|
|
|
void resetActorBgs();
|
|
|
|
void processActors();
|
|
|
|
void drawActorCostume(Actor *a);
|
|
|
|
void actorAnimate(Actor *a);
|
|
|
|
int getActorFromPos(int x, int y);
|
|
|
|
void setActorCostume(Actor *a, int c);
|
|
|
|
byte *getActorName(Actor *a);
|
|
|
|
void faceActorToObj(int act, int obj);
|
|
|
|
void animateActor(int act, int anim);
|
2001-10-16 10:01:48 +00:00
|
|
|
void actorFollowCamera(int act);
|
2002-03-20 17:51:07 +00:00
|
|
|
void startWalkActor(Actor *a, int x, int y, int dir);
|
|
|
|
|
|
|
|
void remapActor(Actor *a, int b, int c, int d, int e);
|
|
|
|
void walkActorOld(Actor *a);
|
|
|
|
bool isCostumeInUse(int i);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Actor talking stuff */
|
|
|
|
byte _actorToPrintStrFor;
|
|
|
|
int _sentenceNum;
|
|
|
|
SentenceTab sentence[6];
|
|
|
|
StringTab string[6];
|
|
|
|
void actorTalk();
|
|
|
|
void stopTalk();
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-03-23 20:34:47 +00:00
|
|
|
/* Akos Class */
|
2002-04-12 10:34:46 +00:00
|
|
|
bool akos_drawCostume(AkosRenderer *ar);
|
|
|
|
void akos_setPalette(AkosRenderer *ar, byte *palette);
|
|
|
|
void akos_setCostume(AkosRenderer *ar, int costume);
|
|
|
|
void akos_setFacing(AkosRenderer *ar, Actor *a);
|
|
|
|
bool akos_drawCostumeChannel(AkosRenderer *ar, int chan);
|
|
|
|
void akos_codec1(AkosRenderer *ar);
|
|
|
|
void akos_codec5(AkosRenderer *ar);
|
|
|
|
void akos_codec16(AkosRenderer *ar);
|
|
|
|
void akos_codec1_ignorePakCols(AkosRenderer *ar, int num);
|
|
|
|
void akos_c1_spec2(AkosRenderer *ar);
|
|
|
|
void akos_c1_spec3(AkosRenderer *ar);
|
|
|
|
|
|
|
|
bool akos_increaseAnims(byte *akos, Actor *a);
|
|
|
|
bool akos_increaseAnim(Actor *a, int i, byte *aksq, uint16 *akfo, int numakfo);
|
|
|
|
|
|
|
|
int getAnimVar(Actor *a, byte var);
|
|
|
|
void setAnimVar(Actor *a, byte var, int value);
|
|
|
|
|
|
|
|
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);
|
|
|
|
int akos_findManyDirection(int16 ManyDirection, uint16 facing);
|
2001-10-16 10:01:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Should be in Graphics class? */
|
|
|
|
uint16 _screenB, _screenH;
|
2002-05-07 18:44:34 +00:00
|
|
|
int _scrHeight, _scrWidth, _realHeight, _realWidth;
|
2002-03-20 17:51:07 +00:00
|
|
|
VirtScreen virtscr[4]; // Virtual screen areas
|
|
|
|
CameraData camera; // 'Camera' - viewport
|
|
|
|
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;
|
|
|
|
uint32 _CLUT_offs, _EPAL_offs;
|
|
|
|
uint32 _IM00_offs, _PALS_offs;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
bool _fullScreen, _fullRedraw, _BgNeedsRedraw, _shakeEnabled;
|
|
|
|
bool _screenEffectFlag, _completeScreenRedraw;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
int _cursorHotspotX, _cursorHotspotY, _cursorWidth, _cursorHeight;
|
|
|
|
byte _cursorAnimate, _cursorAnimateIndex, _grabbedCursor[2048];
|
|
|
|
int8 _cursorState;
|
2001-10-16 10:01:48 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
byte _newEffect, _switchRoomEffect2, _switchRoomEffect;
|
|
|
|
bool _doEffect;
|
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-04-23 23:58:31 +00:00
|
|
|
void initVirtScreen(int slot, int number, int top, int width, int height, bool twobufs, bool fourextra);
|
|
|
|
void initBGBuffers(int height);
|
2002-03-20 17:51:07 +00:00
|
|
|
void initCycl(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);
|
2002-04-22 16:18:20 +00:00
|
|
|
void drawBomp(BompDrawData *bd, int param1, byte* dataPtr, int param2, int param3);
|
2002-03-20 17:51:07 +00:00
|
|
|
|
|
|
|
void restoreBG(int left, int top, int right, int bottom);
|
|
|
|
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 moveCamera();
|
|
|
|
void cameraMoved();
|
|
|
|
void setCameraAtEx(int at);
|
|
|
|
void setCameraAt(int pos_x, int pos_y);
|
|
|
|
void panCameraTo(int x, int y);
|
|
|
|
void setCameraFollows(Actor *a);
|
|
|
|
void clampCameraPos(ScummPoint *pt);
|
2001-11-06 20:00:47 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
byte *getPalettePtr();
|
|
|
|
void setPalette(int pal);
|
|
|
|
void setPaletteFromPtr(byte *ptr);
|
|
|
|
void setPaletteFromRes();
|
|
|
|
void setPalColor(int index, int r, int g, int b);
|
|
|
|
void setDirtyColors(int min, int max);
|
|
|
|
byte *findPalInPals(byte *pal, int index);
|
|
|
|
void swapPalColors(int a, int b);
|
|
|
|
void cyclePalette();
|
|
|
|
void stopCycle(int i);
|
|
|
|
void palManipulate();
|
|
|
|
int remapPaletteColor(int r, int g, int b, uint threshold);
|
|
|
|
void moveMemInPalRes(int start, int end, byte direction);
|
|
|
|
void setupShadowPalette(int slot,int rfact,int gfact,int bfact,int from,int to);
|
|
|
|
void darkenPalette(int a, int b, int c, int d, int e);
|
2001-11-06 20:00:47 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void setShake(int mode);
|
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);
|
|
|
|
void setCursorHotspot2(int x,int y);
|
|
|
|
void grabCursor(int x, int y, int w, int h);
|
|
|
|
void grabCursor(byte *ptr, int width, int height);
|
|
|
|
void makeCursorColorTransparent(int a);
|
2001-11-09 18:54:15 +00:00
|
|
|
void setupCursor() { _cursorAnimate = 1; }
|
2001-11-06 20:00:47 +00:00
|
|
|
void decompressDefaultCursor(int index);
|
2002-03-20 17:51:07 +00:00
|
|
|
void useIm01Cursor(byte *im, int w, int h);
|
|
|
|
void useBompCursor(byte *im, int w, int h);
|
2001-11-06 21:41:56 +00:00
|
|
|
|
2001-11-07 18:10:52 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void updateDirtyRect(int virt, int left, int right, int top, int bottom, uint32 dirtybits);
|
|
|
|
void setDirtyRange(int slot, int a, int height);
|
|
|
|
void drawDirtyScreenParts();
|
|
|
|
void updateDirtyScreen(int slot);
|
2001-11-09 18:54:15 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
VirtScreen *findVirtScreen(int y);
|
|
|
|
void unkVirtScreen4(int a);
|
2001-11-09 18:54:15 +00:00
|
|
|
static void setVirtscreenDirty(VirtScreen *vs, int left, int top, int right, int bottom);
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void screenEffect(int effect);
|
|
|
|
void unkScreenEffect1();
|
|
|
|
void unkScreenEffect2();
|
|
|
|
void unkScreenEffect3();
|
|
|
|
void unkScreenEffect4();
|
|
|
|
void unkScreenEffect5(int a);
|
|
|
|
void unkScreenEffect6();
|
|
|
|
void unkScreenEffect7(int a);
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
void decompressBomp(byte *dst, byte *src, int w, int h);
|
|
|
|
uint _shakeFrame;
|
|
|
|
int _screenStartStrip, _screenEndStrip;
|
|
|
|
int _screenLeft, _screenTop;
|
|
|
|
uint16 _enqueue_b,_enqueue_c,_enqueue_d,_enqueue_e;
|
|
|
|
int _enqueuePos;
|
2002-04-21 21:20:32 +00:00
|
|
|
BlastObject _enqueuedObjects[32];
|
2001-11-11 16:54:45 +00:00
|
|
|
|
2001-12-27 17:51:58 +00:00
|
|
|
void enqueueObject(int a, int b, int c, int d, int e, int f, int g, int h, int mode);
|
2001-11-11 16:54:45 +00:00
|
|
|
void clearEnqueue() { _enqueuePos = 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];
|
|
|
|
int16 _palManipStart, _palManipEnd, _palManipCounter;
|
|
|
|
uint32 gfxUsageBits[200];
|
|
|
|
byte *_shadowPalette;
|
|
|
|
int _shadowPaletteSize;
|
|
|
|
byte _currentPalette[0x300];
|
2002-04-19 15:02:16 +00:00
|
|
|
|
2002-04-19 12:38:03 +00:00
|
|
|
byte _proc_special_palette[256];
|
2002-03-20 17:51:07 +00:00
|
|
|
int _palDirtyMin, _palDirtyMax;
|
|
|
|
byte _bkColor;
|
|
|
|
uint16 _lastXstart;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
|
2001-11-26 19:57:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Walkbox / Navigation class */
|
2002-03-22 03:30:57 +00:00
|
|
|
int _maxBoxVertexHeap, _boxPathVertexHeapIndex, _boxMatrixItem;
|
|
|
|
byte *_boxMatrixPtr4, *_boxMatrixPtr1, *_boxMatrixPtr3;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-03-22 03:30:57 +00:00
|
|
|
ScummPoint p[5]; /* Gate locations */
|
2002-03-20 17:51:07 +00:00
|
|
|
int gate1ax, gate1ay, gate1bx, gate1by, gate2ax, gate2ay, gate2bx, gate2by;
|
|
|
|
uint16 _extraBoxFlags[65];
|
|
|
|
int16 _foundPathX, _foundPathY;
|
|
|
|
int CloX[8], CloY[8];
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
PathVertex *unkMatrixProc1(PathVertex *vtx, PathNode *node);
|
|
|
|
PathNode *unkMatrixProc2(PathVertex *vtx, int i);
|
|
|
|
bool areBoxesNeighbours(int i, int j);
|
|
|
|
void addToBoxMatrix(byte b);
|
|
|
|
int CompareSlope(int X1,int Y1,int X2,int Y2,int X3,int Y3);
|
|
|
|
void SetGate(int line1,int line2, int polyx[8], int polyy[8]);
|
|
|
|
void *addToBoxVertexHeap(int size);
|
|
|
|
PathVertex *addPathVertex();
|
|
|
|
bool checkXYInBoxBounds(int box, int x, int y);
|
|
|
|
uint distanceFromPt(int x, int y, int ptx, int pty);
|
|
|
|
ScummPoint closestPtOnLine(int ulx, int uly, int llx, int lly, int x, int y);
|
|
|
|
bool getSideOfLine(int x1,int y1, int x2, int y2, int x, int y, int box);
|
|
|
|
void getBoxCoordinates(int boxnum, BoxCoords *bc);
|
|
|
|
byte getMaskFromBox(int box);
|
|
|
|
Box *getBoxBaseAddr(int box);
|
|
|
|
byte getBoxFlags(int box);
|
|
|
|
int getBoxScale(int box);
|
|
|
|
byte getNumBoxes();
|
|
|
|
byte *getBoxMatrixBaseAddr();
|
|
|
|
int getPathToDestBox(byte from, byte to);
|
|
|
|
int findPathTowards(Actor *a, byte box, byte box2, byte box3);
|
|
|
|
int findPathTowardsOld(Actor *a, byte box, byte box2, byte box3);
|
|
|
|
void GetGates(int trap1,int trap2);
|
|
|
|
bool inBoxQuickReject(int box, int x, int y, int threshold);
|
|
|
|
AdjustBoxResult getClosestPtOnBox(int box, int x, int y);
|
2002-04-25 08:53:10 +00:00
|
|
|
int getSpecialBox(int param1, int param2);
|
2002-03-20 17:51:07 +00:00
|
|
|
|
|
|
|
void setBoxFlags(int box, int val);
|
|
|
|
void setBoxScale(int box, int b);
|
|
|
|
void createBoxMatrix();
|
2001-11-26 19:57:57 +00:00
|
|
|
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* String class */
|
|
|
|
CharsetRenderer charset;
|
|
|
|
byte _charsetColor;
|
|
|
|
uint16 _noSubtitles; // Skip all subtitles?
|
2002-04-26 18:52:33 +00:00
|
|
|
byte _charsetData[15][16];
|
2002-03-20 17:51:07 +00:00
|
|
|
void initCharset(int charset);
|
|
|
|
void restoreCharsetBg();
|
|
|
|
int hasCharsetMask(int x, int y, int x2, int y2);
|
|
|
|
void CHARSET_1();
|
|
|
|
byte *_msgPtrToAdd;
|
|
|
|
byte *addMessageToStack(byte *msg);
|
|
|
|
void unkAddMsgToStack2(int var);
|
|
|
|
void unkAddMsgToStack3(int var);
|
|
|
|
void unkAddMsgToStack4(int var);
|
|
|
|
void unkAddMsgToStack5(int var);
|
|
|
|
void unkMessage1();
|
|
|
|
void unkMessage2();
|
|
|
|
void clearMsgQueue();
|
|
|
|
int _numInMsgStack;
|
|
|
|
byte *_messagePtr;
|
|
|
|
int16 _talkDelay;
|
|
|
|
bool _keepText;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Should be in System class */
|
|
|
|
byte _fileMode;
|
|
|
|
uint32 _whereInResToRead;
|
|
|
|
void fileClose(void *file);
|
|
|
|
void *fileOpen(const char *filename, int mode);
|
|
|
|
void fileSeek(void *file, long offs, int whence);
|
|
|
|
void fileRead(void *handle, void *ptr, uint32 size);
|
|
|
|
bool fileEof(void *handle);
|
|
|
|
uint32 filePos(void *handle);
|
|
|
|
bool checkFixedDisk();
|
2002-04-07 07:33:39 +00:00
|
|
|
int _cdrom;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
int fileReadByte();
|
|
|
|
uint32 fileReadDwordLE();
|
|
|
|
uint32 fileReadDwordBE();
|
2002-04-29 08:28:27 +00:00
|
|
|
int fileReadByte(void *handle);
|
|
|
|
uint32 fileReadDwordLE(void *handle);
|
|
|
|
uint32 fileReadDwordBE(void *handle);
|
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
#if defined(SCUMM_LITTLE_ENDIAN)
|
|
|
|
uint32 fileReadDword() { return fileReadDwordLE(); }
|
2002-04-29 08:28:27 +00:00
|
|
|
uint32 fileReadDword(void *handle) { return fileReadDwordLE(handle); }
|
2002-03-20 17:51:07 +00:00
|
|
|
#elif defined(SCUMM_BIG_ENDIAN)
|
|
|
|
uint32 fileReadDword() { return fileReadDwordBE(); }
|
2002-04-29 08:28:27 +00:00
|
|
|
uint32 fileReadDword(void *handle) {return fileReadDwordBE(handle);}
|
2002-03-20 17:51:07 +00:00
|
|
|
#endif
|
|
|
|
uint fileReadWordLE();
|
|
|
|
uint fileReadWordBE();
|
2002-04-29 08:28:27 +00:00
|
|
|
uint fileReadWordLE(void *handle);
|
|
|
|
uint fileReadWordBE(void *handle);
|
2001-11-27 17:56:04 +00:00
|
|
|
|
2002-04-27 16:58:29 +00:00
|
|
|
static char *Strdup(const char *);
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Version 5 script opcodes */
|
|
|
|
void o5_actorFollowCamera();
|
|
|
|
void o5_actorFromPos();
|
|
|
|
void o5_actorSet();
|
|
|
|
void o5_actorSetClass();
|
|
|
|
void o5_add();
|
|
|
|
void o5_and();
|
|
|
|
void o5_animateActor();
|
|
|
|
void o5_badOpcode();
|
|
|
|
void o5_breakHere();
|
|
|
|
void o5_chainScript();
|
|
|
|
void o5_cursorCommand();
|
|
|
|
void o5_cutscene();
|
|
|
|
void o5_debug();
|
|
|
|
void o5_decrement();
|
|
|
|
void o5_delay();
|
|
|
|
void o5_delayVariable();
|
|
|
|
void o5_divide();
|
|
|
|
void o5_doSentence();
|
|
|
|
void o5_drawBox();
|
|
|
|
void o5_drawObject();
|
|
|
|
void o5_dummy();
|
|
|
|
void o5_endCutscene();
|
|
|
|
void o5_equalZero();
|
|
|
|
void o5_expression();
|
|
|
|
void o5_faceActor();
|
|
|
|
void o5_findInventory();
|
|
|
|
void o5_findObject();
|
|
|
|
void o5_freezeScripts();
|
|
|
|
void o5_getActorCostume();
|
|
|
|
void o5_getActorElevation();
|
|
|
|
void o5_getActorFacing();
|
|
|
|
void o5_getActorMoving();
|
|
|
|
void o5_getActorRoom();
|
|
|
|
void o5_getActorScale();
|
|
|
|
void o5_getActorWalkBox();
|
|
|
|
void o5_getActorWidth();
|
|
|
|
void o5_getActorX();
|
|
|
|
void o5_getActorY();
|
|
|
|
void o5_getAnimCounter();
|
|
|
|
void o5_getClosestObjActor();
|
|
|
|
void o5_getDist();
|
|
|
|
void o5_getInventoryCount();
|
|
|
|
void o5_getObjectOwner();
|
|
|
|
void o5_getObjectState();
|
|
|
|
void o5_getRandomNr();
|
|
|
|
void o5_getScriptRunning();
|
|
|
|
void o5_getVerbEntrypoint();
|
|
|
|
void o5_ifClassOfIs();
|
|
|
|
void o5_increment();
|
|
|
|
void o5_isActorInBox();
|
|
|
|
void o5_isEqual();
|
|
|
|
void o5_isGreater();
|
|
|
|
void o5_isGreaterEqual();
|
|
|
|
void o5_isLess();
|
|
|
|
void o5_isNotEqual();
|
|
|
|
void o5_isSoundRunning();
|
|
|
|
void o5_jumpRelative();
|
|
|
|
void o5_lessOrEqual();
|
|
|
|
void o5_lights();
|
|
|
|
void o5_loadRoom();
|
|
|
|
void o5_loadRoomWithEgo();
|
|
|
|
void o5_matrixOps();
|
|
|
|
void o5_move();
|
|
|
|
void o5_multiply();
|
|
|
|
void o5_notEqualZero();
|
|
|
|
void o5_or();
|
|
|
|
void o5_overRide();
|
|
|
|
void o5_panCameraTo();
|
|
|
|
void o5_pickupObject();
|
|
|
|
void o5_print();
|
|
|
|
void o5_printEgo();
|
|
|
|
void o5_pseudoRoom();
|
|
|
|
void o5_putActor();
|
|
|
|
void o5_putActorAtObject();
|
|
|
|
void o5_putActorInRoom();
|
|
|
|
void o5_quitPauseRestart();
|
|
|
|
void o5_resourceRoutines();
|
|
|
|
void o5_roomOps();
|
|
|
|
void o5_saveRestoreVerbs();
|
|
|
|
void o5_setCameraAt();
|
|
|
|
void o5_setObjectName();
|
|
|
|
void o5_setOwnerOf();
|
|
|
|
void o5_setState();
|
|
|
|
void o5_setVarRange();
|
|
|
|
void o5_soundKludge();
|
|
|
|
void o5_startMusic();
|
|
|
|
void o5_startObject();
|
|
|
|
void o5_startScript();
|
|
|
|
void o5_startSound();
|
|
|
|
void o5_stopMusic();
|
|
|
|
void o5_stopObjectCode();
|
|
|
|
void o5_stopObjectScript();
|
|
|
|
void o5_stopScript();
|
|
|
|
void o5_stopSound();
|
|
|
|
void o5_stringOps();
|
|
|
|
void o5_subtract();
|
|
|
|
void o5_verbOps();
|
|
|
|
void o5_wait();
|
|
|
|
void o5_walkActorTo();
|
|
|
|
void o5_walkActorToActor();
|
|
|
|
void o5_walkActorToObject();
|
|
|
|
void o5_oldRoomEffect();
|
|
|
|
void o5_pickupObjectOld();
|
2001-12-28 15:26:28 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Version 6 script opcodes */
|
|
|
|
int getStackList(int16 *args, uint maxnum);
|
|
|
|
void setStringVars(int i);
|
|
|
|
void unkMiscOp9();
|
2002-02-23 23:23:28 +00:00
|
|
|
|
2002-04-21 21:20:32 +00:00
|
|
|
void o6_setBlastObjectWindow();
|
2002-03-20 17:51:07 +00:00
|
|
|
void o6_pushByte();
|
|
|
|
void o6_pushWord();
|
|
|
|
void o6_pushByteVar();
|
|
|
|
void o6_pushWordVar();
|
|
|
|
void o6_invalid();
|
|
|
|
void o6_byteArrayRead();
|
|
|
|
void o6_wordArrayRead();
|
|
|
|
void o6_byteArrayIndexedRead();
|
|
|
|
void o6_wordArrayIndexedRead();
|
|
|
|
void o6_dup();
|
|
|
|
void o6_zero();
|
|
|
|
void o6_eq();
|
|
|
|
void o6_neq();
|
|
|
|
void o6_gt();
|
|
|
|
void o6_lt();
|
|
|
|
void o6_le();
|
|
|
|
void o6_ge();
|
|
|
|
void o6_add();
|
|
|
|
void o6_sub();
|
|
|
|
void o6_mul();
|
|
|
|
void o6_div();
|
|
|
|
void o6_land();
|
|
|
|
void o6_lor();
|
|
|
|
void o6_kill();
|
|
|
|
void o6_writeByteVar();
|
|
|
|
void o6_writeWordVar();
|
|
|
|
void o6_byteArrayWrite();
|
|
|
|
void o6_wordArrayWrite();
|
|
|
|
void o6_byteArrayIndexedWrite();
|
|
|
|
void o6_wordArrayIndexedWrite();
|
|
|
|
void o6_byteVarInc();
|
|
|
|
void o6_wordVarInc();
|
|
|
|
void o6_byteArrayInc();
|
|
|
|
void o6_wordArrayInc();
|
|
|
|
void o6_byteVarDec();
|
|
|
|
void o6_wordVarDec();
|
|
|
|
void o6_byteArrayDec();
|
|
|
|
void o6_wordArrayDec();
|
|
|
|
void o6_jumpTrue();
|
|
|
|
void o6_jumpFalse();
|
|
|
|
void o6_jump();
|
|
|
|
void o6_startScriptEx();
|
|
|
|
void o6_startScript();
|
|
|
|
void o6_startObject();
|
|
|
|
void o6_setObjectState();
|
|
|
|
void o6_setObjectXY();
|
|
|
|
void o6_stopObjectCode();
|
|
|
|
void o6_endCutscene();
|
|
|
|
void o6_cutScene();
|
|
|
|
void o6_stopMusic();
|
|
|
|
void o6_freezeUnfreeze();
|
|
|
|
void o6_cursorCommand();
|
|
|
|
void o6_breakHere();
|
|
|
|
void o6_ifClassOfIs();
|
|
|
|
void o6_setClass();
|
|
|
|
void o6_getState();
|
|
|
|
void o6_setState();
|
|
|
|
void o6_setOwner();
|
|
|
|
void o6_getOwner();
|
|
|
|
void o6_startSound();
|
|
|
|
void o6_stopSound();
|
|
|
|
void o6_startMusic();
|
|
|
|
void o6_stopObjectScript();
|
|
|
|
void o6_panCameraTo();
|
|
|
|
void o6_actorFollowCamera();
|
|
|
|
void o6_setCameraAt();
|
|
|
|
void o6_loadRoom();
|
|
|
|
void o6_stopScript();
|
|
|
|
void o6_walkActorToObj();
|
|
|
|
void o6_walkActorTo();
|
|
|
|
void o6_putActorInRoom();
|
|
|
|
void o6_putActorAtObject();
|
|
|
|
void o6_faceActor();
|
|
|
|
void o6_animateActor();
|
|
|
|
void o6_doSentence();
|
|
|
|
void o6_pickupObject();
|
|
|
|
void o6_loadRoomWithEgo();
|
|
|
|
void o6_getRandomNumber();
|
|
|
|
void o6_getRandomNumberRange();
|
|
|
|
void o6_getActorMoving();
|
|
|
|
void o6_getScriptRunning();
|
|
|
|
void o6_getActorRoom();
|
|
|
|
void o6_getObjectX();
|
|
|
|
void o6_getObjectY();
|
|
|
|
void o6_getObjectOldDir();
|
|
|
|
void o6_getObjectNewDir();
|
|
|
|
void o6_getActorWalkBox();
|
|
|
|
void o6_getActorCostume();
|
|
|
|
void o6_findInventory();
|
|
|
|
void o6_getInventoryCount();
|
|
|
|
void o6_getVerbFromXY();
|
|
|
|
void o6_beginOverride();
|
|
|
|
void o6_endOverride();
|
|
|
|
void o6_setObjectName();
|
|
|
|
void o6_isSoundRunning();
|
|
|
|
void o6_setBoxFlags();
|
|
|
|
void o6_createBoxMatrix();
|
|
|
|
void o6_resourceRoutines();
|
|
|
|
void o6_roomOps();
|
|
|
|
void o6_actorSet();
|
|
|
|
void o6_verbOps();
|
|
|
|
void o6_getActorFromXY();
|
|
|
|
void o6_findObject();
|
|
|
|
void o6_pseudoRoom();
|
|
|
|
void o6_getActorElevation();
|
|
|
|
void o6_getVerbEntrypoint();
|
|
|
|
void o6_arrayOps();
|
|
|
|
void o6_saveRestoreVerbs();
|
|
|
|
void o6_drawBox();
|
|
|
|
void o6_getActorWidth();
|
|
|
|
void o6_wait();
|
|
|
|
void o6_getActorScaleX();
|
|
|
|
void o6_getActorAnimCounter1();
|
|
|
|
void o6_soundKludge();
|
|
|
|
void o6_isAnyOf();
|
|
|
|
void o6_quitPauseRestart();
|
|
|
|
void o6_isActorInBox();
|
|
|
|
void o6_delay();
|
|
|
|
void o6_delayLonger();
|
|
|
|
void o6_delayVeryLong();
|
|
|
|
void o6_stopSentence();
|
|
|
|
void o6_print_0();
|
|
|
|
void o6_print_1();
|
|
|
|
void o6_print_2();
|
|
|
|
void o6_print_3();
|
|
|
|
void o6_printActor();
|
|
|
|
void o6_printEgo();
|
|
|
|
void o6_talkActor();
|
|
|
|
void o6_talkEgo();
|
|
|
|
void o6_dim();
|
|
|
|
void o6_runVerbCodeQuick();
|
|
|
|
void o6_runScriptQuick();
|
|
|
|
void o6_dim2();
|
|
|
|
void o6_abs();
|
|
|
|
void o6_distObjectObject();
|
|
|
|
void o6_distObjectPt();
|
|
|
|
void o6_distPtPt();
|
|
|
|
void o6_dummy_stacklist();
|
|
|
|
void o6_miscOps();
|
|
|
|
void o6_breakMaybe();
|
|
|
|
void o6_pickOneOf();
|
|
|
|
void o6_pickOneOfDefault();
|
|
|
|
void o6_jumpToScript();
|
|
|
|
void o6_isRoomScriptRunning();
|
|
|
|
void o6_kernelFunction();
|
|
|
|
void o6_getAnimateVariable();
|
|
|
|
void o6_drawBlastObject();
|
2002-03-22 11:15:33 +00:00
|
|
|
void o6_getActorPriority();
|
2002-02-23 23:23:28 +00:00
|
|
|
|
2002-03-20 17:51:07 +00:00
|
|
|
/* Scumm Vars */
|
2002-03-22 10:56:03 +00:00
|
|
|
byte VAR_EGO;
|
2002-02-23 23:23:28 +00:00
|
|
|
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;
|
|
|
|
byte VAR_CURRENTDRIVE;
|
|
|
|
byte VAR_TMR_1;
|
|
|
|
byte VAR_TMR_2;
|
|
|
|
byte VAR_TMR_3;
|
|
|
|
byte VAR_MUSIC_FLAG;
|
|
|
|
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;
|
2002-03-14 16:49:59 +00:00
|
|
|
byte VAR_OPTIONS_KEY;
|
2002-02-23 23:23:28 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
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_DRAWFLAGS;
|
|
|
|
byte VAR_MI1_TIMER;
|
|
|
|
byte VAR_V5_OBJECT_LO;
|
|
|
|
byte VAR_V5_OBJECT_HI;
|
|
|
|
byte VAR_V5_TALK_STRING_Y;
|
|
|
|
byte VAR_V5_CHARFLAG;
|
|
|
|
|
|
|
|
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;
|
2002-04-24 04:26:09 +00:00
|
|
|
|
2002-04-23 23:58:31 +00:00
|
|
|
byte VAR_CAMERA_DEST_X;
|
2002-04-24 04:26:09 +00:00
|
|
|
|
2002-04-23 23:58:31 +00:00
|
|
|
byte VAR_CAMERA_DEST_Y;
|
2002-04-24 04:26:09 +00:00
|
|
|
|
2002-04-23 23:58:31 +00:00
|
|
|
byte VAR_CAMERA_FOLLOWED_ACTOR;
|
2002-02-23 23:23:28 +00:00
|
|
|
|
|
|
|
byte VAR_LEFTBTN_DOWN;
|
|
|
|
byte VAR_RIGHTBTN_DOWN;
|
|
|
|
byte VAR_LEFTBTN_HOLD;
|
|
|
|
byte VAR_RIGHTBTN_HOLD;
|
|
|
|
|
|
|
|
byte VAR_UNK_SCRIPT;
|
|
|
|
byte VAR_UNK_SCRIPT_2;
|
2002-03-18 22:48:57 +00:00
|
|
|
|
2002-02-23 23:23:28 +00:00
|
|
|
byte VAR_DEFAULT_TALK_DELAY;
|
|
|
|
byte VAR_CHARSET_MASK;
|
2002-03-23 20:34:47 +00:00
|
|
|
|
2002-04-21 19:38:00 +00:00
|
|
|
byte VAR_CUSTOMSCALETABLE;
|
|
|
|
byte VAR_VIDEONAME;
|
|
|
|
|
2002-03-23 20:34:47 +00:00
|
|
|
void launch();
|
2002-04-12 10:34:46 +00:00
|
|
|
|
2002-04-12 21:26:59 +00:00
|
|
|
static Scumm *createFromDetector(GameDetector *detector, OSystem *syst);
|
2002-04-12 10:34:46 +00:00
|
|
|
void go();
|
|
|
|
|
|
|
|
void setupGUIColors();
|
|
|
|
byte getDefaultGUIColor(int color);
|
2002-04-12 21:26:59 +00:00
|
|
|
void waitForTimer(int msec_delay);
|
|
|
|
|
|
|
|
void updateCursor();
|
|
|
|
void animateCursor();
|
|
|
|
void updatePalette();
|
2001-10-09 14:30:12 +00:00
|
|
|
};
|
|
|
|
|
2002-03-25 01:40:51 +00:00
|
|
|
class Scumm_v3 : public Scumm
|
2002-03-23 20:34:47 +00:00
|
|
|
{
|
|
|
|
public:
|
2002-03-25 01:40:51 +00:00
|
|
|
void readIndexFile();
|
2002-03-25 02:09:05 +00:00
|
|
|
virtual void loadCharset(int no);
|
2002-03-23 20:34:47 +00:00
|
|
|
};
|
|
|
|
|
2002-03-25 01:40:51 +00:00
|
|
|
class Scumm_v4 : public Scumm_v3
|
|
|
|
{
|
2002-03-25 02:09:05 +00:00
|
|
|
void loadCharset(int no);
|
2002-03-25 01:40:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Scumm_v5 : public Scumm
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
class Scumm_v6 : public Scumm
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
class Scumm_v7 : public Scumm
|
2002-03-23 20:34:47 +00:00
|
|
|
{
|
|
|
|
};
|
2002-03-20 17:51:07 +00:00
|
|
|
|
2001-10-23 19:51:50 +00:00
|
|
|
struct ScummDebugger {
|
|
|
|
Scumm *_s;
|
|
|
|
byte _command;
|
|
|
|
char *_parameters;
|
|
|
|
|
|
|
|
bool _welcome;
|
|
|
|
|
|
|
|
int _go_amount;
|
|
|
|
|
|
|
|
char _cmd_buffer[256];
|
|
|
|
|
|
|
|
void on_frame();
|
|
|
|
bool do_command();
|
|
|
|
void enter();
|
|
|
|
int get_command();
|
|
|
|
void attach(Scumm *s);
|
|
|
|
void detach();
|
2001-10-26 17:34:50 +00:00
|
|
|
|
|
|
|
void printActors(int act);
|
|
|
|
void printScripts();
|
2001-10-23 19:51:50 +00:00
|
|
|
};
|
|
|
|
|
2001-11-05 19:21:49 +00:00
|
|
|
struct SaveLoadEntry {
|
2002-04-01 06:53:59 +00:00
|
|
|
uint32 offs;
|
2001-11-05 19:21:49 +00:00
|
|
|
uint8 type;
|
|
|
|
uint8 size;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef int SerializerSaveReference(void *me, byte type, void *ref);
|
|
|
|
typedef void *SerializerLoadReference(void *me, byte type, int ref);
|
|
|
|
|
|
|
|
|
2002-02-02 23:27:06 +00:00
|
|
|
struct SerializerStream {
|
|
|
|
#ifdef NONSTANDARD_SAVE
|
|
|
|
void *context;
|
|
|
|
|
|
|
|
bool fopen(const char *filename, const char *mode);
|
|
|
|
void fclose();
|
|
|
|
int fread(void *buf, int size, int cnt);
|
|
|
|
int fwrite(void *buf, int size, int cnt);
|
|
|
|
#else
|
|
|
|
FILE *out;
|
|
|
|
|
|
|
|
FILE *fopen(const char *filename, const char *mode) {
|
|
|
|
return out = ::fopen(filename, mode);
|
|
|
|
}
|
|
|
|
void fclose() {
|
|
|
|
::fclose(out);
|
|
|
|
}
|
|
|
|
int fread(void *buf, int size, int cnt) {
|
|
|
|
return ::fread(buf, size, cnt, out);
|
|
|
|
}
|
|
|
|
int fwrite(void *buf, int size, int cnt) {
|
|
|
|
return ::fwrite(buf, size, cnt, out);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2001-11-05 19:21:49 +00:00
|
|
|
struct Serializer {
|
2002-02-02 23:27:06 +00:00
|
|
|
SerializerStream _saveLoadStream;
|
2001-11-05 19:21:49 +00:00
|
|
|
|
|
|
|
union {
|
|
|
|
SerializerSaveReference *_save_ref;
|
|
|
|
SerializerLoadReference *_load_ref;
|
2001-11-14 18:40:39 +00:00
|
|
|
void *_saveload_ref;
|
2001-11-05 19:21:49 +00:00
|
|
|
};
|
|
|
|
void *_ref_me;
|
|
|
|
|
|
|
|
bool _saveOrLoad;
|
|
|
|
|
|
|
|
void saveLoadBytes(void *b, int len);
|
|
|
|
void saveLoadArrayOf(void *b, int len, int datasize, byte filetype);
|
|
|
|
void saveLoadEntries(void *d, const SaveLoadEntry *sle);
|
|
|
|
void saveLoadArrayOf(void *b, int num, int datasize, const SaveLoadEntry *sle);
|
|
|
|
|
|
|
|
void saveUint32(uint32 d);
|
|
|
|
void saveWord(uint16 d);
|
|
|
|
void saveByte(byte b);
|
|
|
|
|
|
|
|
byte loadByte();
|
|
|
|
uint16 loadWord();
|
|
|
|
uint32 loadUint32();
|
|
|
|
|
|
|
|
bool isSaving() { return _saveOrLoad; }
|
2001-11-14 18:40:39 +00:00
|
|
|
|
2002-03-17 12:10:41 +00:00
|
|
|
bool checkEOFLoadStream();
|
2002-03-14 22:45:22 +00:00
|
|
|
|
2001-11-05 19:21:49 +00:00
|
|
|
};
|
|
|
|
|
2002-04-14 18:13:08 +00:00
|
|
|
|
2001-11-26 19:57:57 +00:00
|
|
|
extern const uint32 IMxx_tags[];
|
2001-11-27 17:56:04 +00:00
|
|
|
extern const byte default_scale_table[768];
|
2002-04-26 14:13:39 +00:00
|
|
|
extern uint16 _debugLevel;
|
2001-10-23 19:51:50 +00:00
|
|
|
|
2001-10-09 14:30:12 +00:00
|
|
|
void outputdisplay2(Scumm *s, int disp);
|
|
|
|
extern const byte revBitMask[8];
|
2002-04-12 21:26:59 +00:00
|
|
|
//void blitToScreen(Scumm *s, byte *src, int x, int y, int w, int h);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2001-11-07 21:44:09 +00:00
|
|
|
#if defined(__GNUC__)
|
2001-11-07 18:10:52 +00:00
|
|
|
void CDECL error(const char *s, ...) NORETURN;
|
2001-11-07 21:44:09 +00:00
|
|
|
#else
|
|
|
|
void CDECL NORETURN error(const char *s, ...);
|
|
|
|
#endif
|
|
|
|
|
2001-10-09 14:30:12 +00:00
|
|
|
void CDECL warning(const char *s, ...);
|
|
|
|
void CDECL debug(int level, const char *s, ...);
|
|
|
|
void checkHeap();
|
2002-04-12 21:26:59 +00:00
|
|
|
//void initGraphics(Scumm *s, bool fullScreen, unsigned int scaleFactor = 2);
|
|
|
|
//void updateScreen(Scumm *s);
|
|
|
|
//void drawMouse(int x, int y, int color, byte *mask, bool visible);
|
|
|
|
//void drawMouse(int x, int y, int w, int h, byte *buf, bool visible);
|
2001-10-26 17:34:50 +00:00
|
|
|
void blit(byte *dst, byte *src, int w, int h);
|
2001-11-26 19:57:57 +00:00
|
|
|
byte *findResource(uint32 tag, byte *searchin, int index);
|
2002-02-12 21:28:07 +00:00
|
|
|
byte *findResourceSmall(uint32 tag, byte *searchin, int index);
|
2001-11-26 19:57:57 +00:00
|
|
|
byte *findResource(uint32 tag, byte *searchin);
|
2002-02-12 18:20:37 +00:00
|
|
|
byte *findResourceSmall(uint32 tag, byte *searchin);
|
2002-04-12 21:26:59 +00:00
|
|
|
//void playSfxSound(void *sound, uint32 size, uint rate);
|
|
|
|
//bool isSfxFinished();
|
|
|
|
//void waitForTimer(Scumm *s, int msec_delay);
|
|
|
|
//void setShakePos(Scumm *s, int shake_pos);
|
2002-03-17 13:00:11 +00:00
|
|
|
void setWindowName(Scumm *s);
|
2002-02-12 18:20:37 +00:00
|
|
|
uint16 newTag2Old(uint32 oldTag);
|
2002-04-17 20:34:10 +00:00
|
|
|
|