2008-07-23 09:02:47 +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.
|
|
|
|
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Starts up new scenes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "tinsel/actors.h"
|
|
|
|
#include "tinsel/anim.h"
|
|
|
|
#include "tinsel/background.h"
|
|
|
|
#include "tinsel/config.h"
|
|
|
|
#include "tinsel/cursor.h"
|
2008-12-01 20:35:36 +00:00
|
|
|
#include "tinsel/dialogs.h"
|
2008-07-23 09:02:47 +00:00
|
|
|
#include "tinsel/dw.h"
|
|
|
|
#include "tinsel/graphics.h"
|
|
|
|
#include "tinsel/handle.h"
|
|
|
|
#include "tinsel/film.h"
|
2008-12-01 20:35:36 +00:00
|
|
|
#include "tinsel/font.h"
|
|
|
|
#include "tinsel/mareels.h"
|
2008-07-23 09:02:47 +00:00
|
|
|
#include "tinsel/move.h"
|
2008-12-01 20:35:36 +00:00
|
|
|
#include "tinsel/music.h"
|
|
|
|
#include "tinsel/object.h"
|
|
|
|
#include "tinsel/pcode.h"
|
|
|
|
#include "tinsel/pid.h" // process IDs
|
|
|
|
#include "tinsel/play.h"
|
|
|
|
#include "tinsel/polygons.h"
|
2008-07-23 09:02:47 +00:00
|
|
|
#include "tinsel/rince.h"
|
|
|
|
#include "tinsel/sched.h"
|
|
|
|
#include "tinsel/scn.h"
|
|
|
|
#include "tinsel/scroll.h"
|
|
|
|
#include "tinsel/sound.h" // stopAllSamples()
|
2008-12-01 20:35:36 +00:00
|
|
|
#include "tinsel/sysvar.h"
|
2008-07-23 09:02:47 +00:00
|
|
|
#include "tinsel/token.h"
|
|
|
|
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "common/textconsole.h"
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
namespace Tinsel {
|
|
|
|
|
|
|
|
//----------------- EXTERNAL FUNCTIONS ---------------------
|
|
|
|
|
|
|
|
// in BG.C
|
2009-11-02 21:54:57 +00:00
|
|
|
extern void DropBackground();
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
// in EFFECT.C
|
2008-07-24 08:59:17 +00:00
|
|
|
extern void EffectPolyProcess(CORO_PARAM, const void *);
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
// in PDISPLAY.C
|
|
|
|
#ifdef DEBUG
|
2008-07-24 08:59:17 +00:00
|
|
|
extern void CursorPositionProcess(CORO_PARAM, const void *);
|
2008-07-23 09:02:47 +00:00
|
|
|
#endif
|
2008-07-24 08:59:17 +00:00
|
|
|
extern void TagProcess(CORO_PARAM, const void *);
|
|
|
|
extern void PointProcess(CORO_PARAM, const void *);
|
2009-11-02 21:54:57 +00:00
|
|
|
extern void EnableTags();
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
//----------------- LOCAL DEFINES --------------------
|
|
|
|
|
|
|
|
#include "common/pack-start.h" // START STRUCT PACKING
|
|
|
|
|
|
|
|
/** scene structure - one per scene */
|
|
|
|
struct SCENE_STRUC {
|
2008-12-01 20:35:36 +00:00
|
|
|
int32 defRefer; // Default refer direction (REFTYPE)
|
|
|
|
SCNHANDLE hSceneScript; // handle to scene script
|
|
|
|
SCNHANDLE hSceneDesc; // handle to scene description
|
|
|
|
int32 numEntrance; // number of entrances in this scene
|
|
|
|
SCNHANDLE hEntrance; // handle to table of entrances
|
|
|
|
int32 numPoly; // number of various polygons in this scene
|
|
|
|
SCNHANDLE hPoly; // handle to table of polygons
|
|
|
|
int32 numTaggedActor; // number of tagged actors in this scene
|
|
|
|
SCNHANDLE hTaggedActor; // handle to table of tagged actors
|
|
|
|
int32 numProcess; // number of processes in this scene
|
|
|
|
SCNHANDLE hProcess; // handle to table of processes
|
|
|
|
SCNHANDLE hMusicScript; // handle to music script data
|
|
|
|
SCNHANDLE hMusicSegment;// handle to music segments
|
2008-07-23 09:02:47 +00:00
|
|
|
} PACKED_STRUCT;
|
|
|
|
|
|
|
|
/** entrance structure - one per entrance */
|
|
|
|
struct ENTRANCE_STRUC {
|
2009-10-08 21:28:57 +00:00
|
|
|
int32 eNumber; ///< entrance number
|
|
|
|
SCNHANDLE hScript; ///< handle to entrance script
|
2008-12-01 20:35:36 +00:00
|
|
|
// Tinsel 2 fields
|
|
|
|
SCNHANDLE hEntDesc; // handle to entrance description
|
|
|
|
uint32 flags;
|
2008-07-23 09:02:47 +00:00
|
|
|
} PACKED_STRUCT;
|
|
|
|
|
|
|
|
#include "common/pack-end.h" // END STRUCT PACKING
|
|
|
|
|
|
|
|
|
|
|
|
//----------------- LOCAL GLOBAL DATA --------------------
|
|
|
|
|
2010-11-16 09:53:55 +00:00
|
|
|
// FIXME: Avoid non-const global vars
|
|
|
|
|
2008-07-23 09:02:47 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
static bool ShowPosition = false; // Set when showpos() has been called
|
|
|
|
#endif
|
|
|
|
|
2009-04-29 10:37:00 +00:00
|
|
|
int sceneCtr = 0;
|
|
|
|
static int initialMyEscape;
|
|
|
|
|
2008-07-23 09:02:47 +00:00
|
|
|
static SCNHANDLE SceneHandle = 0; // Current scene handle - stored in case of Save_Scene()
|
|
|
|
|
2008-12-01 20:35:36 +00:00
|
|
|
SCENE_STRUC tempStruc;
|
|
|
|
|
|
|
|
struct TP_INIT {
|
|
|
|
SCNHANDLE hTinselCode; // Code
|
|
|
|
TINSEL_EVENT event; // Triggering event
|
|
|
|
};
|
|
|
|
|
|
|
|
const SCENE_STRUC *GetSceneStruc(const byte *pStruc) {
|
|
|
|
if (TinselVersion == TINSEL_V2)
|
|
|
|
return (const SCENE_STRUC *)pStruc;
|
|
|
|
|
|
|
|
// Copy appropriate fields into tempStruc, and return a pointer to it
|
2009-04-29 11:33:43 +00:00
|
|
|
const byte *p = pStruc;
|
2009-08-14 16:44:29 +00:00
|
|
|
memset(&tempStruc, 0, sizeof(SCENE_STRUC));
|
2008-12-01 20:35:36 +00:00
|
|
|
|
2009-04-29 11:33:43 +00:00
|
|
|
tempStruc.numEntrance = READ_UINT32(p); p += sizeof(uint32);
|
|
|
|
tempStruc.numPoly = READ_UINT32(p); p += sizeof(uint32);
|
|
|
|
tempStruc.numTaggedActor = READ_UINT32(p); p += sizeof(uint32);
|
|
|
|
tempStruc.defRefer = READ_UINT32(p); p += sizeof(uint32);
|
|
|
|
tempStruc.hSceneScript = READ_UINT32(p); p += sizeof(uint32);
|
|
|
|
tempStruc.hEntrance = READ_UINT32(p); p += sizeof(uint32);
|
|
|
|
tempStruc.hPoly = READ_UINT32(p); p += sizeof(uint32);
|
|
|
|
tempStruc.hTaggedActor = READ_UINT32(p); p += sizeof(uint32);
|
2008-12-01 20:35:36 +00:00
|
|
|
|
|
|
|
return &tempStruc;
|
|
|
|
}
|
|
|
|
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Started up for scene script and entrance script.
|
|
|
|
*/
|
2008-07-24 08:59:17 +00:00
|
|
|
static void SceneTinselProcess(CORO_PARAM, const void *param) {
|
2008-07-23 09:02:47 +00:00
|
|
|
// COROUTINE
|
|
|
|
CORO_BEGIN_CONTEXT;
|
2008-07-25 09:19:06 +00:00
|
|
|
INT_CONTEXT *pic;
|
2008-12-01 20:35:36 +00:00
|
|
|
const TP_INIT *pInit;
|
2009-04-29 10:37:00 +00:00
|
|
|
int myEscape;
|
2008-07-23 09:02:47 +00:00
|
|
|
CORO_END_CONTEXT(_ctx);
|
|
|
|
|
|
|
|
CORO_BEGIN_CODE(_ctx);
|
|
|
|
|
2009-04-29 10:37:00 +00:00
|
|
|
// The following myEscape value setting is used for enabling title screen skipping in DW1
|
|
|
|
if (TinselV1 && (sceneCtr == 1)) initialMyEscape = GetEscEvents();
|
|
|
|
_ctx->myEscape = (TinselV1 && (sceneCtr < 4)) ? initialMyEscape : 0;
|
|
|
|
|
2008-12-01 20:35:36 +00:00
|
|
|
// get the stuff copied to process when it was created
|
|
|
|
_ctx->pInit = (const TP_INIT *)param;
|
|
|
|
assert(_ctx->pInit);
|
|
|
|
assert(_ctx->pInit->hTinselCode); // Must have some code to run
|
|
|
|
|
|
|
|
_ctx->pic = InitInterpretContext(GS_SCENE,
|
|
|
|
READ_LE_UINT32(&_ctx->pInit->hTinselCode),
|
|
|
|
TinselV2 ? _ctx->pInit->event : NOEVENT,
|
|
|
|
NOPOLY, // No polygon
|
|
|
|
0, // No actor
|
|
|
|
NULL, // No object
|
2009-04-29 10:37:00 +00:00
|
|
|
_ctx->myEscape);
|
2008-07-23 09:02:47 +00:00
|
|
|
CORO_INVOKE_1(Interpret, _ctx->pic);
|
|
|
|
|
|
|
|
CORO_END_CODE;
|
|
|
|
}
|
|
|
|
|
2008-12-01 20:35:36 +00:00
|
|
|
/**
|
|
|
|
* Start up a SceneTinselProcess() running the scene
|
|
|
|
* script for various events.
|
|
|
|
*/
|
|
|
|
void SendSceneTinselProcess(TINSEL_EVENT event) {
|
|
|
|
SCENE_STRUC *ss;
|
|
|
|
|
|
|
|
if (SceneHandle != (SCNHANDLE)NULL) {
|
|
|
|
ss = (SCENE_STRUC *) FindChunk(SceneHandle, CHUNK_SCENE);
|
|
|
|
|
|
|
|
if (ss->hSceneScript) {
|
|
|
|
TP_INIT init;
|
|
|
|
|
|
|
|
init.event = event;
|
|
|
|
init.hTinselCode = ss->hSceneScript;
|
|
|
|
|
|
|
|
g_scheduler->createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
|
2011-04-10 11:26:24 +00:00
|
|
|
}
|
2008-12-01 20:35:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-23 09:02:47 +00:00
|
|
|
/**
|
|
|
|
* Get the SCENE_STRUC
|
2011-05-25 15:17:11 +00:00
|
|
|
* Initialize polygons for the scene
|
|
|
|
* Initialize the actors for this scene
|
2008-07-23 09:02:47 +00:00
|
|
|
* Run the appropriate entrance code (if any)
|
|
|
|
* Get the default refer type
|
|
|
|
*/
|
2008-12-01 20:35:36 +00:00
|
|
|
|
2008-07-23 09:02:47 +00:00
|
|
|
static void LoadScene(SCNHANDLE scene, int entry) {
|
2008-12-01 20:35:36 +00:00
|
|
|
uint i;
|
|
|
|
TP_INIT init;
|
2008-07-23 09:02:47 +00:00
|
|
|
const SCENE_STRUC *ss;
|
|
|
|
const ENTRANCE_STRUC *es;
|
|
|
|
|
2008-12-01 20:35:36 +00:00
|
|
|
// Scene handle
|
|
|
|
SceneHandle = scene; // Save scene handle in case of Save_Scene()
|
2008-07-23 09:02:47 +00:00
|
|
|
LockMem(SceneHandle); // Make sure scene is loaded
|
|
|
|
LockScene(SceneHandle); // Prevent current scene from being discarded
|
|
|
|
|
2008-12-01 20:35:36 +00:00
|
|
|
if (TinselV2) {
|
|
|
|
// CdPlay() stuff
|
|
|
|
byte *cptr = FindChunk(scene, CHUNK_CDPLAY_FILENUM);
|
|
|
|
assert(cptr);
|
|
|
|
i = READ_LE_UINT32(cptr);
|
|
|
|
assert(i < 512);
|
|
|
|
cptr = FindChunk(scene, CHUNK_CDPLAY_FILENAME);
|
|
|
|
assert(cptr);
|
|
|
|
SetCdPlaySceneDetails(i, (const char *)cptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Find scene structure
|
|
|
|
ss = GetSceneStruc(FindChunk(scene, CHUNK_SCENE));
|
2008-07-23 09:02:47 +00:00
|
|
|
assert(ss != NULL);
|
|
|
|
|
2008-12-01 20:35:36 +00:00
|
|
|
if (TinselV2) {
|
|
|
|
// Music stuff
|
|
|
|
char *cptr = (char *)FindChunk(scene, CHUNK_MUSIC_FILENAME);
|
|
|
|
assert(cptr);
|
2009-01-01 15:06:43 +00:00
|
|
|
_vm->_pcmMusic->setMusicSceneDetails(FROM_LE_32(ss->hMusicScript),
|
2008-12-01 20:35:36 +00:00
|
|
|
FROM_LE_32(ss->hMusicSegment), cptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (entry == NO_ENTRY_NUM) {
|
|
|
|
// Restoring scene
|
|
|
|
|
2011-05-25 15:17:11 +00:00
|
|
|
// Initialize all the polygons for this scene
|
2008-12-01 20:35:36 +00:00
|
|
|
InitPolygons(FROM_LE_32(ss->hPoly), FROM_LE_32(ss->numPoly), true);
|
|
|
|
|
2011-05-25 15:17:11 +00:00
|
|
|
// Initialize the actors for this scene
|
2008-12-01 20:35:36 +00:00
|
|
|
StartTaggedActors(FROM_LE_32(ss->hTaggedActor), FROM_LE_32(ss->numTaggedActor), false);
|
|
|
|
|
|
|
|
if (TinselV2)
|
|
|
|
// Returning from cutscene
|
|
|
|
SendSceneTinselProcess(RESTORE);
|
2008-07-23 09:02:47 +00:00
|
|
|
|
2008-12-01 20:35:36 +00:00
|
|
|
} else {
|
|
|
|
// Genuine new scene
|
2008-07-23 09:02:47 +00:00
|
|
|
|
2011-05-25 15:17:11 +00:00
|
|
|
// Initialize all the polygons for this scene
|
2008-12-01 20:35:36 +00:00
|
|
|
InitPolygons(FROM_LE_32(ss->hPoly), FROM_LE_32(ss->numPoly), false);
|
|
|
|
|
2011-05-25 15:17:11 +00:00
|
|
|
// Initialize the actors for this scene
|
2008-12-01 20:35:36 +00:00
|
|
|
StartTaggedActors(FROM_LE_32(ss->hTaggedActor), FROM_LE_32(ss->numTaggedActor), true);
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
// Run the appropriate entrance code (if any)
|
|
|
|
es = (const ENTRANCE_STRUC *)LockMem(FROM_LE_32(ss->hEntrance));
|
2008-12-01 20:35:36 +00:00
|
|
|
for (i = 0; i < FROM_LE_32(ss->numEntrance); i++) {
|
2008-07-23 09:02:47 +00:00
|
|
|
if (FROM_LE_32(es->eNumber) == (uint)entry) {
|
2008-12-01 20:35:36 +00:00
|
|
|
if (es->hScript) {
|
|
|
|
init.event = STARTUP;
|
|
|
|
init.hTinselCode = es->hScript;
|
|
|
|
|
|
|
|
g_scheduler->createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
|
|
|
|
}
|
2008-07-23 09:02:47 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-12-01 20:35:36 +00:00
|
|
|
|
|
|
|
// Move to next entrance
|
|
|
|
if (TinselV2)
|
|
|
|
++es;
|
|
|
|
else
|
|
|
|
es = (const ENTRANCE_STRUC *)((const byte *)es + 8);
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2008-07-23 09:02:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (i == FROM_LE_32(ss->numEntrance))
|
|
|
|
error("Non-existant scene entry number");
|
|
|
|
|
2008-12-01 20:35:36 +00:00
|
|
|
if (ss->hSceneScript) {
|
|
|
|
init.event = STARTUP;
|
|
|
|
init.hTinselCode = ss->hSceneScript;
|
|
|
|
|
|
|
|
g_scheduler->createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
|
|
|
|
}
|
2008-07-23 09:02:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Default refer type
|
|
|
|
SetDefaultRefer(FROM_LE_32(ss->defRefer));
|
2008-12-01 20:35:36 +00:00
|
|
|
|
|
|
|
// Scene's processes
|
|
|
|
SceneProcesses(FROM_LE_32(ss->numProcess), FROM_LE_32(ss->hProcess));
|
2008-07-23 09:02:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wrap up the last scene.
|
|
|
|
*/
|
2009-11-02 21:54:57 +00:00
|
|
|
void EndScene() {
|
2008-07-23 09:02:47 +00:00
|
|
|
if (SceneHandle != 0) {
|
|
|
|
UnlockScene(SceneHandle);
|
|
|
|
SceneHandle = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
KillInventory(); // Close down any open inventory
|
|
|
|
|
|
|
|
DropPolygons(); // No polygons
|
2008-12-01 20:35:36 +00:00
|
|
|
DropScroll(); // No no-scrolls
|
2008-07-23 09:02:47 +00:00
|
|
|
DropBackground(); // No background
|
2008-12-01 20:35:36 +00:00
|
|
|
DropMovers(); // No moving actors
|
2008-07-23 09:02:47 +00:00
|
|
|
DropCursor(); // No cursor
|
|
|
|
DropActors(); // No actor reels running
|
|
|
|
FreeAllTokens(); // No-one has tokens
|
|
|
|
FreeMostInterpretContexts(); // Only master script still interpreting
|
|
|
|
|
2008-12-01 20:35:36 +00:00
|
|
|
if (TinselV2) {
|
|
|
|
SetSysVar(ISV_DIVERT_ACTOR, 0);
|
|
|
|
SetSysVar(ISV_GHOST_ACTOR, 0);
|
|
|
|
SetSysVar(SV_MinimumXoffset, 0);
|
|
|
|
SetSysVar(SV_MaximumXoffset, 0);
|
|
|
|
SetSysVar(SV_MinimumYoffset, 0);
|
|
|
|
SetSysVar(SV_MaximumYoffset, 0);
|
|
|
|
ResetFontHandles();
|
|
|
|
NoSoundReels();
|
|
|
|
}
|
|
|
|
|
2008-07-23 09:02:47 +00:00
|
|
|
_vm->_sound->stopAllSamples(); // Kill off any still-running sample
|
2009-01-12 15:51:11 +00:00
|
|
|
//_vm->_mixer->stopAll();
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
// init the palette manager
|
|
|
|
ResetPalAllocator();
|
|
|
|
|
|
|
|
// init the object manager
|
|
|
|
KillAllObjects();
|
|
|
|
|
|
|
|
// kill all destructable process
|
2008-07-24 08:59:17 +00:00
|
|
|
g_scheduler->killMatchingProcess(PID_DESTROY, PID_DESTROY);
|
2008-07-23 09:02:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2009-11-02 21:54:57 +00:00
|
|
|
void PrimeBackground() {
|
2008-07-23 09:02:47 +00:00
|
|
|
// structure for playfields
|
2010-11-16 09:53:55 +00:00
|
|
|
// FIXME: Avoid non-const global vars
|
|
|
|
// TODO: We should simply merge this function with InitBackground
|
|
|
|
// in order to avoid the static var and the problems associate
|
|
|
|
// with it.
|
2008-07-23 09:02:47 +00:00
|
|
|
static PLAYFIELD playfield[] = {
|
|
|
|
{ // FIELD WORLD
|
|
|
|
NULL, // display list
|
|
|
|
0, // init field x
|
|
|
|
0, // init field y
|
|
|
|
0, // x vel
|
|
|
|
0, // y vel
|
|
|
|
Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), // clip rect
|
|
|
|
false // moved flag
|
|
|
|
},
|
|
|
|
{ // FIELD STATUS
|
|
|
|
NULL, // display list
|
|
|
|
0, // init field x
|
|
|
|
0, // init field y
|
|
|
|
0, // x vel
|
|
|
|
0, // y vel
|
|
|
|
Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), // clip rect
|
|
|
|
false // moved flag
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// structure for background
|
2010-11-16 09:53:55 +00:00
|
|
|
static const BACKGND backgnd = {
|
2011-04-14 12:12:27 +00:00
|
|
|
BLACK, // sky color
|
2008-07-23 09:02:47 +00:00
|
|
|
Common::Point(0, 0), // initial world pos
|
|
|
|
Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), // scroll limits
|
|
|
|
0, // no background update process
|
|
|
|
NULL, // no x scroll table
|
|
|
|
NULL, // no y scroll table
|
|
|
|
2, // 2 playfields
|
|
|
|
playfield, // playfield pointer
|
|
|
|
false // no auto-erase
|
|
|
|
};
|
|
|
|
|
|
|
|
InitBackground(&backgnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Start up the standard stuff for the next scene.
|
|
|
|
*/
|
|
|
|
|
2009-11-02 21:54:57 +00:00
|
|
|
void PrimeScene() {
|
2008-12-01 20:35:36 +00:00
|
|
|
SetNoBlocking(false);
|
|
|
|
SetSysVar(SYS_SceneFxDimFactor, SysVar(SYS_DefaultFxDimFactor));
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
RestartCursor(); // Restart the cursor
|
2008-12-01 20:35:36 +00:00
|
|
|
if (!TinselV2)
|
|
|
|
EnableTags(); // Next scene with tags enabled
|
2008-07-23 09:02:47 +00:00
|
|
|
|
2008-07-24 08:59:17 +00:00
|
|
|
g_scheduler->createProcess(PID_SCROLL, ScrollProcess, NULL, 0);
|
|
|
|
g_scheduler->createProcess(PID_SCROLL, EffectPolyProcess, NULL, 0);
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (ShowPosition)
|
2008-07-24 08:59:17 +00:00
|
|
|
g_scheduler->createProcess(PID_POSITION, CursorPositionProcess, NULL, 0);
|
2008-07-23 09:02:47 +00:00
|
|
|
#endif
|
|
|
|
|
2008-07-24 08:59:17 +00:00
|
|
|
g_scheduler->createProcess(PID_TAG, TagProcess, NULL, 0);
|
|
|
|
g_scheduler->createProcess(PID_TAG, PointProcess, NULL, 0);
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
// init the current background
|
|
|
|
PrimeBackground();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wrap up the last scene and start up the next scene.
|
|
|
|
*/
|
|
|
|
|
2008-12-01 20:35:36 +00:00
|
|
|
void StartNewScene(SCNHANDLE scene, int entry) {
|
2008-07-23 09:02:47 +00:00
|
|
|
EndScene(); // Wrap up the last scene.
|
|
|
|
|
2008-12-01 20:35:36 +00:00
|
|
|
if (TinselV2) {
|
|
|
|
TouchMoverReels();
|
|
|
|
|
|
|
|
LockMem(scene); // Do CD change before PrimeScene
|
|
|
|
}
|
|
|
|
|
2008-07-23 09:02:47 +00:00
|
|
|
PrimeScene(); // Start up the standard stuff for the next scene.
|
|
|
|
|
|
|
|
LoadScene(scene, entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
/**
|
|
|
|
* Sets the ShowPosition flag, causing the cursor position process to be
|
|
|
|
* created in each scene.
|
|
|
|
*/
|
|
|
|
|
2009-11-02 21:54:57 +00:00
|
|
|
void setshowpos() {
|
2008-07-23 09:02:47 +00:00
|
|
|
ShowPosition = true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the current scene handle.
|
|
|
|
*/
|
|
|
|
|
2009-11-02 21:54:57 +00:00
|
|
|
SCNHANDLE GetSceneHandle() {
|
2008-07-23 09:02:47 +00:00
|
|
|
return SceneHandle;
|
|
|
|
}
|
|
|
|
|
2008-12-01 20:35:36 +00:00
|
|
|
/**
|
|
|
|
* DoHailScene
|
|
|
|
*/
|
|
|
|
|
|
|
|
void DoHailScene(SCNHANDLE scene) {
|
|
|
|
// Find scene structure
|
|
|
|
const SCENE_STRUC *ss = GetSceneStruc(FindChunk(scene, CHUNK_SCENE));
|
|
|
|
|
|
|
|
if (ss != NULL && ss->hSceneScript) {
|
|
|
|
TP_INIT init;
|
|
|
|
|
|
|
|
init.event = NOEVENT;
|
|
|
|
init.hTinselCode = ss->hSceneScript;
|
|
|
|
|
|
|
|
g_scheduler->createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WrapScene
|
|
|
|
*/
|
2009-11-02 21:54:57 +00:00
|
|
|
void WrapScene() {
|
2008-12-01 20:35:36 +00:00
|
|
|
SendSceneTinselProcess(CLOSEDOWN);
|
|
|
|
}
|
|
|
|
|
2009-10-04 21:26:33 +00:00
|
|
|
} // End of namespace Tinsel
|