From 74d041fb05ae1796d3f52ec8ed0961a0b5665632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo?= Date: Tue, 20 Jan 2026 11:33:46 -0300 Subject: [PATCH] Use the free function instead of clearing the snow count directly. (#121) * Use the free function isntead of clearing the snow count directly. * Also initialize the queue count to 0 if re-allocated. --- patches/snow_patches.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/patches/snow_patches.c b/patches/snow_patches.c index 71592a1..b068175 100644 --- a/patches/snow_patches.c +++ b/patches/snow_patches.c @@ -49,6 +49,7 @@ RECOMP_PATCH void func_802F9054(void) { D_80369288 = assetcache_get(0x8a1); //2D_light // @recomp Initialize the snow ID queue. + snowIDQueueCount = 0; while (snowIDQueueCount < SNOW_PARTICLE_COUNT_EXPANDED) { snowIDQueue[snowIDQueueCount] = snowIDQueueCount; snowIDQueueCount++; @@ -83,6 +84,16 @@ RECOMP_PATCH void func_802F9134(s32 gfx) { } } + +// @recomp Patched to clear the array using the free function instead. +RECOMP_PATCH void func_802F8FF0(void) { + // @recomp Don't just clear the count, use the free function to do it. + // D_80369284 = 0; + while (D_80369284 > 0) { + func_802F9134(D_80369284 - 1); + } +} + // @recomp Patched to increase the amount of snow particles, the spawn area and assign transform IDs to them. RECOMP_PATCH void func_802F919C(void) { f32 temp_f20; @@ -99,7 +110,11 @@ RECOMP_PATCH void func_802F919C(void) { if (D_80369280 != NULL) { if (func_802BEF64() != 0) { - D_80369284 = 0; + // @recomp Don't just clear the count, use the free function to do it. + // D_80369284 = 0; + while (D_80369284 > 0) { + func_802F9134(D_80369284 - 1); + } return; } temp_f20 = time_getDelta();