From fb5d94417003fa3c628f3e5647393fa308082fe1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 3 Dec 2019 20:49:56 +0100 Subject: [PATCH] - 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. --- source/common/gamecvars.cpp | 16 ++++++++-------- source/common/inputstate.cpp | 9 +++++++-- wadsrc/static/demolition/menudef.txt | 10 +++++----- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/source/common/gamecvars.cpp b/source/common/gamecvars.cpp index ed460409d..c96225a59 100644 --- a/source/common/gamecvars.cpp +++ b/source/common/gamecvars.cpp @@ -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; } diff --git a/source/common/inputstate.cpp b/source/common/inputstate.cpp index 4036dfc0f..94353590d 100644 --- a/source/common/inputstate.cpp +++ b/source/common/inputstate.cpp @@ -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) diff --git a/wadsrc/static/demolition/menudef.txt b/wadsrc/static/demolition/menudef.txt index edacd3152..781be168d 100644 --- a/wadsrc/static/demolition/menudef.txt +++ b/wadsrc/static/demolition/menudef.txt @@ -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"