From 08854728d6518f9572d5bf4366297ce96417cafd Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 12 Mar 2020 22:34:12 +1000 Subject: [PATCH] Decompile weaponGetNameId --- src/game/game_097ba0.c | 25 ++++++++++--------------- src/game/game_111600.c | 4 ++-- src/include/game/game_097ba0.h | 2 +- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index fca544fed..a3aa498c0 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -12738,21 +12738,16 @@ glabel func0f0a215c /* f0a21a0: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f0a21a4 -/* f0a21a4: 00047080 */ sll $t6,$a0,0x2 -/* f0a21a8: 3c038007 */ lui $v1,%hi(g_Weapons) -/* f0a21ac: 006e1821 */ addu $v1,$v1,$t6 -/* f0a21b0: 8c63ff18 */ lw $v1,%lo(g_Weapons)($v1) -/* f0a21b4: 00001025 */ or $v0,$zero,$zero -/* f0a21b8: 10600003 */ beqz $v1,.L0f0a21c8 -/* f0a21bc: 00000000 */ sll $zero,$zero,0x0 -/* f0a21c0: 03e00008 */ jr $ra -/* f0a21c4: 94620046 */ lhu $v0,0x46($v1) -.L0f0a21c8: -/* f0a21c8: 03e00008 */ jr $ra -/* f0a21cc: 00000000 */ sll $zero,$zero,0x0 -); +u16 weaponGetNameId(s32 weaponnum) +{ + struct weapon *weapon = g_Weapons[weaponnum]; + + if (weapon) { + return weapon->name; + } + + return 0; +} char *weaponGetShortName(s32 weaponnum) { diff --git a/src/game/game_111600.c b/src/game/game_111600.c index 7266f73e1..5f9fe59c9 100644 --- a/src/game/game_111600.c +++ b/src/game/game_111600.c @@ -1383,12 +1383,12 @@ u16 currentPlayerGetInvNameIdByIndex(s32 index) if (g_Vars.currentplayer->equipallguns) { if (index < WEAPON_PSYCHOSISGUN - currentStageForbidsSlayer()) { index++; - return func0f0a21a4(func0f111b88(index)); + return weaponGetNameId(func0f111b88(index)); } } } - return func0f0a21a4(weaponnum); + return weaponGetNameId(weaponnum); } char *currentPlayerGetInvNameByIndex(s32 index) diff --git a/src/include/game/game_097ba0.h b/src/include/game/game_097ba0.h index cf666da5d..26612bd05 100644 --- a/src/include/game/game_097ba0.h +++ b/src/include/game/game_097ba0.h @@ -101,7 +101,7 @@ void currentPlayerEquipWeapon(u32 arg0, u32 arg1); u32 func0f0a20fc(void); u32 func0f0a212c(void); u32 func0f0a215c(void); -u16 func0f0a21a4(s32 arg0); +u16 weaponGetNameId(s32 weaponnum); char *weaponGetShortName(s32 arg0); u32 func0f0a2218(void); u32 func0f0a2290(void);