2004-04-12 21:40:49 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2005-01-01 16:20:17 +00:00
|
|
|
* Copyright (C) 2004-2005 The ScummVM project
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
|
|
|
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-05-01 13:48:01 +00:00
|
|
|
// Scene management module private header file
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
#ifndef SAGA_SCENE_H
|
|
|
|
#define SAGA_SCENE_H
|
|
|
|
|
2004-08-04 20:28:57 +00:00
|
|
|
#include "saga/text.h"
|
2004-12-15 00:24:12 +00:00
|
|
|
#include "saga/list.h"
|
2005-01-16 19:06:04 +00:00
|
|
|
#include "saga/actor.h"
|
2004-08-04 20:28:57 +00:00
|
|
|
|
2004-04-12 21:40:49 +00:00
|
|
|
namespace Saga {
|
|
|
|
|
2004-12-28 21:33:46 +00:00
|
|
|
#define SCENE_DOORS_MAX 16
|
|
|
|
|
2004-10-07 23:02:19 +00:00
|
|
|
class ObjectMap;
|
|
|
|
|
2005-01-09 16:43:57 +00:00
|
|
|
struct EVENT;
|
|
|
|
|
2005-01-16 19:06:04 +00:00
|
|
|
enum SceneFlags {
|
|
|
|
kSceneFlagISO = 1,
|
|
|
|
kSceneFlagShowCursor = 2
|
|
|
|
};
|
|
|
|
|
2004-08-04 20:28:57 +00:00
|
|
|
struct SCENE_BGINFO {
|
|
|
|
int bg_x;
|
|
|
|
int bg_y;
|
|
|
|
int bg_w;
|
|
|
|
int bg_h;
|
|
|
|
int bg_p;
|
|
|
|
byte *bg_buf;
|
|
|
|
size_t bg_buflen;
|
|
|
|
};
|
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
struct SCENE_INFO {
|
2004-08-04 20:28:57 +00:00
|
|
|
SCENE_BGINFO bg_info;
|
2004-10-27 21:32:28 +00:00
|
|
|
TEXTLIST *text_list;
|
2004-08-04 20:28:57 +00:00
|
|
|
};
|
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
typedef int (SCENE_PROC) (int, SCENE_INFO *, void *);
|
2004-08-04 20:28:57 +00:00
|
|
|
|
2004-04-12 21:40:49 +00:00
|
|
|
enum SCENE_LOAD_FLAGS {
|
|
|
|
BY_RESOURCE = 0,
|
|
|
|
BY_SCENE,
|
|
|
|
BY_DESC
|
|
|
|
};
|
|
|
|
|
|
|
|
enum SCENE_PROC_PARAMS {
|
|
|
|
SCENE_BEGIN = 0,
|
|
|
|
SCENE_END
|
|
|
|
};
|
|
|
|
|
2004-05-01 13:48:01 +00:00
|
|
|
// Resource type numbers
|
2004-04-12 21:40:49 +00:00
|
|
|
enum SAGA_RESOURCE_TYPES {
|
|
|
|
SAGA_BG_IMAGE = 2,
|
|
|
|
SAGA_BG_MASK = 3,
|
2005-01-18 11:55:31 +00:00
|
|
|
SAGA_SCENE_NAME_LIST = 5,
|
2004-04-12 21:40:49 +00:00
|
|
|
SAGA_OBJECT_MAP = 6,
|
|
|
|
SAGA_ACTION_MAP = 7,
|
|
|
|
SAGA_ISO_TILESET = 8,
|
|
|
|
SAGA_ISO_METAMAP = 9,
|
|
|
|
SAGA_ISO_METATILESET = 10,
|
2004-10-05 02:16:26 +00:00
|
|
|
SAGA_ENTRY = 12,
|
2004-04-12 21:40:49 +00:00
|
|
|
SAGA_ANIM_1 = 14,
|
|
|
|
SAGA_ANIM_2,
|
|
|
|
SAGA_ANIM_3,
|
|
|
|
SAGA_ANIM_4,
|
|
|
|
SAGA_ANIM_5,
|
|
|
|
SAGA_ANIM_6,
|
|
|
|
SAGA_ANIM_7,
|
2004-10-05 02:16:26 +00:00
|
|
|
SAGA_PAL_ANIM = 23,
|
|
|
|
SAGA_FACES = 24
|
2004-04-12 21:40:49 +00:00
|
|
|
};
|
|
|
|
|
2004-04-25 14:42:14 +00:00
|
|
|
#define SAGA_RESLIST_ENTRY_LEN 4
|
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
struct SCENE_RESLIST {
|
2004-04-30 23:02:23 +00:00
|
|
|
uint32 res_number;
|
2004-04-25 14:42:14 +00:00
|
|
|
int res_type;
|
2004-04-30 23:02:23 +00:00
|
|
|
byte *res_data;
|
2004-04-25 14:42:14 +00:00
|
|
|
size_t res_data_len;
|
|
|
|
};
|
|
|
|
|
2004-04-12 21:40:49 +00:00
|
|
|
#define SAGA_SCENE_DESC_LEN 16
|
|
|
|
|
2005-01-15 20:12:49 +00:00
|
|
|
struct SceneDescription {
|
2004-08-11 18:02:03 +00:00
|
|
|
int16 flags;
|
|
|
|
int16 resListRN;
|
|
|
|
int16 endSlope;
|
|
|
|
int16 beginSlope;
|
2005-01-15 20:12:49 +00:00
|
|
|
uint16 scriptModuleNumber;
|
|
|
|
uint16 sceneScriptEntrypointNumber;
|
|
|
|
uint16 startScriptEntrypointNumber;
|
2004-08-11 18:02:03 +00:00
|
|
|
int16 musicRN;
|
2004-10-27 21:32:28 +00:00
|
|
|
SCENE_RESLIST *resList;
|
2004-08-11 18:02:03 +00:00
|
|
|
size_t resListCnt;
|
2004-04-25 14:42:14 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-16 19:06:04 +00:00
|
|
|
struct SceneEntry {
|
|
|
|
Location location;
|
|
|
|
int facing;
|
|
|
|
};
|
|
|
|
|
2005-01-18 11:55:31 +00:00
|
|
|
struct SceneEntryList {
|
|
|
|
SceneEntry *entryList;
|
|
|
|
int entryListCount;
|
|
|
|
|
2005-01-16 19:06:04 +00:00
|
|
|
const SceneEntry * getEntry(int index) {
|
2005-01-18 11:55:31 +00:00
|
|
|
if ((index < 0) || (index >= entryListCount)) {
|
2005-01-16 19:06:04 +00:00
|
|
|
error("SceneEntryList::getEntry wrong index");
|
|
|
|
}
|
2005-01-18 11:55:31 +00:00
|
|
|
return &entryList[index];
|
2005-01-16 19:06:04 +00:00
|
|
|
}
|
|
|
|
void freeMem() {
|
2005-01-18 11:55:31 +00:00
|
|
|
free(entryList);
|
|
|
|
memset(this, 0, sizeof(*this));
|
2005-01-16 19:06:04 +00:00
|
|
|
}
|
2005-01-18 11:55:31 +00:00
|
|
|
SceneEntryList() {
|
|
|
|
memset(this, 0, sizeof(*this));
|
2005-01-16 19:06:04 +00:00
|
|
|
}
|
|
|
|
~SceneEntryList() {
|
|
|
|
freeMem();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-04-25 14:42:14 +00:00
|
|
|
struct SCENE_IMAGE {
|
2004-04-12 21:40:49 +00:00
|
|
|
int loaded;
|
|
|
|
int w;
|
|
|
|
int h;
|
|
|
|
int p;
|
2004-04-30 23:02:23 +00:00
|
|
|
byte *buf;
|
2004-04-12 21:40:49 +00:00
|
|
|
size_t buf_len;
|
2004-04-30 23:02:23 +00:00
|
|
|
byte *res_buf;
|
2004-04-12 21:40:49 +00:00
|
|
|
size_t res_len;
|
|
|
|
PALENTRY pal[256];
|
2004-04-25 14:42:14 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-04-25 14:42:14 +00:00
|
|
|
struct SCENE_ANIMINFO {
|
2004-04-12 21:40:49 +00:00
|
|
|
int anim_res_number;
|
|
|
|
int anim_handle;
|
2004-04-25 14:42:14 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-15 00:24:12 +00:00
|
|
|
typedef SortedList<SCENE_ANIMINFO> SceneAnimInfoList;
|
|
|
|
|
2005-01-15 23:46:43 +00:00
|
|
|
enum SceneTransitionType {
|
2004-08-11 22:27:39 +00:00
|
|
|
SCENE_NOFADE = 0,
|
|
|
|
SCENE_FADE = 1,
|
|
|
|
SCENE_FADE_NO_INTERFACE = 2
|
|
|
|
};
|
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
struct SCENE_QUEUE {
|
2004-04-30 23:02:23 +00:00
|
|
|
uint32 scene_n;
|
2005-01-15 20:12:49 +00:00
|
|
|
SceneDescription* sceneDescription;
|
2004-04-12 21:40:49 +00:00
|
|
|
int load_flag;
|
2004-10-27 21:32:28 +00:00
|
|
|
SCENE_PROC *scene_proc;
|
2004-04-12 21:40:49 +00:00
|
|
|
int scene_skiptarget;
|
2004-08-11 22:27:39 +00:00
|
|
|
int fadeType;
|
2004-04-25 14:42:14 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-15 00:24:12 +00:00
|
|
|
typedef Common::List<SCENE_QUEUE> SceneQueueList;
|
|
|
|
|
2004-08-11 23:42:02 +00:00
|
|
|
///// IHNM-specific stuff
|
2004-11-20 17:32:47 +00:00
|
|
|
#define IHNM_PALFADE_TIME 1000
|
|
|
|
#define IHNM_INTRO_FRAMETIME 80
|
|
|
|
#define IHNM_DGLOGO_TIME 8000
|
|
|
|
#define IHNM_TITLE_TIME_GM 28750
|
|
|
|
#define IHNM_TITLE_TIME_FM 19500
|
2004-08-11 23:42:02 +00:00
|
|
|
|
|
|
|
///// ITE-specific stuff
|
|
|
|
#define ITE_INTRO_FRAMETIME 90
|
|
|
|
|
|
|
|
#define INTRO_CAPTION_Y 170
|
2005-01-14 01:17:34 +00:00
|
|
|
#define INTRO_DE_CAPTION_Y 160
|
2004-08-11 23:42:02 +00:00
|
|
|
#define VOICE_PAD 50
|
|
|
|
#define VOICE_LETTERLEN 90
|
|
|
|
|
|
|
|
#define PALETTE_FADE_DURATION 1000
|
|
|
|
#define DISSOLVE_DURATION 3000
|
|
|
|
#define LOGO_DISSOLVE_DURATION 1000
|
|
|
|
|
|
|
|
#define CREDIT_DURATION1 4000
|
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
struct INTRO_DIALOGUE {
|
2004-08-11 23:42:02 +00:00
|
|
|
uint32 i_voice_rn;
|
2005-01-14 11:05:12 +00:00
|
|
|
const char *i_str;
|
2004-08-11 23:42:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct INTRO_CREDIT {
|
2005-01-09 16:43:57 +00:00
|
|
|
int game;
|
|
|
|
int type;
|
2004-08-11 23:42:02 +00:00
|
|
|
const char *string;
|
|
|
|
};
|
|
|
|
|
2005-01-04 17:15:53 +00:00
|
|
|
|
2004-08-04 20:28:57 +00:00
|
|
|
class Scene {
|
|
|
|
public:
|
|
|
|
Scene(SagaEngine *vm);
|
|
|
|
~Scene();
|
2004-12-03 19:15:44 +00:00
|
|
|
|
2004-12-24 20:44:39 +00:00
|
|
|
// Console functions
|
|
|
|
void cmdSceneInfo();
|
|
|
|
void cmdActionMapInfo();
|
|
|
|
void cmdObjectMapInfo();
|
|
|
|
|
|
|
|
void cmdSceneChange(int argc, const char **argv);
|
2004-08-04 20:28:57 +00:00
|
|
|
|
|
|
|
int startScene();
|
|
|
|
int nextScene();
|
|
|
|
int skipScene();
|
|
|
|
int endScene();
|
2004-10-27 21:32:28 +00:00
|
|
|
int queueScene(SCENE_QUEUE *scene_queue);
|
|
|
|
int draw(SURFACE *);
|
2005-01-15 20:12:49 +00:00
|
|
|
int getFlags() const { return _desc.flags; }
|
|
|
|
int getScriptModuleNumber() const { return _desc.scriptModuleNumber; }
|
2005-01-06 14:02:53 +00:00
|
|
|
bool isInDemo() { return !_inGame; }
|
2004-12-28 21:33:46 +00:00
|
|
|
|
|
|
|
void getBGMaskInfo(int &width, int &height, byte *&buffer, size_t &bufferLength);
|
2005-01-07 21:13:26 +00:00
|
|
|
int isBGMaskPresent() { return _bgMask.loaded; }
|
2004-12-28 21:33:46 +00:00
|
|
|
int getBGMaskType(const Point &testPoint);
|
2005-01-04 16:10:43 +00:00
|
|
|
bool validBGMaskPoint(const Point &testPoint);
|
2004-12-28 21:33:46 +00:00
|
|
|
bool canWalk(const Point &testPoint);
|
|
|
|
bool offscreenPath(Point &testPoint);
|
|
|
|
|
|
|
|
void setDoorState(int doorNumber, int doorState);
|
|
|
|
int getDoorState(int doorNumber);
|
2005-01-04 16:10:43 +00:00
|
|
|
void initDoorsState();
|
2004-12-28 21:33:46 +00:00
|
|
|
|
2004-08-04 20:28:57 +00:00
|
|
|
int getBGInfo(SCENE_BGINFO *bginfo);
|
|
|
|
int getBGPal(PALENTRY **pal);
|
2004-10-27 21:32:28 +00:00
|
|
|
int getInfo(SCENE_INFO *si);
|
2004-12-19 13:38:11 +00:00
|
|
|
void getSlopes(int &beginSlope, int &endSlope);
|
2004-08-04 20:28:57 +00:00
|
|
|
|
|
|
|
int clearSceneQueue(void);
|
2005-01-15 23:46:43 +00:00
|
|
|
int changeScene(int sceneNumber, int actorsEntrance);
|
2004-08-04 20:28:57 +00:00
|
|
|
|
|
|
|
bool initialized() { return _initialized; }
|
|
|
|
|
|
|
|
|
2004-10-27 22:17:11 +00:00
|
|
|
int getSceneLUT(int num);
|
|
|
|
int currentSceneNumber() { return _sceneNumber; }
|
|
|
|
|
2004-08-04 20:28:57 +00:00
|
|
|
private:
|
2005-01-15 23:46:43 +00:00
|
|
|
int loadScene(int scene, int load_flag, SCENE_PROC scene_proc, SceneDescription *, int fadeIn, int actorsEntrance);
|
2004-08-04 20:28:57 +00:00
|
|
|
int loadSceneDescriptor(uint32 res_number);
|
|
|
|
int loadSceneResourceList(uint32 res_number);
|
2005-01-18 11:55:31 +00:00
|
|
|
void loadSceneEntryList(const byte* resourcePointer, size_t resourceLength);
|
2004-08-04 20:28:57 +00:00
|
|
|
int processSceneResources();
|
|
|
|
|
|
|
|
private:
|
|
|
|
SagaEngine *_vm;
|
|
|
|
bool _initialized;
|
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
RSCFILE_CONTEXT *_sceneContext;
|
2004-08-04 20:28:57 +00:00
|
|
|
int *_sceneLUT;
|
|
|
|
int _sceneCount;
|
|
|
|
int _sceneMax;
|
2004-12-15 00:24:12 +00:00
|
|
|
SceneQueueList _sceneQueue;
|
2004-08-04 20:28:57 +00:00
|
|
|
int _firstScene;
|
|
|
|
bool _sceneLoaded;
|
|
|
|
int _sceneNumber;
|
|
|
|
int _sceneResNum;
|
|
|
|
bool _inGame;
|
|
|
|
bool _loadDesc;
|
2005-01-15 20:12:49 +00:00
|
|
|
SceneDescription _desc;
|
2004-08-04 20:28:57 +00:00
|
|
|
int _resListEntries;
|
2004-10-27 21:32:28 +00:00
|
|
|
SCENE_RESLIST *_resList;
|
2004-08-04 20:28:57 +00:00
|
|
|
int _animEntries;
|
2004-12-15 00:24:12 +00:00
|
|
|
SceneAnimInfoList _animList;
|
2004-10-27 21:32:28 +00:00
|
|
|
SCENE_PROC *_sceneProc;
|
|
|
|
TEXTLIST *_textList;
|
2004-08-04 20:28:57 +00:00
|
|
|
SCENE_IMAGE _bg;
|
|
|
|
SCENE_IMAGE _bgMask;
|
2005-01-18 11:55:31 +00:00
|
|
|
|
2004-12-28 21:33:46 +00:00
|
|
|
int _sceneDoors[SCENE_DOORS_MAX];
|
2004-08-11 23:42:02 +00:00
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
static int SC_defaultScene(int param, SCENE_INFO *scene_info, void *refCon);
|
|
|
|
int defaultScene(int param, SCENE_INFO *scene_info);
|
2004-08-11 23:42:02 +00:00
|
|
|
|
2004-10-07 22:31:39 +00:00
|
|
|
public:
|
2005-01-18 11:55:31 +00:00
|
|
|
ObjectMap *_actionMap;
|
2004-10-07 23:02:19 +00:00
|
|
|
ObjectMap *_objectMap;
|
2005-01-18 11:55:31 +00:00
|
|
|
SceneEntryList _entryList;
|
2005-01-18 15:01:21 +00:00
|
|
|
StringsTable _sceneStrings;
|
2004-10-07 22:31:39 +00:00
|
|
|
|
2004-08-11 23:42:02 +00:00
|
|
|
private:
|
|
|
|
int IHNMStartProc();
|
|
|
|
int ITEStartProc();
|
|
|
|
|
|
|
|
public:
|
2004-10-27 21:32:28 +00:00
|
|
|
static int SC_IHNMIntroMovieProc1(int param, SCENE_INFO *scene_info, void *refCon);
|
|
|
|
static int SC_IHNMIntroMovieProc2(int param, SCENE_INFO *scene_info, void *refCon);
|
|
|
|
static int SC_IHNMIntroMovieProc3(int param, SCENE_INFO *scene_info, void *refCon);
|
|
|
|
static int SC_IHNMHateProc(int param, SCENE_INFO *scene_info, void *refCon);
|
2004-08-11 23:42:02 +00:00
|
|
|
|
|
|
|
private:
|
2004-10-27 21:32:28 +00:00
|
|
|
int IHNMIntroMovieProc1(int param, SCENE_INFO *scene_info);
|
|
|
|
int IHNMIntroMovieProc2(int param, SCENE_INFO *scene_info);
|
|
|
|
int IHNMIntroMovieProc3(int param, SCENE_INFO *scene_info);
|
|
|
|
int IHNMHateProc(int param, SCENE_INFO *scene_info);
|
2004-08-11 23:42:02 +00:00
|
|
|
|
|
|
|
public:
|
2004-10-27 21:32:28 +00:00
|
|
|
static int SC_ITEIntroAnimProc(int param, SCENE_INFO *scene_info, void *refCon);
|
|
|
|
static int SC_ITEIntroCave1Proc(int param, SCENE_INFO *scene_info, void *refCon);
|
|
|
|
static int SC_ITEIntroCave2Proc(int param, SCENE_INFO *scene_info, void *refCon);
|
|
|
|
static int SC_ITEIntroCave3Proc(int param, SCENE_INFO *scene_info, void *refCon);
|
|
|
|
static int SC_ITEIntroCave4Proc(int param, SCENE_INFO *scene_info, void *refCon);
|
|
|
|
static int SC_ITEIntroValleyProc(int param, SCENE_INFO *scene_info, void *refCon);
|
|
|
|
static int SC_ITEIntroTreeHouseProc(int param, SCENE_INFO *scene_info, void *refCon);
|
|
|
|
static int SC_ITEIntroFairePathProc(int param, SCENE_INFO *scene_info, void *refCon);
|
|
|
|
static int SC_ITEIntroFaireTentProc(int param, SCENE_INFO *scene_info, void *refCon);
|
2004-08-11 23:42:02 +00:00
|
|
|
|
|
|
|
private:
|
2005-01-14 08:02:17 +00:00
|
|
|
EVENT *ITEQueueDialogue(EVENT *q_event, SCENE_INFO *scene_info, int n_dialogues, const INTRO_DIALOGUE dialogue[]);
|
2005-01-09 16:43:57 +00:00
|
|
|
EVENT *ITEQueueCredits(SCENE_INFO *scene_info, int delta_time, int duration, int n_credits, const INTRO_CREDIT credits[]);
|
2004-10-27 21:32:28 +00:00
|
|
|
int ITEIntroAnimProc(int param, SCENE_INFO *scene_info);
|
|
|
|
int ITEIntroCave1Proc(int param, SCENE_INFO *scene_info);
|
|
|
|
int ITEIntroCave2Proc(int param, SCENE_INFO *scene_info);
|
|
|
|
int ITEIntroCave3Proc(int param, SCENE_INFO *scene_info);
|
|
|
|
int ITEIntroCave4Proc(int param, SCENE_INFO *scene_info);
|
|
|
|
int ITEIntroValleyProc(int param, SCENE_INFO *scene_info);
|
|
|
|
int ITEIntroTreeHouseProc(int param, SCENE_INFO *scene_info);
|
|
|
|
int ITEIntroFairePathProc(int param, SCENE_INFO *scene_info);
|
|
|
|
int ITEIntroFaireTentProc(int param, SCENE_INFO *scene_info);
|
2004-08-11 23:42:02 +00:00
|
|
|
|
2004-04-25 14:42:14 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
} // End of namespace Saga
|
|
|
|
|
2004-05-01 13:48:01 +00:00
|
|
|
#endif
|