Cutscene Documentation (z_eventmgr.c OK) (#1164)

* begin cutscene docs

* more docs

* more docs

* z_eventmgr.c OK

Co-authored-by: Thar0 <Thar0@users.noreply.github.com>

* cutscene camera

* commands WIP

* more docs

* merge master

* csId, oof

* more cleanup

* more docs, csCam

* more cleanup

* more docs

* more

* cleanup functions.h

* better misc cmd docs

* apply discord discussions

* small adjustment

* more cleanup

* more docs

* more cleanup

* more cs cam docs

* small fix

* cmd cleanup

* small cleanup

* better match, thanks anon

* remove last return

* PR suggestions, small cleanup

* next PR review

* rm internal funcs from functions.h

* more PR

* add comment

* csCam interp typedef handler

* cleanup, scene cmd

* missed an enum use

* ActorCutscene -> CutsceneManager, PR Suggestions

* more PR Suggestions

* more actorCutscene cleanup

* R_USE_DEBUG_CUTSCENE

* more small docs

* move functions to cutscene.h

* PlayerCsId

* fix bss

* missed some function headers

* more scene cleanup

* more scene cleanup

* missed one

* CS_SPAWN_FLAGS

* wrong usage of macro

* more cleanup

* name last cs transition types

* IsNext bool

* update namefixer

* fix namefixer

* more cleanup

* add comment

* fixed enums for motion blur

* consistent cutscene lists

* cutscene entry func consistent

* PR Suggestion

* fig review

* fix additionalCsId name in actor

* more pr review

* bss

---------

Co-authored-by: Thar0 <Thar0@users.noreply.github.com>
Co-authored-by: angie <angheloalf95@gmail.com>
This commit is contained in:
engineer124
2023-04-20 03:52:00 +10:00
committed by GitHub
parent 543c38ae06
commit 9d25fad407
390 changed files with 7327 additions and 5600 deletions
+380
View File
@@ -0,0 +1,380 @@
#include "global.h"
extern CutsceneCamera* sCurCsCamera;
typedef s16 (*CsCamInterpolateCallback)(Vec3f*, f32*, s16*, CsCmdCamPoint*, CsCmdCamMisc*, CutsceneCameraInterp*);
// function declarations
s16 func_80161180(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc,
CutsceneCameraInterp* interp);
s16 func_8016237C(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc,
CutsceneCameraInterp* interp);
s16 func_8016253C(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc,
CutsceneCameraInterp* interp);
s16 func_80162A50(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc,
CutsceneCameraInterp* interp);
s16 func_801623E4(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc,
CutsceneCameraInterp* interp);
s16 func_80161C20(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc,
CutsceneCameraInterp* interp);
s16 func_80161E4C(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc,
CutsceneCameraInterp* interp);
s16 func_801620CC(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc,
CutsceneCameraInterp* interp);
s16 func_80163334(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc,
CutsceneCameraInterp* interp);
f32 func_80163660(Actor* actor);
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80161180.s")
/**
* Initializes Cutscene Camera Info
*/
s32 CutsceneCamera_Init(Camera* camera, CutsceneCamera* csCamera) {
csCamera->camera = camera;
csCamera->nextSplineTimer = csCamera->updateSplineTimer = 0;
csCamera->cmdIndex = 0;
csCamera->splineIndex = 0xFFFF;
csCamera->splineNeedsInit = true;
csCamera->state = CS_CAM_STATE_UPDATE_ALL;
sCurCsCamera = csCamera;
__osMemset(&csCamera->eyeInterp, 0, sizeof(CutsceneCameraInterp));
__osMemset(&csCamera->atInterp, 0, sizeof(CutsceneCameraInterp));
csCamera->eyeInterp.unk_2D = csCamera->atInterp.unk_2D = 7;
return 1;
}
CsCamInterpolateCallback CutsceneCamera_Interpolate(u8 interpType) {
switch (interpType) {
case CS_CAM_INTERP_7:
default:
return func_80161180;
case CS_CAM_INTERP_0:
return func_8016237C;
case CS_CAM_INTERP_5:
return func_8016253C;
case CS_CAM_INTERP_4:
return func_80162A50;
case CS_CAM_INTERP_1:
return func_801623E4;
case CS_CAM_INTERP_2:
return func_80161C20;
case CS_CAM_INTERP_3:
return func_80161E4C;
case CS_CAM_INTERP_6:
return func_801620CC;
}
}
u8 CutsceneCamera_ProcessSpline(CutsceneCamera* csCamera) {
s32 sp5C;
f32* fov;
s16* roll;
CsCamInterpolateCallback interpHandler;
Player* player;
Actor* target;
s16 numPoints;
sp5C = true;
if (csCamera->state == CS_CAM_STATE_DONE_SPLINE) {
return false;
}
player = GET_PLAYER(csCamera->camera->play);
target = csCamera->camera->target;
if (csCamera->eyeCmd[csCamera->atInterp.curPoint].interpType <
csCamera->atCmd[csCamera->eyeInterp.curPoint].interpType) {
sp5C = false;
}
csCamera->eyeInterp.unk_00 = csCamera->camera->eye;
csCamera->atInterp.unk_00 = csCamera->camera->at;
if (sp5C) {
fov = NULL;
} else {
fov = &csCamera->camera->fov;
}
if (sp5C) {
roll = NULL;
} else {
roll = &csCamera->camera->roll;
}
interpHandler = CutsceneCamera_Interpolate(csCamera->atCmd[csCamera->eyeInterp.curPoint].interpType);
switch (csCamera->atCmd[csCamera->eyeInterp.curPoint].relativeTo) {
case CS_CAM_REL_2:
OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 2);
break;
case CS_CAM_REL_3:
OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 1);
break;
case CS_CAM_REL_1:
OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 1);
break;
case CS_CAM_REL_4:
OLib_DbCameraVec3fDiff(&target->world, &csCamera->camera->at, &csCamera->camera->at, 1);
break;
case CS_CAM_REL_5:
OLib_DbCameraVec3fDiff(&target->world, &csCamera->camera->at, &csCamera->camera->at, 2);
break;
default: // CS_CAM_REL_0
break;
}
numPoints = interpHandler(&csCamera->camera->at, fov, roll, &csCamera->atCmd[csCamera->eyeInterp.curPoint],
&csCamera->miscCmd[csCamera->eyeInterp.curPoint], &csCamera->eyeInterp);
switch (csCamera->atCmd[csCamera->eyeInterp.curPoint].relativeTo) {
case CS_CAM_REL_2:
OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 2);
break;
case CS_CAM_REL_3:
OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 1);
csCamera->camera->at.y += func_80163660(&player->actor);
break;
case CS_CAM_REL_1:
OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 1);
break;
case CS_CAM_REL_4:
OLib_DbCameraVec3fSum(&target->world, &csCamera->camera->at, &csCamera->camera->at, 1);
break;
case CS_CAM_REL_5:
OLib_DbCameraVec3fSum(&target->world, &csCamera->camera->at, &csCamera->camera->at, 2);
break;
default: // CS_CAM_REL_0
break;
}
csCamera->eyeInterp.curPoint += numPoints;
if (sp5C) {
fov = &csCamera->camera->fov;
} else {
fov = NULL;
}
if (sp5C) {
roll = &csCamera->camera->roll;
} else {
roll = NULL;
}
interpHandler = CutsceneCamera_Interpolate(csCamera->eyeCmd[csCamera->atInterp.curPoint].interpType);
switch (csCamera->eyeCmd[csCamera->atInterp.curPoint].relativeTo) {
case CS_CAM_REL_2:
OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 2);
break;
case CS_CAM_REL_3:
OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 1);
break;
case CS_CAM_REL_1:
OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 1);
break;
case CS_CAM_REL_4:
OLib_DbCameraVec3fDiff(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, 1);
break;
case CS_CAM_REL_5:
OLib_DbCameraVec3fDiff(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, 2);
break;
default: // CS_CAM_REL_0
break;
}
numPoints = interpHandler(&csCamera->camera->eye, fov, roll, &csCamera->eyeCmd[csCamera->atInterp.curPoint],
&csCamera->miscCmd[csCamera->atInterp.curPoint], &csCamera->atInterp);
switch (csCamera->eyeCmd[csCamera->atInterp.curPoint].relativeTo) {
case CS_CAM_REL_2:
OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 2);
break;
case CS_CAM_REL_3:
OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 1);
csCamera->camera->eye.y += func_80163660(&player->actor);
break;
case CS_CAM_REL_1:
OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 1);
break;
case CS_CAM_REL_4:
OLib_DbCameraVec3fSum(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, 1);
break;
case CS_CAM_REL_5:
OLib_DbCameraVec3fSum(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, 2);
break;
default: // CS_CAM_REL_0
break;
}
csCamera->atInterp.curPoint += numPoints;
if ((csCamera->eyeInterp.curPoint >= csCamera->eyeInterp.numEntries) ||
(csCamera->atInterp.curPoint >= csCamera->atInterp.numEntries)) {
return false;
}
return true;
}
/**
* Processes camera cutscene commands
*/
s32 CutsceneCamera_UpdateSplines(u8* script, CutsceneCamera* csCamera) {
CsCmdCamSpline* spline;
switch (csCamera->state) {
case CS_CAM_STATE_DONE:
return 0;
case CS_CAM_STATE_PAUSE:
return csCamera->nextSplineTimer;
case CS_CAM_STATE_UPDATE_SPLINE:
if (csCamera->updateSplineTimer <= csCamera->duration) {
csCamera->updateSplineTimer++;
if (csCamera->updateSplineTimer <= csCamera->duration) {
// Process Spline
if (!CutsceneCamera_ProcessSpline(csCamera)) {
csCamera->state = CS_CAM_STATE_DONE_SPLINE;
}
}
}
break;
case CS_CAM_STATE_DONE_SPLINE:
break;
default: // CS_CAM_STATE_UPDATE_ALL
if (csCamera->splineNeedsInit == true) {
// Spline Header
spline = (CsCmdCamSpline*)&script[csCamera->cmdIndex];
csCamera->atInterp.numEntries = csCamera->eyeInterp.numEntries = spline->numEntries;
csCamera->duration = spline->duration;
csCamera->cmdIndex += sizeof(CsCmdCamSpline);
// At Point
csCamera->atCmd = (CsCmdCamPoint*)&script[csCamera->cmdIndex];
csCamera->cmdIndex += (s16)(csCamera->eyeInterp.numEntries * sizeof(CsCmdCamPoint));
// Misc Point
csCamera->eyeCmd = (CsCmdCamPoint*)&script[csCamera->cmdIndex];
csCamera->cmdIndex += (s16)(csCamera->eyeInterp.numEntries * sizeof(CsCmdCamPoint));
// Misc
csCamera->miscCmd = (CsCmdCamMisc*)&script[csCamera->cmdIndex];
csCamera->cmdIndex += (s16)(csCamera->eyeInterp.numEntries * sizeof(CsCmdCamMisc));
// Other Params
csCamera->eyeInterp.curPoint = 0;
csCamera->atInterp.curPoint = 0;
csCamera->splineNeedsInit = false;
//! FAKE: csCamera->splineIndex++;
csCamera->splineIndex = (csCamera->splineIndex & 0xFFFF) + 1;
csCamera->state = CS_CAM_STATE_UPDATE_ALL;
csCamera->nextSplineTimer = csCamera->updateSplineTimer = 0;
csCamera->eyeInterp.unk_2D = csCamera->atInterp.unk_2D = 7;
}
csCamera->nextSplineTimer++;
if (csCamera->updateSplineTimer <= csCamera->duration) {
csCamera->updateSplineTimer++;
if (csCamera->updateSplineTimer <= csCamera->duration) {
// Process SubCommands
if (!CutsceneCamera_ProcessSpline(csCamera)) {
csCamera->state = CS_CAM_STATE_DONE_SPLINE;
}
}
}
break;
}
if (csCamera->nextSplineTimer > csCamera->duration) {
// Next Spline
csCamera->splineNeedsInit = true;
spline = (CsCmdCamSpline*)&script[csCamera->cmdIndex];
if (spline->numEntries == -1) {
csCamera->state = CS_CAM_STATE_DONE;
return 0;
}
}
return csCamera->nextSplineTimer;
}
// Unused
s16 func_80161BAC(void) {
return (sCurCsCamera->state == CS_CAM_STATE_PAUSE) || (sCurCsCamera->state == CS_CAM_STATE_UPDATE_SPLINE);
}
void CutsceneCamera_SetState(s16 state) {
if (sCurCsCamera->state == CS_CAM_STATE_UPDATE_ALL) {
sCurCsCamera->state = state;
}
}
void CutsceneCamera_Reset(void) {
sCurCsCamera->state = CS_CAM_STATE_UPDATE_ALL;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80161C20.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80161E4C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_801620CC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_8016237C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_801623E4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_801624EC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_8016253C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_801629BC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80162A50.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80162FF8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_801631DC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80163334.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80163660.s")
-43
View File
@@ -1,43 +0,0 @@
#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161180.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_8016119C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_8016122C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_801612B8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161998.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161BAC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161BE0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161C0C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161C20.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161E4C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_801620CC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_8016237C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_801623E4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_801624EC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_8016253C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_801629BC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80162A50.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80162FF8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_801631DC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80163334.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80163660.s")
+13 -13
View File
@@ -1371,7 +1371,7 @@ void func_800B722C(GameState* gameState, Player* player) {
s32 func_800B724C(PlayState* play, Actor* actor, u8 csMode) {
Player* player = GET_PLAYER(play);
if ((player->csMode == PLAYER_CSMODE_5) || ((csMode == PLAYER_CSMODE_6) && (player->csMode == PLAYER_CSMODE_0))) {
if ((player->csMode == PLAYER_CSMODE_5) || ((csMode == PLAYER_CSMODE_END) && (player->csMode == PLAYER_CSMODE_0))) {
return false;
}
@@ -1880,7 +1880,7 @@ s32 func_800B8500(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, Player
player->talkActorDistance = actor->xzDistToPlayer;
player->exchangeItemId = exchangeItemId;
ActorCutscene_SetIntentToPlay(0x7C);
CutsceneManager_Queue(CS_ID_GLOBAL_TALK);
return true;
}
@@ -2048,7 +2048,7 @@ s32 Actor_OfferGetItem(Actor* actor, PlayState* play, GetItemId getItemId, f32 x
player->getItemDirection = absYawDiff;
if ((getItemId > GI_NONE) && (getItemId < GI_MAX)) {
ActorCutscene_SetIntentToPlay(play->playerActorCsIds[1]);
CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_ITEM_GET]);
}
return true;
@@ -2123,7 +2123,7 @@ s32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide) {
PLAYER_STATE1_40000 | PLAYER_STATE1_80000 | PLAYER_STATE1_100000 | PLAYER_STATE1_200000))) {
player->rideActor = horse;
player->mountSide = mountSide;
ActorCutscene_SetIntentToPlay(0x7C);
CutsceneManager_Queue(CS_ID_GLOBAL_TALK);
return true;
}
@@ -3126,8 +3126,8 @@ void Actor_FreeOverlay(ActorOverlay* entry) {
Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX,
s16 rotY, s16 rotZ, s32 params) {
return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params, -1,
HALFDAYBIT_ALL, NULL);
return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params,
CS_ID_NONE, HALFDAYBIT_ALL, NULL);
}
ActorInit* Actor_LoadOverlay(ActorContext* actorCtx, s16 index) {
@@ -3171,7 +3171,7 @@ ActorInit* Actor_LoadOverlay(ActorContext* actorCtx, s16 index) {
}
Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s16 index, f32 x, f32 y, f32 z, s16 rotX,
s16 rotY, s16 rotZ, s32 params, u32 cutscene, u32 halfDaysBits, Actor* parent) {
s16 rotY, s16 rotZ, s32 params, u32 csId, u32 halfDaysBits, Actor* parent) {
s32 pad;
Actor* actor;
ActorInit* actorInit;
@@ -3237,10 +3237,10 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1
actor->home.rot.y = rotY;
actor->home.rot.z = rotZ;
actor->params = params & 0xFFFF;
actor->cutscene = (cutscene & 0x7F);
actor->csId = csId & 0x7F;
if (actor->cutscene == 0x7F) {
actor->cutscene = -1;
if (actor->csId == 0x7F) {
actor->csId = CS_ID_NONE;
}
if (halfDaysBits != 0) {
@@ -3263,8 +3263,8 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1
Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play, s16 actorId, f32 posX, f32 posY,
f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s32 params) {
return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params, -1,
parent->halfDaysBits, parent);
return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params,
CS_ID_NONE, parent->halfDaysBits, parent);
}
void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx) {
@@ -4404,7 +4404,7 @@ s16 func_800BDB6C(Actor* actor, PlayState* play, s16 arg2, f32 arg3) {
Player* player = GET_PLAYER(play);
f32 phi_f2;
if ((play->csCtx.state != CS_STATE_0) || gDbgCamEnabled) {
if ((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) {
phi_f2 = Math_Vec3f_DistXYZ(&actor->world.pos, &play->view.eye) * 0.25f;
} else {
phi_f2 = Math_Vec3f_DistXYZ(&actor->world.pos, &player->actor.world.pos);
+25 -25
View File
@@ -3613,31 +3613,31 @@ CameraSetting sCameraSettings[] = {
};
s16 sGlobalCamDataSettings[] = {
/* -25 */ CAM_SET_ELEGY_SHELL,
/* -24 */ CAM_SET_SIDED,
/* -23 */ CAM_SET_BOAT_CRUISE,
/* -22 */ CAM_SET_NONE,
/* -21 */ CAM_SET_SUBJECTD,
/* -20 */ CAM_SET_NORMALD,
/* -19 */ CAM_SET_NONE,
/* -18 */ CAM_SET_NONE,
/* -17 */ CAM_SET_NONE,
/* -16 */ CAM_SET_WARP_PAD_ENTRANCE,
/* -15 */ CAM_SET_ATTENTION,
/* -14 */ CAM_SET_CONNECT0,
/* -13 */ CAM_SET_REMOTEBOMB,
/* -12 */ CAM_SET_NONE,
/* -11 */ CAM_SET_MASK_TRANSFORMATION,
/* -10 */ CAM_SET_LONG_CHEST_OPENING,
/* -9 */ CAM_SET_REBIRTH,
/* -8 */ CAM_SET_DEATH,
/* -7 */ CAM_SET_WARP_PAD_MOON,
/* -6 */ CAM_SET_NAVI,
/* -5 */ CAM_SET_ITEM3,
/* -4 */ CAM_SET_ITEM2,
/* -3 */ CAM_SET_ITEM1,
/* -2 */ CAM_SET_ITEM0,
/* -1 */ CAM_SET_STOP0,
/* -25 */ CAM_SET_ELEGY_SHELL, // CS_CAM_ID_GLOBAL_ELEGY
/* -24 */ CAM_SET_SIDED, // CS_CAM_ID_GLOBAL_SIDED
/* -23 */ CAM_SET_BOAT_CRUISE, // CS_CAM_ID_GLOBAL_BOAT_CRUISE
/* -22 */ CAM_SET_NONE, // CS_CAM_ID_GLOBAL_N16
/* -21 */ CAM_SET_SUBJECTD, // CS_CAM_ID_GLOBAL_SUBJECTD
/* -20 */ CAM_SET_NORMALD, // CS_CAM_ID_GLOBAL_NORMALD
/* -19 */ CAM_SET_NONE, // CS_CAM_ID_GLOBAL_N13
/* -18 */ CAM_SET_NONE, // CS_CAM_ID_GLOBAL_N12
/* -17 */ CAM_SET_NONE, // CS_CAM_ID_GLOBAL_N11
/* -16 */ CAM_SET_WARP_PAD_ENTRANCE, // CS_CAM_ID_GLOBAL_WARP_PAD_ENTRANCE
/* -15 */ CAM_SET_ATTENTION, // CS_CAM_ID_GLOBAL_ATTENTION
/* -14 */ CAM_SET_CONNECT0, // CS_CAM_ID_GLOBAL_CONNECT
/* -13 */ CAM_SET_REMOTEBOMB, // CS_CAM_ID_GLOBAL_REMOTE_BOMB
/* -12 */ CAM_SET_NONE, // CS_CAM_ID_GLOBAL_N0C
/* -11 */ CAM_SET_MASK_TRANSFORMATION, // CS_CAM_ID_GLOBAL_MASK_TRANSFORMATION
/* -10 */ CAM_SET_LONG_CHEST_OPENING, // CS_CAM_ID_GLOBAL_LONG_CHEST_OPENING
/* -9 */ CAM_SET_REBIRTH, // CS_CAM_ID_GLOBAL_REVIVE
/* -8 */ CAM_SET_DEATH, // CS_CAM_ID_GLOBAL_DEATH
/* -7 */ CAM_SET_WARP_PAD_MOON, // CS_CAM_ID_GLOBAL_WARP_PAD_MOON
/* -6 */ CAM_SET_NAVI, // CS_CAM_ID_GLOBAL_SONG_WARP
/* -5 */ CAM_SET_ITEM3, // CS_CAM_ID_GLOBAL_ITEM_SHOW
/* -4 */ CAM_SET_ITEM2, // CS_CAM_ID_GLOBAL_ITEM_BOTTLE
/* -3 */ CAM_SET_ITEM1, // CS_CAM_ID_GLOBAL_ITEM_OCARINA
/* -2 */ CAM_SET_ITEM0, // CS_CAM_ID_GLOBAL_ITEM_GET
/* -1 */ CAM_SET_STOP0, // CS_CAM_ID_NONE
/* 0 */ CAM_SET_NONE,
};
-1
View File
@@ -1,4 +1,3 @@
#include "prevent_bss_reordering.h"
#include "global.h"
Vec3f D_801EDE00;
+754 -677
View File
File diff suppressed because it is too large Load Diff
+9 -9
View File
@@ -1,33 +1,33 @@
#include "global.h"
void EnvFlags_UnsetAll(PlayState* play) {
void CutsceneFlags_UnsetAll(PlayState* play) {
u8 i;
for (i = 0; i < ARRAY_COUNT(play->envFlags); i++) {
play->envFlags[i] = 0;
for (i = 0; i < ARRAY_COUNT(play->cutsceneFlags); i++) {
play->cutsceneFlags[i] = 0;
}
}
void EnvFlags_Set(PlayState* play, s16 flag) {
void CutsceneFlags_Set(PlayState* play, s16 flag) {
s16 index = flag / 16;
s16 bit = flag % 16;
s16 mask = 1 << bit;
play->envFlags[index] |= mask;
play->cutsceneFlags[index] |= mask;
}
void EnvFlags_Unset(PlayState* play, s16 flag) {
void CutsceneFlags_Unset(PlayState* play, s16 flag) {
s16 index = flag / 16;
s16 bit = flag % 16;
s16 mask = (1 << bit) ^ 0xFFFF;
play->envFlags[index] &= mask;
play->cutsceneFlags[index] &= mask;
}
s32 EnvFlags_Get(PlayState* play, s16 flag) {
s32 CutsceneFlags_Get(PlayState* play, s16 flag) {
s16 index = flag / 16;
s16 bit = flag % 16;
s16 mask = 1 << bit;
return play->envFlags[index] & mask;
return play->cutsceneFlags[index] & mask;
}
+527 -25
View File
@@ -1,52 +1,554 @@
/**
* @file z_eventmgr.c
*
* Manages all cutscenes except for manual
*/
#include "global.h"
#include "z64shrink_window.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F1460.s")
ActorCutscene sGlobalCutsceneList[] = {
// CS_ID_GLOBAL_78
{ -100, -1, CS_CAM_ID_NONE, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE_ALT, 255, CS_HUD_VISIBILITY_ALL_ALT, 255,
255 },
// CS_ID_GLOBAL_79
{ -100, -1, CS_CAM_ID_NONE, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE_ALT, 255, CS_HUD_VISIBILITY_ALL_ALT, 255,
255 },
// CS_ID_GLOBAL_7A
{ -100, -1, CS_CAM_ID_NONE, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE_ALT, 255, CS_HUD_VISIBILITY_ALL_ALT, 255,
255 },
// CS_ID_GLOBAL_ELEGY
{ 2, -1, CS_CAM_ID_GLOBAL_ELEGY, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE_ALT, 255, CS_HUD_VISIBILITY_NONE,
CS_END_CAM_0, 32 },
// CS_ID_GLOBAL_TALK
{ 32765, -1, CS_CAM_ID_NONE, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE_ALT, 255, CS_HUD_VISIBILITY_ALL_ALT,
CS_END_CAM_0, 255 },
// CS_ID_GLOBAL_DOOR
{ 32764, -1, CS_CAM_ID_NONE, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE_ALT, 255, CS_HUD_VISIBILITY_ALL_ALT,
CS_END_CAM_0, 255 },
// CS_ID_GLOBAL_RETURN_TO_CAM
{ 32766, -2, CS_CAM_ID_GLOBAL_CONNECT, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE, 255,
CS_HUD_VISIBILITY_ALL_ALT, CS_END_CAM_0, 32 },
// CS_ID_GLOBAL_END
{ 0, -1, CS_CAM_ID_NONE, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE, 255, CS_HUD_VISIBILITY_ALL_ALT,
CS_END_CAM_0, 32 },
};
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCutsceneImpl.s")
typedef enum {
/* 0 */ CS_START_0,
/* 1 */ CS_START_1,
/* 2 */ CS_START_2,
} ActorCutsceneStartMethod;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_Init.s")
typedef struct {
/* 0x00 */ s16 csId;
/* 0x02 */ s16 length;
/* 0x04 */ s16 endCsId;
/* 0x06 */ s16 subCamId;
/* 0x08 */ Actor* targetActor;
/* 0x0C */ s32 startMethod;
/* 0x10 */ PlayState* play;
/* 0x14 */ s16 retCamId;
/* 0x16 */ s16 isCameraStored;
} CutsceneManager; // size = 0x18
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F15D8.s")
CutsceneManager sCutsceneMgr = {
CS_ID_NONE, 0, CS_ID_NONE, SUB_CAM_ID_DONE, NULL, CS_START_0, NULL, CAM_ID_MAIN, false,
};
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_ClearWaiting.s")
s16 CutsceneManager_SetHudVisibility(s16 csHudVisibility) {
u16 hudVisibility;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_ClearNextCutscenes.s")
switch (csHudVisibility) {
case CS_HUD_VISIBILITY_NONE:
hudVisibility = HUD_VISIBILITY_NONE_ALT;
break;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_MarkNextCutscenes.s")
case CS_HUD_VISIBILITY_ALL:
hudVisibility = HUD_VISIBILITY_ALL;
break;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_End.s")
case CS_HUD_VISIBILITY_A_HEARTS_MAGIC:
hudVisibility = HUD_VISIBILITY_A_HEARTS_MAGIC_WITH_OVERWRITE;
break;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_Update.s")
case CS_HUD_VISIBILITY_C_HEARTS_MAGIC:
hudVisibility = HUD_VISIBILITY_HEARTS_MAGIC_C;
break;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_SetIntentToPlay.s")
case CS_HUD_VISIBILITY_ALL_NO_MINIMAP:
hudVisibility = HUD_VISIBILITY_ALL_NO_MINIMAP;
break;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCanPlayNext.s")
case CS_HUD_VISIBILITY_A_B_C:
hudVisibility = HUD_VISIBILITY_A_B_C;
break;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_StartAndSetUnkLinkFields.s")
case CS_HUD_VISIBILITY_B_MINIMAP:
hudVisibility = HUD_VISIBILITY_B_MINIMAP;
break;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_StartAndSetFlag.s")
case CS_HUD_VISIBILITY_A:
hudVisibility = HUD_VISIBILITY_A;
break;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_Start.s")
default:
hudVisibility = HUD_VISIBILITY_ALL;
break;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_Stop.s")
Interface_SetHudVisibility(hudVisibility);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCurrentIndex.s")
return hudVisibility;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCutscene.s")
ActorCutscene* CutsceneManager_GetCutsceneEntryImpl(s16 csId) {
if (csId < CS_ID_GLOBAL_78) {
return &sSceneCutsceneList[csId];
} else {
csId -= CS_ID_GLOBAL_78;
return &sGlobalCutsceneList[csId];
}
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetAdditionalCutscene.s")
void CutsceneManager_Init(PlayState* play, ActorCutscene* cutsceneList, s16 numEntries) {
s32 i;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetLength.s")
sSceneCutsceneList = cutsceneList;
sSceneCutsceneCount = numEntries;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F2138.s")
for (i = 0; i < ARRAY_COUNT(sWaitingCutsceneList); i++) {
sWaitingCutsceneList[i] = 0;
sNextCutsceneList[i] = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F2178.s")
sCutsceneMgr.endCsId = CS_ID_NONE;
sCutsceneMgr.play = play;
sCutsceneMgr.length = -1;
sCutsceneMgr.targetActor = NULL;
sCutsceneMgr.subCamId = SUB_CAM_ID_DONE;
sCutsceneMgr.isCameraStored = false;
sCutsceneMgr.csId = sCutsceneMgr.endCsId;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCurrentSubCamId.s")
/**
* Store camera into subCam 2, and keep subCam 2 INACTIVE to preserve the struct.
*/
void CutsceneManager_StoreCamera(Camera* camera) {
if (camera != NULL) {
memcpy(&sCutsceneMgr.play->subCameras[2], camera, sizeof(Camera));
sCutsceneMgr.play->subCameras[2].camId = camera->camId;
Camera_ChangeStatus(&sCutsceneMgr.play->subCameras[2], CAM_STATUS_INACTIVE);
sCutsceneMgr.isCameraStored = true;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F21CC.s")
void CutsceneManager_ClearWaiting(void) {
s32 i;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F22C4.s")
for (i = 0; i < ARRAY_COUNT(sWaitingCutsceneList); i++) {
sWaitingCutsceneList[i] = 0;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_SetReturnCamera.s")
void CutsceneManager_ClearNextCutscenes(void) {
s32 i;
for (i = 0; i < ARRAY_COUNT(sNextCutsceneList); i++) {
sNextCutsceneList[i] = 0;
}
}
s16 CutsceneManager_MarkNextCutscenes(void) {
s16 bit;
s32 i;
s32 j;
s32 count = 0;
s16 csIdMax = CS_ID_NONE;
s16 priorityMax = SHT_MAX; // lower number means higher priority
s16 csId;
s16 priority;
for (i = 0; i < ARRAY_COUNT(sNextCutsceneList); i++) {
for (bit = 1, j = 0; j < 8; j++) {
if (sWaitingCutsceneList[i] & bit) {
csId = (i << 3) | j;
priority = CutsceneManager_GetCutsceneEntryImpl(csId)->priority;
if ((priority ^ 0) == -1) {
sNextCutsceneList[i] |= bit;
} else if ((priority < priorityMax) && (priority > 0)) {
csIdMax = csId;
priorityMax = priority;
}
count++;
}
bit <<= 1;
}
}
if (csIdMax != CS_ID_NONE) {
sNextCutsceneList[csIdMax >> 3] |= 1 << (csIdMax & 7);
}
return count;
}
#define RET_CAM sCutsceneMgr.play->cameraPtrs[sCutsceneMgr.retCamId]
#define CUR_CAM sCutsceneMgr.play->cameraPtrs[sCutsceneMgr.subCamId]
void CutsceneManager_End(void) {
ActorCutscene* csEntry;
s16 oldCamId;
s16 oldStateFlags;
switch (sCutsceneMgr.startMethod) {
case CS_START_2:
sCutsceneMgr.targetActor->flags &= ~ACTOR_FLAG_100000;
// fallthrough
case CS_START_1:
func_800B7298(sCutsceneMgr.play, 0, PLAYER_CSMODE_END);
sCutsceneMgr.startMethod = CS_START_0;
break;
default:
break;
}
csEntry = CutsceneManager_GetCutsceneEntryImpl(sCutsceneMgr.csId);
switch (csEntry->endSfx) {
case CS_END_SFX_TRE_BOX_APPEAR:
play_sound(NA_SE_SY_TRE_BOX_APPEAR);
break;
case CS_END_SFX_CORRECT_CHIME:
play_sound(NA_SE_SY_CORRECT_CHIME);
break;
default: // CS_END_SFX_NONE
break;
}
switch (csEntry->endCam) {
case CS_END_CAM_SMOOTH:
Play_CopyCamera(sCutsceneMgr.play, sCutsceneMgr.retCamId, sCutsceneMgr.subCamId);
RET_CAM->stateFlags =
(RET_CAM->stateFlags & ~CAM_STATE_UNDERWATER) | (CUR_CAM->stateFlags & CAM_STATE_UNDERWATER);
CutsceneManager_Queue(CS_ID_GLOBAL_RETURN_TO_CAM);
break;
case CS_END_CAM_0:
default:
Play_CopyCamera(sCutsceneMgr.play, sCutsceneMgr.retCamId, sCutsceneMgr.subCamId);
RET_CAM->stateFlags =
(RET_CAM->stateFlags & ~CAM_STATE_UNDERWATER) | (CUR_CAM->stateFlags & CAM_STATE_UNDERWATER);
break;
case CS_END_CAM_1:
oldCamId = RET_CAM->camId;
oldStateFlags = RET_CAM->stateFlags;
if (sCutsceneMgr.isCameraStored) {
// Restore the camera that was stored in subCam 2
memcpy(RET_CAM, &sCutsceneMgr.play->subCameras[2], sizeof(Camera));
RET_CAM->stateFlags =
(RET_CAM->stateFlags & ~CAM_STATE_UNDERWATER) | (CUR_CAM->stateFlags & CAM_STATE_UNDERWATER);
RET_CAM->stateFlags = (RET_CAM->stateFlags & ~CAM_STATE_2) | (oldStateFlags & CAM_STATE_2);
sCutsceneMgr.isCameraStored = false;
}
RET_CAM->camId = oldCamId;
break;
}
if (sCutsceneMgr.subCamId != SUB_CAM_ID_DONE) {
Play_ClearCamera(sCutsceneMgr.play, sCutsceneMgr.subCamId);
Play_ChangeCameraStatus(sCutsceneMgr.play, sCutsceneMgr.retCamId, CAM_STATUS_ACTIVE);
}
sCutsceneMgr.csId = CS_ID_NONE;
sCutsceneMgr.endCsId = CS_ID_NONE;
sCutsceneMgr.length = -1;
sCutsceneMgr.targetActor = NULL;
sCutsceneMgr.subCamId = SUB_CAM_ID_DONE;
}
s16 CutsceneManager_Update(void) {
s16 sp1E = 0;
if (CutsceneManager_IsNext(CS_ID_GLOBAL_RETURN_TO_CAM)) {
CutsceneManager_StartWithPlayerCs(CS_ID_GLOBAL_RETURN_TO_CAM, &GET_PLAYER(sCutsceneMgr.play)->actor);
}
if (sCutsceneMgr.endCsId == CS_ID_NONE) {
if (sCutsceneMgr.csId != CS_ID_NONE) {
if (sCutsceneMgr.length > 0) {
sCutsceneMgr.length--;
}
sp1E = 1;
if (sCutsceneMgr.length == 0) {
CutsceneManager_Stop(sCutsceneMgr.csId);
}
}
}
if (sCutsceneMgr.endCsId != CS_ID_NONE) {
CutsceneManager_End();
sp1E = 2;
}
CutsceneManager_ClearNextCutscenes();
if (sCutsceneMgr.csId == CS_ID_NONE) {
if ((CutsceneManager_MarkNextCutscenes() == 0) && (sp1E != 0)) {
ShrinkWindow_Letterbox_SetSizeTarget(0);
} else if (sp1E == 0) {
CutsceneManager_StoreCamera(Play_GetCamera(sCutsceneMgr.play, sCutsceneMgr.retCamId));
}
}
return sp1E;
}
void CutsceneManager_Queue(s16 csId) {
if (csId >= 0) {
sWaitingCutsceneList[csId >> 3] |= 1 << (csId & 7);
}
}
s16 CutsceneManager_IsNext(s16 csId) {
if (csId == CS_ID_GLOBAL_END) {
if (sCutsceneMgr.csId == CS_ID_NONE) {
return 0x7F;
} else {
return 0;
}
}
if (csId <= CS_ID_NONE) {
return -1;
}
return (sNextCutsceneList[csId >> 3] & (1 << (csId & 7))) ? 1 : 0;
}
/**
* Start an actor cutscene, activate Player Cutscene Mode "Wait"
*/
s16 CutsceneManager_StartWithPlayerCs(s16 csId, Actor* actor) {
s16 startCsId = CutsceneManager_Start(csId, actor);
if (startCsId >= 0) {
func_800B7298(sCutsceneMgr.play, 0, PLAYER_CSMODE_WAIT);
if (sCutsceneMgr.length == 0) {
CutsceneManager_Stop(sCutsceneMgr.csId);
}
sCutsceneMgr.startMethod = CS_START_1;
}
return startCsId;
}
/**
* Start an actor cutscene, activate Player Cutscene Mode "Wait", turn on ACTOR_FLAG_100000
*/
s16 CutsceneManager_StartWithPlayerCsAndSetFlag(s16 csId, Actor* actor) {
s16 startCsId = CutsceneManager_Start(csId, actor);
if (startCsId >= 0) {
func_800B7298(sCutsceneMgr.play, 0, PLAYER_CSMODE_WAIT);
if (sCutsceneMgr.length == 0) {
CutsceneManager_Stop(sCutsceneMgr.csId);
}
if (actor != NULL) {
actor->flags |= ACTOR_FLAG_100000;
sCutsceneMgr.startMethod = CS_START_2;
} else {
sCutsceneMgr.startMethod = CS_START_1;
}
}
return startCsId;
}
s16 CutsceneManager_Start(s16 csId, Actor* actor) {
ActorCutscene* csEntry;
Camera* subCam;
Camera* retCam;
s32 csType = 0;
if ((csId < 0) || (sCutsceneMgr.csId != CS_ID_NONE)) {
return csId;
}
sCutsceneMgr.startMethod = CS_START_0;
csEntry = CutsceneManager_GetCutsceneEntryImpl(csId);
ShrinkWindow_Letterbox_SetSizeTarget(csEntry->letterboxSize);
CutsceneManager_SetHudVisibility(csEntry->hudVisibility);
if (csId == CS_ID_GLOBAL_END) {
csType = 1;
} else if (csEntry->scriptIndex != CS_SCRIPT_ID_NONE) {
// scripted cutscene
csType = 1;
} else if ((csId != CS_ID_GLOBAL_DOOR) && (csId != CS_ID_GLOBAL_TALK)) {
csType = 2;
}
if (csType != 0) {
sCutsceneMgr.retCamId = Play_GetActiveCamId(sCutsceneMgr.play);
sCutsceneMgr.subCamId = Play_CreateSubCamera(sCutsceneMgr.play);
subCam = Play_GetCamera(sCutsceneMgr.play, sCutsceneMgr.subCamId);
retCam = Play_GetCamera(sCutsceneMgr.play, sCutsceneMgr.retCamId);
if ((retCam->setting == CAM_SET_START0) || (retCam->setting == CAM_SET_START2) ||
(retCam->setting == CAM_SET_START1)) {
if (CutsceneManager_FindEntranceCsId() != csId) {
func_800E0348(retCam);
} else {
Camera_ClearFlags(retCam, CAM_STATE_2);
}
}
memcpy(subCam, retCam, sizeof(Camera));
subCam->camId = sCutsceneMgr.subCamId;
Camera_ClearFlags(subCam, CAM_STATE_6 | CAM_STATE_0);
Play_ChangeCameraStatus(sCutsceneMgr.play, sCutsceneMgr.retCamId, CAM_STATUS_WAIT);
Play_ChangeCameraStatus(sCutsceneMgr.play, sCutsceneMgr.subCamId, CAM_STATUS_ACTIVE);
subCam->target = sCutsceneMgr.targetActor = actor;
subCam->behaviorFlags = 0;
if (csType == 1) {
Camera_ChangeSetting(subCam, CAM_SET_FREE0);
Cutscene_StartScripted(sCutsceneMgr.play, csEntry->scriptIndex);
sCutsceneMgr.length = csEntry->length;
} else {
if (csEntry->csCamId != CS_CAM_ID_NONE) {
Camera_ChangeDataIdx(subCam, csEntry->csCamId);
} else {
Camera_ChangeSetting(subCam, CAM_SET_FREE0);
}
sCutsceneMgr.length = csEntry->length;
}
}
sCutsceneMgr.csId = csId;
return csId;
}
s16 CutsceneManager_Stop(s16 csId) {
ActorCutscene* csEntry;
if (csId < 0) {
return csId;
}
csEntry = CutsceneManager_GetCutsceneEntryImpl(sCutsceneMgr.csId);
if ((sCutsceneMgr.length > 0) && (csEntry->scriptIndex == CS_SCRIPT_ID_NONE)) {
return -2;
}
if ((csId != CS_ID_GLOBAL_END) && (csEntry->scriptIndex != CS_SCRIPT_ID_NONE)) {
return -3;
}
if (csId == CS_ID_GLOBAL_END) {
csId = sCutsceneMgr.csId;
}
if (csId == sCutsceneMgr.csId) {
sCutsceneMgr.endCsId = sCutsceneMgr.csId;
return sCutsceneMgr.endCsId;
}
return -1;
}
s16 CutsceneManager_GetCurrentCsId(void) {
return sCutsceneMgr.csId;
}
ActorCutscene* CutsceneManager_GetCutsceneEntry(s16 csId) {
return CutsceneManager_GetCutsceneEntryImpl(csId);
}
s16 CutsceneManager_GetAdditionalCsId(s16 csId) {
if (csId < 0) {
return CS_ID_NONE;
}
return CutsceneManager_GetCutsceneEntryImpl(csId)->additionalCsId;
}
s16 CutsceneManager_GetLength(s16 csId) {
if (csId < 0) {
return -1;
}
return CutsceneManager_GetCutsceneEntryImpl(csId)->length;
}
s16 CutsceneManager_GetCutsceneScriptIndex(s16 csId) {
if (csId < 0) {
return -1;
}
return CutsceneManager_GetCutsceneEntryImpl(csId)->scriptIndex;
}
s16 CutsceneManager_GetCutsceneCustomValue(s16 csId) {
if (csId < 0) {
return -1;
}
return CutsceneManager_GetCutsceneEntryImpl(csId)->customValue;
}
s16 CutsceneManager_GetCurrentSubCamId(s16 csId) {
return sCutsceneMgr.subCamId;
}
s16 CutsceneManager_FindEntranceCsId(void) {
PlayState* play;
s32 csId;
for (csId = 0; csId < sSceneCutsceneCount; csId++) {
//! FAKE:
if ((sSceneCutsceneList[csId].scriptIndex != CS_SCRIPT_ID_NONE) &&
(sSceneCutsceneList[csId].scriptIndex < (play = sCutsceneMgr.play)->csCtx.scriptListCount) &&
(sCutsceneMgr.play->curSpawn ==
sCutsceneMgr.play->csCtx.scriptList[sSceneCutsceneList[csId].scriptIndex].spawn)) {
return csId;
}
}
for (csId = 0; csId < sSceneCutsceneCount; csId++) {
if ((sSceneCutsceneList[csId].customValue >= 100) &&
(sSceneCutsceneList[csId].customValue == (sCutsceneMgr.play->curSpawn + 100))) {
return csId;
}
}
return -1;
}
s32 func_800F22C4(s16 csId, Actor* actor) {
f32 dist;
s16 screenPosX;
s16 screenPosY;
if ((sCutsceneMgr.csId == CS_ID_NONE) || (csId == CS_ID_NONE)) {
return 4;
}
Actor_GetScreenPos(sCutsceneMgr.play, actor, &screenPosX, &screenPosY);
dist = OLib_Vec3fDist(&actor->focus.pos, &Play_GetCamera(sCutsceneMgr.play, sCutsceneMgr.subCamId)->eye);
if ((screenPosX > 40) && (screenPosX < SCREEN_WIDTH - 40) && (screenPosY > 40) &&
(screenPosY < SCREEN_HEIGHT - 40) && (dist < 700.0f)) {
return 1;
}
if (sCutsceneMgr.length < 6) {
return 2;
}
if (csId == sCutsceneMgr.csId) {
return 0;
}
return 3;
}
void CutsceneManager_SetReturnCamera(s16 camId) {
sCutsceneMgr.retCamId = camId;
}
+1 -1
View File
@@ -92,7 +92,7 @@ void KaleidoSetup_Update(PlayState* play) {
if ((pauseCtx->state == PAUSE_STATE_OFF) && (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) &&
(play->gameOverCtx.state == GAMEOVER_INACTIVE)) {
if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) {
if ((gSaveContext.save.cutscene < 0xFFF0) && (gSaveContext.nextCutsceneIndex < 0xFFF0)) {
if ((gSaveContext.save.cutsceneIndex < 0xFFF0) && (gSaveContext.nextCutsceneIndex < 0xFFF0)) {
if (!Play_InCsMode(play) || ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF))) {
if ((play->unk_1887C < 2) && (gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY) &&
(gSaveContext.magicState != MAGIC_STATE_FILL)) {
+3 -3
View File
@@ -1990,7 +1990,7 @@ void Interface_UpdateButtonsPart2(PlayState* play) {
}
if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) {
if (ActorCutscene_GetCurrentIndex() == -1) {
if (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) {
Interface_SetHudVisibility(HUD_VISIBILITY_ALL);
}
}
@@ -2267,7 +2267,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) {
s32 pad;
s32 restoreHudVisibility = false;
if (gSaveContext.save.cutscene < 0xFFF0) {
if (gSaveContext.save.cutsceneIndex < 0xFFF0) {
gSaveContext.hudVisibilityForceButtonAlphasByStatus = false;
if ((player->stateFlags1 & PLAYER_STATE1_800000) || CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01) ||
(!(CHECK_EVENTINF(EVENTINF_41)) && (play->unk_1887C >= 2))) {
@@ -2434,7 +2434,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) {
sPictoState = PICTO_BOX_STATE_OFF;
} else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || (func_801A5100() == 1)) {
if (!(CHECK_EVENTINF(EVENTINF_41)) ||
((CHECK_EVENTINF(EVENTINF_41)) && (ActorCutscene_GetCurrentIndex() == -1))) {
((CHECK_EVENTINF(EVENTINF_41)) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE))) {
play_sound(NA_SE_SY_CAMERA_SHUTTER);
SREG(89) = 1;
play->haltAllActors = true;
+54 -42
View File
@@ -567,11 +567,13 @@ void Play_UpdateTransition(PlayState* this) {
if ((!(Entrance_GetTransitionFlags(this->nextEntrance + sceneLayer) & 0x8000) ||
((this->nextEntrance == ENTRANCE(PATH_TO_MOUNTAIN_VILLAGE, 1)) &&
!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) ||
!CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) ||
((this->nextEntrance == ENTRANCE(ROAD_TO_SOUTHERN_SWAMP, 1)) &&
!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) ||
((this->nextEntrance == ENTRANCE(TERMINA_FIELD, 2)) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) ||
((this->nextEntrance == ENTRANCE(ROAD_TO_IKANA, 1)) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20))) &&
!CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) ||
((this->nextEntrance == ENTRANCE(TERMINA_FIELD, 2)) &&
!CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) ||
((this->nextEntrance == ENTRANCE(ROAD_TO_IKANA, 1)) &&
!CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE))) &&
(!func_800FE590(this) || (Entrance_GetSceneId(this->nextEntrance + sceneLayer) < 0) ||
(AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_FINAL_HOURS))) {
func_801A4058(20);
@@ -983,8 +985,8 @@ void Play_UpdateMain(PlayState* this) {
if (!this->haltAllActors) {
Actor_UpdateAll(this, &this->actorCtx);
}
Cutscene_Update1(this, &this->csCtx);
Cutscene_Update2(this, &this->csCtx);
Cutscene_UpdateManual(this, &this->csCtx);
Cutscene_UpdateScripted(this, &this->csCtx);
Effect_UpdateAll(this);
EffectSS_UpdateAllParticles(this);
EffFootmark_Update(this);
@@ -1502,8 +1504,8 @@ void Play_Main(GameState* thisx) {
*CONTROLLER1(&this->state) = input;
}
ActorCutscene_Update();
ActorCutscene_ClearWaiting();
CutsceneManager_Update();
CutsceneManager_ClearWaiting();
}
s32 Play_InCsMode(PlayState* this) {
@@ -2016,37 +2018,47 @@ s32 Play_IsDebugCamEnabled(void) {
return gDbgCamEnabled;
}
// A mapping from playerActorCsIds to sGlobalCamDataSettings indices.
s16 D_801D0D64[] = { -3, -2, -4, -5, -7, -11, -8, -9, -6, -16 };
// A mapping from playerCsIds to sGlobalCamDataSettings indices.
s16 sPlayerCsIdToCsCamId[] = {
CS_CAM_ID_GLOBAL_ITEM_OCARINA, // PLAYER_CS_ID_ITEM_OCARINA
CS_CAM_ID_GLOBAL_ITEM_GET, // PLAYER_CS_ID_ITEM_GET
CS_CAM_ID_GLOBAL_ITEM_BOTTLE, // PLAYER_CS_ID_ITEM_BOTTLE
CS_CAM_ID_GLOBAL_ITEM_SHOW, // PLAYER_CS_ID_ITEM_SHOW
CS_CAM_ID_GLOBAL_WARP_PAD_MOON, // PLAYER_CS_ID_WARP_PAD_MOON
CS_CAM_ID_GLOBAL_MASK_TRANSFORMATION, // PLAYER_CS_ID_MASK_TRANSFORMATION
CS_CAM_ID_GLOBAL_DEATH, // PLAYER_CS_ID_DEATH
CS_CAM_ID_GLOBAL_REVIVE, // PLAYER_CS_ID_REVIVE
CS_CAM_ID_GLOBAL_SONG_WARP, // PLAYER_CS_ID_SONG_WARP
CS_CAM_ID_GLOBAL_WARP_PAD_ENTRANCE, // PLAYER_CS_ID_WARP_PAD_ENTRANCE
};
// Used by Player
/**
* Extract the common actor cutscene ids used by Player from the scene and set the actor cutscene ids in
* this->playerActorCsIds. If a playerActorCsId is not present in the scene, then that particular id is set
* to -1. Otherwise, if there is an ActorCutscene where csCamSceneDataId matches the appropriate element of D_801D0D64,
* set the corresponding playerActorCsId (and possibly change its priority for the zeroth one)
* Extract the common cutscene ids used by Player from the scene and set the cutscene ids in this->playerCsIds.
* If a playerCsId is not present in the scene, then that particular id is set to CS_ID_NONE.
* Otherwise, if there is an ActorCutscene where csCamId matches the appropriate element of sPlayerCsIdToCsCamId,
* set the corresponding playerActorCsId (and possibly change its priority for the zeroth one).
*/
void Play_AssignPlayerActorCsIdsFromScene(GameState* thisx, s32 startActorCsId) {
void Play_AssignPlayerCsIdsFromScene(GameState* thisx, s32 spawnCsId) {
PlayState* this = (PlayState*)thisx;
s32 i;
s16* curPlayerActorCsId = this->playerActorCsIds;
s16* phi_s1 = D_801D0D64;
s16* curPlayerCsId = this->playerCsIds;
s16* csCamId = sPlayerCsIdToCsCamId;
for (i = 0; i < ARRAY_COUNT(this->playerActorCsIds); i++, curPlayerActorCsId++, phi_s1++) {
ActorCutscene* actorCutscene;
s32 curActorCsId;
for (i = 0; i < ARRAY_COUNT(this->playerCsIds); i++, curPlayerCsId++, csCamId++) {
ActorCutscene* csEntry;
s32 curCsId;
*curPlayerActorCsId = -1;
*curPlayerCsId = CS_ID_NONE;
for (curActorCsId = startActorCsId; curActorCsId != -1; curActorCsId = actorCutscene->additionalCutscene) {
actorCutscene = ActorCutscene_GetCutscene(curActorCsId);
for (curCsId = spawnCsId; curCsId != CS_ID_NONE; curCsId = csEntry->additionalCsId) {
csEntry = CutsceneManager_GetCutsceneEntry(curCsId);
if (actorCutscene->csCamSceneDataId == *phi_s1) {
if ((actorCutscene->csCamSceneDataId == -3) &&
(actorCutscene->priority == 700)) { // override ocarina cs priority
actorCutscene->priority = 550;
if (csEntry->csCamId == *csCamId) {
if ((csEntry->csCamId == CS_CAM_ID_GLOBAL_ITEM_OCARINA) && (csEntry->priority == 700)) {
csEntry->priority = 550;
}
*curPlayerActorCsId = curActorCsId;
*curPlayerCsId = curCsId;
break;
}
}
@@ -2101,7 +2113,7 @@ void Play_Init(GameState* thisx) {
scene = ((void)0, gSaveContext.save.entrance) >> 9;
spawn = (((void)0, gSaveContext.save.entrance) >> 4) & 0x1F;
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) {
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) {
if (scene == ENTR_SCENE_MOUNTAIN_VILLAGE_WINTER) {
scene = ENTR_SCENE_MOUNTAIN_VILLAGE_SPRING;
} else if (scene == ENTR_SCENE_GORON_VILLAGE_WINTER) {
@@ -2115,7 +2127,7 @@ void Play_Init(GameState* thisx) {
}
}
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) {
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) {
if (scene == ENTR_SCENE_SOUTHERN_SWAMP_POISONED) {
scene = ENTR_SCENE_SOUTHERN_SWAMP_CLEARED;
} else if (scene == ENTR_SCENE_WOODFALL) {
@@ -2123,11 +2135,11 @@ void Play_Init(GameState* thisx) {
}
}
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20) && (scene == ENTR_SCENE_IKANA_CANYON)) {
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE) && (scene == ENTR_SCENE_IKANA_CANYON)) {
gSaveContext.nextCutsceneIndex = 0xFFF2;
}
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80) &&
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE) &&
((scene == ENTR_SCENE_GREAT_BAY_COAST) || (scene == ENTR_SCENE_ZORA_CAPE))) {
gSaveContext.nextCutsceneIndex = 0xFFF0;
}
@@ -2179,15 +2191,15 @@ void Play_Init(GameState* thisx) {
EffectSS_Init(this, 100);
CollisionCheck_InitContext(this, &this->colChkCtx);
AnimationContext_Reset(&this->animationCtx);
Cutscene_Init(this, &this->csCtx);
Cutscene_InitContext(this, &this->csCtx);
if (gSaveContext.nextCutsceneIndex != 0xFFEF) {
gSaveContext.save.cutscene = gSaveContext.nextCutsceneIndex;
gSaveContext.save.cutsceneIndex = gSaveContext.nextCutsceneIndex;
gSaveContext.nextCutsceneIndex = 0xFFEF;
}
if (gSaveContext.save.cutscene == 0xFFFD) {
gSaveContext.save.cutscene = 0;
if (gSaveContext.save.cutsceneIndex == 0xFFFD) {
gSaveContext.save.cutsceneIndex = 0;
}
if (gSaveContext.nextDayTime != 0xFFFF) {
@@ -2204,13 +2216,13 @@ void Play_Init(GameState* thisx) {
func_800EDDB0(this);
if (((gSaveContext.gameMode != GAMEMODE_NORMAL) && (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN)) ||
(gSaveContext.save.cutscene >= 0xFFF0)) {
(gSaveContext.save.cutsceneIndex >= 0xFFF0)) {
gSaveContext.unk_3DC0 = 0;
Magic_Reset(this);
gSaveContext.sceneLayer = (gSaveContext.save.cutscene & 0xF) + 1;
gSaveContext.sceneLayer = (gSaveContext.save.cutsceneIndex & 0xF) + 1;
// Set saved cutscene to 0 so it doesn't immediately play, but instead let the `CutsceneManager` handle it.
gSaveContext.save.cutscene = 0;
gSaveContext.save.cutsceneIndex = 0;
} else {
gSaveContext.sceneLayer = 0;
}
@@ -2296,7 +2308,7 @@ void Play_Init(GameState* thisx) {
D_801F6D4C->envColor.g = 0;
D_801F6D4C->envColor.b = 0;
D_801F6D4C->envColor.a = 0;
EnvFlags_UnsetAll(this);
CutsceneFlags_UnsetAll(this);
THA_GetRemaining(&this->state.heap);
zAllocSize = THA_GetRemaining(&this->state.heap);
zAlloc = (uintptr_t)THA_AllocTailAlign16(&this->state.heap, zAllocSize);
@@ -2319,13 +2331,13 @@ void Play_Init(GameState* thisx) {
Camera_ChangeDataIdx(&this->mainCamera, player->actor.params & 0xFF);
}
func_800F15D8(&this->mainCamera);
CutsceneManager_StoreCamera(&this->mainCamera);
Interface_SetSceneRestrictions(this);
func_800FB758(this);
gSaveContext.seqId = this->sequenceCtx.seqId;
gSaveContext.ambienceId = this->sequenceCtx.ambienceId;
AnimationContext_Update(this, &this->animationCtx);
func_800EDBE0(this);
Cutscene_HandleEntranceTriggers(this);
gSaveContext.respawnFlag = 0;
sBombersNotebookOpen = false;
BombersNotebook_Init(&sBombersNotebook);
+2 -2
View File
@@ -359,9 +359,9 @@ void func_80122F28(Player* player) {
PLAYER_STATE1_20000000))) &&
(!(player->stateFlags2 & PLAYER_STATE2_1))) {
if (player->doorType <= PLAYER_DOORTYPE_TALKING) {
ActorCutscene_SetIntentToPlay(0x7C);
CutsceneManager_Queue(CS_ID_GLOBAL_TALK);
} else {
ActorCutscene_SetIntentToPlay(0x7D);
CutsceneManager_Queue(CS_ID_GLOBAL_DOOR);
}
}
}
+11 -11
View File
@@ -402,7 +402,7 @@ void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) {
play->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.save.time) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f;
play->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.save.time) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f;
if ((play->envCtx.sceneTimeSpeed == 0) && (gSaveContext.save.cutscene < 0xFFF0)) {
if ((play->envCtx.sceneTimeSpeed == 0) && (gSaveContext.save.cutsceneIndex < 0xFFF0)) {
gSaveContext.skyboxTime = gSaveContext.save.time;
if ((gSaveContext.skyboxTime >= CLOCK_TIME(4, 0)) && (gSaveContext.skyboxTime < CLOCK_TIME(6, 30))) {
@@ -470,15 +470,15 @@ void Scene_CommandAltHeaderList(PlayState* play, SceneCmd* cmd) {
}
}
// SceneTableEntry Header Command 0x17: Cutscene List
void Scene_CommandCutsceneList(PlayState* play, SceneCmd* cmd) {
play->csCtx.sceneCsCount = cmd->cutsceneList.sceneCsCount;
play->csCtx.sceneCsList = Lib_SegmentedToVirtual(cmd->cutsceneList.segment);
// SceneTableEntry Header Command 0x17: Cutscene Script List
void Scene_CommandCutsceneScriptList(PlayState* play, SceneCmd* cmd) {
play->csCtx.scriptListCount = cmd->scriptList.scriptListCount;
play->csCtx.scriptList = Lib_SegmentedToVirtual(cmd->scriptList.segment);
}
// SceneTableEntry Header Command 0x1B: Actor Cutscene List
void Scene_CommandActorCutsceneList(PlayState* play, SceneCmd* cmd) {
ActorCutscene_Init(play, Lib_SegmentedToVirtual(cmd->cutsceneActorList.segment), cmd->cutsceneActorList.num);
// SceneTableEntry Header Command 0x1B: Cutscene List
void Scene_CommandCutsceneList(PlayState* play, SceneCmd* cmd) {
CutsceneManager_Init(play, Lib_SegmentedToVirtual(cmd->cutsceneList.segment), cmd->cutsceneList.num);
}
// SceneTableEntry Header Command 0x1C: Mini Maps
@@ -560,11 +560,11 @@ void (*sSceneCmdHandlers[])(PlayState*, SceneCmd*) = {
NULL,
Scene_CommandSoundSettings,
Scene_CommandEchoSetting,
Scene_CommandCutsceneList,
Scene_CommandCutsceneScriptList,
Scene_CommandAltHeaderList,
Scene_CommandSetRegionVisitedFlag,
Scene_CommandAnimatedMaterials,
Scene_CommandActorCutsceneList,
Scene_CommandCutsceneList,
Scene_CommandMiniMap,
Scene_Command1D,
Scene_CommandMiniMapCompassInfo,
@@ -601,7 +601,7 @@ u16 Entrance_Create(s32 scene, s32 spawn, s32 layer) {
}
/**
* Creates an layer 0 entranace from the current entrance and the given spawn.
* Creates an layer 0 entrance from the current entrance and the given spawn.
*/
u16 Entrance_CreateFromSpawn(s32 spawn) {
return Entrance_Create((u32)gSaveContext.save.entrance >> 9, spawn, 0);
+8 -9
View File
@@ -939,10 +939,9 @@ void Sram_InitDebugSave(void) {
Sram_GenerateRandomSaveFields();
}
// Unused
void func_80144A94(SramContext* sramCtx) {
void Sram_ResetSaveFromMoonCrash(SramContext* sramCtx) {
s32 i;
s32 cutscene = gSaveContext.save.cutscene;
s32 cutsceneIndex = gSaveContext.save.cutsceneIndex;
bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE);
@@ -957,7 +956,7 @@ void func_80144A94(SramContext* sramCtx) {
D_801C67F0[gSaveContext.fileNum * 2 + 1]);
Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, sizeof(Save));
}
gSaveContext.save.cutscene = cutscene;
gSaveContext.save.cutsceneIndex = cutsceneIndex;
for (i = 0; i < ARRAY_COUNT(gSaveContext.eventInf); i++) {
gSaveContext.eventInf[i] = 0;
@@ -1067,10 +1066,10 @@ void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCtx) {
} else {
gSaveContext.save.entrance = D_801C6A58[(void)0, gSaveContext.save.owlSaveLocation];
if ((gSaveContext.save.entrance == ENTRANCE(SOUTHERN_SWAMP_POISONED, 10)) &&
CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) {
CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) {
gSaveContext.save.entrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 10);
} else if ((gSaveContext.save.entrance == ENTRANCE(MOUNTAIN_VILLAGE_WINTER, 8)) &&
CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) {
CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) {
gSaveContext.save.entrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 8);
}
@@ -1532,7 +1531,7 @@ void Sram_InitSave(FileSelectState* fileSelect2, SramContext* sramCtx) {
if (gSaveContext.unk_3F3F) {
Sram_InitNewSave();
if (fileSelect->unk_24480 == 0) {
gSaveContext.save.cutscene = 0xFFF0;
gSaveContext.save.cutsceneIndex = 0xFFF0;
}
for (phi_v0 = 0; phi_v0 < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.playerName); phi_v0++) {
@@ -1634,7 +1633,7 @@ void Sram_SaveSpecialEnterClockTown(PlayState* play) {
* Saves when beating the game, after showing the "Dawn of the New Day" message
*/
void Sram_SaveSpecialNewDay(PlayState* play) {
s32 cutscene = gSaveContext.save.cutscene;
s32 cutsceneIndex = gSaveContext.save.cutsceneIndex;
s32 day;
u16 time = gSaveContext.save.time;
@@ -1647,7 +1646,7 @@ void Sram_SaveSpecialNewDay(PlayState* play) {
gSaveContext.save.day = day;
gSaveContext.save.time = time;
gSaveContext.save.cutscene = cutscene;
gSaveContext.save.cutsceneIndex = cutsceneIndex;
func_80185F64(play->sramCtx.saveBuf, D_801C67C8[gSaveContext.fileNum * 2], D_801C67F0[gSaveContext.fileNum * 2]);
}
+24 -19
View File
@@ -1386,48 +1386,53 @@ void SubS_ChangeAnimationBySpeedInfo(SkelAnime* skelAnime, AnimationSpeedInfo* a
*curAnimIndex = nextAnimIndex;
}
s32 SubS_StartActorCutscene(Actor* actor, s16 nextCutscene, s16 curCutscene, s32 type) {
s32 SubS_StartCutscene(Actor* actor, s16 nextCsId, s16 curCsId, s32 type) {
s32 isStarted = false;
if ((curCutscene != -1) && (ActorCutscene_GetCurrentIndex() == curCutscene)) {
ActorCutscene_Stop(curCutscene);
ActorCutscene_SetIntentToPlay(nextCutscene);
} else if (ActorCutscene_GetCanPlayNext(nextCutscene)) {
if ((curCsId != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() == curCsId)) {
CutsceneManager_Stop(curCsId);
CutsceneManager_Queue(nextCsId);
} else if (CutsceneManager_IsNext(nextCsId)) {
switch (type) {
case SUBS_CUTSCENE_SET_UNK_LINK_FIELDS:
ActorCutscene_StartAndSetUnkLinkFields(nextCutscene, actor);
case SUBS_CUTSCENE_WITH_PLAYER:
CutsceneManager_StartWithPlayerCs(nextCsId, actor);
break;
case SUBS_CUTSCENE_NORMAL:
ActorCutscene_Start(nextCutscene, actor);
CutsceneManager_Start(nextCsId, actor);
break;
case SUBS_CUTSCENE_SET_FLAG:
ActorCutscene_StartAndSetFlag(nextCutscene, actor);
case SUBS_CUTSCENE_WITH_PLAYER_SET_FLAG:
CutsceneManager_StartWithPlayerCsAndSetFlag(nextCsId, actor);
break;
default:
break;
}
isStarted = true;
} else {
ActorCutscene_SetIntentToPlay(nextCutscene);
CutsceneManager_Queue(nextCsId);
}
return isStarted;
}
s32 SubS_FillCutscenesList(Actor* actor, s16 cutscenes[], s16 numCutscenes) {
s16 cs;
s32 SubS_FillCutscenesList(Actor* actor, s16 csIdList[], s16 numCutscenes) {
s16 csId;
s32 i;
for (i = 0; i < numCutscenes; i++) {
cutscenes[i] = -1;
csIdList[i] = CS_ID_NONE;
}
cs = actor->cutscene;
csId = actor->csId;
i = 0;
while (cs != -1) {
// Note: Infinite loop if numCutscenes is less than possible additional cutscenes
while (csId != CS_ID_NONE) {
// Note: Infinite loop if numCutscenes is less than possible additional csIdList
if (i < numCutscenes) {
cutscenes[i] = cs;
cs = ActorCutscene_GetAdditionalCutscene(cs);
csIdList[i] = csId;
csId = CutsceneManager_GetAdditionalCsId(csId);
i++;
}
}