- Duke: Tidy up some unnecessarily deep branches in vehicle input code.

This commit is contained in:
Mitchell Richters 2023-03-18 12:14:20 +11:00
parent 51a20211f3
commit 401236980c

View file

@ -570,9 +570,7 @@ static float motoApplyTurn(player_struct* p, HIDInput* const hidInput, bool cons
p->TiltStatus = 10;
}
}
else
{
if (p->vehTurnLeft || p->vehTurnRight || p->moto_drink)
else if (p->vehTurnLeft || p->vehTurnRight || p->moto_drink)
{
constexpr float velScale = (3.f / 10.f);
const float baseVel = (buttonMap.ButtonDown(gamefunc_Move_Backward) || hidInput->joyaxes[JOYAXIS_Forward] < 0) && p->MotoSpeed <= 0 ? -VEHICLETURN : VEHICLETURN;
@ -624,7 +622,6 @@ static float motoApplyTurn(player_struct* p, HIDInput* const hidInput, bool cons
else if (p->TiltStatus < 0)
p->TiltStatus += (float)factor;
}
}
if (fabs(p->TiltStatus) < factor)
p->TiltStatus = 0;
@ -643,9 +640,7 @@ static float boatApplyTurn(player_struct *p, HIDInput* const hidInput, bool cons
float turnvel = 0;
p->oTiltStatus = p->TiltStatus;
if (p->MotoSpeed)
{
if (p->vehTurnLeft || p->vehTurnRight || p->moto_drink)
if (p->MotoSpeed && (p->vehTurnLeft || p->vehTurnRight || p->moto_drink))
{
const float velScale = !p->NotOnWater? 1.f : (6.f / 19.f);
const float baseVel = VEHICLETURN * velScale;
@ -701,16 +696,6 @@ static float boatApplyTurn(player_struct *p, HIDInput* const hidInput, bool cons
else if (p->TiltStatus < 0)
p->TiltStatus += (float)factor;
}
}
else if (!p->NotOnWater)
{
resetTurnHeldAmt();
if (p->TiltStatus > 0)
p->TiltStatus -= (float)factor;
else if (p->TiltStatus < 0)
p->TiltStatus += (float)factor;
}
if (fabs(p->TiltStatus) < factor)
p->TiltStatus = 0;