From 45d4feddf6e44e5c66fac93e1647e647c145d590 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 23 Jan 2021 18:11:54 +1000 Subject: [PATCH] Attempt to decompile handPopulateFromCurrentPlayer --- src/game/game_0601b0.c | 4 ++-- src/game/game_097ba0.c | 4 ++-- src/game/game_0b0fd0.c | 19 ++++++++++++++++++- src/include/game/game_0b0fd0.h | 2 +- src/include/types.h | 2 +- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/game/game_0601b0.c b/src/game/game_0601b0.c index fa9b998f2..5f9ac018b 100644 --- a/src/game/game_0601b0.c +++ b/src/game/game_0601b0.c @@ -842,7 +842,7 @@ glabel var7f1a9eb8 /* f060e80: c4e60004 */ lwc1 $f6,0x4($a3) /* f060e84: e7a6020c */ swc1 $f6,0x20c($sp) /* f060e88: c4e80008 */ lwc1 $f8,0x8($a3) -/* f060e8c: 0fc2c6bc */ jal func0f0b1af0 +/* f060e8c: 0fc2c6bc */ jal handPopulateFromCurrentPlayer /* f060e90: e7a80210 */ swc1 $f8,0x210($sp) /* f060e94: 0fc2c41f */ jal handGetWeaponFunction /* f060e98: 27a40214 */ addiu $a0,$sp,0x214 @@ -2409,7 +2409,7 @@ void handTickAttack(s32 handnum) g_Vars.currentplayer->hands[handnum].unk0d0f_03 = false; - func0f0b1af0(handnum, (struct hand *)&tmpweaponnum); + handPopulateFromCurrentPlayer(handnum, (struct hand *)&tmpweaponnum); frIncrementNumShots(); switch (type) { diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index 14ec0f6d2..fe133aac0 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -6812,10 +6812,10 @@ glabel func0f09cf88 /* f09cf94: 3c10800a */ lui $s0,%hi(g_Vars+0x284) /* f09cf98: 8e10a244 */ lw $s0,%lo(g_Vars+0x284)($s0) /* f09cf9c: 27a50054 */ addiu $a1,$sp,0x54 -/* f09cfa0: 0fc2c6bc */ jal func0f0b1af0 +/* f09cfa0: 0fc2c6bc */ jal handPopulateFromCurrentPlayer /* f09cfa4: 24040001 */ addiu $a0,$zero,0x1 /* f09cfa8: 00002025 */ or $a0,$zero,$zero -/* f09cfac: 0fc2c6bc */ jal func0f0b1af0 +/* f09cfac: 0fc2c6bc */ jal handPopulateFromCurrentPlayer /* f09cfb0: 27a50050 */ addiu $a1,$sp,0x50 /* f09cfb4: 27a40054 */ addiu $a0,$sp,0x54 /* f09cfb8: 0fc2c807 */ jal func0f0b201c diff --git a/src/game/game_0b0fd0.c b/src/game/game_0b0fd0.c index 0caa29953..86601e6fb 100644 --- a/src/game/game_0b0fd0.c +++ b/src/game/game_0b0fd0.c @@ -409,7 +409,7 @@ u16 weaponGetModelNum2(s32 weaponnum) } GLOBAL_ASM( -glabel func0f0b1af0 +glabel handPopulateFromCurrentPlayer /* f0b1af0: 3c06800a */ lui $a2,%hi(g_Vars) /* f0b1af4: 24c69fc0 */ addiu $a2,$a2,%lo(g_Vars) /* f0b1af8: 8cce0284 */ lw $t6,0x284($a2) @@ -494,6 +494,23 @@ glabel func0f0b1af0 /* f0b1c20: 00000000 */ nop ); +// Mismatch: regalloc +//void handPopulateFromCurrentPlayer(s32 handnum, struct hand *hand) +//{ +// hand->weaponnum = g_Vars.currentplayer->weaponnum; +// hand->weaponfunc = g_Vars.currentplayer->hands[handnum].weaponfunc; +// hand->unk063a = g_Vars.currentplayer->hands[handnum].unk063a; +// hand->unk0639 = g_Vars.currentplayer->hands[handnum].unk0639; +// +// if (hand->weaponnum == WEAPON_MAULER) { +// hand->unk063a = g_Vars.currentplayer->hands[handnum].unk0874 * 10.0f; +// } +// +// if (hand->weaponnum == WEAPON_LASER) { +// hand->unk063a = g_Vars.currentplayer->hands[handnum].unk0b90; +// } +//} + struct inventory_ammo *handGetAmmoDefinition(struct hand *hand) { struct weaponfunc *func = handGetWeaponFunction(hand); diff --git a/src/include/game/game_0b0fd0.h b/src/include/game/game_0b0fd0.h index 4f2ed2452..7927499e6 100644 --- a/src/include/game/game_0b0fd0.h +++ b/src/include/game/game_0b0fd0.h @@ -23,7 +23,7 @@ s32 currentPlayerGetDeviceState(s32 weaponnum); void currentPlayerSetDeviceActive(s32 weaponum, bool active); u16 weaponGetModelNum(s32 weaponnum); u16 weaponGetModelNum2(s32 weaponnum); -void func0f0b1af0(s32 handnum, struct hand *hand); +void handPopulateFromCurrentPlayer(s32 handnum, struct hand *hand); struct inventory_ammo *handGetAmmoDefinition(struct hand *hand); u8 handGetSingleUnk3c(struct hand *hand); f32 handGetSingleUnk34(struct hand *hand); diff --git a/src/include/types.h b/src/include/types.h index 3f5d5c139..1b8460263 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -1834,7 +1834,7 @@ struct hand { /*0x0868*/ u32 unk0868; /*0x086c*/ u32 unk086c; /*0x0870*/ u32 unk0870; - /*0x0874*/ u32 unk0874; + /*0x0874*/ f32 unk0874; // Mauler charge amount? Or a timer /*0x0878*/ u32 unk0878; /*0x087c*/ u32 unk087c; /*0x0880*/ u32 unk0880;