summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Bird <Archez@users.noreply.github.com>2023-04-01 14:06:53 -0400
committerGitHub <noreply@github.com>2023-04-01 14:06:53 -0400
commitf5bcc6dccfb52499da641f8b00e792b259e01bc0 (patch)
treed9ed83bc17cbeb26281e1862ec7bee4f953e4f83
parentf7703e14e85d7646248320168dc0f4aa3c6c43de (diff)
fix crash when fishing rod is cast and scene is reloaded (#2657)
-rw-r--r--soh/src/overlays/actors/ovl_Fishing/z_fishing.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c
index 29dc52c7f..e67039659 100644
--- a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c
+++ b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c
@@ -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;
+}