From c2daf9c9e0983dc22d81764b7f760d3bb3573c99 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 27 Dec 2020 12:29:22 +1000 Subject: [PATCH] Decompile explosionsClearAll --- src/game/game_015280.c | 69 ++++++++++------------------------ src/game/game_167ae0.c | 2 +- src/game/training.c | 2 +- src/include/game/game_015280.h | 2 +- src/include/types.h | 2 +- 5 files changed, 23 insertions(+), 54 deletions(-) diff --git a/src/game/game_015280.c b/src/game/game_015280.c index bdf1163e0..aebe666e8 100644 --- a/src/game/game_015280.c +++ b/src/game/game_015280.c @@ -12,53 +12,22 @@ #include "lib/lib_09660.h" #include "types.h" -GLOBAL_ASM( -glabel func0f015280 -/* f015280: 27bdffd8 */ addiu $sp,$sp,-40 -/* f015284: afbf0024 */ sw $ra,0x24($sp) -/* f015288: 3c018008 */ lui $at,%hi(var8007e4a0) -/* f01528c: 44806000 */ mtc1 $zero,$f12 -/* f015290: afb20020 */ sw $s2,0x20($sp) -/* f015294: afb1001c */ sw $s1,0x1c($sp) -/* f015298: afb00018 */ sw $s0,0x18($sp) -/* f01529c: 0c002a94 */ jal func0000aa50 -/* f0152a0: ac20e4a0 */ sw $zero,%lo(var8007e4a0)($at) -/* f0152a4: 3c11800a */ lui $s1,%hi(g_Explosions) -/* f0152a8: 26313430 */ addiu $s1,$s1,%lo(g_Explosions) -/* f0152ac: 8e2e0000 */ lw $t6,0x0($s1) -/* f0152b0: 00008025 */ or $s0,$zero,$zero -/* f0152b4: 24121ad0 */ addiu $s2,$zero,0x1ad0 -/* f0152b8: 51c00017 */ beqzl $t6,.L0f015318 -/* f0152bc: 8fbf0024 */ lw $ra,0x24($sp) -/* f0152c0: 8e2f0000 */ lw $t7,0x0($s1) -.L0f0152c4: -/* f0152c4: 01f0c021 */ addu $t8,$t7,$s0 -/* f0152c8: 8f040000 */ lw $a0,0x0($t8) -/* f0152cc: 5080000f */ beqzl $a0,.L0f01530c -/* f0152d0: 26100478 */ addiu $s0,$s0,0x478 -/* f0152d4: 0fc18171 */ jal func0f0605c4 -/* f0152d8: 00000000 */ nop -/* f0152dc: 8e390000 */ lw $t9,0x0($s1) -/* f0152e0: 03304021 */ addu $t0,$t9,$s0 -/* f0152e4: 0fc180c0 */ jal propHide -/* f0152e8: 8d040000 */ lw $a0,0x0($t0) -/* f0152ec: 8e290000 */ lw $t1,0x0($s1) -/* f0152f0: 01305021 */ addu $t2,$t1,$s0 -/* f0152f4: 0fc1810e */ jal propFree -/* f0152f8: 8d440000 */ lw $a0,0x0($t2) -/* f0152fc: 8e2b0000 */ lw $t3,0x0($s1) -/* f015300: 01706021 */ addu $t4,$t3,$s0 -/* f015304: ad800000 */ sw $zero,0x0($t4) -/* f015308: 26100478 */ addiu $s0,$s0,0x478 -.L0f01530c: -/* f01530c: 5612ffed */ bnel $s0,$s2,.L0f0152c4 -/* f015310: 8e2f0000 */ lw $t7,0x0($s1) -/* f015314: 8fbf0024 */ lw $ra,0x24($sp) -.L0f015318: -/* f015318: 8fb00018 */ lw $s0,0x18($sp) -/* f01531c: 8fb1001c */ lw $s1,0x1c($sp) -/* f015320: 8fb20020 */ lw $s2,0x20($sp) -/* f015324: 03e00008 */ jr $ra -/* f015328: 27bd0028 */ addiu $sp,$sp,0x28 -/* f01532c: 00000000 */ nop -); +void explosionsClearAll(void) +{ + s32 i; + + var8007e4a0 = 0; + func0000aa50(0); + + if (g_Explosions) { + for (i = 0; i < 6; i++) { + if (g_Explosions[i].prop) { + func0f0605c4(g_Explosions[i].prop); + propHide(g_Explosions[i].prop); + propFree(g_Explosions[i].prop); + + g_Explosions[i].prop = NULL; + } + } + } +} diff --git a/src/game/game_167ae0.c b/src/game/game_167ae0.c index 3248c88a1..643cb4160 100644 --- a/src/game/game_167ae0.c +++ b/src/game/game_167ae0.c @@ -2762,7 +2762,7 @@ void stageLoad(void) } func0f014f10(); - func0f015280(); + explosionsClearAll(); smokeClearAll(); func0f015400(); func0f015410(); diff --git a/src/game/training.c b/src/game/training.c index c0a62fe23..210e6308a 100644 --- a/src/game/training.c +++ b/src/game/training.c @@ -2289,7 +2289,7 @@ bool frIsAmmoWasted(void) // Check if there are any explosions for (i = 0; i != 6; i++) { - if (g_Explosions[i].unk00) { + if (g_Explosions[i].prop) { return false; } } diff --git a/src/include/game/game_015280.h b/src/include/game/game_015280.h index 936c14520..2c6440210 100644 --- a/src/include/game/game_015280.h +++ b/src/include/game/game_015280.h @@ -3,6 +3,6 @@ #include #include "types.h" -u32 func0f015280(void); +u32 explosionsClearAll(void); #endif diff --git a/src/include/types.h b/src/include/types.h index 060c23311..4fd36bffb 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -4814,7 +4814,7 @@ struct explosionbb { // billboards? }; struct explosion { - u32 unk00; + struct prop *prop; u32 unk04; struct explosion08 unk08[40]; /*0x3c8*/ s16 age;