mirror of
https://github.com/ZDoom/Raze.git
synced 2025-04-25 01:01:02 +00:00
- Duke/RR: Shorten a long ternary.
This commit is contained in:
parent
81650036e6
commit
a9e606ca68
1 changed files with 4 additions and 4 deletions
|
@ -530,9 +530,9 @@ static float getVehicleTurnVel(player_struct* p, HIDInput* const hidInput, const
|
||||||
// Yes, we need all these bools...
|
// Yes, we need all these bools...
|
||||||
const bool kbdLeft = buttonMap.ButtonDown(gamefunc_Turn_Left) || buttonMap.ButtonDown(gamefunc_Strafe_Left);
|
const bool kbdLeft = buttonMap.ButtonDown(gamefunc_Turn_Left) || buttonMap.ButtonDown(gamefunc_Strafe_Left);
|
||||||
const bool kbdRight = buttonMap.ButtonDown(gamefunc_Turn_Right) || buttonMap.ButtonDown(gamefunc_Strafe_Right);
|
const bool kbdRight = buttonMap.ButtonDown(gamefunc_Turn_Right) || buttonMap.ButtonDown(gamefunc_Strafe_Right);
|
||||||
const bool turnLeft = kbdLeft || hidInput->mouseturnx < 0 || hidInput->joyaxes[JOYAXIS_Yaw] > 0;
|
const bool hidLeft = hidInput->mouseturnx < 0 || hidInput->joyaxes[JOYAXIS_Yaw] > 0;
|
||||||
const bool turnRight = kbdRight || hidInput->mouseturnx > 0 || hidInput->joyaxes[JOYAXIS_Yaw] < 0;
|
const bool hidRight = hidInput->mouseturnx > 0 || hidInput->joyaxes[JOYAXIS_Yaw] < 0;
|
||||||
const int turndir = turnRight - turnLeft;
|
const int turndir = (kbdRight || hidRight) - (kbdLeft || hidLeft);
|
||||||
|
|
||||||
if (p->OnMotorcycle && (p->MotoSpeed == 0 || !p->on_ground))
|
if (p->OnMotorcycle && (p->MotoSpeed == 0 || !p->on_ground))
|
||||||
{
|
{
|
||||||
|
@ -544,7 +544,7 @@ static float getVehicleTurnVel(player_struct* p, HIDInput* const hidInput, const
|
||||||
if (p->OnMotorcycle || !p->NotOnWater)
|
if (p->OnMotorcycle || !p->NotOnWater)
|
||||||
doVehicleTilting(p, turndir, factor);
|
doVehicleTilting(p, turndir, factor);
|
||||||
|
|
||||||
const bool noattenuate = (isTurboTurnTime() || hidInput->mouseturnx || hidInput->joyaxes[JOYAXIS_Yaw]) && (!p->OnMotorcycle || p->MotoSpeed > 0);
|
const bool noattenuate = (isTurboTurnTime() || hidLeft || hidRight) && (!p->OnMotorcycle || p->MotoSpeed > 0);
|
||||||
const auto vel = (noattenuate) ? (baseVel) : (baseVel * velScale);
|
const auto vel = (noattenuate) ? (baseVel) : (baseVel * velScale);
|
||||||
|
|
||||||
turnvel = vel * hidInput->joyaxes[JOYAXIS_Yaw];
|
turnvel = vel * hidInput->joyaxes[JOYAXIS_Yaw];
|
||||||
|
|
Loading…
Reference in a new issue