From 99288aaf57d7779f3bc66e6be03575847e8825da Mon Sep 17 00:00:00 2001 From: Sonic Dreamcaster Date: Sat, 24 May 2025 18:28:43 -0300 Subject: [PATCH] better fix for the ending --- src/overlays/ovl_ending/fox_end1.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/overlays/ovl_ending/fox_end1.c b/src/overlays/ovl_ending/fox_end1.c index 5c3fbcdb..efdf3076 100644 --- a/src/overlays/ovl_ending/fox_end1.c +++ b/src/overlays/ovl_ending/fox_end1.c @@ -48,6 +48,25 @@ bool D_ending_80198584; s32 D_ending_80198588; s32 D_ending_8019858C; +void Ending_Port_InitOverlay(void) { + D_ending_80192E70 = 0; // ending sequence frame counter + D_ending_80196D04 = 0; // ending text frame counter + memset(D_ending_80196D08, 0, sizeof(D_ending_80196D08)); + D_ending_80196F88 = 0; + D_ending_80196F8C = 0; + D_ending_80196F90 = 0; + D_ending_80196F94 = 0; + D_ending_80196F98 = 0; + D_ending_80196F9C = 0.0f; + memset(D_ending_80196FA0, 0, sizeof(D_ending_80196FA0)); + memset(D_ending_80197900, 0, sizeof(D_ending_80197900)); + memset(D_ending_80198260, 0, sizeof(D_ending_80198260)); + D_ending_80198580 = 0.0f; + D_ending_80198584 = false; + D_ending_80198588 = 0; + D_ending_8019858C = 0; +} + const char str1[] = "fogR= %d, fogG= %d, fogB= %d\n"; const char str2[] = "ligR= %d, ligG= %d, ligB= %d\n"; const char str3[] = "kanR= %d, kanG= %d, kanB= %d\n"; @@ -1038,10 +1057,10 @@ void Ending_Main(void) { D_ending_80196D00 = 1; // @port Bugfix: - // In the original game, this variable is set zero when the overlay is reloaded. - // Since we don't use overlays, the absence of this counter reset causes the ending not to play - // after a the first playthrough. - D_ending_80192E70 = 0; + // In the original game, these variables are set to zero when the overlay is reloaded. + // Since we don't use overlays, the absence of this initializer causes the ending not to play + // as it should after a the first playthrough. + Ending_Port_InitOverlay(); break; case 1: