27 #include "saga/font.h" 28 #include "saga/actor.h" 29 #include "saga/interface.h" 30 #include "saga/puzzle.h" 31 #include "saga/events.h" 34 #include "saga/shared_detection_defines.h" 40 #define SCENE_DOORS_MAX 16 41 #define NO_CHAPTER_CHANGE -2 44 #define ITE_SCENE_INV -1 45 #define ITE_SCENE_PUZZLE 26 46 #define ITE_SCENE_LODGE 21 47 #define ITE_SCENE_ENDCREDIT1 295 48 #define ITE_SCENE_OVERMAP 226 54 kSceneFlagShowCursor = 2
62 typedef int (SceneProc) (int,
void *);
65 enum SCENE_PROC_PARAMS {
71 enum SAGAResourceTypes {
92 #define SAGA_RESLIST_ENTRY_LEN 4 105 #define SAGA_SCENE_DESC_LEN 16 109 int16 resourceListResourceId;
112 uint16 scriptModuleNumber;
113 uint16 sceneScriptEntrypointNumber;
114 uint16 startScriptEntrypointNumber;
115 int16 musicResourceId;
118 flags = resourceListResourceId = endSlope = beginSlope = scriptModuleNumber = sceneScriptEntrypointNumber = startScriptEntrypointNumber = musicResourceId = 0;
137 SceneImage() : loaded(
false), w(0), h(0), p(0) {
138 memset(pal, 0,
sizeof(pal));
143 enum SceneTransitionType {
148 enum SceneLoadFlags {
149 kLoadByResourceId = 0,
150 kLoadBySceneNumber = 1,
152 kLoadBgMaskIsImage = 1 << 16,
156 int32 sceneDescriptor;
157 SceneLoadFlags loadFlag;
158 SceneProc *sceneProc;
159 bool sceneSkipTarget;
160 SceneTransitionType transitionType;
168 #define IHNM_PALFADE_TIME 1000 169 #define IHNM_INTRO_FRAMETIME 80 170 #define IHNM_DGLOGO_TIME 8000 171 #define IHNM_TITLE_TIME_GM 28750 172 #define IHNM_TITLE_TIME_FM 19500 174 #define CREDIT_DURATION1 4000 182 void cmdActionMapInfo();
183 void cmdObjectMapInfo();
185 void cmdSceneChange(
int argc,
const char **argv);
194 _sceneQueue.push_back(sceneQueue);
198 int getFlags()
const {
return _sceneDescription.flags; }
199 int getScriptModuleNumber()
const {
return _sceneDescription.scriptModuleNumber; }
200 bool isInIntro() {
return !_inGame; }
201 const Rect& getSceneClip()
const {
return _sceneClip; }
203 void getBGMaskInfo(
int &width,
int &height, byte *&buffer);
204 int isBGMaskPresent() {
return _bgMask.loaded; }
206 int getBGMaskType(
const Point &testPoint) {
208 if (!_bgMask.loaded) {
211 offset = testPoint.
x + testPoint.
y * _bgMask.w;
214 if (offset >= _bgMask.buf_len) {
215 error(
"Scene::getBGMaskType offset 0x%X exceed bufferLength 0x%X", offset, (
int)_bgMask.buf_len);
219 return (_bgMask.buffer[offset] >> 4) & 0x0f;
222 bool validBGMaskPoint(
const Point &testPoint) {
224 if (!_bgMask.loaded) {
225 error(
"Scene::validBGMaskPoint _bgMask not loaded");
229 return !((testPoint.
x < 0) || (testPoint.
x >= _bgMask.w) ||
230 (testPoint.
y < 0) || (testPoint.
y >= _bgMask.h));
233 bool canWalk(
const Point &testPoint);
234 bool offscreenPath(
Point &testPoint);
236 void setDoorState(
int doorNumber,
int doorState) {
238 if ((doorNumber < 0) || (doorNumber >= SCENE_DOORS_MAX))
239 error(
"Scene::setDoorState wrong doorNumber");
242 _sceneDoors[doorNumber] = doorState;
245 int getDoorState(
int doorNumber) {
247 if ((doorNumber < 0) || (doorNumber >= SCENE_DOORS_MAX))
248 error(
"Scene::getDoorState wrong doorNumber");
251 return _sceneDoors[doorNumber];
254 void initDoorsState();
256 void getBGInfo(
BGInfo &bgInfo);
261 void getSlopes(
int &beginSlope,
int &endSlope);
263 void clearSceneQueue() {
266 void changeScene(int16 sceneNumber,
int actorsEntrance, SceneTransitionType transitionType,
int chapter = NO_CHAPTER_CHANGE);
268 bool isSceneLoaded()
const {
return _sceneLoaded; }
270 uint16 getSceneResourceId(
int sceneNumber) {
272 if ((sceneNumber < 0) || (sceneNumber >= _sceneCount)) {
273 error(
"getSceneResourceId: wrong sceneNumber %i", sceneNumber);
276 return _sceneLUT[sceneNumber];
278 int currentSceneNumber()
const {
return _sceneNumber; }
279 int currentChapterNumber()
const {
return _chapterNumber; }
280 void setChapterNumber(
int ch) { _chapterNumber = ch; }
281 int getOutsetSceneNumber()
const {
return _outsetSceneNumber; }
282 int currentSceneResourceId()
const {
return _sceneResourceId; }
283 int getCurrentMusicTrack()
const {
return _currentMusicTrack; }
284 void setCurrentMusicTrack(
int tr) { _currentMusicTrack = tr; }
285 int getCurrentMusicRepeat()
const {
return _currentMusicRepeat; }
286 void setCurrentMusicRepeat(
int rp) { _currentMusicRepeat = rp; }
287 bool haveChapterPointsChanged()
const {
return _chapterPointsChanged; }
288 void setChapterPointsChanged(
bool cp) { _chapterPointsChanged = cp; }
291 _vm->_framesEsc = _vm->_scene->isInIntro() ? 2 : 1;
296 int getHeight(
bool speech =
false)
const {
297 if (_vm->getGameId() == GID_IHNM && _vm->_scene->currentChapterNumber() == 8 && !speech)
298 return _vm->getDisplayInfo().height;
300 return _vm->getDisplayInfo().sceneHeight;
304 void showPsychicProfile(
const char *text);
305 void clearPsychicProfile();
306 void showIHNMDemoSpecialScreen();
308 bool isNonInteractiveIHNMDemoPart() {
309 return _vm->isIHNMDemo() && (_sceneNumber >= 144 && _sceneNumber <= 149);
312 bool isITEPuzzleScene() {
313 return _vm->getGameId() == GID_ITE && _vm->_puzzle->isActive();
318 void loadSceneDescriptor(uint32 resourceId);
319 void loadSceneResourceList(uint32 resourceId, SceneResourceDataArray &resourceList);
320 void loadSceneEntryList(
const ByteArray &resourceData);
321 void processSceneResources(SceneResourceDataArray &resourceList, SceneLoadFlags flags);
322 void getResourceTypes(SAGAResourceTypes *&types,
int &typesCount);
329 SceneQueueList _sceneQueue;
333 int _outsetSceneNumber;
334 int _sceneResourceId;
335 int _currentMusicTrack;
336 int _currentMusicRepeat;
337 bool _chapterPointsChanged;
340 SceneProc *_sceneProc;
345 int _sceneDoors[SCENE_DOORS_MAX];
351 SceneEntryList _entryList;
358 int IHNMCreditsProc();
360 void IHNMLoadCutaways();
364 bool playTitle(
int title,
int time,
int mode = kPanelVideo);
365 bool playLoopingTitle(
int title,
int seconds);
368 static int SC_ITEIntroAnimProc(
int param,
void *refCon);
369 static int SC_ITEIntroCave1Proc(
int param,
void *refCon);
370 static int SC_ITEIntroCave2Proc(
int param,
void *refCon);
371 static int SC_ITEIntroCave3Proc(
int param,
void *refCon);
372 static int SC_ITEIntroCave4Proc(
int param,
void *refCon);
373 static int SC_ITEIntroValleyProc(
int param,
void *refCon);
374 static int SC_ITEIntroTreeHouseProc(
int param,
void *refCon);
375 static int SC_ITEIntroFairePathProc(
int param,
void *refCon);
376 static int SC_ITEIntroFaireTentProc(
int param,
void *refCon);
377 static int SC_ITEIntroCaveDemoProc(
int param,
void *refCon);
382 int ITEIntroAnimProc(
int param);
383 int ITEIntroCaveCommonProc(
int param,
int caveScene);
384 int ITEIntroCaveDemoProc(
int param);
385 int ITEIntroValleyProc(
int param);
386 int ITEIntroTreeHouseProc(
int param);
387 int ITEIntroFairePathProc(
int param);
388 int ITEIntroFaireTentProc(
int param);
Definition: resource.h:105
Definition: objectmap.h:91
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
int16 x
Definition: rect.h:46
int16 y
Definition: rect.h:47