From f5ab1a9b5dc86ffd15b33008cfb26d8c46a8fa42 Mon Sep 17 00:00:00 2001 From: Adam Bird Date: Sun, 6 Aug 2023 12:05:34 -0400 Subject: [PATCH] fix: disable Idle camera re-center no longer stuck on level geometry (#3094) --- soh/src/code/z_camera.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index e0d827107..325eca828 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -1678,12 +1678,13 @@ s32 Camera_Normal1(Camera* camera) { Camera_ClampDist(camera, eyeAdjustment.r, norm1->distMin, norm1->distMax, anim->unk_28); if (anim->startSwingTimer <= 0) { + // idle camera re-center if (CVarGetInteger("gA11yDisableIdleCam", 0)) return; eyeAdjustment.pitch = atEyeNextGeo.pitch; eyeAdjustment.yaw = Camera_LERPCeilS(anim->swingYawTarget, atEyeNextGeo.yaw, 1.0f / camera->yawUpdateRateInv, 0xA); } else if (anim->swing.unk_18 != 0) { - if (CVarGetInteger("gA11yDisableIdleCam", 0)) return; + // camera adjustments when obstructed/pushed by scene geometry eyeAdjustment.yaw = Camera_LERPCeilS(anim->swing.unk_16, atEyeNextGeo.yaw, 1.0f / camera->yawUpdateRateInv, 0xA); eyeAdjustment.pitch = @@ -1708,19 +1709,19 @@ s32 Camera_Normal1(Camera* camera) { if ((camera->status == CAM_STAT_ACTIVE) && (!(norm1->interfaceFlags & 0x10))) { anim->swingYawTarget = BINANG_ROT180(camera->playerPosRot.rot.y); if (!CVarGetInteger("gFixCameraSwing", 0)) { - if (anim->startSwingTimer > 0) { - func_80046E20(camera, &eyeAdjustment, norm1->distMin, norm1->unk_0C, &sp98, &anim->swing); - } else { - sp88 = *eyeNext; - anim->swing.swingUpdateRate = camera->yawUpdateRateInv = norm1->unk_0C * 2.0f; - if (Camera_BGCheck(camera, at, &sp88)) { - anim->swingYawTarget = atEyeNextGeo.yaw; - anim->startSwingTimer = -1; + if (anim->startSwingTimer > 0) { + func_80046E20(camera, &eyeAdjustment, norm1->distMin, norm1->unk_0C, &sp98, &anim->swing); } else { - *eye = *eyeNext; + sp88 = *eyeNext; + anim->swing.swingUpdateRate = camera->yawUpdateRateInv = norm1->unk_0C * 2.0f; + if (Camera_BGCheck(camera, at, &sp88)) { + anim->swingYawTarget = atEyeNextGeo.yaw; + anim->startSwingTimer = -1; + } else { + *eye = *eyeNext; + } + anim->swing.unk_18 = 0; } - anim->swing.unk_18 = 0; - } } else { if (anim->startSwingTimer <= 0) { anim->swing.swingUpdateRate = camera->yawUpdateRateInv = norm1->unk_0C * 2.0f;