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-03-15 20:19:01 -04:00
|
|
|
#include "mads/user_interface.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-12 22:45:33 -04:00
|
|
|
#define SPRITE_SLOTS_MAX_SIZE 50
|
|
|
|
#define TEXT_DISPLAY_MAX_SIZE 40
|
|
|
|
#define DIRTY_AREAS_SIZE (SPRITE_SLOTS_MAX_SIZE + TEXT_DISPLAY_MAX_SIZE)
|
2014-03-03 23:40:23 -05:00
|
|
|
|
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) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class SceneLogic {
|
|
|
|
protected:
|
2014-03-05 21:36:02 -05:00
|
|
|
MADSEngine *_vm;
|
2014-02-25 09:21:19 -05:00
|
|
|
Scene *_scene;
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*/
|
2014-03-05 21:36:02 -05:00
|
|
|
SceneLogic(MADSEngine *vm);
|
2014-02-25 09:21:19 -05:00
|
|
|
|
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-16 14:53:10 -04:00
|
|
|
|
|
|
|
|
|
|
|
int getRouteFlags(const Common::Point &src, const Common::Point &dest, MSurface &depthSurface);
|
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-12 23:45:57 -04:00
|
|
|
virtual void loadCodes(MSurface &depthSurface) = 0;
|
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;
|
|
|
|
|
2014-03-10 01:00:11 -04:00
|
|
|
int _usageIndex;
|
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);
|
2014-03-16 14:53:10 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set up a route node
|
|
|
|
*/
|
|
|
|
void setRouteNode(int nodeIndex, const Common::Point &pt, MSurface &depthSurface);
|
2014-03-22 19:25:26 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads the given surface with depth information of a given scene
|
|
|
|
*/
|
|
|
|
virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) = 0;
|
2014-03-01 22:53:08 -05:00
|
|
|
};
|
|
|
|
|
2014-02-25 09:21:19 -05:00
|
|
|
} // End of namespace MADS
|
|
|
|
|
|
|
|
#endif /* MADS_SCENE_DATA_H */
|