diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 8db80cbec..aa45f537d 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -78,37 +78,22 @@ bool currentPlayerIsAutoAimYEnabled(void) return optionsGetAutoAim(g_Vars.currentplayerstats->mpindex); } -GLOBAL_ASM( -glabel func0f0c7a8c -/* f0c7a8c: 27bdffe8 */ addiu $sp,$sp,-24 -/* f0c7a90: afbf0014 */ sw $ra,0x14($sp) -/* f0c7a94: 0fc2c43b */ jal func0f0b10ec -/* f0c7a98: 00002025 */ or $a0,$zero,$zero -/* f0c7a9c: 1040000e */ beqz $v0,.L0f0c7ad8 -/* f0c7aa0: 00000000 */ sll $zero,$zero,0x0 -/* f0c7aa4: 8c4e0010 */ lw $t6,0x10($v0) -/* f0c7aa8: 31cf0040 */ andi $t7,$t6,0x40 -/* f0c7aac: 51e00004 */ beqzl $t7,.L0f0c7ac0 -/* f0c7ab0: 8c580000 */ lw $t8,0x0($v0) -/* f0c7ab4: 1000000a */ beqz $zero,.L0f0c7ae0 -/* f0c7ab8: 00001025 */ or $v0,$zero,$zero -/* f0c7abc: 8c580000 */ lw $t8,0x0($v0) -.L0f0c7ac0: -/* f0c7ac0: 24010003 */ addiu $at,$zero,0x3 -/* f0c7ac4: 331900ff */ andi $t9,$t8,0xff -/* f0c7ac8: 17210003 */ bne $t9,$at,.L0f0c7ad8 -/* f0c7acc: 00000000 */ sll $zero,$zero,0x0 -/* f0c7ad0: 10000003 */ beqz $zero,.L0f0c7ae0 -/* f0c7ad4: 24020001 */ addiu $v0,$zero,0x1 -.L0f0c7ad8: -/* f0c7ad8: 0fc31e8c */ jal currentPlayerIsAutoAimYEnabled -/* f0c7adc: 00000000 */ sll $zero,$zero,0x0 -.L0f0c7ae0: -/* f0c7ae0: 8fbf0014 */ lw $ra,0x14($sp) -/* f0c7ae4: 27bd0018 */ addiu $sp,$sp,0x18 -/* f0c7ae8: 03e00008 */ jr $ra -/* f0c7aec: 00000000 */ sll $zero,$zero,0x0 -); +bool func0f0c7a8c(void) +{ + struct weaponfunc *func = currentPlayerGetWeaponFunction(0); + + if (func) { + if (func->flags & WEAPONFUNCFLAG_00000040) { + return false; + } + + if ((func->type & 0xff) == INVENTORYFUNCTYPE_CLOSE) { + return true; + } + } + + return currentPlayerIsAutoAimYEnabled(); +} bool currentPlayerIsInSightAimMode(void) { @@ -155,7 +140,7 @@ GLOBAL_ASM( glabel func0f0c7bd0 /* f0c7bd0: 27bdffe8 */ addiu $sp,$sp,-24 /* f0c7bd4: afbf0014 */ sw $ra,0x14($sp) -/* f0c7bd8: 0fc2c43b */ jal func0f0b10ec +/* f0c7bd8: 0fc2c43b */ jal currentPlayerGetWeaponFunction /* f0c7bdc: 00002025 */ or $a0,$zero,$zero /* f0c7be0: 1040000e */ beqz $v0,.L0f0c7c1c /* f0c7be4: 00000000 */ sll $zero,$zero,0x0 diff --git a/src/game/game_0601b0.c b/src/game/game_0601b0.c index 35d80db4b..f78a98b50 100644 --- a/src/game/game_0601b0.c +++ b/src/game/game_0601b0.c @@ -4815,7 +4815,7 @@ glabel var7f1a9f54 /* f0643a4: afa600b0 */ sw $a2,0xb0($sp) /* f0643a8: afa700b4 */ sw $a3,0xb4($sp) /* f0643ac: 00002025 */ or $a0,$zero,$zero -/* f0643b0: 0fc2c43b */ jal func0f0b10ec +/* f0643b0: 0fc2c43b */ jal currentPlayerGetWeaponFunction /* f0643b4: e7a40058 */ swc1 $f4,0x58($sp) /* f0643b8: 10400006 */ beqz $v0,.L0f0643d4 /* f0643bc: 8fa300c4 */ lw $v1,0xc4($sp) @@ -5472,7 +5472,7 @@ glabel func0f064ce8 /* f064d40: 3c050008 */ lui $a1,0x8 /* f064d44: afa200e4 */ sw $v0,0xe4($sp) /* f064d48: afa000e0 */ sw $zero,0xe0($sp) -/* f064d4c: 0fc2c43b */ jal func0f0b10ec +/* f064d4c: 0fc2c43b */ jal currentPlayerGetWeaponFunction /* f064d50: 00002025 */ or $a0,$zero,$zero /* f064d54: 10400007 */ beqz $v0,.L0f064d74 /* f064d58: 00000000 */ sll $zero,$zero,0x0 diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index fd003648f..cf2d5f445 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -11221,7 +11221,7 @@ glabel func0f0a0cb0 /* f0a0cc4: afa60050 */ sw $a2,0x50($sp) /* f0a0cc8: afa70054 */ sw $a3,0x54($sp) /* f0a0ccc: 00c02025 */ or $a0,$a2,$zero -/* f0a0cd0: 0fc2c43b */ jal func0f0b10ec +/* f0a0cd0: 0fc2c43b */ jal currentPlayerGetWeaponFunction /* f0a0cd4: e7a2003c */ swc1 $f2,0x3c($sp) /* f0a0cd8: 3c0e800a */ lui $t6,%hi(g_Vars+0x284) /* f0a0cdc: 8dcea244 */ lw $t6,%lo(g_Vars+0x284)($t6) @@ -12849,7 +12849,7 @@ glabel var7f1ac768 /* f0a2340: 27bdffd0 */ addiu $sp,$sp,-48 /* f0a2344: afbf0014 */ sw $ra,0x14($sp) /* f0a2348: afa40030 */ sw $a0,0x30($sp) -/* f0a234c: 0fc2c43b */ jal func0f0b10ec +/* f0a234c: 0fc2c43b */ jal currentPlayerGetWeaponFunction /* f0a2350: e7a2002c */ swc1 $f2,0x2c($sp) /* f0a2354: 3c06800a */ lui $a2,%hi(g_Vars) /* f0a2358: 24c69fc0 */ addiu $a2,$a2,%lo(g_Vars) diff --git a/src/game/game_0b0420.c b/src/game/game_0b0420.c index 6b7d17c37..bc4311030 100644 --- a/src/game/game_0b0420.c +++ b/src/game/game_0b0420.c @@ -931,7 +931,7 @@ glabel weaponGetFunction ); GLOBAL_ASM( -glabel func0f0b10ec +glabel currentPlayerGetWeaponFunction /* f0b10ec: 00041900 */ sll $v1,$a0,0x4 /* f0b10f0: 00641823 */ subu $v1,$v1,$a0 /* f0b10f4: 00031880 */ sll $v1,$v1,0x2 diff --git a/src/include/constants.h b/src/include/constants.h index 7089757f5..046a8306b 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -2652,6 +2652,8 @@ #define WEAPONFLAG_DETERMINER_F_SOME 0x20000000 #define WEAPONFLAG_80000000 0x80000000 +#define WEAPONFUNCFLAG_00000040 0x00000040 // related to auto aim + #define WEATHERTYPE_RAIN 0 #define WEATHERTYPE_SNOW 1 diff --git a/src/include/game/bondmove.h b/src/include/game/bondmove.h index ce859e173..1484dadde 100644 --- a/src/include/game/bondmove.h +++ b/src/include/game/bondmove.h @@ -7,7 +7,7 @@ void currentPlayerSetControlDef(u32 controldef); void currentPlayerSetAutoMoveCentreEnabled(bool enabled); void currentPlayerSetAutoAimY(bool enabled); bool currentPlayerIsAutoAimYEnabled(void); -u32 func0f0c7a8c(void); +bool func0f0c7a8c(void); bool currentPlayerIsInSightAimMode(void); void currentPlayerUpdateAutoAimYProp(struct prop *prop, f32 autoaimy); void currentPlayerSetAutoAimX(bool enabled); diff --git a/src/include/game/game_0b0420.h b/src/include/game/game_0b0420.h index 6c6583274..ba9c8b532 100644 --- a/src/include/game/game_0b0420.h +++ b/src/include/game/game_0b0420.h @@ -22,7 +22,7 @@ struct weaponfunc *weaponGetFunctionById(s32 weapon_id, s32 which); u32 func0f0b103c(void); u32 func0f0b107c(void); struct weaponfunc *weaponGetFunction(u8 *arg0, s32 which); -u32 func0f0b10ec(void); +struct weaponfunc *currentPlayerGetWeaponFunction(u32 arg0); u32 func0f0b11bc(void); u32 func0f0b11ec(void); f32 func0f0b12ec(u32 arg0);