2013-05-20 02:45:54 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2014-02-18 01:43:50 +00:00
|
|
|
*
|
2013-05-20 02:45:54 +00:00
|
|
|
* 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.
|
2014-02-18 01:43:50 +00:00
|
|
|
*
|
2013-05-20 02:45:54 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef VOYEUR_FILES_H
|
|
|
|
#define VOYEUR_FILES_H
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/file.h"
|
2013-05-25 19:36:57 +00:00
|
|
|
#include "common/rect.h"
|
2013-05-20 02:45:54 +00:00
|
|
|
#include "common/str.h"
|
2013-05-30 03:21:07 +00:00
|
|
|
#include "voyeur/graphics.h"
|
2013-05-20 02:45:54 +00:00
|
|
|
|
|
|
|
namespace Voyeur {
|
|
|
|
|
|
|
|
class VoyeurEngine;
|
2013-05-25 13:58:03 +00:00
|
|
|
class BoltFile;
|
2013-05-20 02:45:54 +00:00
|
|
|
class BoltGroup;
|
|
|
|
class BoltEntry;
|
2013-12-25 05:40:46 +00:00
|
|
|
class RectResource;
|
2013-05-25 19:36:57 +00:00
|
|
|
class PictureResource;
|
2013-05-26 03:30:48 +00:00
|
|
|
class ViewPortResource;
|
2013-05-27 02:18:54 +00:00
|
|
|
class ViewPortListResource;
|
2013-05-28 03:01:15 +00:00
|
|
|
class FontResource;
|
|
|
|
class CMapResource;
|
2013-12-29 23:25:46 +00:00
|
|
|
class VInitCycleResource;
|
2013-12-08 15:40:26 +00:00
|
|
|
class PtrResource;
|
|
|
|
class ControlResource;
|
2014-02-05 03:23:15 +00:00
|
|
|
class StateResource;
|
2013-12-08 21:51:50 +00:00
|
|
|
class ThreadResource;
|
2013-05-26 03:30:48 +00:00
|
|
|
|
2013-05-22 03:15:43 +00:00
|
|
|
#define DECOMPRESS_SIZE 0x7000
|
2013-05-20 02:45:54 +00:00
|
|
|
|
2013-05-26 03:30:48 +00:00
|
|
|
class ResolveEntry {
|
|
|
|
public:
|
|
|
|
uint32 _id;
|
|
|
|
byte **_p;
|
|
|
|
|
|
|
|
ResolveEntry(uint32 id, byte **p) { _id = id; _p = p; }
|
|
|
|
};
|
|
|
|
|
2013-05-25 19:36:57 +00:00
|
|
|
class BoltFilesState {
|
|
|
|
public:
|
2013-05-26 00:51:53 +00:00
|
|
|
VoyeurEngine *_vm;
|
2013-05-25 19:36:57 +00:00
|
|
|
BoltFile *_curLibPtr;
|
|
|
|
BoltGroup *_curGroupPtr;
|
|
|
|
BoltEntry *_curMemberPtr;
|
|
|
|
int _bufferEnd;
|
|
|
|
int _bufferBegin;
|
|
|
|
int _bytesLeft;
|
|
|
|
int _bufSize;
|
|
|
|
byte *_bufStart;
|
|
|
|
byte *_bufPos;
|
|
|
|
byte _decompressBuf[DECOMPRESS_SIZE];
|
|
|
|
int _historyIndex;
|
|
|
|
byte _historyBuffer[0x200];
|
|
|
|
int _runLength;
|
2014-02-18 21:43:48 +00:00
|
|
|
bool _decompState;
|
2013-05-25 19:36:57 +00:00
|
|
|
int _runType;
|
|
|
|
int _runValue;
|
|
|
|
int _runOffset;
|
2013-05-26 00:51:53 +00:00
|
|
|
Common::File *_curFd;
|
2013-05-26 03:30:48 +00:00
|
|
|
Common::Array<ResolveEntry> _resolves;
|
2013-05-26 00:51:53 +00:00
|
|
|
|
|
|
|
byte *_boltPageFrame;
|
2013-05-25 19:36:57 +00:00
|
|
|
public:
|
2014-03-15 09:43:06 +00:00
|
|
|
BoltFilesState(VoyeurEngine *vm);
|
2013-05-25 19:36:57 +00:00
|
|
|
|
|
|
|
byte *decompress(byte *buf, int size, int mode);
|
|
|
|
void nextBlock();
|
|
|
|
};
|
|
|
|
|
2013-05-20 02:45:54 +00:00
|
|
|
class BoltFile {
|
|
|
|
private:
|
|
|
|
Common::Array<BoltGroup> _groups;
|
2013-12-08 01:44:28 +00:00
|
|
|
protected:
|
|
|
|
BoltFilesState &_state;
|
2013-05-22 02:07:17 +00:00
|
|
|
|
2013-12-08 01:44:28 +00:00
|
|
|
virtual void initResource(int resType) = 0;
|
2013-05-25 13:58:03 +00:00
|
|
|
void initDefault();
|
2013-05-20 02:45:54 +00:00
|
|
|
private:
|
2013-05-26 03:30:48 +00:00
|
|
|
void resolveAll();
|
2013-05-21 01:18:40 +00:00
|
|
|
byte *getBoltMember(uint32 id);
|
2013-05-20 02:45:54 +00:00
|
|
|
|
2013-12-15 22:51:47 +00:00
|
|
|
public:
|
|
|
|
Common::File _file;
|
2014-02-18 23:14:47 +00:00
|
|
|
|
2013-12-08 01:44:28 +00:00
|
|
|
BoltFile(const Common::String &filename, BoltFilesState &state);
|
2013-12-14 16:07:01 +00:00
|
|
|
virtual ~BoltFile();
|
2013-05-21 01:18:40 +00:00
|
|
|
|
2014-03-03 18:00:14 +00:00
|
|
|
BoltGroup *getBoltGroup(uint16 id);
|
2014-03-03 18:05:55 +00:00
|
|
|
void freeBoltGroup(uint16 id);
|
2013-12-08 21:51:50 +00:00
|
|
|
void freeBoltMember(uint32 id);
|
2013-05-21 01:18:40 +00:00
|
|
|
byte *memberAddr(uint32 id);
|
2013-05-26 03:30:48 +00:00
|
|
|
byte *memberAddrOffset(uint32 id);
|
|
|
|
void resolveIt(uint32 id, byte **p);
|
2013-05-30 03:21:07 +00:00
|
|
|
void resolveFunction(uint32 id, GraphicMethodPtr *fn);
|
2013-05-29 03:57:16 +00:00
|
|
|
|
2014-05-28 21:30:29 +00:00
|
|
|
BoltEntry &boltEntry(uint16 id);
|
2013-06-15 15:39:28 +00:00
|
|
|
BoltEntry &getBoltEntryFromLong(uint32 id);
|
2013-06-13 02:13:52 +00:00
|
|
|
PictureResource *getPictureResource(uint32 id);
|
2013-06-06 01:28:51 +00:00
|
|
|
CMapResource *getCMapResource(uint32 id);
|
2013-05-20 02:45:54 +00:00
|
|
|
};
|
|
|
|
|
2013-12-08 01:44:28 +00:00
|
|
|
class BVoyBoltFile: public BoltFile {
|
|
|
|
private:
|
|
|
|
// initType method table
|
2013-12-25 05:40:46 +00:00
|
|
|
void sInitRect();
|
2013-12-08 01:44:28 +00:00
|
|
|
void sInitPic();
|
|
|
|
void vInitCMap();
|
|
|
|
void vInitCycl();
|
|
|
|
void initViewPort();
|
|
|
|
void initViewPortList();
|
|
|
|
void initFontInfo();
|
|
|
|
void initFont();
|
|
|
|
void initSoundMap();
|
|
|
|
protected:
|
|
|
|
virtual void initResource(int resType);
|
|
|
|
public:
|
|
|
|
BVoyBoltFile(BoltFilesState &state);
|
|
|
|
};
|
|
|
|
|
|
|
|
class StampBoltFile: public BoltFile {
|
2013-12-08 15:40:26 +00:00
|
|
|
private:
|
2013-12-08 21:51:50 +00:00
|
|
|
void initThread();
|
2014-02-05 03:23:15 +00:00
|
|
|
void initState();
|
2013-12-08 15:40:26 +00:00
|
|
|
void initPtr();
|
|
|
|
void initControl();
|
2013-12-08 01:44:28 +00:00
|
|
|
protected:
|
|
|
|
virtual void initResource(int resType);
|
|
|
|
public:
|
|
|
|
StampBoltFile(BoltFilesState &state);
|
|
|
|
};
|
|
|
|
|
2013-05-20 02:45:54 +00:00
|
|
|
class BoltGroup {
|
|
|
|
private:
|
|
|
|
Common::SeekableReadStream *_file;
|
|
|
|
public:
|
2014-02-18 23:14:47 +00:00
|
|
|
bool _loaded;
|
2013-05-22 02:07:17 +00:00
|
|
|
bool _processed;
|
2013-05-20 02:45:54 +00:00
|
|
|
int _count;
|
|
|
|
int _fileOffset;
|
|
|
|
Common::Array<BoltEntry> _entries;
|
|
|
|
public:
|
2014-05-28 21:30:29 +00:00
|
|
|
BoltGroup(Common::SeekableReadStream *f);
|
2013-06-08 19:49:44 +00:00
|
|
|
virtual ~BoltGroup();
|
2013-05-20 02:45:54 +00:00
|
|
|
|
2014-02-01 02:58:03 +00:00
|
|
|
void load(uint16 groupId);
|
2013-06-08 19:49:44 +00:00
|
|
|
void unload();
|
2013-05-20 02:45:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class BoltEntry {
|
|
|
|
private:
|
|
|
|
Common::SeekableReadStream *_file;
|
|
|
|
public:
|
2014-02-01 02:58:03 +00:00
|
|
|
uint16 _id;
|
2013-05-21 01:18:40 +00:00
|
|
|
byte _mode;
|
2013-05-25 13:58:03 +00:00
|
|
|
byte _initMethod;
|
2013-05-20 02:45:54 +00:00
|
|
|
int _fileOffset;
|
2013-05-21 01:18:40 +00:00
|
|
|
int _size;
|
|
|
|
byte *_data;
|
2013-05-25 19:36:57 +00:00
|
|
|
|
2013-12-08 15:40:26 +00:00
|
|
|
// bvoy.blt resource types
|
2013-12-25 05:40:46 +00:00
|
|
|
RectResource *_rectResource;
|
2013-05-25 19:36:57 +00:00
|
|
|
PictureResource *_picResource;
|
2013-05-26 03:30:48 +00:00
|
|
|
ViewPortResource *_viewPortResource;
|
2013-05-27 02:18:54 +00:00
|
|
|
ViewPortListResource *_viewPortListResource;
|
2013-05-28 03:01:15 +00:00
|
|
|
FontResource *_fontResource;
|
2013-06-15 15:39:28 +00:00
|
|
|
FontInfoResource *_fontInfoResource;
|
2013-05-28 03:01:15 +00:00
|
|
|
CMapResource *_cMapResource;
|
2013-12-29 23:25:46 +00:00
|
|
|
VInitCycleResource *_vInitCycleResource;
|
2013-12-08 15:40:26 +00:00
|
|
|
|
|
|
|
// stampblt.blt resource types
|
|
|
|
PtrResource *_ptrResource;
|
|
|
|
ControlResource *_controlResource;
|
2014-02-05 03:23:15 +00:00
|
|
|
StateResource *_stateResource;
|
2013-12-08 21:51:50 +00:00
|
|
|
ThreadResource *_threadResource;
|
2013-05-20 02:45:54 +00:00
|
|
|
public:
|
2014-02-01 02:58:03 +00:00
|
|
|
BoltEntry(Common::SeekableReadStream *f, uint16 id);
|
2013-05-21 01:18:40 +00:00
|
|
|
virtual ~BoltEntry();
|
2013-05-20 02:45:54 +00:00
|
|
|
|
|
|
|
void load();
|
2013-05-29 02:39:32 +00:00
|
|
|
bool hasResource() const;
|
2013-05-20 02:45:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class FilesManager {
|
|
|
|
public:
|
2014-03-15 09:43:06 +00:00
|
|
|
BoltFilesState *_boltFilesState;
|
2013-05-20 02:45:54 +00:00
|
|
|
BoltFile *_curLibPtr;
|
|
|
|
public:
|
2014-02-27 07:09:57 +00:00
|
|
|
FilesManager(VoyeurEngine *vm);
|
2014-03-15 09:43:06 +00:00
|
|
|
~FilesManager();
|
2013-05-20 02:45:54 +00:00
|
|
|
|
2013-05-21 01:18:40 +00:00
|
|
|
bool openBoltLib(const Common::String &filename, BoltFile *&boltFile);
|
2014-03-03 22:02:44 +00:00
|
|
|
byte *fload(const Common::String &filename, int *size);
|
2013-05-20 02:45:54 +00:00
|
|
|
};
|
|
|
|
|
2014-02-01 02:58:03 +00:00
|
|
|
class RectEntry: public Common::Rect {
|
|
|
|
public:
|
|
|
|
int _arrIndex;
|
|
|
|
int _count;
|
|
|
|
|
|
|
|
RectEntry(int x1, int y1, int x2, int y2, int arrIndex, int count);
|
|
|
|
};
|
|
|
|
|
2013-12-25 05:40:46 +00:00
|
|
|
class RectResource: public Common::Rect {
|
|
|
|
public:
|
2014-02-01 02:58:03 +00:00
|
|
|
Common::Array<RectEntry> _entries;
|
2013-12-25 06:07:05 +00:00
|
|
|
public:
|
2014-02-01 02:58:03 +00:00
|
|
|
RectResource(const byte *src, int size, bool isExtendedRects);
|
2013-12-25 05:40:46 +00:00
|
|
|
RectResource(int xp, int yp, int width, int height);
|
|
|
|
virtual ~RectResource() {}
|
|
|
|
};
|
|
|
|
|
2014-03-15 09:43:06 +00:00
|
|
|
/* bvoy.blt resource types */
|
|
|
|
|
|
|
|
enum PictureFlag {
|
2014-05-28 21:30:29 +00:00
|
|
|
PICFLAG_2 = 2, PICFLAG_PIC_OFFSET = 8, PICFLAG_CLEAR_SCREEN = 0x10,
|
2014-03-15 09:43:06 +00:00
|
|
|
PICFLAG_20 = 0x20, PICFLAG_HFLIP = 0x40, PICFLAG_VFLIP = 0x80, PICFLAG_100 = 0x100,
|
2014-05-28 21:30:29 +00:00
|
|
|
PICFLAG_CLEAR_SCREEN00 = 0x1000
|
2014-03-15 09:43:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum DisplayFlag {
|
2014-05-28 21:30:29 +00:00
|
|
|
DISPFLAG_1 = 1, DISPFLAG_2 = 2, DISPFLAG_4 = 4, DISPFLAG_8 = 8,
|
2013-06-18 02:41:58 +00:00
|
|
|
DISPFLAG_10 = 0x10, DISPFLAG_20 = 0x20, DISPFLAG_40 = 0x40, DISPFLAG_80 = 0x80,
|
2014-05-28 21:30:29 +00:00
|
|
|
DISPFLAG_100 = 0x100, DISPFLAG_200 = 0x200, DISPFLAG_400 = 0x400,
|
2013-06-18 02:41:58 +00:00
|
|
|
DISPFLAG_800 = 0x800, DISPFLAG_1000 = 0x1000, DISPFLAG_2000 = 0x2000,
|
2014-03-14 07:08:31 +00:00
|
|
|
DISPFLAG_4000 = 0x4000, DISPFLAG_VIEWPORT = 0x8000, DISPFLAG_CURSOR = 0x10000,
|
|
|
|
DISPFLAG_NONE = 0};
|
2013-06-18 02:41:58 +00:00
|
|
|
|
2013-06-01 01:03:16 +00:00
|
|
|
class DisplayResource {
|
2014-01-18 13:09:38 +00:00
|
|
|
private:
|
|
|
|
VoyeurEngine *_vm;
|
2013-05-30 03:21:07 +00:00
|
|
|
public:
|
2013-06-21 04:18:19 +00:00
|
|
|
uint32 _flags;
|
2014-01-18 13:09:38 +00:00
|
|
|
public:
|
|
|
|
DisplayResource();
|
|
|
|
DisplayResource(VoyeurEngine *vm);
|
|
|
|
|
2014-05-28 21:30:29 +00:00
|
|
|
/**
|
2014-01-18 15:16:27 +00:00
|
|
|
* Fill a box of the given size at the current _drawPtr location
|
|
|
|
*/
|
2014-01-18 13:09:38 +00:00
|
|
|
void sFillBox(int width, int height);
|
2014-01-18 15:16:27 +00:00
|
|
|
|
2014-01-18 19:38:33 +00:00
|
|
|
/**
|
|
|
|
* Draw text at the current pen position
|
|
|
|
*/
|
|
|
|
int drawText(const Common::String &msg);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the width of a given text in the current font
|
|
|
|
*/
|
|
|
|
int textWidth(const Common::String &msg);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clip the given rectangle by the currently viewable area
|
|
|
|
*/
|
2014-01-18 15:16:27 +00:00
|
|
|
bool clipRect(Common::Rect &rect);
|
2013-06-01 01:03:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class PictureResource: public DisplayResource {
|
2014-01-15 04:19:24 +00:00
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* Flip the image data horizontally
|
|
|
|
*/
|
|
|
|
void flipHorizontal(const byte *data);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Flip the image data vertically
|
|
|
|
*/
|
|
|
|
void flipVertical(const byte *data);
|
2013-06-01 01:03:16 +00:00
|
|
|
public:
|
2013-05-25 19:36:57 +00:00
|
|
|
byte _select;
|
|
|
|
byte _pick;
|
|
|
|
byte _onOff;
|
2013-05-30 03:21:07 +00:00
|
|
|
Common::Rect _bounds;
|
2013-05-25 19:36:57 +00:00
|
|
|
uint32 _maskData;
|
2013-05-26 00:51:53 +00:00
|
|
|
uint _planeSize;
|
2014-03-02 02:11:08 +00:00
|
|
|
byte _keyColor;
|
2013-05-25 19:36:57 +00:00
|
|
|
|
2014-01-16 14:25:31 +00:00
|
|
|
/**
|
|
|
|
* Image data for the picture
|
|
|
|
*/
|
2013-05-25 19:36:57 +00:00
|
|
|
byte *_imgData;
|
2014-01-16 14:25:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Flag to indicate whether to free the image data
|
|
|
|
*/
|
|
|
|
DisposeAfterUse::Flag _freeImgData;
|
2013-05-25 19:36:57 +00:00
|
|
|
public:
|
|
|
|
PictureResource(BoltFilesState &state, const byte *src);
|
2014-05-28 21:30:29 +00:00
|
|
|
PictureResource(int flags, int select, int pick, int onOff,
|
2013-06-16 13:03:03 +00:00
|
|
|
const Common::Rect &bounds, int maskData, byte *imgData, int planeSize);
|
2013-12-31 20:17:29 +00:00
|
|
|
PictureResource(Graphics::Surface *surface);
|
2013-06-08 21:51:41 +00:00
|
|
|
PictureResource();
|
2013-05-25 19:36:57 +00:00
|
|
|
virtual ~PictureResource();
|
|
|
|
};
|
|
|
|
|
2013-05-29 02:39:32 +00:00
|
|
|
typedef void (ViewPortResource::*ViewPortMethodPtr)();
|
|
|
|
|
2013-06-01 01:03:16 +00:00
|
|
|
class ViewPortResource: public DisplayResource {
|
2013-05-29 02:39:32 +00:00
|
|
|
private:
|
|
|
|
BoltFilesState &_state;
|
|
|
|
private:
|
2014-02-21 18:35:37 +00:00
|
|
|
void setupViewPort(PictureResource *page, Common::Rect *clippingRect, ViewPortSetupPtr setupFn,
|
2013-05-30 03:21:07 +00:00
|
|
|
ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn);
|
2013-05-26 03:30:48 +00:00
|
|
|
public:
|
2013-06-17 01:20:42 +00:00
|
|
|
ViewPortResource *_parent;
|
2013-06-01 01:31:33 +00:00
|
|
|
int _pageCount;
|
|
|
|
int _pageIndex;
|
|
|
|
int _lastPage;
|
2013-05-30 03:21:07 +00:00
|
|
|
Common::Rect _bounds;
|
2013-06-01 01:31:33 +00:00
|
|
|
PictureResource *_currentPic;
|
2013-05-30 03:21:07 +00:00
|
|
|
PictureResource *_activePage;
|
2013-06-01 01:31:33 +00:00
|
|
|
PictureResource *_pages[2];
|
2013-06-01 17:01:09 +00:00
|
|
|
|
|
|
|
// Rect lists and counts. Note that _rectListCount values of '-1' seem to have
|
2014-05-28 21:30:29 +00:00
|
|
|
// special significance, which is why I'm not making them redundant in favor
|
2013-06-01 17:01:09 +00:00
|
|
|
// of the arrays' .size() method
|
2013-06-01 16:35:50 +00:00
|
|
|
Common::Array<Common::Rect> *_rectListPtr[3];
|
|
|
|
int _rectListCount[3];
|
2013-06-01 17:01:09 +00:00
|
|
|
|
2013-05-30 03:21:07 +00:00
|
|
|
Common::Rect _clipRect;
|
|
|
|
GraphicMethodPtr _fn1;
|
|
|
|
ViewPortSetupPtr _setupFn;
|
|
|
|
ViewPortAddPtr _addFn;
|
|
|
|
ViewPortRestorePtr _restoreFn;
|
2013-06-15 02:01:59 +00:00
|
|
|
Common::Rect _fontRect;
|
2013-05-26 03:30:48 +00:00
|
|
|
public:
|
|
|
|
ViewPortResource(BoltFilesState &state, const byte *src);
|
2013-06-01 16:35:50 +00:00
|
|
|
virtual ~ViewPortResource();
|
2013-05-29 02:39:32 +00:00
|
|
|
|
|
|
|
void setupViewPort();
|
2014-02-21 18:35:37 +00:00
|
|
|
void setupViewPort(PictureResource *pic, Common::Rect *clippingRect = NULL);
|
2013-06-15 02:01:59 +00:00
|
|
|
void addSaveRect(int pageIndex, const Common::Rect &r);
|
2014-03-03 22:02:44 +00:00
|
|
|
void fillPic(byte onOff);
|
2013-12-19 03:01:16 +00:00
|
|
|
void drawIfaceTime();
|
2014-02-02 03:22:34 +00:00
|
|
|
void drawPicPerm(PictureResource *pic, const Common::Point &pt);
|
2013-05-26 03:30:48 +00:00
|
|
|
};
|
|
|
|
|
2013-06-08 02:07:57 +00:00
|
|
|
class ViewPortPalEntry {
|
|
|
|
public:
|
|
|
|
uint16 _rEntry, _gEntry, _bEntry;
|
2013-06-08 14:31:37 +00:00
|
|
|
uint16 _rChange, _gChange, _bChange;
|
|
|
|
uint16 _palIndex;
|
2013-06-08 02:07:57 +00:00
|
|
|
public:
|
|
|
|
ViewPortPalEntry(const byte *src);
|
|
|
|
};
|
|
|
|
|
2013-05-27 02:18:54 +00:00
|
|
|
class ViewPortListResource {
|
|
|
|
public:
|
2013-06-08 02:07:57 +00:00
|
|
|
Common::Array<ViewPortPalEntry> _palette;
|
2013-05-29 02:39:32 +00:00
|
|
|
Common::Array<ViewPortResource *> _entries;
|
2013-06-11 01:46:19 +00:00
|
|
|
int _palIndex;
|
2013-05-27 02:18:54 +00:00
|
|
|
|
|
|
|
ViewPortListResource(BoltFilesState &state, const byte *src);
|
|
|
|
virtual ~ViewPortListResource() {}
|
|
|
|
};
|
|
|
|
|
2013-05-28 03:01:15 +00:00
|
|
|
class FontResource {
|
|
|
|
public:
|
2013-06-15 02:01:59 +00:00
|
|
|
int _minChar, _maxChar;
|
2014-02-13 07:14:01 +00:00
|
|
|
int _fontDepth;
|
2013-06-15 02:01:59 +00:00
|
|
|
int _padding;
|
|
|
|
int _fontHeight;
|
2013-06-19 04:16:51 +00:00
|
|
|
int _topPadding;
|
2013-06-15 02:01:59 +00:00
|
|
|
int *_charWidth;
|
2013-12-04 03:17:04 +00:00
|
|
|
byte *_charOffsets;
|
|
|
|
byte *_charImages;
|
2013-06-15 02:01:59 +00:00
|
|
|
|
|
|
|
FontResource(BoltFilesState &state, byte *src);
|
|
|
|
virtual ~FontResource();
|
2013-05-28 03:01:15 +00:00
|
|
|
};
|
|
|
|
|
2014-02-19 20:43:22 +00:00
|
|
|
enum FontJustify { ALIGN_LEFT = 0, ALIGN_CENTER = 1, ALIGN_RIGHT = 2 };
|
2013-06-15 15:39:28 +00:00
|
|
|
|
|
|
|
class FontInfoResource {
|
|
|
|
public:
|
|
|
|
FontResource *_curFont;
|
|
|
|
byte _picFlags;
|
|
|
|
byte _picSelect;
|
|
|
|
byte _picPick;
|
|
|
|
byte _picOnOff;
|
|
|
|
byte _fontFlags;
|
|
|
|
FontJustify _justify;
|
|
|
|
int _fontSaveBack;
|
|
|
|
Common::Point _pos;
|
|
|
|
int _justifyWidth;
|
|
|
|
int _justifyHeight;
|
|
|
|
Common::Point _shadow;
|
|
|
|
int _foreColor;
|
|
|
|
int _backColor;
|
|
|
|
int _shadowColor;
|
|
|
|
public:
|
|
|
|
FontInfoResource(BoltFilesState &state, const byte *src);
|
|
|
|
FontInfoResource();
|
2014-05-28 21:30:29 +00:00
|
|
|
FontInfoResource(byte picFlags, byte picSelect, byte picPick, byte picOnOff, byte fontFlags,
|
|
|
|
FontJustify justify, int fontSaveBack, const Common::Point &pos, int justifyWidth,
|
|
|
|
int justifyHeight, const Common::Point &shadow, int foreColor, int backColor,
|
2013-06-15 15:39:28 +00:00
|
|
|
int shadowColor);
|
|
|
|
};
|
|
|
|
|
2013-05-28 03:01:15 +00:00
|
|
|
class CMapResource {
|
2013-06-06 01:28:51 +00:00
|
|
|
private:
|
|
|
|
VoyeurEngine *_vm;
|
2013-05-28 03:01:15 +00:00
|
|
|
public:
|
2013-06-06 01:28:51 +00:00
|
|
|
int _steps;
|
|
|
|
int _fadeStatus;
|
2013-05-28 03:01:15 +00:00
|
|
|
int _start;
|
|
|
|
int _end;
|
2013-06-06 01:28:51 +00:00
|
|
|
byte *_entries;
|
2013-05-28 03:01:15 +00:00
|
|
|
public:
|
|
|
|
CMapResource(BoltFilesState &state, const byte *src);
|
|
|
|
virtual ~CMapResource();
|
2013-06-06 01:28:51 +00:00
|
|
|
|
|
|
|
void startFade();
|
2013-05-28 03:01:15 +00:00
|
|
|
};
|
|
|
|
|
2013-12-29 23:25:46 +00:00
|
|
|
class VInitCycleResource {
|
2013-12-30 05:52:50 +00:00
|
|
|
private:
|
|
|
|
BoltFilesState &_state;
|
2013-05-28 03:01:15 +00:00
|
|
|
public:
|
2013-12-30 11:00:15 +00:00
|
|
|
int _type[4];
|
2013-05-28 03:01:15 +00:00
|
|
|
byte *_ptr[4];
|
|
|
|
public:
|
2013-12-29 23:25:46 +00:00
|
|
|
VInitCycleResource(BoltFilesState &state, const byte *src);
|
|
|
|
virtual ~VInitCycleResource() {}
|
|
|
|
|
2014-02-18 23:37:51 +00:00
|
|
|
void vStartCycle();
|
2013-12-29 23:25:46 +00:00
|
|
|
void vStopCycle();
|
2013-05-28 03:01:15 +00:00
|
|
|
};
|
|
|
|
|
2013-12-08 15:40:26 +00:00
|
|
|
/* stampblt.blt resources */
|
|
|
|
|
|
|
|
class PtrResource {
|
|
|
|
public:
|
|
|
|
Common::Array<BoltEntry *> _entries;
|
|
|
|
|
|
|
|
PtrResource(BoltFilesState &state, const byte *src);
|
|
|
|
virtual ~PtrResource() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class ControlResource {
|
|
|
|
public:
|
2013-12-08 21:51:50 +00:00
|
|
|
int _memberIds[8];
|
|
|
|
byte *_entries[8];
|
2014-02-05 03:23:15 +00:00
|
|
|
int _stateId;
|
|
|
|
StateResource *_state;
|
2013-12-08 15:40:26 +00:00
|
|
|
|
|
|
|
ControlResource(BoltFilesState &state, const byte *src);
|
|
|
|
virtual ~ControlResource() {}
|
|
|
|
};
|
|
|
|
|
2014-02-05 03:38:35 +00:00
|
|
|
/**
|
|
|
|
* Stores data about the intended victim
|
|
|
|
*/
|
2014-02-05 03:23:15 +00:00
|
|
|
class StateResource {
|
|
|
|
public:
|
|
|
|
int _vals[4];
|
2014-02-05 03:38:35 +00:00
|
|
|
int &_victimIndex;
|
|
|
|
int &_victimEvidenceIndex;
|
|
|
|
int &_victimMurderIndex;
|
2014-02-05 03:23:15 +00:00
|
|
|
|
|
|
|
StateResource(BoltFilesState &state, const byte *src);
|
|
|
|
virtual ~StateResource() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Synchronizes the game data
|
|
|
|
*/
|
|
|
|
void synchronize(Common::Serializer &s);
|
|
|
|
};
|
|
|
|
|
2013-12-08 21:51:50 +00:00
|
|
|
class ThreadResource {
|
|
|
|
public:
|
2013-12-09 00:25:40 +00:00
|
|
|
static int _useCount[8];
|
|
|
|
static void initUseCount();
|
|
|
|
static void unloadAllStacks(VoyeurEngine *vm);
|
2013-12-14 16:39:15 +00:00
|
|
|
|
|
|
|
static void init();
|
2014-01-19 04:47:04 +00:00
|
|
|
private:
|
|
|
|
VoyeurEngine *_vm;
|
|
|
|
Common::Point _aptPos;
|
2013-12-09 03:57:11 +00:00
|
|
|
private:
|
|
|
|
bool getStateInfo();
|
|
|
|
byte *getDataOffset();
|
|
|
|
void getButtonsText();
|
2013-12-10 03:22:32 +00:00
|
|
|
void getButtonsFlags();
|
|
|
|
void performOpenCard();
|
2013-12-09 04:44:06 +00:00
|
|
|
const byte *getRecordOffset(const byte *p);
|
|
|
|
const byte *getNextRecord(const byte *p);
|
2013-12-12 13:51:13 +00:00
|
|
|
const byte *getSTAMPCard(int cardId);
|
|
|
|
int getStateFromID(uint32 id);
|
|
|
|
uint32 getSID(int sid);
|
2013-12-10 03:22:32 +00:00
|
|
|
void cardAction(const byte *p);
|
2013-12-12 13:51:13 +00:00
|
|
|
void doSTAMPCardAction();
|
2014-02-01 23:35:08 +00:00
|
|
|
bool goToStateID(int stackId, int id);
|
2013-12-12 13:51:13 +00:00
|
|
|
const byte *cardPerform(const byte *card);
|
2013-12-13 04:56:54 +00:00
|
|
|
bool cardPerform2(const byte *p, int cardCmdId);
|
2013-12-12 13:51:13 +00:00
|
|
|
void savePrevious();
|
2013-12-13 04:56:54 +00:00
|
|
|
void setButtonFlag(int idx, byte bits);
|
|
|
|
void clearButtonFlag(int idx, byte bits);
|
2013-12-23 20:38:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Frees the apartment screen data
|
|
|
|
*/
|
2013-12-15 03:27:16 +00:00
|
|
|
void freeTheApt();
|
2013-12-23 20:38:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Does any necessary animation at the start or end of showing the apartment.
|
|
|
|
*/
|
2013-12-15 03:27:16 +00:00
|
|
|
void doAptAnim(int mode);
|
2014-01-03 19:20:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the mansion scroll position if ncessary, and returns true if it
|
|
|
|
* has been changed.
|
|
|
|
*/
|
|
|
|
bool checkMansionScroll();
|
2013-12-09 00:25:40 +00:00
|
|
|
public:
|
2014-02-01 23:35:08 +00:00
|
|
|
int _stateId;
|
|
|
|
int _stackId;
|
2014-02-01 23:55:18 +00:00
|
|
|
int _savedStateId;
|
|
|
|
int _savedStackId;
|
|
|
|
int _newStateId;
|
|
|
|
int _newStackId;
|
2014-01-22 02:04:13 +00:00
|
|
|
int _stateFlags;
|
|
|
|
int _stateCount;
|
2013-12-10 14:19:54 +00:00
|
|
|
int _parseCount;
|
2014-02-13 07:14:01 +00:00
|
|
|
uint32 _nextStateId;
|
2014-01-22 02:04:13 +00:00
|
|
|
byte *_threadInfoPtr;
|
2013-12-13 04:56:54 +00:00
|
|
|
byte _buttonFlags[64];
|
2014-02-03 03:38:27 +00:00
|
|
|
byte _buttonIds[64];
|
2013-12-08 21:51:50 +00:00
|
|
|
byte *_ctlPtr;
|
2014-01-22 02:04:13 +00:00
|
|
|
byte *_playCommandsPtr;
|
2014-02-03 03:38:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads the specified stack
|
|
|
|
*/
|
2014-02-01 23:35:08 +00:00
|
|
|
bool loadAStack(int stackId);
|
2014-02-03 03:38:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unloads the specified stack
|
|
|
|
*/
|
2014-02-01 23:35:08 +00:00
|
|
|
void unloadAStack(int stackId);
|
2014-02-03 03:38:27 +00:00
|
|
|
|
2014-02-03 04:59:45 +00:00
|
|
|
/**
|
2014-02-19 20:01:14 +00:00
|
|
|
* Initializes data for the thread based on the current state
|
2014-02-03 04:59:45 +00:00
|
|
|
*/
|
2014-02-19 20:01:14 +00:00
|
|
|
bool doState();
|
|
|
|
|
|
|
|
public:
|
|
|
|
ThreadResource(BoltFilesState &state, const byte *src);
|
|
|
|
virtual ~ThreadResource() {}
|
2014-02-03 04:59:45 +00:00
|
|
|
|
2014-02-03 03:38:27 +00:00
|
|
|
/**
|
2014-02-19 20:01:14 +00:00
|
|
|
* Initialize the thread
|
2014-02-03 03:38:27 +00:00
|
|
|
*/
|
2014-02-19 20:01:14 +00:00
|
|
|
void initThreadStruct(int idx, int id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Go to a new state and/or stack
|
|
|
|
*/
|
|
|
|
bool goToState(int stackId, int stateId);
|
2013-12-10 03:22:32 +00:00
|
|
|
|
2013-12-12 13:51:13 +00:00
|
|
|
bool chooseSTAMPButton(int buttonId);
|
2014-02-03 03:38:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Parses the script commands from the currently active stack
|
|
|
|
*/
|
2013-12-10 03:22:32 +00:00
|
|
|
void parsePlayCommands();
|
2013-12-23 23:32:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Do the camera view looking at the mansion
|
|
|
|
*/
|
2013-12-10 03:22:32 +00:00
|
|
|
int doInterface();
|
2014-02-03 03:38:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Do the display of a room that has one or more evidence hotspots
|
|
|
|
* available for display
|
|
|
|
*/
|
2013-12-10 03:22:32 +00:00
|
|
|
void doRoom();
|
2013-12-23 20:38:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows the apartment screen
|
|
|
|
*/
|
2013-12-10 03:22:32 +00:00
|
|
|
int doApt();
|
2013-12-23 20:38:39 +00:00
|
|
|
|
2014-01-15 02:49:26 +00:00
|
|
|
/**
|
|
|
|
* Loads data needed for displaying the initial apartment screen
|
|
|
|
*/
|
|
|
|
void loadTheApt();
|
|
|
|
|
2014-01-09 04:31:34 +00:00
|
|
|
/**
|
|
|
|
* Synchronizes the game data
|
|
|
|
*/
|
|
|
|
void synchronize(Common::Serializer &s);
|
2013-12-08 21:51:50 +00:00
|
|
|
};
|
|
|
|
|
2013-05-20 02:45:54 +00:00
|
|
|
} // End of namespace Voyeur
|
|
|
|
|
2013-05-23 13:13:28 +00:00
|
|
|
#endif /* VOYEUR_FILES_H */
|