From 788bf872cc4af031f1fbd184f35e4cc80924220d Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 29 Feb 2020 23:41:32 +1000 Subject: [PATCH] Decompile currentPlayerUpdateAutoAimYProp --- src/game/game_0601b0.c | 4 +-- src/game/game_0c79f0.c | 47 ++++++++++++---------------------- src/include/game/game_0c79f0.h | 2 +- src/include/types.h | 9 ++++--- 4 files changed, 26 insertions(+), 36 deletions(-) diff --git a/src/game/game_0601b0.c b/src/game/game_0601b0.c index 058287e8d..8f0e80015 100644 --- a/src/game/game_0601b0.c +++ b/src/game/game_0601b0.c @@ -5893,7 +5893,7 @@ glabel func0f064ce8 /* f065388: 46123283 */ div.s $f10,$f6,$f18 /* f06538c: 46105101 */ sub.s $f4,$f10,$f16 /* f065390: 44052000 */ mfc1 $a1,$f4 -/* f065394: 0fc31ec0 */ jal func0f0c7b00 +/* f065394: 0fc31ec0 */ jal currentPlayerUpdateAutoAimYProp /* f065398: 00000000 */ sll $zero,$zero,0x0 .L0f06539c: /* f06539c: 0fc31ef4 */ jal func0f0c7bd0 @@ -5965,7 +5965,7 @@ glabel func0f064ce8 /* f065494: 1000000a */ beqz $zero,.L0f0654c0 /* f065498: a04a1583 */ sb $t2,0x1583($v0) .L0f06549c: -/* f06549c: 0fc31ec0 */ jal func0f0c7b00 +/* f06549c: 0fc31ec0 */ jal currentPlayerUpdateAutoAimYProp /* f0654a0: 24050000 */ addiu $a1,$zero,0x0 /* f0654a4: 00002025 */ or $a0,$zero,$zero /* f0654a8: 0fc31f0d */ jal currentPlayerUpdateAutoAimXProp diff --git a/src/game/game_0c79f0.c b/src/game/game_0c79f0.c index b17a963e6..768fd5a28 100644 --- a/src/game/game_0c79f0.c +++ b/src/game/game_0c79f0.c @@ -238,36 +238,23 @@ bool currentPlayerIsInSightAimMode(void) return g_Vars.currentplayer->insightaimmode; } -GLOBAL_ASM( -glabel func0f0c7b00 -/* f0c7b00: 44856000 */ mtc1 $a1,$f12 -/* f0c7b04: 3c05800a */ lui $a1,%hi(g_Vars) -/* f0c7b08: 24a59fc0 */ addiu $a1,$a1,%lo(g_Vars) -/* f0c7b0c: 8ca20284 */ lw $v0,0x284($a1) -/* f0c7b10: 8c430130 */ lw $v1,0x130($v0) -/* f0c7b14: 04620006 */ bltzl $v1,.L0f0c7b30 -/* f0c7b18: 8c58012c */ lw $t8,0x12c($v0) -/* f0c7b1c: 8cae0038 */ lw $t6,0x38($a1) -/* f0c7b20: 006e7823 */ subu $t7,$v1,$t6 -/* f0c7b24: ac4f0130 */ sw $t7,0x130($v0) -/* f0c7b28: 8ca20284 */ lw $v0,0x284($a1) -/* f0c7b2c: 8c58012c */ lw $t8,0x12c($v0) -.L0f0c7b30: -/* f0c7b30: 5098000a */ beql $a0,$t8,.L0f0c7b5c -/* f0c7b34: e44c0128 */ swc1 $f12,0x128($v0) -/* f0c7b38: 8c590130 */ lw $t9,0x130($v0) -/* f0c7b3c: 2408001e */ addiu $t0,$zero,0x1e -/* f0c7b40: 07210006 */ bgez $t9,.L0f0c7b5c -/* f0c7b44: 00000000 */ sll $zero,$zero,0x0 -/* f0c7b48: ac480130 */ sw $t0,0x130($v0) -/* f0c7b4c: 8ca90284 */ lw $t1,0x284($a1) -/* f0c7b50: ad24012c */ sw $a0,0x12c($t1) -/* f0c7b54: 8ca20284 */ lw $v0,0x284($a1) -/* f0c7b58: e44c0128 */ swc1 $f12,0x128($v0) -.L0f0c7b5c: -/* f0c7b5c: 03e00008 */ jr $ra -/* f0c7b60: 00000000 */ sll $zero,$zero,0x0 -); +void currentPlayerUpdateAutoAimYProp(struct prop *prop, f32 autoaimy) +{ + if (g_Vars.currentplayer->autoyaimtime60 >= 0) { + g_Vars.currentplayer->autoyaimtime60 -= g_Vars.lvupdate240_60; + } + + if (prop != g_Vars.currentplayer->autoyaimprop) { + if (g_Vars.currentplayer->autoyaimtime60 < 0) { + g_Vars.currentplayer->autoyaimtime60 = 30; + g_Vars.currentplayer->autoyaimprop = prop; + } else { + return; + } + } + + g_Vars.currentplayer->autoaimy = autoaimy; +} void currentPlayerSetAutoAimX(bool enabled) { diff --git a/src/include/game/game_0c79f0.h b/src/include/game/game_0c79f0.h index 1dc638609..49d5e7b55 100644 --- a/src/include/game/game_0c79f0.h +++ b/src/include/game/game_0c79f0.h @@ -9,7 +9,7 @@ void currentPlayerSetAutoAimY(bool enabled); bool currentPlayerIsAutoAimYEnabled(void); u32 func0f0c7a8c(void); bool currentPlayerIsInSightAimMode(void); -u32 func0f0c7b00(void); +void currentPlayerUpdateAutoAimYProp(struct prop *prop, f32 autoaimy); void currentPlayerSetAutoAimX(bool enabled); bool currentPlayerIsAutoAimXEnabled(void); u32 func0f0c7bd0(void); diff --git a/src/include/types.h b/src/include/types.h index f6e72b0ff..f3c25a7fb 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -1091,14 +1091,17 @@ struct player { /*0x0118*/ u32 unk0118; /*0x011c*/ u32 unk011c; /*0x0120*/ bool insightaimmode; + /*0x0124*/ bool autoyaimenabled; - /*0x0128*/ u32 unk0128; - /*0x012c*/ u32 unk012c; - /*0x0130*/ u32 unk0130; + /*0x0128*/ f32 autoaimy; + /*0x012c*/ struct prop *autoyaimprop; + /*0x0130*/ s32 autoyaimtime60; + /*0x0134*/ bool autoxaimenabled; /*0x0138*/ f32 autoaimx; /*0x013c*/ struct prop *autoxaimprop; /*0x0140*/ s32 autoxaimtime60; + /*0x0144*/ f32 unk0144; /*0x0148*/ u32 unk0148; /*0x014c*/ u32 unk014c;