From 8d0f6c348c1ffbdc5bcc02fee8fcaf9b83d7af40 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 5 May 2020 22:21:04 +1000 Subject: [PATCH] Decompile handGetWeaponFunction --- src/game/bondcutscene.c | 2 +- src/game/bondmove.c | 12 ++++---- src/game/chr/chr.c | 2 +- src/game/chr/chraction.c | 2 +- src/game/game_0601b0.c | 4 +-- src/game/game_097ba0.c | 54 +++++++++++++++++----------------- src/game/game_0b0420.c | 53 ++++++++++++++------------------- src/game/game_0fd660.c | 6 ++-- src/game/game_190260.c | 2 +- src/game/game_19c990.c | 4 +-- src/game/game_1a3340.c | 4 +-- src/game/propobj.c | 2 +- src/include/game/game_0b0420.h | 2 +- src/include/types.h | 6 ++-- 14 files changed, 73 insertions(+), 82 deletions(-) diff --git a/src/game/bondcutscene.c b/src/game/bondcutscene.c index 3e8c5b02d..56cbe24cc 100644 --- a/src/game/bondcutscene.c +++ b/src/game/bondcutscene.c @@ -23,7 +23,7 @@ void currentPlayerSetMoveModeCutscene(void) // @bug? Should this be < 2? for (j = 0; j < 1; j++) { - struct player638 *thing = &g_Vars.players[i]->unk0638[j]; + struct hand *thing = &g_Vars.players[i]->hands[j]; if (thing->unk0d84 && func000337f0(thing->unk0d84)) { func00033b24(thing->unk0d84); diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 1ce9657f7..ccb96556c 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -4845,7 +4845,7 @@ glabel var7f1ad8e4 // if (getCurrentPlayerWeaponId(0) == WEAPON_FARSIGHTXR20 // && g_Vars.currentplayer->insightaimmode // && uStack48 -// && g_Vars.currentplayer->unk0638[0].weaponfunc == FUNC_SECONDARY +// && g_Vars.currentplayer->hands[0].weaponfunc == FUNC_SECONDARY // && g_Vars.currentplayer->autoeraserdist > 0) { // fVar25 = func0f0b49b8(500.0f / g_Vars.currentplayer->autoeraserdist); // fStack436 = 2; @@ -4885,7 +4885,7 @@ glabel var7f1ad8e4 // } // // if (getCurrentPlayerWeaponId(0) == WEAPON_AR34 -// && g_Vars.currentplayer->unk0638[0].weaponfunc == FUNC_SECONDARY) { +// && g_Vars.currentplayer->hands[0].weaponfunc == FUNC_SECONDARY) { // fStack432 = func0f0b14d8(); // } // @@ -5094,8 +5094,8 @@ glabel var7f1ad8e4 // func0f0c8004(); // // if (iStack56) { -// g_Vars.currentplayer->unk0638[0].unk0658 = 0; -// g_Vars.currentplayer->unk0638[0].unk065c = 0; +// g_Vars.currentplayer->hands[0].unk0658 = 0; +// g_Vars.currentplayer->hands[0].unk065c = 0; // func0f08a9f4(g_Vars.currentplayernum); // } // @@ -5132,7 +5132,7 @@ glabel var7f1ad8e4 // || g_Vars.currentplayer->autoyaimprop == NULL // || func0f0b1804(iStack180, 2) == 0 // ) -// && (getCurrentPlayerWeaponId(0) != WEAPON_CMP150 || g_Vars.currentplayer->unk0638[0].weaponfunc != FUNC_SECONDARY)) { +// && (getCurrentPlayerWeaponId(0) != WEAPON_CMP150 || g_Vars.currentplayer->hands[0].weaponfunc != FUNC_SECONDARY)) { // // if (g_Vars.currentplayer->unk1b68 < 0.979f) { // g_Vars.currentplayer->unk1b68 += g_Vars.lvupdate240freal * 0.00032f; @@ -5149,7 +5149,7 @@ glabel var7f1ad8e4 // bool followlockon = false; // // if (getCurrentPlayerWeaponId(0) == WEAPON_CMP150 -// && g_Vars.currentplayer->unk0638[0].weaponfunc == FUNC_SECONDARY) { +// && g_Vars.currentplayer->hands[0].weaponfunc == FUNC_SECONDARY) { // followlockon = true; // } // diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index 5dfc72d9b..3e880dce0 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -10765,7 +10765,7 @@ glabel func0f027e1c /* f027e30: 00a08825 */ or $s1,$a1,$zero /* f027e34: afb00034 */ sw $s0,0x34($sp) /* f027e38: a3a0008f */ sb $zero,0x8f($sp) -/* f027e3c: 0fc2c41f */ jal func0f0b107c +/* f027e3c: 0fc2c41f */ jal handGetWeaponFunction /* f027e40: afa40048 */ sw $a0,0x48($sp) /* f027e44: 50400009 */ beqzl $v0,.L0f027e6c /* f027e48: 8e300004 */ lw $s0,0x4($s1) diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 78fc6b0aa..c71f97db8 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -7204,7 +7204,7 @@ glabel var7f1a8d98 /* f0347b4: 27a70114 */ addiu $a3,$sp,0x114 /* f0347b8: 00e02025 */ or $a0,$a3,$zero .L0f0347bc: -/* f0347bc: 0fc2c41f */ jal func0f0b107c +/* f0347bc: 0fc2c41f */ jal handGetWeaponFunction /* f0347c0: afa7014c */ sw $a3,0x14c($sp) /* f0347c4: 0002182b */ sltu $v1,$zero,$v0 /* f0347c8: 10600005 */ beqz $v1,.L0f0347e0 diff --git a/src/game/game_0601b0.c b/src/game/game_0601b0.c index f78a98b50..4eed88a0a 100644 --- a/src/game/game_0601b0.c +++ b/src/game/game_0601b0.c @@ -968,7 +968,7 @@ glabel var7f1a9eb8 /* f060e88: c4e80008 */ lwc1 $f8,0x8($a3) /* f060e8c: 0fc2c6bc */ jal func0f0b1af0 /* f060e90: e7a80210 */ swc1 $f8,0x210($sp) -/* f060e94: 0fc2c41f */ jal func0f0b107c +/* f060e94: 0fc2c41f */ jal handGetWeaponFunction /* f060e98: 27a40214 */ addiu $a0,$sp,0x214 /* f060e9c: 10400013 */ beqz $v0,.L0f060eec /* f060ea0: afa201f0 */ sw $v0,0x1f0($sp) @@ -2489,7 +2489,7 @@ glabel var7f1a9ec4 .L0f0623c0: /* f0623c0: 4481b000 */ mtc1 $at,$f22 /* f0623c4: 8e710004 */ lw $s1,0x4($s3) -/* f0623c8: 0fc2c41f */ jal func0f0b107c +/* f0623c8: 0fc2c41f */ jal handGetWeaponFunction /* f0623cc: 02e02025 */ or $a0,$s7,$zero /* f0623d0: 8c4b0000 */ lw $t3,0x0($v0) /* f0623d4: 24010003 */ addiu $at,$zero,0x3 diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index cf2d5f445..5bc34aee6 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -2698,7 +2698,7 @@ glabel var7f1ac31c /* f099c58: 00c08025 */ or $s0,$a2,$zero /* f099c5c: afa5003c */ sw $a1,0x3c($sp) /* f099c60: afa70044 */ sw $a3,0x44($sp) -/* f099c64: 0fc2c41f */ jal func0f0b107c +/* f099c64: 0fc2c41f */ jal handGetWeaponFunction /* f099c68: 00c02025 */ or $a0,$a2,$zero /* f099c6c: 3c0e800a */ lui $t6,%hi(g_Vars+0x284) /* f099c70: 8dcea244 */ lw $t6,%lo(g_Vars+0x284)($t6) @@ -4097,7 +4097,7 @@ glabel var7f1ac334 /* f09aff0: afa40070 */ sw $a0,0x70($sp) /* f09aff4: 00c08025 */ or $s0,$a2,$zero /* f09aff8: afa50074 */ sw $a1,0x74($sp) -/* f09affc: 0fc2c41f */ jal func0f0b107c +/* f09affc: 0fc2c41f */ jal handGetWeaponFunction /* f09b000: 00c02025 */ or $a0,$a2,$zero /* f09b004: 14400003 */ bnez $v0,.L0f09b014 /* f09b008: afa2006c */ sw $v0,0x6c($sp) @@ -4280,7 +4280,7 @@ glabel func0f09b260 /* f09b268: afb00018 */ sw $s0,0x18($sp) /* f09b26c: afa40028 */ sw $a0,0x28($sp) /* f09b270: 00a08025 */ or $s0,$a1,$zero -/* f09b274: 0fc2c41f */ jal func0f0b107c +/* f09b274: 0fc2c41f */ jal handGetWeaponFunction /* f09b278: 00a02025 */ or $a0,$a1,$zero /* f09b27c: 14400003 */ bnez $v0,.L0f09b28c /* f09b280: 00403825 */ or $a3,$v0,$zero @@ -4479,7 +4479,7 @@ glabel var7f1ac33c /* f09b508: afb00018 */ sw $s0,0x18($sp) /* f09b50c: afa40028 */ sw $a0,0x28($sp) /* f09b510: 00a08025 */ or $s0,$a1,$zero -/* f09b514: 0fc2c41f */ jal func0f0b107c +/* f09b514: 0fc2c41f */ jal handGetWeaponFunction /* f09b518: 00a02025 */ or $a0,$a1,$zero /* f09b51c: 14400003 */ bnez $v0,.L0f09b52c /* f09b520: 00403825 */ or $a3,$v0,$zero @@ -4704,7 +4704,7 @@ GLOBAL_ASM( glabel func0f09b828 /* f09b828: 27bdffe8 */ addiu $sp,$sp,-24 /* f09b82c: afbf0014 */ sw $ra,0x14($sp) -/* f09b830: 0fc2c41f */ jal func0f0b107c +/* f09b830: 0fc2c41f */ jal handGetWeaponFunction /* f09b834: afa40018 */ sw $a0,0x18($sp) /* f09b838: 14400003 */ bnez $v0,.L0f09b848 /* f09b83c: 8fa40018 */ lw $a0,0x18($sp) @@ -4942,7 +4942,7 @@ glabel var7f1ac450 /* f09b97c: 02002025 */ or $a0,$s0,$zero /* f09b980: 11800005 */ beqz $t4,.L0f09b998 /* f09b984: 00000000 */ sll $zero,$zero,0x0 -/* f09b988: 0fc2c41f */ jal func0f0b107c +/* f09b988: 0fc2c41f */ jal handGetWeaponFunction /* f09b98c: afa0004c */ sw $zero,0x4c($sp) /* f09b990: 8fa5004c */ lw $a1,0x4c($sp) /* f09b994: 00401825 */ or $v1,$v0,$zero @@ -5166,7 +5166,7 @@ glabel var7f1ac480 /* f09bc4c: 24080001 */ addiu $t0,$zero,0x1 /* f09bc50: 11e00005 */ beqz $t7,.L0f09bc68 /* f09bc54: 00c02025 */ or $a0,$a2,$zero -/* f09bc58: 0fc2c41f */ jal func0f0b107c +/* f09bc58: 0fc2c41f */ jal handGetWeaponFunction /* f09bc5c: afa8001c */ sw $t0,0x1c($sp) /* f09bc60: 8fa8001c */ lw $t0,0x1c($sp) /* f09bc64: 00401825 */ or $v1,$v0,$zero @@ -13466,7 +13466,7 @@ glabel func0f0a2ae4 /* f0a2c04: 26920638 */ addiu $s2,$s4,0x638 /* f0a2c08: 24130002 */ addiu $s3,$zero,0x2 .L0f0a2c0c: -/* f0a2c0c: 0fc2c41f */ jal func0f0b107c +/* f0a2c0c: 0fc2c41f */ jal handGetWeaponFunction /* f0a2c10: 02402025 */ or $a0,$s2,$zero /* f0a2c14: 8c4f0000 */ lw $t7,0x0($v0) /* f0a2c18: 31e900ff */ andi $t1,$t7,0xff @@ -20653,7 +20653,7 @@ glabel var7f1acb14 void func0f0a8c50(void) { - if (g_Vars.currentplayer->unk0638[0].unk0d0f_03 == 0) { + if (g_Vars.currentplayer->hands[0].unk0d0f_03 == 0) { g_Vars.currentplayer->invertgunfunc = false; } } @@ -21214,29 +21214,29 @@ void func0f0a93e0(struct coord *coord) { struct player *player = g_Vars.currentplayer; - player->unk0638[0].unk07f8.x = func0f0b12ec(0) + coord->x; - player->unk0638[0].unk07f8.y = coord->y; - player->unk0638[0].unk07f8.z = coord->z; + player->hands[0].unk07f8.x = func0f0b12ec(0) + coord->x; + player->hands[0].unk07f8.y = coord->y; + player->hands[0].unk07f8.z = coord->z; - player->unk0638[1].unk07f8.x = func0f0b12ec(1) + coord->x; - player->unk0638[1].unk07f8.y = coord->y; - player->unk0638[1].unk07f8.z = coord->z; + player->hands[1].unk07f8.x = func0f0b12ec(1) + coord->x; + player->hands[1].unk07f8.y = coord->y; + player->hands[1].unk07f8.z = coord->z; } void func0f0a9464(struct coord *coord) { struct player *player = g_Vars.currentplayer; - player->unk0638[1].unk0b94.x = player->unk0638[0].unk0b94.x = coord->x; - player->unk0638[1].unk0b94.y = player->unk0638[0].unk0b94.y = coord->y; - player->unk0638[1].unk0b94.z = player->unk0638[0].unk0b94.z = coord->z; + player->hands[1].unk0b94.x = player->hands[0].unk0b94.x = coord->x; + player->hands[1].unk0b94.y = player->hands[0].unk0b94.y = coord->y; + player->hands[1].unk0b94.z = player->hands[0].unk0b94.z = coord->z; } void func0f0a9494(u32 operation) { switch (operation) { case 0: - g_Vars.currentplayer->unk0638[1].unk0cec = g_Vars.currentplayer->unk0638[0].unk0cec = false; + g_Vars.currentplayer->hands[1].unk0cec = g_Vars.currentplayer->hands[0].unk0cec = false; break; case 1: break; @@ -21252,16 +21252,16 @@ void func0f0a94d0(u32 operation, struct coord *a, struct coord *b) if (a->x > -100000.0f && a->x < 100000.0f && a->y > -100000.0f && a->y < 100000.0f && a->z > -100000.0f && a->z < 100000.0f) { - player->unk0638[0].unk0cec = true; - player->unk0638[1].unk0cec = true; + player->hands[0].unk0cec = true; + player->hands[1].unk0cec = true; - player->unk0638[1].unk0cf0.x = player->unk0638[0].unk0cf0.x = a->x; - player->unk0638[1].unk0cf0.y = player->unk0638[0].unk0cf0.y = a->y; - player->unk0638[1].unk0cf0.z = player->unk0638[0].unk0cf0.z = a->z; + player->hands[1].unk0cf0.x = player->hands[0].unk0cf0.x = a->x; + player->hands[1].unk0cf0.y = player->hands[0].unk0cf0.y = a->y; + player->hands[1].unk0cf0.z = player->hands[0].unk0cf0.z = a->z; - player->unk0638[1].unk0cfc.x = player->unk0638[0].unk0cfc.x = b->x; - player->unk0638[1].unk0cfc.y = player->unk0638[0].unk0cfc.y = b->y; - player->unk0638[1].unk0cfc.z = player->unk0638[0].unk0cfc.z = b->z; + player->hands[1].unk0cfc.x = player->hands[0].unk0cfc.x = b->x; + player->hands[1].unk0cfc.y = player->hands[0].unk0cfc.y = b->y; + player->hands[1].unk0cfc.z = player->hands[0].unk0cfc.z = b->z; } break; case 1: diff --git a/src/game/game_0b0420.c b/src/game/game_0b0420.c index f0757144d..dff1c23fc 100644 --- a/src/game/game_0b0420.c +++ b/src/game/game_0b0420.c @@ -892,25 +892,16 @@ glabel func0f0b103c /* f0b1078: 27bd0018 */ addiu $sp,$sp,0x18 ); -GLOBAL_ASM( -glabel func0f0b107c -/* f0b107c: 908e0000 */ lbu $t6,0x0($a0) -/* f0b1080: 3c038007 */ lui $v1,%hi(g_Weapons) -/* f0b1084: 00001025 */ or $v0,$zero,$zero -/* f0b1088: 000e7880 */ sll $t7,$t6,0x2 -/* f0b108c: 006f1821 */ addu $v1,$v1,$t7 -/* f0b1090: 8c63ff18 */ lw $v1,%lo(g_Weapons)($v1) -/* f0b1094: 10600006 */ beqz $v1,.L0f0b10b0 -/* f0b1098: 00000000 */ sll $zero,$zero,0x0 -/* f0b109c: 90980003 */ lbu $t8,0x3($a0) -/* f0b10a0: 0018c880 */ sll $t9,$t8,0x2 -/* f0b10a4: 00794021 */ addu $t0,$v1,$t9 -/* f0b10a8: 03e00008 */ jr $ra -/* f0b10ac: 8d020014 */ lw $v0,0x14($t0) -.L0f0b10b0: -/* f0b10b0: 03e00008 */ jr $ra -/* f0b10b4: 00000000 */ sll $zero,$zero,0x0 -); +struct weaponfunc *handGetWeaponFunction(struct hand *hand) +{ + struct weapon *weapon = g_Weapons[hand->weaponnum]; + + if (weapon) { + return weapon->functions[hand->weaponfunc]; + } + + return NULL; +} struct weaponfunc *weaponGetFunction(u8 *arg0, s32 which) { @@ -925,10 +916,10 @@ struct weaponfunc *weaponGetFunction(u8 *arg0, s32 which) struct weaponfunc *currentPlayerGetWeaponFunction(u32 hand) { - struct weapon *weapon = weaponFindById(g_Vars.currentplayer->unk0638[hand].weaponnum); + struct weapon *weapon = weaponFindById(g_Vars.currentplayer->hands[hand].weaponnum); if (weapon) { - return weapon->functions[g_Vars.currentplayer->unk0638[hand].weaponfunc]; + return weapon->functions[g_Vars.currentplayer->hands[hand].weaponfunc]; } return NULL; @@ -1678,7 +1669,7 @@ GLOBAL_ASM( glabel func0f0b1c24 /* f0b1c24: 27bdffe0 */ addiu $sp,$sp,-32 /* f0b1c28: afbf0014 */ sw $ra,0x14($sp) -/* f0b1c2c: 0fc2c41f */ jal func0f0b107c +/* f0b1c2c: 0fc2c41f */ jal handGetWeaponFunction /* f0b1c30: afa40020 */ sw $a0,0x20($sp) /* f0b1c34: 8fae0020 */ lw $t6,0x20($sp) /* f0b1c38: 91c40000 */ lbu $a0,0x0($t6) @@ -1705,7 +1696,7 @@ GLOBAL_ASM( glabel func0f0b1c78 /* f0b1c78: 27bdffe8 */ addiu $sp,$sp,-24 /* f0b1c7c: afbf0014 */ sw $ra,0x14($sp) -/* f0b1c80: 0fc2c41f */ jal func0f0b107c +/* f0b1c80: 0fc2c41f */ jal handGetWeaponFunction /* f0b1c84: 00000000 */ sll $zero,$zero,0x0 /* f0b1c88: 10400008 */ beqz $v0,.L0f0b1cac /* f0b1c8c: 8fbf0014 */ lw $ra,0x14($sp) @@ -1740,7 +1731,7 @@ GLOBAL_ASM( glabel func0f0b1ce8 /* f0b1ce8: 27bdffe8 */ addiu $sp,$sp,-24 /* f0b1cec: afbf0014 */ sw $ra,0x14($sp) -/* f0b1cf0: 0fc2c41f */ jal func0f0b107c +/* f0b1cf0: 0fc2c41f */ jal handGetWeaponFunction /* f0b1cf4: 00000000 */ sll $zero,$zero,0x0 /* f0b1cf8: 44801000 */ mtc1 $zero,$f2 /* f0b1cfc: 10400007 */ beqz $v0,.L0f0b1d1c @@ -1762,7 +1753,7 @@ GLOBAL_ASM( glabel func0f0b1d28 /* f0b1d28: 27bdffe0 */ addiu $sp,$sp,-32 /* f0b1d2c: afbf0014 */ sw $ra,0x14($sp) -/* f0b1d30: 0fc2c41f */ jal func0f0b107c +/* f0b1d30: 0fc2c41f */ jal handGetWeaponFunction /* f0b1d34: afa40020 */ sw $a0,0x20($sp) /* f0b1d38: 44801000 */ mtc1 $zero,$f2 /* f0b1d3c: 10400016 */ beqz $v0,.L0f0b1d98 @@ -1838,7 +1829,7 @@ GLOBAL_ASM( glabel func0f0b1e28 /* f0b1e28: 27bdffe8 */ addiu $sp,$sp,-24 /* f0b1e2c: afbf0014 */ sw $ra,0x14($sp) -/* f0b1e30: 0fc2c41f */ jal func0f0b107c +/* f0b1e30: 0fc2c41f */ jal handGetWeaponFunction /* f0b1e34: 00000000 */ sll $zero,$zero,0x0 /* f0b1e38: 10400008 */ beqz $v0,.L0f0b1e5c /* f0b1e3c: 8fbf0014 */ lw $ra,0x14($sp) @@ -1860,7 +1851,7 @@ GLOBAL_ASM( glabel func0f0b1e68 /* f0b1e68: 27bdffe8 */ addiu $sp,$sp,-24 /* f0b1e6c: afbf0014 */ sw $ra,0x14($sp) -/* f0b1e70: 0fc2c41f */ jal func0f0b107c +/* f0b1e70: 0fc2c41f */ jal handGetWeaponFunction /* f0b1e74: 00000000 */ sll $zero,$zero,0x0 /* f0b1e78: 10400008 */ beqz $v0,.L0f0b1e9c /* f0b1e7c: 8fbf0014 */ lw $ra,0x14($sp) @@ -1882,7 +1873,7 @@ GLOBAL_ASM( glabel func0f0b1ea8 /* f0b1ea8: 27bdffe8 */ addiu $sp,$sp,-24 /* f0b1eac: afbf0014 */ sw $ra,0x14($sp) -/* f0b1eb0: 0fc2c41f */ jal func0f0b107c +/* f0b1eb0: 0fc2c41f */ jal handGetWeaponFunction /* f0b1eb4: afa5001c */ sw $a1,0x1c($sp) /* f0b1eb8: 10400006 */ beqz $v0,.L0f0b1ed4 /* f0b1ebc: 8fa4001c */ lw $a0,0x1c($sp) @@ -1918,7 +1909,7 @@ s8 weaponGetMaxFireRatePerTick(u32 weaponnum, u32 funcindex) u32 currentPlayerGetSight(void) { - struct weaponfunc *func = weaponGetFunctionById(g_Vars.currentplayer->unk0638[0].weaponnum, g_Vars.currentplayer->unk0638[0].weaponfunc); + struct weaponfunc *func = weaponGetFunctionById(g_Vars.currentplayer->hands[0].weaponnum, g_Vars.currentplayer->hands[0].weaponfunc); if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_CLOSE) { return SIGHT_NONE; @@ -1928,7 +1919,7 @@ u32 currentPlayerGetSight(void) return SIGHT_CLASSIC; } - switch (g_Vars.currentplayer->unk0638[0].weaponnum) { + switch (g_Vars.currentplayer->hands[0].weaponnum) { case WEAPON_HORIZONSCANNER: return SIGHT_NONE; case WEAPON_NONE: @@ -1990,7 +1981,7 @@ glabel func0f0b201c /* f0b201c: 27bdffe0 */ addiu $sp,$sp,-32 /* f0b2020: afbf0014 */ sw $ra,0x14($sp) /* f0b2024: afa0001c */ sw $zero,0x1c($sp) -/* f0b2028: 0fc2c41f */ jal func0f0b107c +/* f0b2028: 0fc2c41f */ jal handGetWeaponFunction /* f0b202c: afa50024 */ sw $a1,0x24($sp) /* f0b2030: 8fa3001c */ lw $v1,0x1c($sp) /* f0b2034: 10400002 */ beqz $v0,.L0f0b2040 diff --git a/src/game/game_0fd660.c b/src/game/game_0fd660.c index 7d328e9c4..e528d047c 100644 --- a/src/game/game_0fd660.c +++ b/src/game/game_0fd660.c @@ -626,7 +626,7 @@ void activemenuApply(s32 slot) if (var80088804 != 0) { uVar6 = frGetWeaponBySlot(frGetSlot()); - if (g_Vars.currentplayer->unk0638[0].weaponnum == uVar6) { + if (g_Vars.currentplayer->hands[0].weaponnum == uVar6) { pass = false; } } @@ -747,8 +747,8 @@ void activemenuGetSlotDetails(s32 slot, u32 *flags, char *label) if (slot == 4) { strcpy(label, langGet(L_MISC(171))); // "Function" } else if (slot == 1 || slot == 7) { - prifunc = weaponGetFunction(&g_Vars.currentplayer->unk0638[0].weaponnum, FUNC_PRIMARY); - secfunc = weaponGetFunction(&g_Vars.currentplayer->unk0638[0].weaponnum, FUNC_SECONDARY); + prifunc = weaponGetFunction(&g_Vars.currentplayer->hands[0].weaponnum, FUNC_PRIMARY); + secfunc = weaponGetFunction(&g_Vars.currentplayer->hands[0].weaponnum, FUNC_SECONDARY); if (slot == 1) { if (!secfunc diff --git a/src/game/game_190260.c b/src/game/game_190260.c index 5f6452a02..c1d1e6526 100644 --- a/src/game/game_190260.c +++ b/src/game/game_190260.c @@ -1335,7 +1335,7 @@ u32 func0f1915b4(struct chrdata *chr) return chr->aibot->weaponnum; } - return g_Vars.players[propGetPlayerNum(chr->prop)]->unk0638[0].weaponnum; + return g_Vars.players[propGetPlayerNum(chr->prop)]->hands[0].weaponnum; } u8 func0f191600(struct chrdata *chr) diff --git a/src/game/game_19c990.c b/src/game/game_19c990.c index 53066d8f9..e3b078c21 100644 --- a/src/game/game_19c990.c +++ b/src/game/game_19c990.c @@ -2076,8 +2076,8 @@ void func0f19e9c0(s32 weapon) for (i = 0; i < 2; i++) { if (g_Vars.currentplayer->unk15e4[i] >= 0) { - g_Vars.currentplayer->unk0638[0].unk0858[i] = 0; - g_Vars.currentplayer->unk0638[1].unk0858[i] = 0; + g_Vars.currentplayer->hands[0].unk0858[i] = 0; + g_Vars.currentplayer->hands[1].unk0858[i] = 0; } } diff --git a/src/game/game_1a3340.c b/src/game/game_1a3340.c index dadaea00b..7a79672a1 100644 --- a/src/game/game_1a3340.c +++ b/src/game/game_1a3340.c @@ -64,8 +64,8 @@ s32 frDetailsOkMenuHandler(u32 operation, struct menu_item *item, s32 *value) g_FrWeaponNum = weapon; for (i = 0; i < 4; i++) { - g_Vars.currentplayer->unk0638[0].unk0d74[i] = 0; - g_Vars.currentplayer->unk0638[1].unk0d74[i] = 0; + g_Vars.currentplayer->hands[0].unk0d74[i] = 0; + g_Vars.currentplayer->hands[1].unk0d74[i] = 0; } func0f19e9c0(weapon); diff --git a/src/game/propobj.c b/src/game/propobj.c index 8533a60be..9602a3e96 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -36700,7 +36700,7 @@ glabel func0f085eac /* f085ec4: 80af004c */ lb $t7,0x4c($a1) /* f085ec8: 24840018 */ addiu $a0,$a0,0x18 /* f085ecc: afa40048 */ sw $a0,0x48($sp) -/* f085ed0: 0fc2c41f */ jal func0f0b107c +/* f085ed0: 0fc2c41f */ jal handGetWeaponFunction /* f085ed4: afaf00fc */ sw $t7,0xfc($sp) /* f085ed8: 5040000e */ beqzl $v0,.L0f085f14 /* f085edc: 8fa40124 */ lw $a0,0x124($sp) diff --git a/src/include/game/game_0b0420.h b/src/include/game/game_0b0420.h index 70ccfc9fc..b225ffee7 100644 --- a/src/include/game/game_0b0420.h +++ b/src/include/game/game_0b0420.h @@ -20,7 +20,7 @@ s32 func0f0b09f4(s32 arg0, s32 playernum); struct weapon *weaponFindById(s32 itemid); struct weaponfunc *weaponGetFunctionById(s32 weapon_id, s32 which); u32 func0f0b103c(void); -u32 func0f0b107c(void); +struct weaponfunc *handGetWeaponFunction(struct hand *hand); struct weaponfunc *weaponGetFunction(u8 *arg0, s32 which); struct weaponfunc *currentPlayerGetWeaponFunction(u32 hand); u32 func0f0b11bc(void); diff --git a/src/include/types.h b/src/include/types.h index 3d7d81270..a2132609d 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -1161,8 +1161,8 @@ struct player1630 { s16 unk0a; }; -// Suspected weapon data per hand -struct player638 { +// Weapon data per hand +struct hand { /*0x0638*/ u8 weaponnum; /*0x0639*/ u8 unk0639; /*0x063a*/ u8 unk063a; @@ -1976,7 +1976,7 @@ struct player { /*0x0632*/ s16 viewy; // 220 regardless of res /*0x0634*/ s16 viewleft; // 0 /*0x0636*/ s16 viewtop; // 0 - /*0x0638*/ struct player638 unk0638[2]; + /*0x0638*/ struct hand hands[2]; /*0x1580*/ s8 unk1580; /*0x1581*/ u8 unk1581; /*0x1582*/ u8 unk1582;