From 60f8f071e2a5f9fba4aa4654983ac17399d6e8df Mon Sep 17 00:00:00 2001 From: wookieejedi Date: Tue, 23 Jun 2026 10:12:29 -0400 Subject: [PATCH 1/2] Update camera.cpp --- code/camera/camera.cpp | 61 ++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/code/camera/camera.cpp b/code/camera/camera.cpp index 5d23dd127fb..7f87d3958e5 100644 --- a/code/camera/camera.cpp +++ b/code/camera/camera.cpp @@ -56,6 +56,7 @@ APPLY_TO_FOV_T(-, sub) // Used to set the default value for in-game options static float fov_default = DEFAULT_FOV; +static float cockpit_fov_default = DEFAULT_FOV; static SCP_string fov_display(float val) { @@ -73,6 +74,14 @@ static void parse_fov_func() fov_default = value; } +static void parse_cockpit_fov_func() +{ + float value; + stuff_float(&value); + CLAMP(value, 0.436332f, 1.5708f); + cockpit_fov_default = value; +} + // coverity[GLOBAL_INIT_ORDER] -- safe; OptionBuilder::finish() uses Meyers singleton auto FovOption = options::OptionBuilder("Graphics.FOV", std::pair{"Field Of View", 1703}, @@ -90,25 +99,6 @@ auto FovOption = options::OptionBuilder("Graphics.FOV", .parser(parse_fov_func) .finish(); -bool Use_cockpit_fov = false; - -// coverity[GLOBAL_INIT_ORDER] -- safe; OptionBuilder::finish() uses Meyers singleton -auto CockpitFOVToggleOption = options::OptionBuilder("Graphics.CockpitFOVToggle", - std::pair{"Cockpit FOV Toggle", 1838}, - std::pair{"Whether or not to use a different FOV for cockpit rendering from normal rendering", 1839}) - .category(std::make_pair("Graphics", 1825)) - .default_val(false) - .change_listener([](bool val, bool) { - if (!val) { - COCKPIT_ZOOM_DEFAULT = VIEWER_ZOOM_DEFAULT; - } - return true; // This option will always persist so we never return false - }) - .level(options::ExpertLevel::Advanced) - .bind_to(&Use_cockpit_fov) - .importance(61) - .finish(); - // coverity[GLOBAL_INIT_ORDER] -- safe; OptionBuilder::finish() uses Meyers singleton auto CockpitFovOption = options::OptionBuilder("Graphics.CockpitFOV", std::pair{"Cockpit Field Of View", 1840}, @@ -124,9 +114,40 @@ auto CockpitFovOption = options::OptionBuilder("Graphics.CockpitFOV", return true; }) .display(fov_display) - .default_val(fov_default) + .default_func([]() { return cockpit_fov_default; }) .level(options::ExpertLevel::Advanced) .importance(62) + .parser(parse_cockpit_fov_func) + .finish(); + +bool Use_cockpit_fov = false; + +// Used to set the default value for the in-game option +static bool cockpit_fov_toggle_default = false; + +static void parse_cockpit_fov_toggle_func() +{ + bool value; + stuff_boolean(&value); + cockpit_fov_toggle_default = value; +} + +// coverity[GLOBAL_INIT_ORDER] -- safe; OptionBuilder::finish() uses Meyers singleton +auto CockpitFOVToggleOption = options::OptionBuilder("Graphics.CockpitFOVToggle", + std::pair{"Cockpit FOV Toggle", 1838}, + std::pair{"Whether or not to use a different FOV for cockpit rendering from normal rendering", 1839}) + .category(std::make_pair("Graphics", 1825)) + .default_func([]() {return cockpit_fov_toggle_default;}) + .change_listener([](bool val, bool) { + if (!val) { + COCKPIT_ZOOM_DEFAULT = VIEWER_ZOOM_DEFAULT; + } + return true; // This option will always persist so we never return false + }) + .level(options::ExpertLevel::Advanced) + .bind_to(&Use_cockpit_fov) + .importance(61) + .parser(parse_cockpit_fov_toggle_func) .finish(); //*************************CLASS: camera************************* From dc4581ce9381a0716ca75ba59b08c116b377c726 Mon Sep 17 00:00:00 2001 From: wookieejedi Date: Tue, 23 Jun 2026 10:26:38 -0400 Subject: [PATCH 2/2] order cleanup --- code/camera/camera.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/code/camera/camera.cpp b/code/camera/camera.cpp index 7f87d3958e5..34b14419f7f 100644 --- a/code/camera/camera.cpp +++ b/code/camera/camera.cpp @@ -57,6 +57,9 @@ APPLY_TO_FOV_T(-, sub) // Used to set the default value for in-game options static float fov_default = DEFAULT_FOV; static float cockpit_fov_default = DEFAULT_FOV; +static bool cockpit_fov_toggle_default = false; + +bool Use_cockpit_fov = false; static SCP_string fov_display(float val) { @@ -82,6 +85,13 @@ static void parse_cockpit_fov_func() cockpit_fov_default = value; } +static void parse_cockpit_fov_toggle_func() +{ + bool value; + stuff_boolean(&value); + cockpit_fov_toggle_default = value; +} + // coverity[GLOBAL_INIT_ORDER] -- safe; OptionBuilder::finish() uses Meyers singleton auto FovOption = options::OptionBuilder("Graphics.FOV", std::pair{"Field Of View", 1703}, @@ -120,18 +130,6 @@ auto CockpitFovOption = options::OptionBuilder("Graphics.CockpitFOV", .parser(parse_cockpit_fov_func) .finish(); -bool Use_cockpit_fov = false; - -// Used to set the default value for the in-game option -static bool cockpit_fov_toggle_default = false; - -static void parse_cockpit_fov_toggle_func() -{ - bool value; - stuff_boolean(&value); - cockpit_fov_toggle_default = value; -} - // coverity[GLOBAL_INIT_ORDER] -- safe; OptionBuilder::finish() uses Meyers singleton auto CockpitFOVToggleOption = options::OptionBuilder("Graphics.CockpitFOVToggle", std::pair{"Cockpit FOV Toggle", 1838},