mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- handle button-mashing in motoApplyTurn()
.
* If player was turning left and right, only left was returned. Now, both apply (effectively cancelling each other out. * Move application of scale to returning value within `motoApplyTurn()`.
This commit is contained in:
parent
230332338c
commit
e0bc2c6c97
1 changed files with 37 additions and 31 deletions
|
@ -931,8 +931,10 @@ static void processMovement(player_struct *p, input_t &input, ControlInfo &info,
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static int motoApplyTurn(player_struct* p, int turnl, int turnr, int bike_turn, bool goback, double factor)
|
||||
static double motoApplyTurn(player_struct* p, int turnl, int turnr, int bike_turn, bool goback, double factor)
|
||||
{
|
||||
int turnvel = 0;
|
||||
|
||||
if (p->MotoSpeed == 0 || !p->on_ground)
|
||||
{
|
||||
turnheldtime = 0;
|
||||
|
@ -953,38 +955,42 @@ static int motoApplyTurn(player_struct* p, int turnl, int turnr, int bike_turn,
|
|||
else
|
||||
{
|
||||
int tics = getticssincelastupdate();
|
||||
if (turnl || p->moto_drink < 0)
|
||||
if (turnl || turnr || p->moto_drink != 0)
|
||||
{
|
||||
turnheldtime += tics;
|
||||
p->TiltStatus -= (float)factor;
|
||||
if (p->TiltStatus < -10)
|
||||
p->TiltStatus = -10;
|
||||
if (turnheldtime >= TURBOTURNTIME && p->MotoSpeed > 0)
|
||||
if (turnl || p->moto_drink < 0)
|
||||
{
|
||||
if (goback) return bike_turn ? 40 : 20;
|
||||
else return bike_turn ? -40 : -20;
|
||||
turnheldtime += tics;
|
||||
p->TiltStatus -= (float)factor;
|
||||
if (p->TiltStatus < -10)
|
||||
p->TiltStatus = -10;
|
||||
if (turnheldtime >= TURBOTURNTIME && p->MotoSpeed > 0)
|
||||
{
|
||||
if (goback) turnvel += bike_turn ? 40 : 20;
|
||||
else turnvel += bike_turn ? -40 : -20;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (goback) turnvel += bike_turn ? 20 : 6;
|
||||
else turnvel += bike_turn ? -20 : -6;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (turnr || p->moto_drink > 0)
|
||||
{
|
||||
if (goback) return bike_turn ? 20 : 6;
|
||||
else return bike_turn ? -20 : -6;
|
||||
}
|
||||
}
|
||||
else if (turnr || p->moto_drink > 0)
|
||||
{
|
||||
turnheldtime += tics;
|
||||
p->TiltStatus += (float)factor;
|
||||
if (p->TiltStatus > 10)
|
||||
p->TiltStatus = 10;
|
||||
if (turnheldtime >= TURBOTURNTIME && p->MotoSpeed > 0)
|
||||
{
|
||||
if (goback) return bike_turn ? -40 : -20;
|
||||
else return bike_turn ? 40 : 20;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (goback) return bike_turn ? -20 : -6;
|
||||
else return bike_turn ? 20 : 6;
|
||||
turnheldtime += tics;
|
||||
p->TiltStatus += (float)factor;
|
||||
if (p->TiltStatus > 10)
|
||||
p->TiltStatus = 10;
|
||||
if (turnheldtime >= TURBOTURNTIME && p->MotoSpeed > 0)
|
||||
{
|
||||
if (goback) turnvel += bike_turn ? -40 : -20;
|
||||
else turnvel += bike_turn ? 40 : 20;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (goback) turnvel += bike_turn ? -20 : -6;
|
||||
else turnvel += bike_turn ? 20 : 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1002,7 +1008,7 @@ static int motoApplyTurn(player_struct* p, int turnl, int turnr, int bike_turn,
|
|||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return turnvel * factor;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -1121,7 +1127,7 @@ static void processVehicleInput(player_struct *p, ControlInfo& info, input_t& in
|
|||
{
|
||||
bool backward = buttonMap.ButtonDown(gamefunc_Move_Backward) && p->MotoSpeed <= 0;
|
||||
|
||||
turnvel = motoApplyTurn(p, turnl, turnr, turnspeed, backward, scaleAdjust) * scaleAdjust;
|
||||
turnvel = motoApplyTurn(p, turnl, turnr, turnspeed, backward, scaleAdjust);
|
||||
if (p->moto_underwater) p->MotoSpeed = 0;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue