mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
TINSEL: Simplify the scene entrance handling code
This also reverts the rest of the BE resource handling code
This commit is contained in:
+24
-25
@@ -86,8 +86,8 @@ struct SCENE_STRUC {
|
||||
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
|
||||
SCNHANDLE hMusicScript; // handle to music script data - Tinsel 2 only
|
||||
SCNHANDLE hMusicSegment;// handle to music segments - Tinsel 2 only
|
||||
} PACKED_STRUCT;
|
||||
|
||||
/** entrance structure - one per entrance */
|
||||
@@ -130,15 +130,15 @@ const SCENE_STRUC *GetSceneStruc(const byte *pStruc) {
|
||||
const byte *p = pStruc;
|
||||
memset(&g_tempStruc, 0, sizeof(SCENE_STRUC));
|
||||
|
||||
g_tempStruc.numEntrance = READ_UINT32(p); p += sizeof(uint32);
|
||||
g_tempStruc.numPoly = READ_UINT32(p); p += sizeof(uint32);
|
||||
g_tempStruc.numTaggedActor = READ_UINT32(p); p += sizeof(uint32);
|
||||
g_tempStruc.defRefer = READ_UINT32(p); p += sizeof(uint32);
|
||||
g_tempStruc.hSceneScript = READ_UINT32(p); p += sizeof(uint32);
|
||||
g_tempStruc.hEntrance = READ_UINT32(p); p += sizeof(uint32);
|
||||
g_tempStruc.hPoly = READ_UINT32(p); p += sizeof(uint32);
|
||||
g_tempStruc.hTaggedActor = READ_UINT32(p); p += sizeof(uint32);
|
||||
|
||||
g_tempStruc.numEntrance = FROM_LE_32(READ_LE_UINT32(p)); p += sizeof(uint32);
|
||||
g_tempStruc.numPoly = FROM_LE_32(READ_LE_UINT32(p)); p += sizeof(uint32);
|
||||
g_tempStruc.numTaggedActor = FROM_LE_32(READ_LE_UINT32(p)); p += sizeof(uint32);
|
||||
g_tempStruc.defRefer = FROM_LE_32(READ_LE_UINT32(p)); p += sizeof(uint32);
|
||||
g_tempStruc.hSceneScript = FROM_LE_32(READ_LE_UINT32(p)); p += sizeof(uint32);
|
||||
g_tempStruc.hEntrance = FROM_LE_32(READ_LE_UINT32(p)); p += sizeof(uint32);
|
||||
g_tempStruc.hPoly = FROM_LE_32(READ_LE_UINT32(p)); p += sizeof(uint32);
|
||||
g_tempStruc.hTaggedActor = FROM_LE_32(READ_LE_UINT32(p)); p += sizeof(uint32);
|
||||
|
||||
return &g_tempStruc;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ static void SceneTinselProcess(CORO_PARAM, const void *param) {
|
||||
assert(_ctx->pInit->hTinselCode); // Must have some code to run
|
||||
|
||||
_ctx->pic = InitInterpretContext(GS_SCENE,
|
||||
READ_32(&_ctx->pInit->hTinselCode),
|
||||
_ctx->pInit->hTinselCode,
|
||||
TinselV2 ? _ctx->pInit->event : NOEVENT,
|
||||
NOPOLY, // No polygon
|
||||
0, // No actor
|
||||
@@ -209,7 +209,7 @@ void SendSceneTinselProcess(TINSEL_EVENT event) {
|
||||
*/
|
||||
|
||||
static void LoadScene(SCNHANDLE scene, int entry) {
|
||||
uint i;
|
||||
int32 i;
|
||||
TP_INIT init;
|
||||
const SCENE_STRUC *ss;
|
||||
const ENTRANCE_STRUC *es;
|
||||
@@ -238,18 +238,17 @@ static void LoadScene(SCNHANDLE scene, int entry) {
|
||||
// Music stuff
|
||||
char *cptr = (char *)FindChunk(scene, CHUNK_MUSIC_FILENAME);
|
||||
assert(cptr);
|
||||
_vm->_pcmMusic->setMusicSceneDetails(FROM_LE_32(ss->hMusicScript),
|
||||
FROM_LE_32(ss->hMusicSegment), cptr);
|
||||
_vm->_pcmMusic->setMusicSceneDetails(ss->hMusicScript, ss->hMusicSegment, cptr);
|
||||
}
|
||||
|
||||
if (entry == NO_ENTRY_NUM) {
|
||||
// Restoring scene
|
||||
|
||||
// Initialize all the polygons for this scene
|
||||
InitPolygons(FROM_LE_32(ss->hPoly), FROM_LE_32(ss->numPoly), true);
|
||||
InitPolygons(ss->hPoly, ss->numPoly, true);
|
||||
|
||||
// Initialize the actors for this scene
|
||||
StartTaggedActors(FROM_LE_32(ss->hTaggedActor), FROM_LE_32(ss->numTaggedActor), false);
|
||||
StartTaggedActors(ss->hTaggedActor, ss->numTaggedActor, false);
|
||||
|
||||
if (TinselV2)
|
||||
// Returning from cutscene
|
||||
@@ -259,18 +258,18 @@ static void LoadScene(SCNHANDLE scene, int entry) {
|
||||
// Genuine new scene
|
||||
|
||||
// Initialize all the polygons for this scene
|
||||
InitPolygons(FROM_LE_32(ss->hPoly), FROM_LE_32(ss->numPoly), false);
|
||||
InitPolygons(ss->hPoly, ss->numPoly, false);
|
||||
|
||||
// Initialize the actors for this scene
|
||||
StartTaggedActors(FROM_LE_32(ss->hTaggedActor), FROM_LE_32(ss->numTaggedActor), true);
|
||||
StartTaggedActors(ss->hTaggedActor, ss->numTaggedActor, true);
|
||||
|
||||
// Run the appropriate entrance code (if any)
|
||||
es = (const ENTRANCE_STRUC *)LockMem(FROM_32(ss->hEntrance));
|
||||
for (i = 0; i < FROM_32(ss->numEntrance); i++) {
|
||||
es = (const ENTRANCE_STRUC *)LockMem(ss->hEntrance);
|
||||
for (i = 0; i < ss->numEntrance; i++) {
|
||||
if (FROM_LE_32(es->eNumber) == (uint)entry) {
|
||||
if (es->hScript) {
|
||||
init.event = STARTUP;
|
||||
init.hTinselCode = es->hScript;
|
||||
init.hTinselCode = FROM_LE_32(es->hScript);
|
||||
|
||||
CoroScheduler.createProcess(PID_TCODE, SceneTinselProcess, &init, sizeof(init));
|
||||
}
|
||||
@@ -285,7 +284,7 @@ static void LoadScene(SCNHANDLE scene, int entry) {
|
||||
|
||||
}
|
||||
|
||||
if (i == FROM_LE_32(ss->numEntrance))
|
||||
if (i == ss->numEntrance)
|
||||
error("Non-existant scene entry number");
|
||||
|
||||
if (ss->hSceneScript) {
|
||||
@@ -297,10 +296,10 @@ static void LoadScene(SCNHANDLE scene, int entry) {
|
||||
}
|
||||
|
||||
// Default refer type
|
||||
SetDefaultRefer(FROM_LE_32(ss->defRefer));
|
||||
SetDefaultRefer(ss->defRefer);
|
||||
|
||||
// Scene's processes
|
||||
SceneProcesses(FROM_LE_32(ss->numProcess), FROM_LE_32(ss->hProcess));
|
||||
SceneProcesses(ss->numProcess, ss->hProcess);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -133,11 +133,6 @@ typedef bool (*KEYFPTR)(const Common::KeyState &);
|
||||
#define TinselV1PSX (TinselVersion == TINSEL_V1 && _vm->getPlatform() == Common::kPlatformPSX)
|
||||
#define TinselV1Mac (TinselVersion == TINSEL_V1 && _vm->getPlatform() == Common::kPlatformMacintosh)
|
||||
|
||||
#define READ_16(v) (TinselV1Mac ? READ_BE_UINT16(v) : READ_LE_UINT16(v))
|
||||
#define READ_32(v) (TinselV1Mac ? READ_BE_UINT32(v) : READ_LE_UINT32(v))
|
||||
#define FROM_16(v) (TinselV1Mac ? FROM_BE_16(v) : FROM_LE_16(v))
|
||||
#define FROM_32(v) (TinselV1Mac ? FROM_BE_32(v) : FROM_LE_32(v))
|
||||
|
||||
// Global reference to the TinselEngine object
|
||||
extern TinselEngine *_vm;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user