From 638d2fee9078fba89c2b0e47319d0b12bd4f0b06 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 29 Feb 2020 20:24:40 +1000 Subject: [PATCH] Decompile currentPlayerSetWeaponFlag40 --- src/game/chr/chraicommands.c | 10 +++++----- src/game/game_066310.c | 6 +++--- src/game/game_097ba0.c | 10 +++++----- src/game/game_127910.c | 19 ++++--------------- src/include/game/game_066310.h | 2 +- src/include/game/game_127910.h | 2 +- 6 files changed, 19 insertions(+), 30 deletions(-) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index dc1fe186e..dd1d71b87 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -5811,7 +5811,7 @@ bool ai00e9(void) struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); if (chr) { - func0f08b8b8(chr, cmd[3]); + chrSetWeaponFlag40(chr, cmd[3]); } g_Vars.aioffset += 4; @@ -10808,8 +10808,8 @@ bool aiChrSetCutsceneWeapon(void) } if (valid) { - func0f08b8b8(chr, 1); - func0f08b8b8(chr, 0); + chrSetWeaponFlag40(chr, 1); + chrSetWeaponFlag40(chr, 0); } } } else { @@ -10818,8 +10818,8 @@ bool aiChrSetCutsceneWeapon(void) } } } else { - func0f08b8b8(chr, 1); - func0f08b8b8(chr, 0); + chrSetWeaponFlag40(chr, 1); + chrSetWeaponFlag40(chr, 0); if (model_id >= 0) { func0f08b8e8(chr, model_id, cmd[3], 0, 0, 0); diff --git a/src/game/game_066310.c b/src/game/game_066310.c index 012528c0f..ec8fd892a 100644 --- a/src/game/game_066310.c +++ b/src/game/game_066310.c @@ -42990,7 +42990,7 @@ glabel func0f08b880 ); GLOBAL_ASM( -glabel func0f08b8b8 +glabel chrSetWeaponFlag40 /* f08b8b8: 10800009 */ beqz $a0,.L0f08b8e0 /* f08b8bc: 00057080 */ sll $t6,$a1,0x2 /* f08b8c0: 008e7821 */ addu $t7,$a0,$t6 @@ -48963,10 +48963,10 @@ glabel func0f0910ac /* f0910e4: 8dcf00bc */ lw $t7,0xbc($t6) /* f0910e8: 00002825 */ or $a1,$zero,$zero /* f0910ec: 8df00004 */ lw $s0,0x4($t7) -/* f0910f0: 0fc22e2e */ jal func0f08b8b8 +/* f0910f0: 0fc22e2e */ jal chrSetWeaponFlag40 /* f0910f4: 02002025 */ or $a0,$s0,$zero /* f0910f8: 02002025 */ or $a0,$s0,$zero -/* f0910fc: 0fc22e2e */ jal func0f08b8b8 +/* f0910fc: 0fc22e2e */ jal chrSetWeaponFlag40 /* f091100: 24050001 */ addiu $a1,$zero,0x1 /* f091104: 3c16800b */ lui $s6,%hi(g_MpSetup) /* f091108: 26d6cb88 */ addiu $s6,$s6,%lo(g_MpSetup) diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index 338ec5ce8..d29115bf5 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -2240,7 +2240,7 @@ glabel func0f099808 /* f099994: 10d80003 */ beq $a2,$t8,.L0f0999a4 /* f099998: 00000000 */ sll $zero,$zero,0x0 .L0f09999c: -/* f09999c: 0fc4a33c */ jal func0f128cf0 +/* f09999c: 0fc4a33c */ jal currentPlayerSetWeaponFlag40 /* f0999a0: 8fa40064 */ lw $a0,0x64($sp) .L0f0999a4: /* f0999a4: 0fc27e88 */ jal func0f09fa20 @@ -5215,7 +5215,7 @@ glabel func0f09c01c /* f09c308: 11e10003 */ beq $t7,$at,.L0f09c318 /* f09c30c: 00000000 */ sll $zero,$zero,0x0 .L0f09c310: -/* f09c310: 0fc4a33c */ jal func0f128cf0 +/* f09c310: 0fc4a33c */ jal currentPlayerSetWeaponFlag40 /* f09c314: 8fa40074 */ lw $a0,0x74($sp) .L0f09c318: /* f09c318: 0fc27e88 */ jal func0f09fa20 @@ -10950,7 +10950,7 @@ glabel func0f0a134c /* f0a14e0: 10c80003 */ beq $a2,$t0,.L0f0a14f0 /* f0a14e4: 00000000 */ sll $zero,$zero,0x0 .L0f0a14e8: -/* f0a14e8: 0fc4a33c */ jal func0f128cf0 +/* f0a14e8: 0fc4a33c */ jal currentPlayerSetWeaponFlag40 /* f0a14ec: 03c02025 */ or $a0,$s8,$zero .L0f0a14f0: /* f0a14f0: 0fc27e88 */ jal func0f09fa20 @@ -12671,10 +12671,10 @@ glabel func0f0a2ae4 .L0f0a2c60: /* f0a2c60: 24130002 */ addiu $s3,$zero,0x2 /* f0a2c64: 8fa40044 */ lw $a0,0x44($sp) -/* f0a2c68: 0fc22e2e */ jal func0f08b8b8 +/* f0a2c68: 0fc22e2e */ jal chrSetWeaponFlag40 /* f0a2c6c: 00002825 */ or $a1,$zero,$zero /* f0a2c70: 8fa40044 */ lw $a0,0x44($sp) -/* f0a2c74: 0fc22e2e */ jal func0f08b8b8 +/* f0a2c74: 0fc22e2e */ jal chrSetWeaponFlag40 /* f0a2c78: 24050001 */ addiu $a1,$zero,0x1 /* f0a2c7c: 0fc4a2bd */ jal weaponGetModel /* f0a2c80: 8fa40048 */ lw $a0,0x48($sp) diff --git a/src/game/game_127910.c b/src/game/game_127910.c index c31d25764..3fd2a979a 100644 --- a/src/game/game_127910.c +++ b/src/game/game_127910.c @@ -1403,21 +1403,10 @@ glabel weaponGetModel // return -1; //} -GLOBAL_ASM( -glabel func0f128cf0 -/* f128cf0: 3c0e800a */ lui $t6,0x800a -/* f128cf4: 8dcea244 */ lw $t6,-0x5dbc($t6) -/* f128cf8: 27bdffe8 */ addiu $sp,$sp,-24 -/* f128cfc: afbf0014 */ sw $ra,0x14($sp) -/* f128d00: 8dcf00bc */ lw $t7,0xbc($t6) -/* f128d04: 00802825 */ or $a1,$a0,$zero -/* f128d08: 0fc22e2e */ jal func0f08b8b8 -/* f128d0c: 8de40004 */ lw $a0,0x4($t7) -/* f128d10: 8fbf0014 */ lw $ra,0x14($sp) -/* f128d14: 27bd0018 */ addiu $sp,$sp,0x18 -/* f128d18: 03e00008 */ jr $ra -/* f128d1c: 00000000 */ sll $zero,$zero,0x0 -); +void currentPlayerSetWeaponFlag40(s32 weaponslot) +{ + chrSetWeaponFlag40(g_Vars.currentplayer->prop->chr, weaponslot); +} GLOBAL_ASM( glabel func0f128d20 diff --git a/src/include/game/game_066310.h b/src/include/game/game_066310.h index f9739f8b6..4dcac29a9 100644 --- a/src/include/game/game_066310.h +++ b/src/include/game/game_066310.h @@ -275,7 +275,7 @@ u32 func0f08b25c(void); u32 func0f08b27c(void); u32 func0f08b658(void); u32 func0f08b880(void); -void func0f08b8b8(struct chrdata *chr, u32 arg1); +void chrSetWeaponFlag40(struct chrdata *chr, u32 arg1); void func0f08b8e8(struct chrdata *chr, s32 weapon_id, s32 arg2, u32 flags, s32 arg4, s32 arg5); struct prop *func0f08bad0(struct chrdata *chr, s32 arg1, s32 weapon_id, u32 flags); u32 func0f08bb3c(void); diff --git a/src/include/game/game_127910.h b/src/include/game/game_127910.h index 459d60411..4255d5f10 100644 --- a/src/include/game/game_127910.h +++ b/src/include/game/game_127910.h @@ -14,7 +14,7 @@ void func0f128ab8(u32 arg0, u32 arg1); void currentPlayerSetFovY(f32 fovy); void currentPlayerSetAspectRatio(f32 aspect); s32 weaponGetModel(s32 arg0); -u32 func0f128cf0(void); +void currentPlayerSetWeaponFlag40(s32 weaponslot); u32 func0f128d20(void); u32 func0f128dbc(void); u32 func0f128ec8(void);