From 923d6ecde2a4c2a189188b0740378c91b4446f10 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 10 Apr 2021 10:35:43 +1000 Subject: [PATCH] Decompile func0f099188 --- src/game/game_097ba0.c | 39 ++++++++++------------------------ src/include/game/game_097ba0.h | 2 +- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index 4f767c86c..930a71aa5 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -2775,34 +2775,17 @@ bool func0f0990b0(struct weaponfunc *basefunc, struct weapon *weapon) return false; } -GLOBAL_ASM( -glabel func0f099188 -/* f099188: 27bdffe0 */ addiu $sp,$sp,-32 -/* f09918c: afbf0014 */ sw $ra,0x14($sp) -/* f099190: afa40020 */ sw $a0,0x20($sp) -/* f099194: 0fc2c42e */ jal weaponGetFunction -/* f099198: afa50024 */ sw $a1,0x24($sp) -/* f09919c: 8fae0020 */ lw $t6,0x20($sp) -/* f0991a0: afa2001c */ sw $v0,0x1c($sp) -/* f0991a4: 0fc2c3f4 */ jal weaponFindById -/* f0991a8: 91c40000 */ lbu $a0,0x0($t6) -/* f0991ac: 0fc2a31f */ jal currentPlayerIsUsingSecondaryFunction -/* f0991b0: afa20018 */ sw $v0,0x18($sp) -/* f0991b4: 8faf0024 */ lw $t7,0x24($sp) -/* f0991b8: 8fa4001c */ lw $a0,0x1c($sp) -/* f0991bc: 144f0003 */ bne $v0,$t7,.L0f0991cc -/* f0991c0: 00000000 */ nop -/* f0991c4: 10000003 */ b .L0f0991d4 -/* f0991c8: 00001025 */ or $v0,$zero,$zero -.L0f0991cc: -/* f0991cc: 0fc2642c */ jal func0f0990b0 -/* f0991d0: 8fa50018 */ lw $a1,0x18($sp) -.L0f0991d4: -/* f0991d4: 8fbf0014 */ lw $ra,0x14($sp) -/* f0991d8: 27bd0020 */ addiu $sp,$sp,0x20 -/* f0991dc: 03e00008 */ jr $ra -/* f0991e0: 00000000 */ nop -); +bool func0f099188(struct hand *hand, s32 gunfunc) +{ + struct weaponfunc *func = weaponGetFunction(&hand->base, gunfunc); + struct weapon *weapon = weaponFindById(hand->base.weaponnum); + + if (currentPlayerIsUsingSecondaryFunction() == gunfunc) { + return false; + } + + return func0f0990b0(func, weapon); +} #if VERSION >= VERSION_PAL_FINAL GLOBAL_ASM( diff --git a/src/include/game/game_097ba0.h b/src/include/game/game_097ba0.h index 5fdfebd6d..26f08d83d 100644 --- a/src/include/game/game_097ba0.h +++ b/src/include/game/game_097ba0.h @@ -24,7 +24,7 @@ u32 func0f098df8(void); u32 func0f098f8c(void); bool func0f099008(s32 handnum); bool func0f0990b0(struct weaponfunc *basefunc, struct weapon *weapon); -s32 func0f099188(struct hand *hand, s32 gunfunc); +bool func0f099188(struct hand *hand, s32 gunfunc); s32 handTickIncIdle(struct handweaponinfo *info, s32 handnum, struct hand *hand, s32 lvupdate); void func0f099780(struct hand *hand, f32 arg1); s32 handTickIncAutoSwitch(struct handweaponinfo *info, s32 handnum, struct hand *hand, s32 lvupdate);