From 307d70867bc447cbaffda1bf12078bd97af727c6 Mon Sep 17 00:00:00 2001 From: Sirius902 <3645979-Sirius902@users.noreply.gitlab.com> Date: Fri, 2 Oct 2020 22:54:42 -0700 Subject: [PATCH] Fix func_80A7492C --- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 38 +++++++------------------ 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 436b92f7a5..aec8aa41b7 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -247,37 +247,21 @@ void func_80A7489C(EnIk* this) { EnIk_SetupAction(this, func_80A7492C); } -void func_80A7492C(EnIk *this, GlobalContext *globalCtx) { - s16 yawDiff; - s32 phi_a0; - f32 absDist; +void func_80A7492C(EnIk* this, GlobalContext* globalCtx) { + s32 phi_a0 = (this->unk_2FB == 0) ? 0x0AAA : 0x3FFC; + s16 yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y; - phi_a0 = (this->unk_2FB == 0) ? 0x0AAA : 0x3FFC; - yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y; - if ((ABS(yawDiff) <= phi_a0) && (this->actor.xzDistFromLink < 100.0f)) { - absDist = ABS(this->actor.yDistFromLink); - if (absDist < 150.0f) { - if ((globalCtx->gameplayFrames & 1)) { - func_80A74E2C(this); - } else { - func_80A751C8(this); - } + if ((ABS(yawDiff) <= phi_a0) && (this->actor.xzDistFromLink < 100.0f) && + (ABS(this->actor.yDistFromLink) < 150.0f)) { + if ((globalCtx->gameplayFrames & 1)) { + func_80A74E2C(this); } else { -block_13: - if (ABS(yawDiff) < 0x4001) { - absDist = ABS(this->actor.yDistFromLink); - if (absDist < 150.0f) { - func_80A74AAC(this); - } else { -block_21: - func_80A74AAC(this); - } - } else { - goto block_21; - } + func_80A751C8(this); } + } else if ((ABS(yawDiff) <= 0x4000) && (ABS(this->actor.yDistFromLink) < 150.0f)) { + func_80A74AAC(this); } else { - goto block_13; + func_80A74AAC(this); } func_80A745E4(this, globalCtx); SkelAnime_FrameUpdateMatrix(&this->skelAnime);