mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +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 keymove = gi->playerKeyMove() << running;
|
||||||
int const cntrlvelscale = g_gameType & GAMEFLAG_PSEXHUMED ? 8 : 1;
|
int const cntrlvelscale = g_gameType & GAMEFLAG_PSEXHUMED ? 8 : 1;
|
||||||
float const mousevelscale = keymove / 160.f;
|
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.
|
// 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->avel += hidInput->mouseturnx + (scaleAdjust * hidInput->dyaw);
|
currInput->avel += hidInput->mouseturnx + (scaleAdjust * hidInput->dyaw * hidspeed * turnscale);
|
||||||
|
|
||||||
if (!(inputBuffer->actions & SB_AIMMODE))
|
if (!(inputBuffer->actions & SB_AIMMODE))
|
||||||
currInput->horz -= hidInput->mouseturny;
|
currInput->horz -= hidInput->mouseturny;
|
||||||
|
@ -1468,7 +1470,7 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
|
||||||
currInput->avel = -currInput->avel;
|
currInput->avel = -currInput->avel;
|
||||||
|
|
||||||
// process remaining controller input.
|
// 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->svel -= xs_CRoundToInt(scaleAdjust * hidInput->dx * keymove * cntrlvelscale);
|
||||||
currInput->fvel -= xs_CRoundToInt(scaleAdjust * hidInput->dz * 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;
|
static double turnheldtime;
|
||||||
int const turnheldamt = 120 / GameTicRate;
|
int const turnheldamt = 120 / GameTicRate;
|
||||||
double const turboturntime = 590. / GameTicRate;
|
double const turboturntime = 590. / GameTicRate;
|
||||||
double turnamount = ((running ? 43375. / 27. : 867.5) / GameTicRate) * turnscale;
|
double turnamount = hidspeed * turnscale;
|
||||||
double preambleturn = turnamount / (347. / 92.);
|
double preambleturn = turnamount * (92. / 347.);
|
||||||
|
|
||||||
// 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)
|
||||||
{
|
{
|
||||||
preambleturn = turnamount = running ? 12 : 8;
|
preambleturn = turnamount = (running ? 12 : 8) * angtodegscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !allowstrafe))
|
if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !allowstrafe))
|
||||||
{
|
{
|
||||||
turnheldtime += scaleAdjust * turnheldamt;
|
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))
|
else if (buttonMap.ButtonDown(gamefunc_Turn_Right) || (buttonMap.ButtonDown(gamefunc_Strafe_Right) && !allowstrafe))
|
||||||
{
|
{
|
||||||
turnheldtime += scaleAdjust * turnheldamt;
|
turnheldtime += scaleAdjust * turnheldamt;
|
||||||
currInput->avel += scaleAdjust * (turnheldtime >= turboturntime ? turnamount : preambleturn) * (45. / 256.);
|
currInput->avel += scaleAdjust * (turnheldtime >= turboturntime ? turnamount : preambleturn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -181,10 +181,10 @@ ControlInfo CONTROL_GetInput()
|
||||||
|
|
||||||
I_GetAxes(joyaxes);
|
I_GetAxes(joyaxes);
|
||||||
|
|
||||||
hidInput.dyaw += -joyaxes[JOYAXIS_Yaw] * (1350.f / GameTicRate);
|
hidInput.dyaw += -joyaxes[JOYAXIS_Yaw];
|
||||||
hidInput.dx += -joyaxes[JOYAXIS_Side] * 0.75f;
|
hidInput.dx += -joyaxes[JOYAXIS_Side] * .5f;
|
||||||
hidInput.dz += -joyaxes[JOYAXIS_Forward] * 0.75f;
|
hidInput.dz += -joyaxes[JOYAXIS_Forward] * .5f;
|
||||||
hidInput.dpitch += -joyaxes[JOYAXIS_Pitch] * (675.f / GameTicRate);
|
hidInput.dpitch += -joyaxes[JOYAXIS_Pitch];
|
||||||
}
|
}
|
||||||
|
|
||||||
return hidInput;
|
return hidInput;
|
||||||
|
|
Loading…
Reference in a new issue