- made the mouse sensitivity CVARs floating point so that the menu can display them properly.

- disabled the mouse movement sensitivity CVARs pending a refactoring of the code to handle them in the input backend instead of the individual input handlers.
This commit is contained in:
Christoph Oelckers 2019-12-03 20:49:56 +01:00
parent 49e0e551d6
commit fb5d944170
3 changed files with 20 additions and 15 deletions

View file

@ -348,22 +348,22 @@ CUSTOM_CVARD(Int, in_mousedeadzone, 0, CVAR_GLOBALCONFIG|CVAR_ARCHIVE, "amount o
CVARD(Bool, in_mousesmoothing, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE, "enable/disable mouse input smoothing")
CUSTOM_CVARD(Float, in_mousesensitivity, DEFAULTMOUSESENSITIVITY, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "changes the mouse sensitivity")
CUSTOM_CVARD(Float, in_mousesensitivity, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "changes the mouse sensitivity")
{
if (self < 0) self = 0;
else if (self > 25) self = 25;
else if (self > 6) self = 6;
}
CUSTOM_CVARD(Int, in_mousescalex, 65536, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "changes the mouse sensitivity")
CUSTOM_CVARD(Float, in_mousescalex, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "changes the mouse sensitivity")
{
if (self < -4*65536) self = 4 * 65536;
else if (self > 4 * 65536) self = 4 * 65536;
if (self < -4) self = 4;
else if (self > 4) self = 4;
}
CUSTOM_CVARD(Int, in_mousescaley, 65536, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "changes the mouse sensitivity")
CUSTOM_CVARD(Float, in_mousescaley, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "changes the mouse sensitivity")
{
if (self < -4 * 65536) self = 4 * 65536;
else if (self > 4 * 65536) self = 4 * 65536;
if (self < -4) self = 4;
else if (self > 4) self = 4;
}

View file

@ -40,8 +40,13 @@ void InputState::GetMouseDelta(ControlInfo * info)
last = input;
}
info->mousex = int(finput.x * (4.f / 65536.f) * in_mousesensitivity * in_mousescalex);
info->mousey = int(finput.y * (4.f / 65536.f) * in_mousesensitivity * in_mousescaley);
info->mousex = int(finput.x * (16.f) * in_mousesensitivity * in_mousescalex);
info->mousey = int(finput.y * (16.f) * in_mousesensitivity * in_mousescaley);
// todo: Use these when the mouse is used for moving instead of turning.
//info->mousex = int(finput.x * (4.f) * in_mousesensitivity * in_mouseside);
//info->mousey = int(finput.y * (4.f) * in_mousesensitivity * in_mouseforward);
}
void InputState::AddEvent(const event_t *ev)

View file

@ -930,12 +930,12 @@ OptionMenu "MouseOptions" //protected
StaticText ""
Slider "$MOUSEMNU_SENSITIVITY", "mouse_sensitivity", 0.5, 2.5, 0.1
Option "$MOUSEMNU_NOPRESCALE", "m_noprescale", "NoYes"
Option "$MOUSEMNU_SMOOTHMOUSE", "m_filter", "YesNo"
Option "$MOUSEMNU_SMOOTHMOUSE", "in_mousesmoothing", "YesNo"
StaticText ""
Slider "$MOUSEMNU_TURNSPEED", "m_yaw", 0, 2.5, 0.1
Slider "$MOUSEMNU_MOUSELOOKSPEED", "m_pitch", 0, 2.5, 0.1
Slider "$MOUSEMNU_FORWBACKSPEED", "m_forward", 0, 2.5, 0.1
Slider "$MOUSEMNU_STRAFESPEED", "m_side", 0, 2.5, 0.1
Slider "$MOUSEMNU_TURNSPEED", "in_mousescalex", -4, 4, 0.2
Slider "$MOUSEMNU_MOUSELOOKSPEED", "in_mousescaley", -4, 4, 0.2
//Slider "$MOUSEMNU_FORWBACKSPEED", "in_mouseforward", 0, 2.5, 0.1
//Slider "$MOUSEMNU_STRAFESPEED", "in_mouseside", 0, 2.5, 0.1
StaticText ""
Option "$MOUSEMNU_ALWAYSMOUSELOOK", "in_mousemode", "OnOff"
Option "$MOUSEMNU_INVERTMOUSE", "in_mouseflip", "OnOff"