diff --git a/data/gui/dialogs/custom_camera_settings.stkgui b/data/gui/dialogs/custom_camera_settings.stkgui
index 36b6cce96..b231c2422 100644
--- a/data/gui/dialogs/custom_camera_settings.stkgui
+++ b/data/gui/dialogs/custom_camera_settings.stkgui
@@ -64,17 +64,6 @@
-
-
-
-
diff --git a/data/gui/screens/options_ui.stkgui b/data/gui/screens/options_ui.stkgui
index 4e090205c..4af18cc40 100644
--- a/data/gui/screens/options_ui.stkgui
+++ b/data/gui/screens/options_ui.stkgui
@@ -33,28 +33,28 @@
-
+
-
+
-
+
-
+
@@ -62,13 +62,21 @@
-
+
+
+
+
+
+
+
+
+
diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp
index f0dbbf8c8..902e7605d 100644
--- a/src/config/user_config.hpp
+++ b/src/config/user_config.hpp
@@ -963,6 +963,37 @@ namespace UserConfigParams
&m_camera_normal,
"Focal distance (single player)"));
+ // ---- Saved custom camera settings
+ PARAM_PREFIX GroupUserConfigParam m_saved_camera_settings
+ PARAM_DEFAULT( GroupUserConfigParam(
+ "saved-camera-settings",
+ "Saved custom camera settings for player.") );
+
+ PARAM_PREFIX FloatUserConfigParam m_saved_camera_distance
+ PARAM_DEFAULT( FloatUserConfigParam(1.0, "distance",
+ &m_saved_camera_settings,
+ "Distance between kart and camera"));
+
+ PARAM_PREFIX FloatUserConfigParam m_saved_camera_forward_up_angle
+ PARAM_DEFAULT( FloatUserConfigParam(0, "forward-up-angle",
+ &m_saved_camera_settings,
+ "Angle between camera and plane of kart (pitch) when the camera is pointing forward"));
+
+ PARAM_PREFIX BoolUserConfigParam m_saved_camera_forward_smoothing
+ PARAM_DEFAULT( BoolUserConfigParam(true, "forward-smoothing",
+ &m_saved_camera_settings,
+ "if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
+
+ PARAM_PREFIX FloatUserConfigParam m_saved_camera_backward_up_angle
+ PARAM_DEFAULT( FloatUserConfigParam(5, "backward-up-angle",
+ &m_saved_camera_settings,
+ "Angle between camera and plane of kart (pitch) when the camera is pointing backwards. This is usually larger than the forward-up-angle, since the kart itself otherwise obstricts too much of the view"));
+
+ PARAM_PREFIX IntUserConfigParam m_saved_camera_fov
+ PARAM_DEFAULT( IntUserConfigParam(80, "fov",
+ &m_saved_camera_settings,
+ "Focal distance (single player)"));
+
// camera in artist mode
PARAM_PREFIX GroupUserConfigParam m_camera
diff --git a/src/states_screens/dialogs/custom_camera_settings.cpp b/src/states_screens/dialogs/custom_camera_settings.cpp
index 02820af80..9ae0bbaf6 100644
--- a/src/states_screens/dialogs/custom_camera_settings.cpp
+++ b/src/states_screens/dialogs/custom_camera_settings.cpp
@@ -42,12 +42,6 @@ CustomCameraSettingsDialog::CustomCameraSettingsDialog(const float w, const floa
{
m_self_destroy = false;
loadFromFile("custom_camera_settings.stkgui");
- getWidget("fov")->setValue(UserConfigParams::m_camera_fov);
- getWidget("camera_distance")->setFloatValue(UserConfigParams::m_camera_distance);
- getWidget("camera_angle")->setValue(UserConfigParams::m_camera_forward_up_angle);
- getWidget("camera_smoothing")->setState(UserConfigParams::m_camera_forward_smoothing);
- getWidget("backward_camera_angle")->setValue(UserConfigParams::m_camera_backward_up_angle);
-// updateActivation();
}
// -----------------------------------------------------------------------------
@@ -63,15 +57,14 @@ void CustomCameraSettingsDialog::beforeAddingWidgets()
{
#ifndef SERVER_ONLY
getWidget("fov")->setRange(75, 115);
- getWidget("fov")->setValue(UserConfigParams::m_camera_fov);
+ getWidget("fov")->setValue(UserConfigParams::m_saved_camera_fov);
getWidget("camera_distance")->setRange(0 , 20, 0.1);
- getWidget("camera_distance")->setFloatValue(UserConfigParams::m_camera_distance);
+ getWidget("camera_distance")->setFloatValue(UserConfigParams::m_saved_camera_distance);
getWidget("camera_angle")->setRange(0 , 45);
- getWidget("camera_angle")->setValue(UserConfigParams::m_camera_forward_up_angle);
- getWidget("camera_smoothing")->setState(UserConfigParams::m_camera_forward_smoothing);
+ getWidget("camera_angle")->setValue(UserConfigParams::m_saved_camera_forward_up_angle);
+ getWidget("camera_smoothing")->setState(UserConfigParams::m_saved_camera_forward_smoothing);
getWidget("backward_camera_angle")->setRange(0 , 45);
- getWidget("backward_camera_angle")->setValue(UserConfigParams::m_camera_backward_up_angle);
- getWidget("use_soccer_camera")->setState(UserConfigParams::m_reverse_look_use_soccer_cam);
+ getWidget("backward_camera_angle")->setValue(UserConfigParams::m_saved_camera_backward_up_angle);
#endif
}
@@ -87,7 +80,11 @@ GUIEngine::EventPropagation CustomCameraSettingsDialog::processEvent(const std::
UserConfigParams::m_camera_forward_up_angle = getWidget("camera_angle")->getValue();
UserConfigParams::m_camera_forward_smoothing = getWidget("camera_smoothing")->getState();
UserConfigParams::m_camera_backward_up_angle = getWidget("backward_camera_angle")->getValue();
- UserConfigParams::m_reverse_look_use_soccer_cam = getWidget("use_soccer_camera")->getState();
+ UserConfigParams::m_saved_camera_fov = UserConfigParams::m_camera_fov;
+ UserConfigParams::m_saved_camera_distance = UserConfigParams::m_camera_distance;
+ UserConfigParams::m_saved_camera_forward_up_angle = UserConfigParams::m_camera_forward_up_angle;
+ UserConfigParams::m_saved_camera_forward_smoothing = UserConfigParams::m_camera_forward_smoothing;
+ UserConfigParams::m_saved_camera_backward_up_angle = UserConfigParams::m_camera_backward_up_angle;
OptionsScreenUI::getInstance()->updateCameraPresetSpinner();
m_self_destroy = true;
return GUIEngine::EVENT_BLOCK;
diff --git a/src/states_screens/options/options_screen_ui.cpp b/src/states_screens/options/options_screen_ui.cpp
index 9448e1b11..a52349dac 100644
--- a/src/states_screens/options/options_screen_ui.cpp
+++ b/src/states_screens/options/options_screen_ui.cpp
@@ -310,6 +310,7 @@ void OptionsScreenUI::init()
}
speedrun_timer->setState( UserConfigParams::m_speedrun_mode );
+ getWidget("follow_ball_backward_camera")->setState(UserConfigParams::m_reverse_look_use_soccer_cam);
// --- select the right skin in the spinner
bool currSkinFound = false;
const std::string& user_skin = UserConfigParams::m_skin_file;
@@ -406,9 +407,12 @@ void OptionsScreenUI::updateCameraPresetSpinner()
if (!found)
{
+ getWidget("custom_camera")->setActive(true);
camera_preset->setValue(0);
camera_preset->m_properties[GUIEngine::PROP_MIN_VALUE] = std::to_string(0);
}
+ else
+ getWidget("custom_camera")->setActive(false);
updateCamera();
} // updateCameraPresetSpinner
@@ -546,15 +550,30 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
GUIEngine::SpinnerWidget* camera_preset = getWidget("camera_preset");
assert( camera_preset != NULL );
unsigned int i = camera_preset->getValue();
- if (i != 0) {
+ if (i != 0)
+ {
UserConfigParams::m_camera_fov = m_camera_presets[i-1].fov;
UserConfigParams::m_camera_distance = m_camera_presets[i-1].distance;
UserConfigParams::m_camera_forward_up_angle = m_camera_presets[i-1].angle;
UserConfigParams::m_camera_forward_smoothing = m_camera_presets[i-1].smoothing;
UserConfigParams::m_camera_backward_up_angle = m_camera_presets[i-1].backward_angle;
+ getWidget("custom_camera")->setActive(false);
+ }
+ else
+ {
+ UserConfigParams::m_camera_fov = UserConfigParams::m_saved_camera_fov;
+ UserConfigParams::m_camera_distance = UserConfigParams::m_saved_camera_distance;
+ UserConfigParams::m_camera_forward_up_angle = UserConfigParams::m_saved_camera_forward_up_angle;
+ UserConfigParams::m_camera_forward_smoothing = UserConfigParams::m_saved_camera_forward_smoothing;
+ UserConfigParams::m_camera_backward_up_angle = UserConfigParams::m_saved_camera_backward_up_angle;
+ getWidget("custom_camera")->setActive(true);
}
updateCamera();
}
+ else if (name == "follow_ball_backward_camera")
+ {
+ UserConfigParams::m_reverse_look_use_soccer_cam = getWidget("follow_ball_backward_camera")->getState();
+ }
else if(name == "custom_camera")
{
new CustomCameraSettingsDialog(0.8f, 0.9f);