mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-06-18 15:55:29 -04:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user