fix crash when fishing rod is cast and scene is reloaded (#2657)

This commit is contained in:
Adam Bird 2023-04-01 14:06:53 -04:00 committed by GitHub
parent f7703e14e8
commit f5bcc6dccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -22,6 +22,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play);
void Fishing_UpdateOwner(Actor* thisx, PlayState* play);
void Fishing_DrawFish(Actor* thisx, PlayState* play);
void Fishing_DrawOwner(Actor* thisx, PlayState* play);
void Fishing_Reset(void);
typedef struct {
/* 0x00 */ u8 unk_00;
@ -132,7 +133,7 @@ const ActorInit Fishing_InitVars = {
(ActorFunc)Fishing_Destroy,
(ActorFunc)Fishing_UpdateFish,
(ActorFunc)Fishing_DrawFish,
NULL,
(ActorResetFunc)Fishing_Reset,
};
static f32 D_80B7A650 = 0.0f;
@ -5888,3 +5889,10 @@ void Fishing_DrawOwner(Actor* thisx, PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx);
}
void Fishing_Reset(void) {
// Reset static variables for fishing camera and cinematic state to prevent crashing when dying
// or re-entering the scene while the fishing rod was cast
sCameraId = 0;
D_80B7A6CC = 0;
}