From 8bdf4bfd360df2a5c3ed586ff31f17cc4ec86650 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 22 Feb 2021 23:14:54 +1000 Subject: [PATCH] Decompile mpHasShield --- src/game/game_190260.c | 4 ++-- src/game/game_197600.c | 42 ++++++++++++---------------------- src/include/game/game_197600.h | 2 +- 3 files changed, 17 insertions(+), 31 deletions(-) diff --git a/src/game/game_190260.c b/src/game/game_190260.c index f02dcf15c..2fb358c1c 100644 --- a/src/game/game_190260.c +++ b/src/game/game_190260.c @@ -287,7 +287,7 @@ glabel mpChrReset /* f1905a4: 24190001 */ addiu $t9,$zero,0x1 /* f1905a8: 960f0064 */ lhu $t7,0x64($s0) /* f1905ac: 31f8fffe */ andi $t8,$t7,0xfffe -/* f1905b0: 0fc6609e */ jal func0f198278 +/* f1905b0: 0fc6609e */ jal mpHasShield /* f1905b4: a6180064 */ sh $t8,0x64($s0) /* f1905b8: 10400004 */ beqz $v0,.L0f1905cc /* f1905bc: 3c014100 */ lui $at,0x4100 @@ -438,7 +438,7 @@ glabel mpChrReset // if (aibot->simulant->difficulty == SIMDIFF_DARK) { // aibot->unk064 &= ~1; // -// if (func0f198278()) { +// if (mpHasShield()) { // chr->cshield = 8; // } // } diff --git a/src/game/game_197600.c b/src/game/game_197600.c index 08c9ed680..9bb58b8a3 100644 --- a/src/game/game_197600.c +++ b/src/game/game_197600.c @@ -1244,34 +1244,20 @@ glabel func0f198068 /* f198274: 27bd0088 */ addiu $sp,$sp,0x88 ); -GLOBAL_ASM( -glabel func0f198278 -/* f198278: 3c03800b */ lui $v1,%hi(g_MpSetup) -/* f19827c: 3c07800b */ lui $a3,%hi(g_MpSetup+0x6) -/* f198280: 3c048008 */ lui $a0,%hi(g_MpWeapons) -/* f198284: 24847268 */ addiu $a0,$a0,%lo(g_MpWeapons) -/* f198288: 24e7cb8e */ addiu $a3,$a3,%lo(g_MpSetup+0x6) -/* f19828c: 2463cb88 */ addiu $v1,$v1,%lo(g_MpSetup) -/* f198290: 2406005b */ addiu $a2,$zero,0x5b -/* f198294: 2405000a */ addiu $a1,$zero,0xa -/* f198298: 906e0018 */ lbu $t6,0x18($v1) -.L0f19829c: -/* f19829c: 24630001 */ addiu $v1,$v1,0x1 -/* f1982a0: 01c50019 */ multu $t6,$a1 -/* f1982a4: 00007812 */ mflo $t7 -/* f1982a8: 008fc021 */ addu $t8,$a0,$t7 -/* f1982ac: 93020000 */ lbu $v0,0x0($t8) -/* f1982b0: 14460003 */ bne $v0,$a2,.L0f1982c0 -/* f1982b4: 00000000 */ nop -/* f1982b8: 03e00008 */ jr $ra -/* f1982bc: 24020001 */ addiu $v0,$zero,0x1 -.L0f1982c0: -/* f1982c0: 5467fff6 */ bnel $v1,$a3,.L0f19829c -/* f1982c4: 906e0018 */ lbu $t6,0x18($v1) -/* f1982c8: 00001025 */ or $v0,$zero,$zero -/* f1982cc: 03e00008 */ jr $ra -/* f1982d0: 00000000 */ nop -); +bool mpHasShield(void) +{ + s32 i; + + for (i = 0; i < ARRAYCOUNT(g_MpSetup.weapons); i++) { + s32 weaponnum = g_MpWeapons[g_MpSetup.weapons[i]].weaponnum; + + if (weaponnum == WEAPON_MPSHIELD) { + return true; + } + } + + return false; +} s32 mpGetWeaponIndexByWeaponNum(s32 weaponnum) { diff --git a/src/include/game/game_197600.h b/src/include/game/game_197600.h index 038ac15ed..822021f4d 100644 --- a/src/include/game/game_197600.h +++ b/src/include/game/game_197600.h @@ -16,7 +16,7 @@ void aibotGiveDualWeapon(struct chrdata *chr, u32 weaponnum); s16 aibotGetWeaponPad(struct chrdata *chr, u32 weaponnum); void aibotGiveProp(struct chrdata *chr, struct prop *prop); u32 func0f198068(void); -u32 func0f198278(void); +bool mpHasShield(void); s32 mpGetWeaponIndexByWeaponNum(s32 weaponnum); u32 func0f198338(void); u32 func0f198db4(void);