From 6b70cad6e1fc8d161e893f4e118f4e20d14e1622 Mon Sep 17 00:00:00 2001 From: arookas Date: Tue, 24 Mar 2020 23:21:26 -0400 Subject: [PATCH] Add option to invert mouse x --- src/d_main.cpp | 6 +++++- src/g_game.cpp | 1 + wadsrc/static/menudef.txt | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 163c9824f0..bf2eb02df1 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -171,6 +171,7 @@ EXTERN_CVAR (Bool, freelook) EXTERN_CVAR (Float, m_pitch) EXTERN_CVAR (Float, m_yaw) EXTERN_CVAR (Bool, invertmouse) +EXTERN_CVAR (Bool, invertmousex) EXTERN_CVAR (Bool, lookstrafe) EXTERN_CVAR (Int, screenblocks) EXTERN_CVAR (Bool, sv_cheats) @@ -449,7 +450,10 @@ void D_PostEvent (const event_t *ev) } if (!buttonMap.ButtonDown(Button_Strafe) && !lookstrafe) { - G_AddViewAngle (int(ev->x * m_yaw * mouse_sensitivity * 8.0), true); + int turn = int(ev->x * m_yaw * mouse_sensitivity * 8.0); + if (invertmousex) + turn = -turn; + G_AddViewAngle (turn, true); events[eventhead].x = 0; } if ((events[eventhead].x | events[eventhead].y) == 0) diff --git a/src/g_game.cpp b/src/g_game.cpp index 0bf7812604..b29f67d6bf 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -202,6 +202,7 @@ int lookspeed[2] = {450, 512}; CVAR (Bool, cl_run, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Always run? CVAR (Bool, invertmouse, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Invert mouse look down/up? +CVAR (Bool, invertmousex, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Invert mouse look left/right? CVAR (Bool, freelook, true, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Always mlook? CVAR (Bool, lookstrafe, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Always strafe with mouse? CVAR (Float, m_pitch, 1.f, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Mouse speeds diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index b59af595f4..e7803545ef 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -734,6 +734,7 @@ OptionMenu "MouseOptions" protected Slider "$MOUSEMNU_STRAFESPEED", "m_side", 0, 2.5, 0.1 StaticText "" Option "$MOUSEMNU_ALWAYSMOUSELOOK", "freelook", "OnOff" + Option "$MOUSEMNU_INVERTMOUSEX", "invertmousex", "OnOff" Option "$MOUSEMNU_INVERTMOUSE", "invertmouse", "OnOff" Option "$MOUSEMNU_LOOKSPRING", "lookspring", "OnOff" Option "$MOUSEMNU_LOOKSTRAFE", "lookstrafe", "OnOff"