diff --git a/data/gui/dialogs/custom_camera_settings.stkgui b/data/gui/dialogs/custom_camera_settings.stkgui
index b231c2422..36b6cce96 100644
--- a/data/gui/dialogs/custom_camera_settings.stkgui
+++ b/data/gui/dialogs/custom_camera_settings.stkgui
@@ -64,6 +64,17 @@
+
+
+
+
diff --git a/data/gui/screens/options_ui.stkgui b/data/gui/screens/options_ui.stkgui
index 4af18cc40..b969cd5ab 100644
--- a/data/gui/screens/options_ui.stkgui
+++ b/data/gui/screens/options_ui.stkgui
@@ -69,14 +69,6 @@
-
-
-
-
-
-
-
-
diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp
index fe0030049..5030cc24c 100644
--- a/src/config/user_config.hpp
+++ b/src/config/user_config.hpp
@@ -968,7 +968,88 @@ namespace UserConfigParams
&m_camera_normal,
"Focal distance (single player)"));
- // ---- Saved custom camera settings
+ PARAM_PREFIX BoolUserConfigParam m_reverse_look_use_soccer_cam
+ PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
+ "Use ball camera in soccer mode, instead of reverse") );
+
+ // ---- The present camera (default: Standard)
+ PARAM_PREFIX IntUserConfigParam m_camera_present
+ PARAM_DEFAULT( IntUserConfigParam(1, "camera-present",
+ "The current used camera. 0=Custom; 1=Standard; 2=Drone chase") );
+
+ // ---- Standard camera settings
+ PARAM_PREFIX GroupUserConfigParam m_standard_camera_settings
+ PARAM_DEFAULT( GroupUserConfigParam(
+ "standard-camera-settings",
+ "Standard camera settings for player.") );
+
+ PARAM_PREFIX FloatUserConfigParam m_standard_camera_distance
+ PARAM_DEFAULT( FloatUserConfigParam(1.0, "distance",
+ &m_standard_camera_settings,
+ "Distance between kart and camera"));
+
+ PARAM_PREFIX FloatUserConfigParam m_standard_camera_forward_up_angle
+ PARAM_DEFAULT( FloatUserConfigParam(0, "forward-up-angle",
+ &m_standard_camera_settings,
+ "Angle between camera and plane of kart (pitch) when the camera is pointing forward"));
+
+ PARAM_PREFIX BoolUserConfigParam m_standard_camera_forward_smoothing
+ PARAM_DEFAULT( BoolUserConfigParam(true, "forward-smoothing",
+ &m_standard_camera_settings,
+ "if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
+
+ PARAM_PREFIX FloatUserConfigParam m_standard_camera_backward_up_angle
+ PARAM_DEFAULT( FloatUserConfigParam(5, "backward-up-angle",
+ &m_standard_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_standard_camera_fov
+ PARAM_DEFAULT( IntUserConfigParam(80, "fov",
+ &m_standard_camera_settings,
+ "Focal distance (single player)"));
+
+ PARAM_PREFIX BoolUserConfigParam m_standard_reverse_look_use_soccer_cam
+ PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
+ &m_standard_camera_settings,
+ "Use ball camera in soccer mode, instead of reverse"));
+
+ // ---- Drone chase camera settings
+ PARAM_PREFIX GroupUserConfigParam m_drone_camera_settings
+ PARAM_DEFAULT( GroupUserConfigParam(
+ "drone-camera-settings",
+ "Drone chase camera settings for player.") );
+
+ PARAM_PREFIX FloatUserConfigParam m_drone_camera_distance
+ PARAM_DEFAULT( FloatUserConfigParam(2.6, "distance",
+ &m_drone_camera_settings,
+ "Distance between kart and camera"));
+
+ PARAM_PREFIX FloatUserConfigParam m_drone_camera_forward_up_angle
+ PARAM_DEFAULT( FloatUserConfigParam(33, "forward-up-angle",
+ &m_drone_camera_settings,
+ "Angle between camera and plane of kart (pitch) when the camera is pointing forward"));
+
+ PARAM_PREFIX BoolUserConfigParam m_drone_camera_forward_smoothing
+ PARAM_DEFAULT( BoolUserConfigParam(false, "forward-smoothing",
+ &m_drone_camera_settings,
+ "if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
+
+ PARAM_PREFIX FloatUserConfigParam m_drone_camera_backward_up_angle
+ PARAM_DEFAULT( FloatUserConfigParam(10, "backward-up-angle",
+ &m_drone_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_drone_camera_fov
+ PARAM_DEFAULT( IntUserConfigParam(100, "fov",
+ &m_drone_camera_settings,
+ "Focal distance (single player)"));
+
+ PARAM_PREFIX BoolUserConfigParam m_drone_reverse_look_use_soccer_cam
+ PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
+ &m_drone_camera_settings,
+ "Use ball camera in soccer mode, instead of reverse"));
+
+ // ---- Custom camera settings
PARAM_PREFIX GroupUserConfigParam m_saved_camera_settings
PARAM_DEFAULT( GroupUserConfigParam(
"saved-camera-settings",
@@ -999,6 +1080,10 @@ namespace UserConfigParams
&m_saved_camera_settings,
"Focal distance (single player)"));
+ PARAM_PREFIX BoolUserConfigParam m_saved_reverse_look_use_soccer_cam
+ PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
+ &m_saved_camera_settings,
+ "Use ball camera in soccer mode, instead of reverse"));
// camera in artist mode
PARAM_PREFIX GroupUserConfigParam m_camera
@@ -1063,11 +1148,6 @@ namespace UserConfigParams
PARAM_DEFAULT( FloatUserConfigParam(40.0, "camera-angle", &m_spectator,
"Angle between ground, kart and camera.") );
- // ---- Special settings for soccer mode
- PARAM_PREFIX BoolUserConfigParam m_reverse_look_use_soccer_cam
- PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
- "Use ball camera in soccer mode, instead of reverse") );
-
// ---- Handicap
PARAM_PREFIX GroupUserConfigParam m_handicap
PARAM_DEFAULT( GroupUserConfigParam("Handicap",
diff --git a/src/states_screens/dialogs/custom_camera_settings.cpp b/src/states_screens/dialogs/custom_camera_settings.cpp
index 9ae0bbaf6..8a822bd90 100644
--- a/src/states_screens/dialogs/custom_camera_settings.cpp
+++ b/src/states_screens/dialogs/custom_camera_settings.cpp
@@ -57,14 +57,38 @@ void CustomCameraSettingsDialog::beforeAddingWidgets()
{
#ifndef SERVER_ONLY
getWidget("fov")->setRange(75, 115);
- getWidget("fov")->setValue(UserConfigParams::m_saved_camera_fov);
getWidget("camera_distance")->setRange(0 , 20, 0.1);
- getWidget("camera_distance")->setFloatValue(UserConfigParams::m_saved_camera_distance);
getWidget("camera_angle")->setRange(0 , 45);
- 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_saved_camera_backward_up_angle);
+ if (UserConfigParams::m_camera_present == 1) // Standard camera
+ {
+ getWidget("camera_smoothing")->setState(UserConfigParams::m_standard_camera_forward_smoothing);
+ getWidget("use_soccer_camera")->setState(UserConfigParams::m_standard_reverse_look_use_soccer_cam);
+ // Not allowed to change fov, distance, and angles. Only allow to change smoothing and follow soccer
+ getWidget("fov")->setActive(false);
+ getWidget("camera_distance")->setActive(false);
+ getWidget("camera_angle")->setActive(false);
+ getWidget("backward_camera_angle")->setActive(false);
+ }
+ else if (UserConfigParams::m_camera_present == 2) // Drone chase camera
+ {
+ getWidget("camera_smoothing")->setState(UserConfigParams::m_drone_camera_forward_smoothing);
+ getWidget("use_soccer_camera")->setState(UserConfigParams::m_drone_reverse_look_use_soccer_cam);
+ // Not allowed to change fov, distance, and angles. Only allow to change smoothing and follow soccer
+ getWidget("fov")->setActive(false);
+ getWidget("camera_distance")->setActive(false);
+ getWidget("camera_angle")->setActive(false);
+ getWidget("backward_camera_angle")->setActive(false);
+ }
+ else // Custom camera
+ {
+ getWidget("fov")->setValue(UserConfigParams::m_saved_camera_fov);
+ getWidget("camera_distance")->setFloatValue(UserConfigParams::m_saved_camera_distance);
+ 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")->setValue(UserConfigParams::m_saved_camera_backward_up_angle);
+ getWidget("use_soccer_camera")->setState(UserConfigParams::m_saved_reverse_look_use_soccer_cam);
+ }
#endif
}
@@ -75,16 +99,32 @@ GUIEngine::EventPropagation CustomCameraSettingsDialog::processEvent(const std::
#ifndef SERVER_ONLY
if (eventSource == "close")
{
- UserConfigParams::m_camera_fov = getWidget("fov")->getValue();
- UserConfigParams::m_camera_distance = getWidget("camera_distance")->getFloatValue();
- 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_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;
+ UserConfigParams::m_reverse_look_use_soccer_cam = getWidget("use_soccer_camera")->getState();
+ if (UserConfigParams::m_camera_present == 1) // Standard camera, only smoothing and follow soccer is customizable
+ {
+ UserConfigParams::m_saved_camera_forward_smoothing = UserConfigParams::m_camera_forward_smoothing;
+ UserConfigParams::m_standard_reverse_look_use_soccer_cam = UserConfigParams::m_reverse_look_use_soccer_cam;
+
+ }
+ else if (UserConfigParams::m_camera_present == 2) // Drone chase camera, only smoothing and follow soccer is customizable
+ {
+ UserConfigParams::m_drone_camera_forward_smoothing = UserConfigParams::m_camera_forward_smoothing;
+ UserConfigParams::m_drone_reverse_look_use_soccer_cam = UserConfigParams::m_reverse_look_use_soccer_cam;
+ }
+ else // Custom camera, everything is customizable
+ {
+ UserConfigParams::m_camera_fov = getWidget("fov")->getValue();
+ UserConfigParams::m_camera_distance = getWidget("camera_distance")->getFloatValue();
+ UserConfigParams::m_camera_forward_up_angle = getWidget("camera_angle")->getValue();
+ UserConfigParams::m_camera_backward_up_angle = getWidget("backward_camera_angle")->getValue();
+ 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;
+ UserConfigParams::m_saved_reverse_look_use_soccer_cam = UserConfigParams::m_reverse_look_use_soccer_cam;
+ }
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 a52349dac..51fc18dbc 100644
--- a/src/states_screens/options/options_screen_ui.cpp
+++ b/src/states_screens/options/options_screen_ui.cpp
@@ -310,7 +310,6 @@ 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;
@@ -340,30 +339,20 @@ void OptionsScreenUI::init()
irr_driver->setMaxTextureSize();
}
- // Camera presets
- m_camera_presets.push_back // Standard
- ({
- 80 /* fov */, 1.0f /* distance */, 0.0f /* angle */, true /* smoothing */, 5.0f /* backward angle */,
- });
-
- m_camera_presets.push_back // Drone chase
- ({
- 100 /* fov */, 2.6f /* distance */, 33.0f /* angle */, false /* smoothing */, 10.0f /* backward angle */,
- });
-
GUIEngine::SpinnerWidget* camera_preset = getWidget("camera_preset");
assert( camera_preset != NULL );
camera_preset->m_properties[PROP_WRAP_AROUND] = "true";
camera_preset->clearLabels();
- //I18N: custom camera setting
+ //I18N: In the UI options, Camera setting: Custom
camera_preset->addLabel( core::stringw(_("Custom")));
- //I18N: In the UI options,litscreen_method in the race UI
+ //I18N: In the UI options, Camera setting: Standard
camera_preset->addLabel( core::stringw(_("Standard")));
- //I18N: In the UI options, splitscreen_method position in the race UI
+ //I18N: In the UI options, Camera setting: Drone chase
camera_preset->addLabel( core::stringw(_("Drone chase")));
camera_preset->m_properties[GUIEngine::PROP_MIN_VALUE] = "1";
camera_preset->m_properties[GUIEngine::PROP_MAX_VALUE] = "2";
+ camera_preset->setValue(UserConfigParams::m_camera_present); // use the saved camera
updateCameraPresetSpinner();
} // init
@@ -384,37 +373,7 @@ void OptionsScreenUI::updateCamera()
void OptionsScreenUI::updateCameraPresetSpinner()
{
- GUIEngine::SpinnerWidget* camera_preset = getWidget("camera_preset");
- assert( camera_preset != NULL );
-
-#define FLOAT_EPSILON 0.001
-
- bool found = false;
- unsigned int i = 0;
- for (; i < m_camera_presets.size(); i++)
- {
- if (m_camera_presets[i].fov == UserConfigParams::m_camera_fov &&
- m_camera_presets[i].smoothing == UserConfigParams::m_camera_forward_smoothing &&
- fabs(m_camera_presets[i].distance - UserConfigParams::m_camera_distance) < FLOAT_EPSILON &&
- fabs(m_camera_presets[i].angle - UserConfigParams::m_camera_forward_up_angle) < FLOAT_EPSILON &&
- fabs(m_camera_presets[i].backward_angle - UserConfigParams::m_camera_backward_up_angle) < FLOAT_EPSILON)
- {
- camera_preset->setValue(i + 1);
- found = true;
- break;
- }
- }
-
- 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
// -----------------------------------------------------------------------------
@@ -550,30 +509,36 @@ 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)
+ UserConfigParams::m_camera_present = i;
+ if (i == 1) //Standard
{
- 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);
+ UserConfigParams::m_camera_fov = UserConfigParams::m_standard_camera_fov;
+ UserConfigParams::m_camera_distance = UserConfigParams::m_standard_camera_distance;
+ UserConfigParams::m_camera_forward_up_angle = UserConfigParams::m_standard_camera_forward_up_angle;
+ UserConfigParams::m_camera_forward_smoothing = UserConfigParams::m_standard_camera_forward_smoothing;
+ UserConfigParams::m_camera_backward_up_angle = UserConfigParams::m_standard_camera_backward_up_angle;
+ UserConfigParams::m_reverse_look_use_soccer_cam = UserConfigParams::m_standard_reverse_look_use_soccer_cam;
}
- else
+ else if (i == 2) //Drone chase
+ {
+ UserConfigParams::m_camera_fov = UserConfigParams::m_drone_camera_fov;
+ UserConfigParams::m_camera_distance = UserConfigParams::m_drone_camera_distance;
+ UserConfigParams::m_camera_forward_up_angle = UserConfigParams::m_drone_camera_forward_up_angle;
+ UserConfigParams::m_camera_forward_smoothing = UserConfigParams::m_drone_camera_forward_smoothing;
+ UserConfigParams::m_camera_backward_up_angle = UserConfigParams::m_drone_camera_backward_up_angle;
+ UserConfigParams::m_reverse_look_use_soccer_cam = UserConfigParams::m_drone_reverse_look_use_soccer_cam;
+ }
+ else //Custom
{
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);
+ UserConfigParams::m_reverse_look_use_soccer_cam = UserConfigParams::m_saved_reverse_look_use_soccer_cam;
}
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);