From b74be9196c4a6e01b8e4d634f93521f6c46cfa99 Mon Sep 17 00:00:00 2001 From: David Chavez Date: Wed, 1 Mar 2023 03:42:15 +0100 Subject: [PATCH] [Accessibility] Add ability to disable camera re-centering on idle (#2503) * Add ability to disable camera recentering on idle * Remove platform check * Update else camera comment --- soh/soh/GameMenuBar.cpp | 9 +++++++++ soh/src/code/z_camera.c | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index 5b8549355..a385d486d 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -302,6 +302,15 @@ namespace GameMenuBar { UIWidgets::EnhancementRadioButton("French", "gLanguages", LANGUAGE_FRA); ImGui::EndMenu(); } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Accessibility")) { + UIWidgets::PaddedEnhancementCheckbox("Disable Idle Camera Re-Centering", "gA11yDisableIdleCam"); + UIWidgets::Tooltip("Disables the automatic re-centering of the camera when idle."); + + ImGui::EndMenu(); + } ImGui::EndMenu(); } diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index 1f14671f9..b1fe9987d 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -1677,16 +1677,18 @@ s32 Camera_Normal1(Camera* camera) { Camera_ClampDist(camera, eyeAdjustment.r, norm1->distMin, norm1->distMax, anim->unk_28); if (anim->startSwingTimer <= 0) { + 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; eyeAdjustment.yaw = Camera_LERPCeilS(anim->swing.unk_16, atEyeNextGeo.yaw, 1.0f / camera->yawUpdateRateInv, 0xA); eyeAdjustment.pitch = Camera_LERPCeilS(anim->swing.unk_14, atEyeNextGeo.pitch, 1.0f / camera->yawUpdateRateInv, 0xA); } else { - // rotate yaw to follow player. + // rotate yaw to follow player while moving around - to keep player on camera. eyeAdjustment.yaw = Camera_CalcDefaultYaw(camera, atEyeNextGeo.yaw, camera->playerPosRot.rot.y, norm1->unk_14, sp94); eyeAdjustment.pitch =