- Tune mouse input following changes in b57e13ff62.

* Reduce `hidInput->mouseturny` to previous scaling (0.25 of incoming input).
* Change `hidInput->mouseturnx` to be 0.5 of incoming input (33% slower than b57e13ff62, but matches what other ports by providing a 2:1 scale).
* Remove further divisions beyond m_side and m_forward and adjust code in `processMovement()` accordingly.
* Change scaling for `mousevelscale` in `processMovement()` to be 1/160th of keymove. Slightly lower for Duke and a lot faster for Blood where it's needed.
This commit is contained in:
Mitchell Richters 2020-09-29 21:02:36 +10:00
parent b57e13ff62
commit 0bb9904338
2 changed files with 9 additions and 12 deletions

View file

@ -1448,19 +1448,19 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
// set up variables // set up variables
int const running = !!(inputBuffer->actions & SB_RUN); int const running = !!(inputBuffer->actions & SB_RUN);
int const keymove = gi->playerKeyMove() << running; int const keymove = gi->playerKeyMove() << running;
int const mousevelscale = g_gameType & GAMEFLAG_BLOOD ? 32 : 4;
int const cntrlvelscale = g_gameType & GAMEFLAG_PSEXHUMED ? 8 : 1; int const cntrlvelscale = g_gameType & GAMEFLAG_PSEXHUMED ? 8 : 1;
float const mousevelscale = keymove / 160.f;
// process mouse and initial controller input. // process mouse and initial controller input.
if (buttonMap.ButtonDown(gamefunc_Strafe) && allowstrafe) if (buttonMap.ButtonDown(gamefunc_Strafe) && allowstrafe)
currInput->svel -= xs_CRoundToInt((hidInput->mousemovex * mousevelscale) + (scaleAdjust * (hidInput->dyaw / 60) * keymove * cntrlvelscale)); currInput->svel -= xs_CRoundToInt(hidInput->mousemovex * mousevelscale + (scaleAdjust * (hidInput->dyaw / 60) * keymove * cntrlvelscale));
else else
currInput->q16avel += FloatToFixed(hidInput->mouseturnx + (scaleAdjust * hidInput->dyaw)); currInput->q16avel += FloatToFixed(hidInput->mouseturnx + (scaleAdjust * hidInput->dyaw));
if (!(inputBuffer->actions & SB_AIMMODE)) if (!(inputBuffer->actions & SB_AIMMODE))
currInput->q16horz -= FloatToFixed(hidInput->mouseturny); currInput->q16horz -= FloatToFixed(hidInput->mouseturny);
else else
currInput->fvel -= xs_CRoundToInt(hidInput->mousemovey * mousevelscale * 2); currInput->fvel -= xs_CRoundToInt(hidInput->mousemovey * mousevelscale);
if (invertmouse) if (invertmouse)
currInput->q16horz = -currInput->q16horz; currInput->q16horz = -currInput->q16horz;
@ -1496,8 +1496,7 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
// allow Exhumed to use its legacy values given the drastic difference from the other games. // allow Exhumed to use its legacy values given the drastic difference from the other games.
if ((g_gameType & GAMEFLAG_PSEXHUMED) && cl_exhumedoldturn) if ((g_gameType & GAMEFLAG_PSEXHUMED) && cl_exhumedoldturn)
{ {
turnamount = running ? 12 : 8; preambleturn = turnamount = running ? 12 : 8;
preambleturn = turnamount;
} }
if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !allowstrafe)) if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !allowstrafe))

View file

@ -62,14 +62,12 @@ CVAR(Float, m_side, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
void InputState::GetMouseDelta(ControlInfo * hidInput) void InputState::GetMouseDelta(ControlInfo * hidInput)
{ {
vec2f_t finput = g_mousePos; hidInput->mouseturnx = g_mousePos.x * m_yaw * (1.f / 4.f);
hidInput->mouseturny = g_mousePos.y * m_pitch * (1.f / 8.f);
hidInput->mousemovex = g_mousePos.x * m_side;
hidInput->mousemovey = g_mousePos.y * m_forward;
g_mousePos = {}; g_mousePos = {};
hidInput->mouseturnx = finput.x * m_yaw * (1.f / 3.f);
hidInput->mouseturny = finput.y * m_pitch * 0.5f;
hidInput->mousemovex = finput.x * m_side* (1.f / 3.f);
hidInput->mousemovey = finput.y * m_forward * 0.5f;
} }
//========================================================================== //==========================================================================