From 78cd37b8d9a57816ad23437a8a6b5df633e98124 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 29 Feb 2020 23:38:49 +1000 Subject: [PATCH] Decompile currentPlayerUpdateAutoAimXProp --- src/game/game_0601b0.c | 4 +-- src/game/game_0c79f0.c | 47 ++++++++++++---------------------- src/include/game/game_0c79f0.h | 2 +- src/include/types.h | 6 ++--- 4 files changed, 23 insertions(+), 36 deletions(-) diff --git a/src/game/game_0601b0.c b/src/game/game_0601b0.c index 98d98d8a5..058287e8d 100644 --- a/src/game/game_0601b0.c +++ b/src/game/game_0601b0.c @@ -5918,7 +5918,7 @@ glabel func0f064ce8 /* f0653e4: 46124283 */ div.s $f10,$f8,$f18 /* f0653e8: 46105101 */ sub.s $f4,$f10,$f16 /* f0653ec: 44052000 */ mfc1 $a1,$f4 -/* f0653f0: 0fc31f0d */ jal func0f0c7c34 +/* f0653f0: 0fc31f0d */ jal currentPlayerUpdateAutoAimXProp /* f0653f4: 00000000 */ sll $zero,$zero,0x0 /* f0653f8: 8fb900e4 */ lw $t9,0xe4($sp) .L0f0653fc: @@ -5968,7 +5968,7 @@ glabel func0f064ce8 /* f06549c: 0fc31ec0 */ jal func0f0c7b00 /* f0654a0: 24050000 */ addiu $a1,$zero,0x0 /* f0654a4: 00002025 */ or $a0,$zero,$zero -/* f0654a8: 0fc31f0d */ jal func0f0c7c34 +/* f0654a8: 0fc31f0d */ jal currentPlayerUpdateAutoAimXProp /* f0654ac: 24050000 */ addiu $a1,$zero,0x0 /* f0654b0: 8ea20284 */ lw $v0,0x284($s5) /* f0654b4: 904c1583 */ lbu $t4,0x1583($v0) diff --git a/src/game/game_0c79f0.c b/src/game/game_0c79f0.c index a3a5bc470..b17a963e6 100644 --- a/src/game/game_0c79f0.c +++ b/src/game/game_0c79f0.c @@ -319,36 +319,23 @@ glabel func0f0c7bd0 /* f0c7c30: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f0c7c34 -/* f0c7c34: 44856000 */ mtc1 $a1,$f12 -/* f0c7c38: 3c05800a */ lui $a1,%hi(g_Vars) -/* f0c7c3c: 24a59fc0 */ addiu $a1,$a1,%lo(g_Vars) -/* f0c7c40: 8ca20284 */ lw $v0,0x284($a1) -/* f0c7c44: 8c430140 */ lw $v1,0x140($v0) -/* f0c7c48: 04620006 */ bltzl $v1,.L0f0c7c64 -/* f0c7c4c: 8c58013c */ lw $t8,0x13c($v0) -/* f0c7c50: 8cae0038 */ lw $t6,0x38($a1) -/* f0c7c54: 006e7823 */ subu $t7,$v1,$t6 -/* f0c7c58: ac4f0140 */ sw $t7,0x140($v0) -/* f0c7c5c: 8ca20284 */ lw $v0,0x284($a1) -/* f0c7c60: 8c58013c */ lw $t8,0x13c($v0) -.L0f0c7c64: -/* f0c7c64: 5098000a */ beql $a0,$t8,.L0f0c7c90 -/* f0c7c68: e44c0138 */ swc1 $f12,0x138($v0) -/* f0c7c6c: 8c590140 */ lw $t9,0x140($v0) -/* f0c7c70: 2408001e */ addiu $t0,$zero,0x1e -/* f0c7c74: 07210006 */ bgez $t9,.L0f0c7c90 -/* f0c7c78: 00000000 */ sll $zero,$zero,0x0 -/* f0c7c7c: ac480140 */ sw $t0,0x140($v0) -/* f0c7c80: 8ca90284 */ lw $t1,0x284($a1) -/* f0c7c84: ad24013c */ sw $a0,0x13c($t1) -/* f0c7c88: 8ca20284 */ lw $v0,0x284($a1) -/* f0c7c8c: e44c0138 */ swc1 $f12,0x138($v0) -.L0f0c7c90: -/* f0c7c90: 03e00008 */ jr $ra -/* f0c7c94: 00000000 */ sll $zero,$zero,0x0 -); +void currentPlayerUpdateAutoAimXProp(struct prop *prop, f32 autoaimx) +{ + if (g_Vars.currentplayer->autoxaimtime60 >= 0) { + g_Vars.currentplayer->autoxaimtime60 -= g_Vars.lvupdate240_60; + } + + if (prop != g_Vars.currentplayer->autoxaimprop) { + if (g_Vars.currentplayer->autoxaimtime60 < 0) { + g_Vars.currentplayer->autoxaimtime60 = 30; + g_Vars.currentplayer->autoxaimprop = prop; + } else { + return; + } + } + + g_Vars.currentplayer->autoaimx = autoaimx; +} GLOBAL_ASM( glabel func0f0c7c98 diff --git a/src/include/game/game_0c79f0.h b/src/include/game/game_0c79f0.h index d8b3af345..1dc638609 100644 --- a/src/include/game/game_0c79f0.h +++ b/src/include/game/game_0c79f0.h @@ -13,7 +13,7 @@ u32 func0f0c7b00(void); void currentPlayerSetAutoAimX(bool enabled); bool currentPlayerIsAutoAimXEnabled(void); u32 func0f0c7bd0(void); -u32 func0f0c7c34(void); +void currentPlayerUpdateAutoAimXProp(struct prop *prop, f32 autoaimx); u32 func0f0c7c98(void); u32 func0f0c7cc4(void); void currentPlayerGrabProp(struct prop *prop); diff --git a/src/include/types.h b/src/include/types.h index c3cb11ff9..f6e72b0ff 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -1096,9 +1096,9 @@ struct player { /*0x012c*/ u32 unk012c; /*0x0130*/ u32 unk0130; /*0x0134*/ bool autoxaimenabled; - /*0x0138*/ u32 unk0138; - /*0x013c*/ u32 unk013c; - /*0x0140*/ u32 unk0140; + /*0x0138*/ f32 autoaimx; + /*0x013c*/ struct prop *autoxaimprop; + /*0x0140*/ s32 autoxaimtime60; /*0x0144*/ f32 unk0144; /*0x0148*/ u32 unk0148; /*0x014c*/ u32 unk014c;