diff --git a/CHANGELOG.md b/CHANGELOG.md
index cb02ce983..9bcf6f1d2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@
Bug #4746: Non-solid player can't run or sneak
Feature #2229: Improve pathfinding AI
Feature #3442: Default values for fallbacks from ini file
+ Feature #3610: Option to invert X axis
Feature #4673: Weapon sheathing
Task #4686: Upgrade media decoder to a more current FFmpeg API
diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp
index 0d017ba90..d8b4fd831 100644
--- a/apps/openmw/mwinput/inputmanagerimp.cpp
+++ b/apps/openmw/mwinput/inputmanagerimp.cpp
@@ -52,6 +52,7 @@ namespace MWInput
, mUserFile(userFile)
, mDragDrop(false)
, mGrabCursor (Settings::Manager::getBool("grab cursor", "Input"))
+ , mInvertX (Settings::Manager::getBool("invert x axis", "Input"))
, mInvertY (Settings::Manager::getBool("invert y axis", "Input"))
, mControlsDisabled(false)
, mCameraSensitivity (Settings::Manager::getFloat("camera sensitivity", "Input"))
@@ -467,7 +468,7 @@ namespace MWInput
float rot[3];
rot[0] = yAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f) * (mInvertY ? -1 : 1) * mCameraYMultiplier;
rot[1] = 0.0f;
- rot[2] = xAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f);
+ rot[2] = xAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f) * (mInvertX ? -1 : 1);
// Only actually turn player when we're not in vanity mode
if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot))
@@ -646,6 +647,9 @@ namespace MWInput
for (Settings::CategorySettingVector::const_iterator it = changed.begin();
it != changed.end(); ++it)
{
+ if (it->first == "Input" && it->second == "invert x axis")
+ mInvertX = Settings::Manager::getBool("invert x axis", "Input");
+
if (it->first == "Input" && it->second == "invert y axis")
mInvertY = Settings::Manager::getBool("invert y axis", "Input");
@@ -827,7 +831,7 @@ namespace MWInput
{
resetIdleTime();
- float x = arg.xrel * mCameraSensitivity * (1.0f/256.f);
+ float x = arg.xrel * mCameraSensitivity * (1.0f/256.f) * (mInvertX ? -1 : 1);
float y = arg.yrel * mCameraSensitivity * (1.0f/256.f) * (mInvertY ? -1 : 1) * mCameraYMultiplier;
float rot[3];
diff --git a/apps/openmw/mwinput/inputmanagerimp.hpp b/apps/openmw/mwinput/inputmanagerimp.hpp
index bc62ef7dc..361babec4 100644
--- a/apps/openmw/mwinput/inputmanagerimp.hpp
+++ b/apps/openmw/mwinput/inputmanagerimp.hpp
@@ -175,6 +175,7 @@ namespace MWInput
bool mGrabCursor;
+ bool mInvertX;
bool mInvertY;
bool mControlsDisabled;
diff --git a/docs/source/reference/modding/settings/input.rst b/docs/source/reference/modding/settings/input.rst
index 36c8fa41a..321c28afd 100644
--- a/docs/source/reference/modding/settings/input.rst
+++ b/docs/source/reference/modding/settings/input.rst
@@ -94,6 +94,20 @@ meaning that it should remain set at 1.0 unless the player desires to have diffe
This setting can only be configured by editing the settings configuration file.
+invert x axis
+-------------
+
+:Type: boolean
+:Range: True/False
+:Default: False
+
+
+Invert the horizontal axis while not in GUI mode.
+If this setting is true, moving the mouse to the left will cause the view to rotate counter-clockwise,
+while moving it to the right will cause the view to rotate clockwise. This setting does not affect cursor movement in GUI mode.
+
+This setting can be toggled in game with the Invert X Axis button in the Controls panel of the Options menu.
+
invert y axis
-------------
diff --git a/files/mygui/openmw_settings_window.layout b/files/mygui/openmw_settings_window.layout
index 3c2664857..8062980ff 100644
--- a/files/mygui/openmw_settings_window.layout
+++ b/files/mygui/openmw_settings_window.layout
@@ -214,6 +214,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -223,10 +233,10 @@
-
+
-
+
@@ -236,11 +246,11 @@
-
+
-
+
diff --git a/files/settings-default.cfg b/files/settings-default.cfg
index dad915cbb..71a93d1a2 100644
--- a/files/settings-default.cfg
+++ b/files/settings-default.cfg
@@ -333,6 +333,9 @@ camera sensitivity = 1.0
# (>0.0, Because it's a multiplier values should be near 1.0)
camera y multiplier = 1.0
+# Invert the horizontal axis while not in GUI mode.
+invert x axis = false
+
# Invert the vertical axis while not in GUI mode.
invert y axis = false