Option to disable controller (feature #3980)

pull/541/head
Capostrophic 6 years ago
parent 4a9abf1c1b
commit 39dcbacf44

@ -29,6 +29,7 @@
Feature #2229: Improve pathfinding AI Feature #2229: Improve pathfinding AI
Feature #3442: Default values for fallbacks from ini file Feature #3442: Default values for fallbacks from ini file
Feature #3610: Option to invert X axis Feature #3610: Option to invert X axis
Feature #3980: In-game option to disable controller
Feature #4209: Editor: Faction rank sub-table Feature #4209: Editor: Faction rank sub-table
Feature #4673: Weapon sheathing Feature #4673: Weapon sheathing
Feature #4730: Native animated containers support Feature #4730: Native animated containers support

@ -55,6 +55,7 @@ namespace MWInput
, mInvertX (Settings::Manager::getBool("invert x axis", "Input")) , mInvertX (Settings::Manager::getBool("invert x axis", "Input"))
, mInvertY (Settings::Manager::getBool("invert y axis", "Input")) , mInvertY (Settings::Manager::getBool("invert y axis", "Input"))
, mControlsDisabled(false) , mControlsDisabled(false)
, mJoystickEnabled (Settings::Manager::getBool("enable controller", "Input"))
, mCameraSensitivity (Settings::Manager::getFloat("camera sensitivity", "Input")) , mCameraSensitivity (Settings::Manager::getFloat("camera sensitivity", "Input"))
, mCameraYMultiplier (Settings::Manager::getFloat("camera y multiplier", "Input")) , mCameraYMultiplier (Settings::Manager::getFloat("camera y multiplier", "Input"))
, mPreviewPOVDelay(0.f) , mPreviewPOVDelay(0.f)
@ -659,6 +660,9 @@ namespace MWInput
if (it->first == "Input" && it->second == "grab cursor") if (it->first == "Input" && it->second == "grab cursor")
mGrabCursor = Settings::Manager::getBool("grab cursor", "Input"); mGrabCursor = Settings::Manager::getBool("grab cursor", "Input");
if (it->first == "Input" && it->second == "enable controller")
mJoystickEnabled = Settings::Manager::getBool("enable controller", "Input");
if (it->first == "Video" && ( if (it->first == "Video" && (
it->second == "resolution x" it->second == "resolution x"
|| it->second == "resolution y" || it->second == "resolution y"
@ -858,6 +862,9 @@ namespace MWInput
void InputManager::buttonPressed(int deviceID, const SDL_ControllerButtonEvent &arg ) void InputManager::buttonPressed(int deviceID, const SDL_ControllerButtonEvent &arg )
{ {
if (!mJoystickEnabled)
return;
mJoystickLastUsed = true; mJoystickLastUsed = true;
bool guiMode = false; bool guiMode = false;
@ -892,6 +899,9 @@ namespace MWInput
void InputManager::buttonReleased(int deviceID, const SDL_ControllerButtonEvent &arg ) void InputManager::buttonReleased(int deviceID, const SDL_ControllerButtonEvent &arg )
{ {
if (!mJoystickEnabled)
return;
mJoystickLastUsed = true; mJoystickLastUsed = true;
if(mInputBinder->detectingBindingState()) if(mInputBinder->detectingBindingState())
mInputBinder->buttonReleased(deviceID, arg); mInputBinder->buttonReleased(deviceID, arg);
@ -915,7 +925,7 @@ namespace MWInput
void InputManager::axisMoved(int deviceID, const SDL_ControllerAxisEvent &arg ) void InputManager::axisMoved(int deviceID, const SDL_ControllerAxisEvent &arg )
{ {
if (!mControlsDisabled) if (!mControlsDisabled && mJoystickEnabled)
mInputBinder->axisMoved(deviceID, arg); mInputBinder->axisMoved(deviceID, arg);
} }

@ -179,6 +179,7 @@ namespace MWInput
bool mInvertY; bool mInvertY;
bool mControlsDisabled; bool mControlsDisabled;
bool mJoystickEnabled;
float mCameraSensitivity; float mCameraSensitivity;
float mCameraYMultiplier; float mCameraYMultiplier;

@ -120,3 +120,16 @@ If this setting is true, moving the mouse away from the player will look down,
while moving it towards the player will look up. This setting does not affect cursor movement in GUI mode. while moving it towards the player will look up. This setting does not affect cursor movement in GUI mode.
This setting can be toggled in game with the Invert Y Axis button in the Controls panel of the Options menu. This setting can be toggled in game with the Invert Y Axis button in the Controls panel of the Options menu.
enable controller
-----------------
:Type: boolean
:Range: True/False
:Default: True
Enable support of controller input — or rather not ignore controller events,
which are always sent if a controller is present and detected.
Disabling this setting can be useful for working around controller-related issues or for setting up split-screen gameplay configurations.
This setting can be toggled in game with the Enable Joystick button in the Controls panel of the Options menu.

@ -222,21 +222,19 @@
<Widget type="AutoSizedTextBox" skin="SandText" position="28 4 78 16" align="Left Bottom"> <Widget type="AutoSizedTextBox" skin="SandText" position="28 4 78 16" align="Left Bottom">
<Property key="Caption" value="Invert X Axis"/> <Property key="Caption" value="Invert X Axis"/>
</Widget> </Widget>
</Widget> <Widget type="AutoSizedButton" skin="MW_Button" position="28 0 24 24" align="Left Bottom">
<Widget type="HBox" skin="" position="4 254 300 24" align="Left Bottom">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Bottom">
<UserString key="SettingCategory" value="Input"/> <UserString key="SettingCategory" value="Input"/>
<UserString key="SettingName" value="invert y axis"/> <UserString key="SettingName" value="invert y axis"/>
<UserString key="SettingType" value="CheckButton"/> <UserString key="SettingType" value="CheckButton"/>
</Widget> </Widget>
<Widget type="AutoSizedTextBox" skin="SandText" position="28 4 78 16" align="Left Bottom"> <Widget type="AutoSizedTextBox" skin="SandText" position="56 4 78 16" align="Left Bottom">
<Property key="Caption" value="#{sMouseFlip}"/> <Property key="Caption" value="#{sMouseFlip}"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="TextBox" skin="NormalText" position="4 284 336 18" align="Left Bottom"> <Widget type="TextBox" skin="NormalText" position="4 254 336 18" align="Left Bottom">
<Property key="Caption" value="Camera Sensitivity"/> <Property key="Caption" value="Camera Sensitivity"/>
</Widget> </Widget>
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 308 336 18" align="HStretch Bottom"> <Widget type="MWScrollBar" skin="MW_HScroll" position="4 278 336 18" align="HStretch Bottom">
<Property key="Range" value="10000"/> <Property key="Range" value="10000"/>
<Property key="Page" value="300"/> <Property key="Page" value="300"/>
<UserString key="SettingType" value="Slider"/> <UserString key="SettingType" value="Slider"/>
@ -246,14 +244,24 @@
<UserString key="SettingMin" value="0.2"/> <UserString key="SettingMin" value="0.2"/>
<UserString key="SettingMax" value="5.0"/> <UserString key="SettingMax" value="5.0"/>
</Widget> </Widget>
<Widget type="TextBox" skin="SandText" position="4 332 336 18" align="Left Bottom"> <Widget type="TextBox" skin="SandText" position="4 302 336 18" align="Left Bottom">
<Property key="Caption" value="#{sLow}"/> <Property key="Caption" value="#{sLow}"/>
<Property key="TextAlign" value="Left"/> <Property key="TextAlign" value="Left"/>
</Widget> </Widget>
<Widget type="TextBox" skin="SandText" position="4 332 336 18" align="Right Bottom"> <Widget type="TextBox" skin="SandText" position="4 302 336 18" align="Right Bottom">
<Property key="Caption" value="#{sHigh}"/> <Property key="Caption" value="#{sHigh}"/>
<Property key="TextAlign" value="Right"/> <Property key="TextAlign" value="Right"/>
</Widget> </Widget>
<Widget type="HBox" skin="" position="4 324 336 24" align="Left Bottom">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Bottom">
<UserString key="SettingCategory" value="Input"/>
<UserString key="SettingName" value="enable controller"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" position="28 4 78 16" align="Left Bottom">
<Property key="Caption" value="#{sEnableJoystick}"/>
</Widget>
</Widget>
</Widget> </Widget>
<Widget type="TabItem" skin="" position="4 32 360 308"> <Widget type="TabItem" skin="" position="4 32 360 308">
<Property key="Caption" value=" #{sVideo} "/> <Property key="Caption" value=" #{sVideo} "/>

@ -339,6 +339,9 @@ invert x axis = false
# Invert the vertical axis while not in GUI mode. # Invert the vertical axis while not in GUI mode.
invert y axis = false invert y axis = false
# Enable controller support.
enable controller = true
[Saves] [Saves]
# Name of last character played, and default for loading save files. # Name of last character played, and default for loading save files.

Loading…
Cancel
Save