From ef7ba6df1bf82b2ee286453f3a035b2fe834ed60 Mon Sep 17 00:00:00 2001 From: Archez Date: Sun, 14 Apr 2024 09:10:53 -0400 Subject: [PATCH] fix talk animation crash (#192) --- mm/src/overlays/actors/ovl_player_actor/z_player.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/src/overlays/actors/ovl_player_actor/z_player.c b/mm/src/overlays/actors/ovl_player_actor/z_player.c index 1f125dbcc..ba9770481 100644 --- a/mm/src/overlays/actors/ovl_player_actor/z_player.c +++ b/mm/src/overlays/actors/ovl_player_actor/z_player.c @@ -20733,6 +20733,14 @@ s32 func_8085B930(PlayState* play, PlayerAnimationHeader* talkAnim, AnimationMod return false; } + // 2S2H [Port] We are setting the result of func_8082ED20 to talkAnim ahead of time + // so that Animation_GetLastframe returns a real value + if (talkAnim == NULL) { + talkAnim = func_8082ED20(player); + } + + //! @bug When func_8082ED20 is used to get a wait animation, NULL is still passed to Animation_GetLastFrame, + // causing it to read the frame count from address 0x80000000 which returns 15385 PlayerAnimation_Change(play, &player->skelAnime, (talkAnim == NULL) ? func_8082ED20(player) : talkAnim, 2.0f / 3.0f, 0.0f, Animation_GetLastFrame(talkAnim), animMode, -6.0f); return true;