diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 52598fcc6..227e03b28 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -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