Prevent multiple star cutscenes from causing a rare softlock

This commit is contained in:
MysterD 2022-02-21 18:15:05 -08:00
parent 804bee1ff7
commit ebcaddede4
1 changed files with 9 additions and 1 deletions

View File

@ -394,6 +394,7 @@ struct CameraStoredInfo sCameraStoreCutscene;
// first iteration of data
u32 unused8032CFC0 = 0;
struct Object *gCutsceneFocus = NULL;
const BehaviorScript *gCutsceneFocusBehavior = NULL;
// other camera focuses?
u32 unused8032CFC8 = 0;
u32 unused8032CFCC = 0;
@ -3277,6 +3278,7 @@ void reset_camera(struct Camera *c) {
gCutsceneObjSpawn = 0;
gObjCutsceneDone = FALSE;
gCutsceneFocus = NULL;
gCutsceneFocusBehavior = NULL;
unused8032CFC8 = 0;
unused8032CFCC = 0;
gSecondCameraFocus = NULL;
@ -6944,6 +6946,7 @@ void start_object_cutscene(u8 cutscene, struct Object *o) {
sObjectCutscene = cutscene;
gRecentCutscene = 0;
gCutsceneFocus = o;
gCutsceneFocusBehavior = o->behavior;
gObjCutsceneDone = FALSE;
}
@ -11295,9 +11298,14 @@ void play_cutscene(struct Camera *c) {
gCameraMovementFlags &= ~CAM_MOVING_INTO_MODE;
if (gCutsceneFocus != NULL) {
if (gCutsceneFocus->activeFlags == ACTIVE_FLAG_DEACTIVATED) {
if (gCutsceneFocus->activeFlags == ACTIVE_FLAG_DEACTIVATED || gCutsceneFocus->behavior != gCutsceneFocusBehavior) {
gObjCutsceneDone = true;
gTimeStopState = 0;
sStatusFlags |= CAM_FLAG_SMOOTH_MOVEMENT;
gCutsceneTimer = CUTSCENE_STOP;
c->cutscene = 0;
return;
}
}