diff --git a/data/gui/screens/options_device.stkgui b/data/gui/screens/options_device.stkgui
index 6f42b60c4..fd77f4a4a 100644
--- a/data/gui/screens/options_device.stkgui
+++ b/data/gui/screens/options_device.stkgui
@@ -50,13 +50,16 @@
I18N="In the input configuration screen" text="Disable Configuration"/>
-
+
+
+
+
diff --git a/data/po/supertuxkart.pot b/data/po/supertuxkart.pot
index 55e88349e..0daa906ea 100644
--- a/data/po/supertuxkart.pot
+++ b/data/po/supertuxkart.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: supertuxkart\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-05-08 11:13+0800\n"
+"POT-Creation-Date: 2021-05-22 00:50+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -173,7 +173,7 @@ msgstr ""
#. I18N: High score info screen action
#. I18N: ./data/gui/dialogs/select_challenge.stkgui
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:149
+#: src/input/gamepad_config.cpp:153
#: src/states_screens/dialogs/addons_loading.cpp:297
msgid "Back"
msgstr ""
@@ -972,9 +972,9 @@ msgstr ""
#. I18N: ./data/gui/screens/online/network_karts.stkgui
#. I18N: ./data/gui/screens/soccer_setup.stkgui
#. I18N: In soccer setup screen
-#: src/states_screens/race_result_gui.cpp:237
-#: src/states_screens/race_result_gui.cpp:266
-#: src/states_screens/race_result_gui.cpp:274
+#: src/states_screens/race_result_gui.cpp:238
+#: src/states_screens/race_result_gui.cpp:267
+#: src/states_screens/race_result_gui.cpp:275
msgid "Continue"
msgstr ""
@@ -2092,8 +2092,8 @@ msgstr ""
#. I18N: ./data/gui/screens/options_device.stkgui
#. I18N: In the input configuration screen
#. I18N: button to disable a keyboard configuration
-#: src/states_screens/options/options_screen_device.cpp:117
-#: src/states_screens/options/options_screen_device.cpp:626
+#: src/states_screens/options/options_screen_device.cpp:123
+#: src/states_screens/options/options_screen_device.cpp:632
msgid "Disable Configuration"
msgstr ""
@@ -2107,6 +2107,11 @@ msgstr ""
msgid "Rename Configuration"
msgstr ""
+#. I18N: ./data/gui/screens/options_device.stkgui
+#. I18N: In the input configuration screen, for gamepad
+msgid "Enable force feedback (if support)"
+msgstr ""
+
#. I18N: ./data/gui/screens/options_general.stkgui
#. I18N: In the general settings
msgid "Internet options"
@@ -2806,7 +2811,7 @@ msgid "FPS: %d/%d/%d - %d KTris, Ping: %dms"
msgstr ""
#. I18N: Tip shown in gui for giving player hints
-#: src/guiengine/engine.cpp:1439 src/states_screens/race_result_gui.cpp:198
+#: src/guiengine/engine.cpp:1439 src/states_screens/race_result_gui.cpp:199
#, c-format
msgid "Tip: %s"
msgstr ""
@@ -2835,12 +2840,12 @@ msgstr ""
#. activated for this kart (i.e. it will drive slower)
#: src/guiengine/widgets/player_kart_widget.cpp:387
#: src/guiengine/widgets/player_kart_widget.cpp:758
-#: src/karts/controller/local_player_controller.cpp:446
+#: src/karts/controller/local_player_controller.cpp:452
#: src/karts/controller/player_controller.cpp:413
#: src/network/protocols/client_lobby.cpp:824
#: src/states_screens/dialogs/splitscreen_player_dialog.cpp:121
-#: src/states_screens/race_result_gui.cpp:1475
-#: src/states_screens/race_result_gui.cpp:1537
+#: src/states_screens/race_result_gui.cpp:1476
+#: src/states_screens/race_result_gui.cpp:1538
#, c-format
msgid "%s (handicapped)"
msgstr ""
@@ -3346,115 +3351,115 @@ msgid "Your input config file is not compatible with this version of STK."
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:151
+#: src/input/gamepad_config.cpp:155
msgid "Guide"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:153
+#: src/input/gamepad_config.cpp:157
msgid "Start"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:155
+#: src/input/gamepad_config.cpp:159
msgid "Left thumbstick press"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:157
+#: src/input/gamepad_config.cpp:161
msgid "Right thumbstick press"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:159
+#: src/input/gamepad_config.cpp:163
msgid "Left shoulder"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:161
+#: src/input/gamepad_config.cpp:165
msgid "Right shoulder"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:163
+#: src/input/gamepad_config.cpp:167
msgid "DPad up"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:165
+#: src/input/gamepad_config.cpp:169
msgid "DPad down"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:167
+#: src/input/gamepad_config.cpp:171
msgid "DPad left"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:169
+#: src/input/gamepad_config.cpp:173
msgid "DPad right"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:173
+#: src/input/gamepad_config.cpp:177
msgid "Left thumbstick right"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:175
+#: src/input/gamepad_config.cpp:179
msgid "Left thumbstick left"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:177
+#: src/input/gamepad_config.cpp:181
msgid "Left thumbstick down"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:179
+#: src/input/gamepad_config.cpp:183
msgid "Left thumbstick up"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:181
+#: src/input/gamepad_config.cpp:185
msgid "Right thumbstick right"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:183
+#: src/input/gamepad_config.cpp:187
msgid "Right thumbstick left"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:185
+#: src/input/gamepad_config.cpp:189
msgid "Right thumbstick down"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:187
+#: src/input/gamepad_config.cpp:191
msgid "Right thumbstick up"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:189
+#: src/input/gamepad_config.cpp:193
msgid "Left trigger"
msgstr ""
#. I18N: name of buttons on gamepads
-#: src/input/gamepad_config.cpp:191
+#: src/input/gamepad_config.cpp:195
msgid "Right trigger"
msgstr ""
-#: src/input/input_manager.cpp:832
+#: src/input/input_manager.cpp:848
#, c-format
msgid "Ignoring '%s'. You needed to join earlier to play!"
msgstr ""
-#: src/input/input_manager.cpp:868
+#: src/input/input_manager.cpp:884
msgid "Only the Game Master may act at this point!"
msgstr ""
-#: src/input/sdl_controller.cpp:241
+#: src/input/sdl_controller.cpp:253
#, c-format
msgid "%s has low battery level."
msgstr ""
@@ -3486,11 +3491,11 @@ msgstr ""
msgid "Getting ready to race"
msgstr ""
-#: src/karts/controller/local_player_controller.cpp:307
+#: src/karts/controller/local_player_controller.cpp:313
msgid "Penalty time!!"
msgstr ""
-#: src/karts/controller/local_player_controller.cpp:310
+#: src/karts/controller/local_player_controller.cpp:316
msgid "Don't accelerate before 'Set!'"
msgstr ""
@@ -3686,7 +3691,7 @@ msgstr ""
#: src/network/protocols/client_lobby.cpp:695
#: src/states_screens/dialogs/high_score_info_dialog.cpp:92
#: src/states_screens/dialogs/server_info_dialog.cpp:84
-#: src/states_screens/race_result_gui.cpp:1841
+#: src/states_screens/race_result_gui.cpp:1842
#, c-format
msgid "Difficulty: %s"
msgstr ""
@@ -4283,7 +4288,7 @@ msgstr ""
#: src/states_screens/dialogs/achievement_progress_dialog.cpp:256
#: src/states_screens/dialogs/achievement_progress_dialog.cpp:260
#: src/states_screens/dialogs/achievement_progress_dialog.cpp:267
-#: src/states_screens/options/options_screen_device.cpp:276
+#: src/states_screens/options/options_screen_device.cpp:282
msgid "Skidding"
msgstr ""
@@ -4419,7 +4424,7 @@ msgstr ""
#: src/states_screens/dialogs/addons_loading.cpp:292
#: src/states_screens/dialogs/addons_pack.cpp:185
-#: src/states_screens/dialogs/download_assets.cpp:189
+#: src/states_screens/dialogs/download_assets.cpp:191
msgid "Sorry, downloading the add-on failed"
msgstr ""
@@ -4430,7 +4435,7 @@ msgstr ""
#: src/states_screens/dialogs/addons_loading.cpp:379
#: src/states_screens/dialogs/addons_loading.cpp:428
-#: src/states_screens/dialogs/download_assets.cpp:254
+#: src/states_screens/dialogs/download_assets.cpp:256
msgid "Try again"
msgstr ""
@@ -4442,7 +4447,7 @@ msgstr ""
#. I18N: Shown when there is download error for assets download
#. in the first run
#: src/states_screens/dialogs/addons_pack.cpp:225
-#: src/states_screens/dialogs/download_assets.cpp:239
+#: src/states_screens/dialogs/download_assets.cpp:241
msgid ""
"Failed to download assets, check your storage space or internet connection "
"and try again later."
@@ -4557,7 +4562,7 @@ msgid ""
msgstr ""
#. I18N: In download assets dialog
-#: src/states_screens/dialogs/download_assets.cpp:115
+#: src/states_screens/dialogs/download_assets.cpp:116
msgid ""
"SuperTuxKart will download full assets (including high quality textures and "
"music) for better gaming experience."
@@ -4762,7 +4767,7 @@ msgid "Exit Battle"
msgstr ""
#: src/states_screens/dialogs/race_paused_dialog.cpp:143
-#: src/states_screens/race_result_gui.cpp:320
+#: src/states_screens/race_result_gui.cpp:321
msgid "Setup New Race"
msgstr ""
@@ -4808,7 +4813,7 @@ msgstr ""
#. I18N: In the Select challenge dialog
#: src/states_screens/dialogs/select_challenge.cpp:72
-#: src/states_screens/race_result_gui.cpp:1831
+#: src/states_screens/race_result_gui.cpp:1832
#, c-format
msgid "Laps: %i"
msgstr ""
@@ -5106,7 +5111,7 @@ msgid "Better luck next time!"
msgstr ""
#: src/states_screens/grand_prix_win.cpp:166
-#: src/states_screens/race_result_gui.cpp:256
+#: src/states_screens/race_result_gui.cpp:257
msgid "You completed a challenge!"
msgstr ""
@@ -5494,126 +5499,126 @@ msgstr ""
msgid "Locked: solve active challenges to gain access to more!"
msgstr ""
-#: src/states_screens/options/options_screen_device.cpp:74
+#: src/states_screens/options/options_screen_device.cpp:76
msgid "Action"
msgstr ""
-#: src/states_screens/options/options_screen_device.cpp:75
+#: src/states_screens/options/options_screen_device.cpp:77
msgid "Key binding"
msgstr ""
#. I18N: button to disable a gamepad configuration
-#: src/states_screens/options/options_screen_device.cpp:102
-#: src/states_screens/options/options_screen_device.cpp:621
+#: src/states_screens/options/options_screen_device.cpp:106
+#: src/states_screens/options/options_screen_device.cpp:627
msgid "Disable Device"
msgstr ""
#. I18N: button to enable a gamepad configuration
-#: src/states_screens/options/options_screen_device.cpp:104
-#: src/states_screens/options/options_screen_device.cpp:622
+#: src/states_screens/options/options_screen_device.cpp:108
+#: src/states_screens/options/options_screen_device.cpp:628
msgid "Enable Device"
msgstr ""
#. I18N: button to enable a keyboard configuration
-#: src/states_screens/options/options_screen_device.cpp:119
-#: src/states_screens/options/options_screen_device.cpp:627
+#: src/states_screens/options/options_screen_device.cpp:125
+#: src/states_screens/options/options_screen_device.cpp:633
msgid "Enable Configuration"
msgstr ""
#. I18N: Key binding section
-#: src/states_screens/options/options_screen_device.cpp:168
+#: src/states_screens/options/options_screen_device.cpp:174
msgid "Game Keys"
msgstr ""
#. I18N: Key binding section
-#: src/states_screens/options/options_screen_device.cpp:182
+#: src/states_screens/options/options_screen_device.cpp:188
msgid "Menu Keys"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:258
+#: src/states_screens/options/options_screen_device.cpp:264
msgid "Steer Left"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:261
+#: src/states_screens/options/options_screen_device.cpp:267
msgid "Steer Right"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:264
+#: src/states_screens/options/options_screen_device.cpp:270
msgid "Accelerate"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:267
+#: src/states_screens/options/options_screen_device.cpp:273
msgid "Brake / Reverse"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:270
+#: src/states_screens/options/options_screen_device.cpp:276
msgid "Fire"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:273
+#: src/states_screens/options/options_screen_device.cpp:279
msgid "Nitro"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:279
+#: src/states_screens/options/options_screen_device.cpp:285
msgid "Look Back"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:282
+#: src/states_screens/options/options_screen_device.cpp:288
msgid "Rescue"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:285
+#: src/states_screens/options/options_screen_device.cpp:291
msgid "Pause Game"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:290
+#: src/states_screens/options/options_screen_device.cpp:296
msgid "Up"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:293
+#: src/states_screens/options/options_screen_device.cpp:299
msgid "Down"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:296
+#: src/states_screens/options/options_screen_device.cpp:302
msgid "Left"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:299
+#: src/states_screens/options/options_screen_device.cpp:305
msgid "Right"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:302
+#: src/states_screens/options/options_screen_device.cpp:308
msgid "Select"
msgstr ""
#. I18N: Key binding name
-#: src/states_screens/options/options_screen_device.cpp:305
+#: src/states_screens/options/options_screen_device.cpp:311
msgid "Cancel/Back"
msgstr ""
-#: src/states_screens/options/options_screen_device.cpp:396
+#: src/states_screens/options/options_screen_device.cpp:402
msgid "* A blue item means a conflict with another configuration"
msgstr ""
-#: src/states_screens/options/options_screen_device.cpp:401
+#: src/states_screens/options/options_screen_device.cpp:407
msgid "* A red item means a conflict in the current configuration"
msgstr ""
-#: src/states_screens/options/options_screen_device.cpp:508
+#: src/states_screens/options/options_screen_device.cpp:514
msgid ""
"Warning: The 'Shift' is not a recommended key. When 'Shift' is pressed down, "
"all keys that contain a character that is different in upper-case will stop "
@@ -5621,11 +5626,11 @@ msgid ""
msgstr ""
#. I18N: shown before deleting an input configuration
-#: src/states_screens/options/options_screen_device.cpp:607
+#: src/states_screens/options/options_screen_device.cpp:613
msgid "Are you sure you want to permanently delete this configuration?"
msgstr ""
-#: src/states_screens/options/options_screen_device.cpp:635
+#: src/states_screens/options/options_screen_device.cpp:641
msgid "Enter new configuration name, leave empty to revert default value."
msgstr ""
@@ -5889,7 +5894,7 @@ msgstr ""
#. I18N: Shown waiting for other players in network to finish loading or
#. waiting
#: src/states_screens/race_gui_base.cpp:79
-#: src/states_screens/race_result_gui.cpp:366
+#: src/states_screens/race_result_gui.cpp:367
msgid "Waiting for others"
msgstr ""
@@ -5947,84 +5952,84 @@ msgstr ""
msgid "Press fire to start the challenge"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:242
+#: src/states_screens/race_result_gui.cpp:243
msgid "Quit the server"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:257
+#: src/states_screens/race_result_gui.cpp:258
msgid "You completed challenges!"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:280
+#: src/states_screens/race_result_gui.cpp:281
msgid "Abort Grand Prix"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:300
+#: src/states_screens/race_result_gui.cpp:301
msgid "Restart"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:307
+#: src/states_screens/race_result_gui.cpp:308
msgid "Back to challenge selection"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:315
+#: src/states_screens/race_result_gui.cpp:316
msgid "Race against the new ghost replay"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:323
+#: src/states_screens/race_result_gui.cpp:324
msgid "Back to the menu"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:492
+#: src/states_screens/race_result_gui.cpp:493
msgid "Do you really want to abort the Grand Prix?"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:590
-#: src/states_screens/race_result_gui.cpp:1402
+#: src/states_screens/race_result_gui.cpp:591
+#: src/states_screens/race_result_gui.cpp:1403
msgid "Red Team Wins"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:592
-#: src/states_screens/race_result_gui.cpp:1406
+#: src/states_screens/race_result_gui.cpp:593
+#: src/states_screens/race_result_gui.cpp:1407
msgid "Blue Team Wins"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:594
-#: src/states_screens/race_result_gui.cpp:1411
+#: src/states_screens/race_result_gui.cpp:595
+#: src/states_screens/race_result_gui.cpp:1412
msgid "It's a draw"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:827
-#: src/states_screens/race_result_gui.cpp:1255
+#: src/states_screens/race_result_gui.cpp:828
+#: src/states_screens/race_result_gui.cpp:1256
msgid "Eliminated"
msgstr ""
#. I18N: indicates a player that scored in their own goal in result screen
-#: src/states_screens/race_result_gui.cpp:1481
-#: src/states_screens/race_result_gui.cpp:1543
+#: src/states_screens/race_result_gui.cpp:1482
+#: src/states_screens/race_result_gui.cpp:1544
msgid "(Own Goal)"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:1622
+#: src/states_screens/race_result_gui.cpp:1623
#, c-format
msgid "Track %i/%i"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:1706
+#: src/states_screens/race_result_gui.cpp:1707
msgid "Grand Prix progress:"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:1752
+#: src/states_screens/race_result_gui.cpp:1753
msgid "Highscores"
msgstr ""
-#: src/states_screens/race_result_gui.cpp:1855
+#: src/states_screens/race_result_gui.cpp:1856
#, c-format
msgid "Best lap time: %s"
msgstr ""
#. I18N: is used to indicate who has the bast laptime (best laptime "by kart_name")
-#: src/states_screens/race_result_gui.cpp:1869
+#: src/states_screens/race_result_gui.cpp:1870
#, c-format
msgid "by %s"
msgstr ""
diff --git a/src/input/gamepad_config.cpp b/src/input/gamepad_config.cpp
index de6d9337c..ac2ea3978 100644
--- a/src/input/gamepad_config.cpp
+++ b/src/input/gamepad_config.cpp
@@ -63,6 +63,7 @@ GamepadConfig::GamepadConfig( const std::string &name,
m_hat_count = 0;
m_deadzone = 4096;
m_desensitize = false;
+ m_use_force_feedback = true;
setDefaultBinds();
} // GamepadConfig
@@ -75,6 +76,7 @@ GamepadConfig::GamepadConfig() : DeviceConfig()
m_hat_count = 0;
m_deadzone = 4096;
m_desensitize = false;
+ m_use_force_feedback = true;
setDefaultBinds();
} // GamepadConfig
@@ -87,6 +89,7 @@ bool GamepadConfig::load(const XMLNode *config)
{
config->get("deadzone", &m_deadzone );
config->get("desensitize", &m_desensitize );
+ config->get("force-feedback", &m_use_force_feedback);
bool ok = DeviceConfig::load(config);
if(getName()=="")
@@ -107,7 +110,8 @@ void GamepadConfig::save (std::ofstream& stream)
{
stream << "\n\n";
} // save
diff --git a/src/input/gamepad_config.hpp b/src/input/gamepad_config.hpp
index 346fd47d0..ea38c6fff 100644
--- a/src/input/gamepad_config.hpp
+++ b/src/input/gamepad_config.hpp
@@ -59,6 +59,8 @@ private:
* values close to 0 the joystick will react less sensitive. */
bool m_desensitize;
+ bool m_use_force_feedback;
+
std::map, int> m_sdl_mapping;
std::set m_digital_axes;
@@ -118,6 +120,10 @@ public:
int hats);
// ------------------------------------------------------------------------
void initSDLMapping();
+ // ------------------------------------------------------------------------
+ bool useForceFeedback() const { return m_use_force_feedback; }
+ // ------------------------------------------------------------------------
+ void setForceFeedback(bool val) { m_use_force_feedback = val; }
}; // class GamepadConfig
#endif
diff --git a/src/input/gamepad_device.cpp b/src/input/gamepad_device.cpp
index 7fa56ba90..9e5f140b9 100644
--- a/src/input/gamepad_device.cpp
+++ b/src/input/gamepad_device.cpp
@@ -242,3 +242,7 @@ bool GamePadDevice::processAndMapInput(Input::InputType type, const int id,
} // processAndMapInput
// ----------------------------------------------------------------------------
+bool GamePadDevice::useForceFeedback() const
+{
+ return static_cast(m_configuration)->useForceFeedback();
+} // useForceFeedback
diff --git a/src/input/gamepad_device.hpp b/src/input/gamepad_device.hpp
index d1ec83334..e01eb218b 100644
--- a/src/input/gamepad_device.hpp
+++ b/src/input/gamepad_device.hpp
@@ -61,7 +61,7 @@ public:
// ------------------------------------------------------------------------
void setIrrIndex(int i ) { m_irr_index = i; }
-
+ bool useForceFeedback() const;
}; // class GamepadDevice
#endif
diff --git a/src/karts/controller/local_player_controller.cpp b/src/karts/controller/local_player_controller.cpp
index 196929d5c..28c73d55e 100644
--- a/src/karts/controller/local_player_controller.cpp
+++ b/src/karts/controller/local_player_controller.cpp
@@ -480,8 +480,10 @@ void LocalPlayerController::rumble(float strength_low, float strength_high, uint
SDLController* controller = input_manager->getSDLController(count);
if (controller && controller->getGamePadDevice()->getPlayer() == m_player)
{
- controller->doRumble(strength_low, strength_high, duration);
- break;
+ if (!controller->getGamePadDevice()->useForceFeedback())
+ return;
+ controller->doRumble(strength_low, strength_high, duration);
+ break;
}
}
#endif
diff --git a/src/states_screens/options/options_screen_device.cpp b/src/states_screens/options/options_screen_device.cpp
index 874c23f15..4782f3dae 100644
--- a/src/states_screens/options/options_screen_device.cpp
+++ b/src/states_screens/options/options_screen_device.cpp
@@ -24,12 +24,14 @@
#include "guiengine/screen.hpp"
#include "guiengine/widget.hpp"
#include "guiengine/widgets/button_widget.hpp"
+#include "guiengine/widgets/check_box_widget.hpp"
#include "guiengine/widgets/label_widget.hpp"
#include "guiengine/widgets/text_box_widget.hpp"
#include "guiengine/widgets/list_widget.hpp"
#include "guiengine/widgets/ribbon_widget.hpp"
#include "input/input_manager.hpp"
#include "input/device_manager.hpp"
+#include "input/gamepad_config.hpp"
#include "input/gamepad_device.hpp"
#include "io/file_manager.hpp"
#include "states_screens/dialogs/press_a_key_dialog.hpp"
@@ -91,6 +93,9 @@ void OptionsScreenDevice::init()
core::stringw label;
+ CheckBoxWidget* ff = getWidget("force_feedback");
+ ff->setVisible(!m_config->isKeyboard());
+ getWidget("force_feedback_text")->setVisible(!m_config->isKeyboard());
if (!m_config->isKeyboard())
{
// Only allow to enable or disable a gamepad,
@@ -102,6 +107,8 @@ void OptionsScreenDevice::init()
_("Disable Device")
: //I18N: button to enable a gamepad configuration
_("Enable Device"));
+ ff->setState(
+ static_cast(m_config)->useForceFeedback());
}
else
{
@@ -645,7 +652,16 @@ void OptionsScreenDevice::eventCallback(Widget* widget,
return true;
});
}
-
+ else if (name == "force_feedback")
+ {
+ GamepadConfig* gc = dynamic_cast(m_config);
+ if (gc)
+ {
+ gc->setForceFeedback(
+ getWidget("force_feedback")->getState());
+ input_manager->getDeviceManager()->save();
+ }
+ }
} // eventCallback
// -----------------------------------------------------------------------------