
That's why I set out to make it an option in the engine :)
This patch creates a new default-on option FPSInvertMouse. If enabled (default), the y-axis will be inverted, like it has always been, when it's disabled, the y-axis will behave like god intended it to!
It also adds the new option to the settings tool...
Anyway, here's the patch:
Code: Select all
Index: rts/Game/CameraController.cpp
===================================================================
--- rts/Game/CameraController.cpp (revision 1727)
+++ rts/Game/CameraController.cpp (working copy)
@@ -38,6 +38,7 @@
{
scrollSpeed=configHandler.GetInt("FPSScrollSpeed",10)*0.1;
enabled=!!configHandler.GetInt("FPSEnabled",1);
+ m_bMouseInverted=!!configHandler.GetInt("FPSInvertMouse",1);
}
void CFPSController::KeyMove(float3 move)
@@ -49,7 +50,10 @@
void CFPSController::MouseMove(float3 move)
{
camera->rot.y -= mouseScale*move.x;
- camera->rot.x -= mouseScale*move.y*move.z;
+ if (m_bMouseInverted)
+ camera->rot.x += mouseScale*move.y*move.z;
+ else
+ camera->rot.x -= mouseScale*move.y*move.z;
if(camera->rot.x>PI*0.4999)
camera->rot.x=PI*0.4999;
Index: rts/Game/CameraController.h
===================================================================
--- rts/Game/CameraController.h (revision 1727)
+++ rts/Game/CameraController.h (working copy)
@@ -45,6 +45,8 @@
float oldHeight;
float3 dir;
+
+ bool m_bMouseInverted;
};
class COverheadController : public CCameraController
Index: tools/RtsSettings/RtsSettings.rc
===================================================================
--- tools/RtsSettings/RtsSettings.rc (revision 1727)
+++ tools/RtsSettings/RtsSettings.rc (working copy)
@@ -146,6 +146,7 @@
62,22
LTEXT "1",IDC_STATIC,205,159,11,16
LTEXT "20",IDC_STATIC,273,159,13,12
+ CONTROL "Invert mouse in FPS-mode",IDC_InvertMouse,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,296,152,126,16
END
Index: tools/RtsSettings/RtsSettingsDlg.cpp
===================================================================
--- tools/RtsSettings/RtsSettingsDlg.cpp (revision 1727)
+++ tools/RtsSettings/RtsSettingsDlg.cpp (working copy)
@@ -60,6 +60,7 @@
DDX_Control(pDX, IDC_24BITZBUF, zbits24);
DDX_Control(pDX, IDC_UnitIconDist, UnitIconDist);
DDX_Control(pDX, IDC_MaxTextureStages, Sm3MaxTextureStages);
+ DDX_Control(pDX, IDC_InvertMouse, InvertMouse);
}
BEGIN_MESSAGE_MAP(CRtsSettingsDlg, CDialog)
@@ -174,6 +175,8 @@
else
Water0.SetCheck(true);
+ InvertMouse.SetCheck(regHandler.GetInt("FPSInvertMouse",1));
+
return TRUE; // return TRUE unless you set the focus to a control
}
@@ -275,6 +278,9 @@
if(Water0.GetCheck())
regHandler.SetInt("ReflectiveWater",0);
+
+ regHandler.SetInt("FPSInvertMouse",InvertMouse.GetCheck());
+
CString s;
PlayerName.GetWindowText(s);
regHandler.SetString("name",s.GetString());
Index: tools/RtsSettings/RtsSettingsDlg.h
===================================================================
--- tools/RtsSettings/RtsSettingsDlg.h (revision 1727)
+++ tools/RtsSettings/RtsSettingsDlg.h (working copy)
@@ -67,6 +67,7 @@
CButton Water1;
CButton Water2;
CSliderCtrl UnitIconDist;
+ CButton InvertMouse;
CButton zbits16, zbits24;