From 100bae3b9fb7f4b6807dc1899a3179cf314c9371 Mon Sep 17 00:00:00 2001 From: David Racine Date: Thu, 18 Jun 2026 09:34:29 -0400 Subject: [PATCH] feat(camera): option for free look to follow the default camera distance (#6757) Free Look pinned the camera to the fixed "Camera Distance" setting, so it never pulled in or out the way the vanilla camera does for the current situation. Add an opt-in "Follow Default Camera Distance" setting (FreeLook.UseGameDistance) that uses the game's per-mode default distance instead. The fixed distance slider is hidden while it is enabled. Closes #4050 Co-authored-by: Claude Opus 4.8 --- .../Enhancements/controls/SohInputEditorWindow.cpp | 11 +++++++++-- soh/src/code/z_camera.c | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp index f16d4b4ca4..49175f6ce5 100644 --- a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp +++ b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp @@ -1464,8 +1464,15 @@ void SohInputEditorWindow::DrawCameraControlPanel() { .Max(5.0f) .DefaultValue(1.0f) .ShowButtons(true)); - CVarSliderInt("Camera Distance: %d", CVAR_SETTING("FreeLook.MaxCameraDistance"), - IntSliderOptions().Color(THEME_COLOR).Min(100).Max(900).DefaultValue(185).ShowButtons(true)); + CVarCheckbox("Follow Default Camera Distance", CVAR_SETTING("FreeLook.UseGameDistance"), + CheckboxOptions() + .Color(THEME_COLOR) + .Tooltip("Lets the free camera pull in and out using the game's default distance for the " + "current situation instead of a fixed distance.")); + if (!CVarGetInteger(CVAR_SETTING("FreeLook.UseGameDistance"), 0)) { + CVarSliderInt("Camera Distance: %d", CVAR_SETTING("FreeLook.MaxCameraDistance"), + IntSliderOptions().Color(THEME_COLOR).Min(100).Max(900).DefaultValue(185).ShowButtons(true)); + } CVarSliderInt("Camera Transition Speed: %d", CVAR_SETTING("FreeLook.TransitionSpeed"), IntSliderOptions().Color(THEME_COLOR).Min(0).Max(900).DefaultValue(25).ShowButtons(true)); Ship::GuiWindow::EndGroupPanel(0); diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index f6f0a607e3..af665014d7 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -1513,7 +1513,11 @@ s32 Camera_Free(Camera* camera) { camera->play->camY = -0x228C; } - f32 distTarget = CVarGetInteger(CVAR_SETTING("FreeLook.MaxCameraDistance"), para1->distTarget); + // SOH [Enhancement] When set, use the game's per-mode default distance (para1->distTarget) + // instead of the fixed free-look distance. + f32 distTarget = CVarGetInteger(CVAR_SETTING("FreeLook.UseGameDistance"), 0) + ? para1->distTarget + : CVarGetInteger(CVAR_SETTING("FreeLook.MaxCameraDistance"), para1->distTarget); f32 speedScaler = CVarGetInteger(CVAR_SETTING("FreeLook.TransitionSpeed"), 25); f32 distDiff = ABS(distTarget - camera->dist); if (distDiff > 0)