From 59d9e09bd6fb3755696e8a1381a38212af0b2cb6 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 2 Nov 2020 21:45:03 +1000 Subject: [PATCH] Decopmile getCurrentPlayerWeaponId --- src/game/game_097ba0.c | 36 +++++++++++----------------------- src/include/game/game_097ba0.h | 4 ++-- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index d5c73c5af..cc5e1984a 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -12126,32 +12126,18 @@ void currentPlayerEquipWeapon(s32 weaponnum) player->unk1583_05 = 0; } -GLOBAL_ASM( -glabel getCurrentPlayerWeaponId -/* f0a19a8: 00047100 */ sll $t6,$a0,0x4 -/* f0a19ac: 01c47023 */ subu $t6,$t6,$a0 -/* f0a19b0: 000e7080 */ sll $t6,$t6,0x2 -/* f0a19b4: 01c47021 */ addu $t6,$t6,$a0 -/* f0a19b8: 3c03800a */ lui $v1,%hi(g_Vars+0x284) -/* f0a19bc: 8c63a244 */ lw $v1,%lo(g_Vars+0x284)($v1) -/* f0a19c0: 000e70c0 */ sll $t6,$t6,0x3 -/* f0a19c4: 01c47021 */ addu $t6,$t6,$a0 -/* f0a19c8: 000e7080 */ sll $t6,$t6,0x2 -/* f0a19cc: 006e7821 */ addu $t7,$v1,$t6 -/* f0a19d0: 81f80640 */ lb $t8,0x640($t7) -/* f0a19d4: 57000004 */ bnezl $t8,.L0f0a19e8 -/* f0a19d8: 80621580 */ lb $v0,0x1580($v1) -/* f0a19dc: 03e00008 */ jr $ra -/* f0a19e0: 00001025 */ or $v0,$zero,$zero -/* f0a19e4: 80621580 */ lb $v0,0x1580($v1) -.L0f0a19e8: -/* f0a19e8: 03e00008 */ jr $ra -/* f0a19ec: 00000000 */ nop -); - -u32 getCurrentPlayerWeaponIdWrapper(u32 arg0) +s32 getCurrentPlayerWeaponId(s32 handnum) { - return getCurrentPlayerWeaponId(arg0); + if (!g_Vars.currentplayer->hands[handnum].unk0640) { + return WEAPON_NONE; + } + + return g_Vars.currentplayer->weaponnum; +} + +s32 getCurrentPlayerWeaponIdWrapper(s32 handnum) +{ + return getCurrentPlayerWeaponId(handnum); } GLOBAL_ASM( diff --git a/src/include/game/game_097ba0.h b/src/include/game/game_097ba0.h index a50fddba9..adf379ca7 100644 --- a/src/include/game/game_097ba0.h +++ b/src/include/game/game_097ba0.h @@ -89,7 +89,7 @@ u32 func0f0a1318(void); u32 func0f0a134c(void); u32 func0f0a1528(void); void currentPlayerEquipWeapon(s32 weaponnum); -u32 getCurrentPlayerWeaponId(u32 arg0); +s32 getCurrentPlayerWeaponId(s32 handnum); u32 func0f0a1a10(void); u32 func0f0a1a68(void); u32 func0f0a1ab0(void); @@ -175,7 +175,7 @@ void speedpillTick(void); void currentPlayerSetGunSightVisible(u32 bits, bool visible); Gfx *func0f0abcb0(Gfx *gdl); u32 func0f0abd30(void); -u32 getCurrentPlayerWeaponIdWrapper(u32 arg0); +s32 getCurrentPlayerWeaponIdWrapper(s32 handnum); s8 freeFireslotWrapper(s32 fireslot); s8 freeFireslot(s32 fireslot);