Add option to invert mouse x

This commit is contained in:
arookas 2020-03-24 23:21:26 -04:00 committed by Christoph Oelckers
parent d563b0339c
commit 6b70cad6e1
3 changed files with 7 additions and 1 deletions

View file

@ -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)

View file

@ -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

View file

@ -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"