2014-02-25 09:21:19 -05: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.
|
|
|
|
|
|
|
|
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MADS_SCENE_DATA_H
|
|
|
|
#define MADS_SCENE_DATA_H
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/array.h"
|
2014-02-25 23:10:51 -05:00
|
|
|
#include "common/str.h"
|
|
|
|
#include "common/str-array.h"
|
2014-02-25 09:21:19 -05:00
|
|
|
#include "common/rect.h"
|
2014-03-02 19:29:54 -05:00
|
|
|
#include "mads/action.h"
|
2014-02-25 09:21:19 -05:00
|
|
|
#include "mads/assets.h"
|
2014-03-03 00:42:41 -05:00
|
|
|
#include "mads/events.h"
|
2014-02-25 23:10:51 -05:00
|
|
|
#include "mads/game_data.h"
|
2014-03-03 23:40:23 -05:00
|
|
|
#include "mads/messages.h"
|
2014-02-25 09:21:19 -05:00
|
|
|
|
|
|
|
namespace MADS {
|
|
|
|
|
2014-02-25 19:52:35 -05:00
|
|
|
class MADSEngine;
|
|
|
|
class Scene;
|
2014-03-04 22:33:27 -05:00
|
|
|
class SpriteSlot;
|
2014-02-25 19:52:35 -05:00
|
|
|
|
2014-03-02 16:42:39 -05:00
|
|
|
#define MADS_INTERFACE_HEIGHT 44
|
2014-03-02 18:37:09 -05:00
|
|
|
#define MADS_SCENE_HEIGHT 156
|
2014-03-02 16:42:39 -05:00
|
|
|
|
2014-03-02 10:49:20 -05:00
|
|
|
#define DEPTH_BANDS_SIZE 15
|
|
|
|
#define MAX_ROUTE_NODES 22
|
|
|
|
|
2014-03-03 23:40:23 -05:00
|
|
|
#define DIRTY_AREAS_SIZE 90
|
|
|
|
#define DIRTY_AREAS_TEXT_DISPLAY_IDX 50
|
|
|
|
|
2014-03-02 23:09:17 -05:00
|
|
|
enum ScrCategory {
|
|
|
|
CAT_NONE = 0, CAT_ACTION = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3,
|
|
|
|
CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_6 = 6, CAT_INV_SCROLLER = 7,
|
|
|
|
CAT_12 = 12
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Layer {
|
|
|
|
LAYER_GUI = 19
|
|
|
|
};
|
|
|
|
|
2014-02-25 09:21:19 -05:00
|
|
|
class VerbInit {
|
|
|
|
public:
|
|
|
|
int _id;
|
|
|
|
int _action1;
|
|
|
|
int _action2;
|
|
|
|
|
|
|
|
VerbInit() {}
|
|
|
|
VerbInit(int id, int action1, int action2): _id(id), _action1(action1), _action2(action2) {}
|
|
|
|
};
|
|
|
|
|
2014-03-02 23:09:17 -05:00
|
|
|
class ScreenObject {
|
|
|
|
public:
|
|
|
|
Common::Rect _bounds;
|
|
|
|
ScrCategory _category;
|
|
|
|
int _descId;
|
|
|
|
int _layer;
|
|
|
|
|
|
|
|
ScreenObject();
|
|
|
|
};
|
|
|
|
|
|
|
|
class ScreenObjects: public Common::Array<ScreenObject> {
|
|
|
|
private:
|
|
|
|
MADSEngine *_vm;
|
|
|
|
|
|
|
|
int scanBackwards(const Common::Point &pt, int layer);
|
|
|
|
|
|
|
|
void proc1();
|
2014-02-25 09:21:19 -05:00
|
|
|
public:
|
|
|
|
int _v832EC;
|
2014-03-02 23:09:17 -05:00
|
|
|
int _v7FECA;
|
|
|
|
int _v7FED6;
|
|
|
|
int _v8332A;
|
2014-02-25 09:21:19 -05:00
|
|
|
int _yp;
|
2014-03-02 23:09:17 -05:00
|
|
|
int _v8333C;
|
|
|
|
int _selectedObject;
|
|
|
|
ScrCategory _category;
|
|
|
|
int _objectIndex;
|
|
|
|
bool _released;
|
2014-02-25 09:21:19 -05:00
|
|
|
|
2014-03-02 23:09:17 -05:00
|
|
|
/*
|
|
|
|
* Constructor
|
|
|
|
*/
|
|
|
|
ScreenObjects(MADSEngine *vm);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a new item to the list
|
|
|
|
*/
|
|
|
|
void add(const Common::Rect &bounds, ScrCategory category, int descId);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
void check(bool scanFlag);
|
2014-02-25 09:21:19 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class DynamicHotspot {
|
|
|
|
public:
|
2014-03-03 20:53:27 -05:00
|
|
|
bool _active;
|
2014-02-25 09:21:19 -05:00
|
|
|
int _seqIndex;
|
|
|
|
Common::Rect _bounds;
|
|
|
|
Common::Point _feetPos;
|
|
|
|
int _facing;
|
|
|
|
int _descId;
|
|
|
|
int _field14;
|
|
|
|
int _articleNumber;
|
2014-03-03 00:42:41 -05:00
|
|
|
CursorType _cursor;
|
2014-02-25 09:21:19 -05:00
|
|
|
|
|
|
|
DynamicHotspot();
|
|
|
|
};
|
|
|
|
|
2014-03-03 20:53:27 -05:00
|
|
|
#define DYNAMIC_HOTSPOTS_SIZE 8
|
|
|
|
|
|
|
|
class DynamicHotspots {
|
2014-03-02 23:09:17 -05:00
|
|
|
private:
|
|
|
|
MADSEngine *_vm;
|
2014-03-03 20:53:27 -05:00
|
|
|
Common::Array<DynamicHotspot> _entries;
|
|
|
|
int _count;
|
2014-03-02 23:09:17 -05:00
|
|
|
public:
|
|
|
|
bool _changed;
|
2014-03-03 20:53:27 -05:00
|
|
|
public:
|
2014-03-02 23:09:17 -05:00
|
|
|
DynamicHotspots(MADSEngine *vm);
|
|
|
|
|
2014-03-03 20:53:27 -05:00
|
|
|
DynamicHotspot &operator[](uint idx) { return _entries[idx]; }
|
|
|
|
int add(int descId, int field14, int seqIndex, const Common::Rect &bounds);
|
|
|
|
int setPosition(int index, int xp, int yp, int facing);
|
|
|
|
int setCursor(int index, CursorType cursor);
|
|
|
|
void remove(int index);
|
2014-03-02 23:09:17 -05:00
|
|
|
void clear();
|
2014-03-03 20:53:27 -05:00
|
|
|
void reset();
|
2014-03-02 23:09:17 -05:00
|
|
|
void refresh();
|
|
|
|
};
|
|
|
|
|
2014-02-25 09:21:19 -05:00
|
|
|
class Hotspot {
|
|
|
|
public:
|
|
|
|
Common::Rect _bounds;
|
|
|
|
Common::Point _feetPos;
|
|
|
|
int _facing;
|
|
|
|
int _articleNumber;
|
2014-03-03 00:42:41 -05:00
|
|
|
CursorType _cursor;
|
2014-02-25 09:21:19 -05:00
|
|
|
int _vocabId;
|
|
|
|
int _verbId;
|
|
|
|
|
|
|
|
Hotspot();
|
|
|
|
Hotspot(Common::SeekableReadStream &f);
|
|
|
|
};
|
|
|
|
|
2014-03-03 23:40:23 -05:00
|
|
|
class DirtyArea {
|
2014-03-04 22:33:27 -05:00
|
|
|
private:
|
|
|
|
static MADSEngine *_vm;
|
|
|
|
friend class DirtyAreas;
|
2014-03-03 23:40:23 -05:00
|
|
|
public:
|
|
|
|
Common::Rect _bounds;
|
|
|
|
Common::Rect _bounds2;
|
|
|
|
bool _textActive;
|
|
|
|
bool _active;
|
|
|
|
|
|
|
|
DirtyArea() { _active = false; }
|
2014-03-04 22:33:27 -05:00
|
|
|
|
2014-03-03 23:40:23 -05:00
|
|
|
void setArea(int width, int height, int maxWidth, int maxHeight);
|
2014-03-04 22:33:27 -05:00
|
|
|
|
|
|
|
void setSpriteSlot(const SpriteSlot *spriteSlot);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set up a dirty area for a text display
|
|
|
|
*/
|
|
|
|
void setTextDisplay(const TextDisplay *textDisplay);
|
2014-03-03 23:40:23 -05:00
|
|
|
};
|
|
|
|
|
2014-03-04 22:33:27 -05:00
|
|
|
class DirtyAreas: public Common::Array<DirtyArea> {
|
2014-03-03 23:40:23 -05:00
|
|
|
private:
|
|
|
|
MADSEngine *_vm;
|
|
|
|
public:
|
|
|
|
DirtyAreas(MADSEngine *vm);
|
2014-03-04 22:33:27 -05:00
|
|
|
|
2014-03-03 23:40:23 -05:00
|
|
|
/**
|
|
|
|
* Merge together any designated dirty areas that overlap
|
|
|
|
* @param startIndex 1-based starting dirty area starting index
|
|
|
|
* @param count Number of entries to process
|
|
|
|
*/
|
|
|
|
void merge(int startIndex, int count);
|
|
|
|
|
|
|
|
bool intersects(int idx1, int idx2);
|
|
|
|
void mergeAreas(int idx1, int idx2);
|
|
|
|
void copy(MSurface *dest, MSurface *src, const Common::Point &posAdjust);
|
2014-03-04 22:33:27 -05:00
|
|
|
void reset();
|
2014-03-03 23:40:23 -05:00
|
|
|
};
|
|
|
|
|
2014-02-25 09:21:19 -05:00
|
|
|
class SceneLogic {
|
|
|
|
protected:
|
|
|
|
Scene *_scene;
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*/
|
|
|
|
SceneLogic(Scene *scene): _scene(scene) {}
|
|
|
|
|
2014-02-28 20:37:42 -05:00
|
|
|
/**
|
|
|
|
* Destructor
|
|
|
|
*/
|
|
|
|
virtual ~SceneLogic() {}
|
|
|
|
|
2014-02-25 09:21:19 -05:00
|
|
|
/**
|
|
|
|
* Called to initially setup a scene
|
|
|
|
*/
|
|
|
|
virtual void setup() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called as the scene is entered (made active)
|
|
|
|
*/
|
|
|
|
virtual void enter() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called one per frame
|
|
|
|
*/
|
|
|
|
virtual void step() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called before an action is started
|
|
|
|
*/
|
|
|
|
virtual void preActions() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles scene actions
|
|
|
|
*/
|
|
|
|
virtual void actions() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Post-action handling
|
|
|
|
*/
|
|
|
|
virtual void postActions() = 0;
|
|
|
|
};
|
|
|
|
|
2014-02-25 23:10:51 -05:00
|
|
|
struct ARTHeader {
|
|
|
|
int _width;
|
|
|
|
int _height;
|
|
|
|
Common::Array<RGB6> _palette;
|
2014-03-02 10:49:20 -05:00
|
|
|
Common::Array<RGB4> _palAnimData;
|
|
|
|
|
|
|
|
void load(Common::SeekableReadStream *f);
|
|
|
|
};
|
|
|
|
|
|
|
|
class SceneNode {
|
|
|
|
public:
|
|
|
|
Common::Point _walkPos;
|
|
|
|
int _indexes[MAX_ROUTE_NODES];
|
|
|
|
bool _active;
|
2014-02-25 23:10:51 -05:00
|
|
|
|
2014-03-02 10:49:20 -05:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*/
|
|
|
|
SceneNode() : _active(false) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads the scene node
|
|
|
|
*/
|
2014-02-28 20:37:42 -05:00
|
|
|
void load(Common::SeekableReadStream *f);
|
2014-02-25 23:10:51 -05:00
|
|
|
};
|
2014-03-02 10:49:20 -05:00
|
|
|
typedef Common::Array<SceneNode> SceneNodeList;
|
2014-02-25 23:10:51 -05:00
|
|
|
|
2014-03-02 16:42:39 -05:00
|
|
|
|
2014-02-25 23:10:51 -05:00
|
|
|
/**
|
|
|
|
* Handles general data for a given scene
|
|
|
|
*/
|
|
|
|
class SceneInfo {
|
2014-03-01 20:19:02 -05:00
|
|
|
class SpriteInfo {
|
|
|
|
public:
|
|
|
|
int _spriteSetIndex;
|
|
|
|
Common::Point _position;
|
|
|
|
int _depth;
|
|
|
|
int _scale;
|
|
|
|
|
|
|
|
void load(Common::SeekableReadStream *f);
|
|
|
|
};
|
2014-03-01 22:53:08 -05:00
|
|
|
protected:
|
2014-02-25 23:10:51 -05:00
|
|
|
MADSEngine *_vm;
|
|
|
|
|
2014-03-01 22:53:08 -05:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*/
|
|
|
|
SceneInfo(MADSEngine *vm) : _vm(vm) {}
|
|
|
|
|
2014-02-25 23:10:51 -05:00
|
|
|
/**
|
|
|
|
* Loads the given surface with depth information of a given scene
|
|
|
|
*/
|
2014-03-01 22:53:08 -05:00
|
|
|
virtual void loadCodes(MSurface &depthSurface);
|
2014-02-25 23:10:51 -05:00
|
|
|
public:
|
|
|
|
int _sceneId;
|
|
|
|
int _artFileNum;
|
|
|
|
int _depthStyle;
|
|
|
|
int _width;
|
|
|
|
int _height;
|
|
|
|
|
|
|
|
int _yBandsEnd;
|
|
|
|
int _yBandsStart;
|
|
|
|
int _maxScale;
|
|
|
|
int _minScale;
|
2014-03-02 10:49:20 -05:00
|
|
|
int _depthList[DEPTH_BANDS_SIZE];
|
2014-02-25 23:10:51 -05:00
|
|
|
int _field4A;
|
|
|
|
|
|
|
|
int _field4C;
|
2014-03-02 10:49:20 -05:00
|
|
|
Common::Array<RGB4> _palAnimData;
|
|
|
|
SceneNodeList _nodes;
|
2014-02-25 23:10:51 -05:00
|
|
|
public:
|
|
|
|
/**
|
2014-03-01 22:53:08 -05:00
|
|
|
* Destructor
|
2014-02-25 23:10:51 -05:00
|
|
|
*/
|
2014-03-01 22:53:08 -05:00
|
|
|
virtual ~SceneInfo() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instantiates the class
|
|
|
|
*/
|
|
|
|
static SceneInfo *init(MADSEngine *vm);
|
|
|
|
|
|
|
|
/**
|
|
|
|
loads the data
|
|
|
|
*/
|
|
|
|
void load(int sceneId, int flags, const Common::String &resName, int v3,
|
|
|
|
MSurface &depthSurface, MSurface &bgSurface);
|
|
|
|
};
|
|
|
|
|
|
|
|
class SceneInfoNebular : public SceneInfo {
|
|
|
|
friend class SceneInfo;
|
|
|
|
protected:
|
|
|
|
virtual void loadCodes(MSurface &depthSurface);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*/
|
|
|
|
SceneInfoNebular(MADSEngine *vm) : SceneInfo(vm) {}
|
2014-02-25 23:10:51 -05:00
|
|
|
};
|
|
|
|
|
2014-02-25 09:21:19 -05:00
|
|
|
} // End of namespace MADS
|
|
|
|
|
|
|
|
#endif /* MADS_SCENE_DATA_H */
|