mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- Fix joystick scaling following shift to fixedhoriz and binangle.
* Remove joystick scaling from `CONTROL_GetInput()`. * Store turnspeed as constant at top of `processMovement()` and use it for joystick yaw/pitch scaling. This adds the advantage of having the out-of-box turning speed match the keyboard's turn speed and also attenuates when the player is not running.
This commit is contained in:
parent
f35bec4a5d
commit
44e4c5ff78
2 changed files with 14 additions and 12 deletions
|
@ -1449,12 +1449,14 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
|
|||
int const keymove = gi->playerKeyMove() << running;
|
||||
int const cntrlvelscale = g_gameType & GAMEFLAG_PSEXHUMED ? 8 : 1;
|
||||
float const mousevelscale = keymove / 160.f;
|
||||
double const angtodegscale = 45. / 256.;
|
||||
double const hidspeed = ((running ? 43375. / 27. : 867.5) / GameTicRate) * angtodegscale;
|
||||
|
||||
// process mouse and initial controller input.
|
||||
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
|
||||
currInput->avel += hidInput->mouseturnx + (scaleAdjust * hidInput->dyaw);
|
||||
currInput->avel += hidInput->mouseturnx + (scaleAdjust * hidInput->dyaw * hidspeed * turnscale);
|
||||
|
||||
if (!(inputBuffer->actions & SB_AIMMODE))
|
||||
currInput->horz -= hidInput->mouseturny;
|
||||
|
@ -1468,7 +1470,7 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
|
|||
currInput->avel = -currInput->avel;
|
||||
|
||||
// process remaining controller input.
|
||||
currInput->horz -= scaleAdjust * hidInput->dpitch;
|
||||
currInput->horz -= scaleAdjust * hidInput->dpitch * hidspeed;
|
||||
currInput->svel -= xs_CRoundToInt(scaleAdjust * hidInput->dx * keymove * cntrlvelscale);
|
||||
currInput->fvel -= xs_CRoundToInt(scaleAdjust * hidInput->dz * keymove * cntrlvelscale);
|
||||
|
||||
|
@ -1489,24 +1491,24 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
|
|||
static double turnheldtime;
|
||||
int const turnheldamt = 120 / GameTicRate;
|
||||
double const turboturntime = 590. / GameTicRate;
|
||||
double turnamount = ((running ? 43375. / 27. : 867.5) / GameTicRate) * turnscale;
|
||||
double preambleturn = turnamount / (347. / 92.);
|
||||
double turnamount = hidspeed * turnscale;
|
||||
double preambleturn = turnamount * (92. / 347.);
|
||||
|
||||
// allow Exhumed to use its legacy values given the drastic difference from the other games.
|
||||
if ((g_gameType & GAMEFLAG_PSEXHUMED) && cl_exhumedoldturn)
|
||||
{
|
||||
preambleturn = turnamount = running ? 12 : 8;
|
||||
preambleturn = turnamount = (running ? 12 : 8) * angtodegscale;
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !allowstrafe))
|
||||
{
|
||||
turnheldtime += scaleAdjust * turnheldamt;
|
||||
currInput->avel -= scaleAdjust * (turnheldtime >= turboturntime ? turnamount : preambleturn) * (45. / 256.);
|
||||
currInput->avel -= scaleAdjust * (turnheldtime >= turboturntime ? turnamount : preambleturn);
|
||||
}
|
||||
else if (buttonMap.ButtonDown(gamefunc_Turn_Right) || (buttonMap.ButtonDown(gamefunc_Strafe_Right) && !allowstrafe))
|
||||
{
|
||||
turnheldtime += scaleAdjust * turnheldamt;
|
||||
currInput->avel += scaleAdjust * (turnheldtime >= turboturntime ? turnamount : preambleturn) * (45. / 256.);
|
||||
currInput->avel += scaleAdjust * (turnheldtime >= turboturntime ? turnamount : preambleturn);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -181,10 +181,10 @@ ControlInfo CONTROL_GetInput()
|
|||
|
||||
I_GetAxes(joyaxes);
|
||||
|
||||
hidInput.dyaw += -joyaxes[JOYAXIS_Yaw] * (1350.f / GameTicRate);
|
||||
hidInput.dx += -joyaxes[JOYAXIS_Side] * 0.75f;
|
||||
hidInput.dz += -joyaxes[JOYAXIS_Forward] * 0.75f;
|
||||
hidInput.dpitch += -joyaxes[JOYAXIS_Pitch] * (675.f / GameTicRate);
|
||||
hidInput.dyaw += -joyaxes[JOYAXIS_Yaw];
|
||||
hidInput.dx += -joyaxes[JOYAXIS_Side] * .5f;
|
||||
hidInput.dz += -joyaxes[JOYAXIS_Forward] * .5f;
|
||||
hidInput.dpitch += -joyaxes[JOYAXIS_Pitch];
|
||||
}
|
||||
|
||||
return hidInput;
|
||||
|
|
Loading…
Reference in a new issue