From 571583ca9cee8fb3845322d11617f35c5060a62e Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 1 Jan 2021 21:21:26 +1100 Subject: [PATCH] - Duke: Store velocity scale in `motoApplyTurn()` as a variable like `boatApplyTurn()`. --- source/games/duke/src/input.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index bbec33627..24544287f 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -592,6 +592,7 @@ static double motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool { if (kbdLeft || kbdRight || p->moto_drink || hidInput->mouseturnx || hidInput->dyaw) { + double const velScale = 3. / 10; auto const baseVel = (buttonMap.ButtonDown(gamefunc_Move_Backward) || hidInput->dz < 0) && p->MotoSpeed <= 0 ? -VEHICLETURN : VEHICLETURN; int tics = getticssincelastupdate(); @@ -604,13 +605,13 @@ static double motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool p->TiltStatus = -10; if (kbdLeft) - turnvel -= turnheldtime >= TURBOTURNTIME && p->MotoSpeed > 0 ? baseVel : baseVel * (3. / 10.); + turnvel -= turnheldtime >= TURBOTURNTIME && p->MotoSpeed > 0 ? baseVel : baseVel * velScale; if (hidInput->mouseturnx < 0) - turnvel -= sqrt((p->MotoSpeed > 0 ? baseVel : baseVel * (3. / 10.)) * -(hidInput->mouseturnx / factor) * 2.); + turnvel -= sqrt((p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * -(hidInput->mouseturnx / factor) * 2.); if (hidInput->dyaw < 0) - turnvel += (p->MotoSpeed > 0 ? baseVel : baseVel * (3. / 10.)) * hidInput->dyaw; + turnvel += (p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * hidInput->dyaw; } if (kbdRight || p->moto_drink > 0 || hidInput->mouseturnx > 0 || hidInput->dyaw > 0) @@ -622,13 +623,13 @@ static double motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool p->TiltStatus = 10; if (kbdRight) - turnvel += turnheldtime >= TURBOTURNTIME && p->MotoSpeed > 0 ? baseVel : baseVel * (3. / 10.); + turnvel += turnheldtime >= TURBOTURNTIME && p->MotoSpeed > 0 ? baseVel : baseVel * velScale; if (hidInput->mouseturnx > 0) - turnvel += sqrt((p->MotoSpeed > 0 ? baseVel : baseVel * (3. / 10.)) * (hidInput->mouseturnx / factor) * 2.); + turnvel += sqrt((p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * (hidInput->mouseturnx / factor) * 2.); if (hidInput->dyaw > 0) - turnvel += (p->MotoSpeed > 0 ? baseVel : baseVel * (3. / 10.)) * hidInput->dyaw; + turnvel += (p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * hidInput->dyaw; } } else