Skip to content

Commit

Permalink
- Call updateTurnHeldAmt() after doing the turn, not before it. Thi…
Browse files Browse the repository at this point in the history
…s gives one tic more preamble.
  • Loading branch information
mjr4077au committed Jul 23, 2022
1 parent e016f65 commit 4324f92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion source/core/gameinput.cpp
Expand Up @@ -215,7 +215,6 @@ void processMovement(InputPacket* const currInput, InputPacket* const inputBuffe

if (turnleft || turnright)
{
updateTurnHeldAmt(scaleAdjust);
double const turnspeed = getTicrateScale(running ? RUNNINGTURNBASE : NORMALTURNBASE) * turnscale * BAngToDegree;
float const turnamount = float(scaleAdjust * turnspeed * (isTurboTurnTime() ? 1. : PREAMBLESCALE));

Expand All @@ -224,6 +223,8 @@ void processMovement(InputPacket* const currInput, InputPacket* const inputBuffe

if (turnright)
currInput->avel += turnamount;

updateTurnHeldAmt(scaleAdjust);
}
else
{
Expand Down
14 changes: 8 additions & 6 deletions source/games/duke/src/input.cpp
Expand Up @@ -589,7 +589,6 @@ static double motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool

if (kbdLeft || p->moto_drink < 0 || hidInput->mouseturnx < 0 || hidInput->dyaw < 0)
{
updateTurnHeldAmt(factor);
p->TiltStatus -= (float)factor;

if (p->TiltStatus < -10)
Expand All @@ -603,11 +602,12 @@ static double motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool

if (hidInput->dyaw < 0)
turnvel += (p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * hidInput->dyaw;

updateTurnHeldAmt(factor);
}

if (kbdRight || p->moto_drink > 0 || hidInput->mouseturnx > 0 || hidInput->dyaw > 0)
{
updateTurnHeldAmt(factor);
p->TiltStatus += (float)factor;

if (p->TiltStatus > 10)
Expand All @@ -621,6 +621,8 @@ static double motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool

if (hidInput->dyaw > 0)
turnvel += (p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * hidInput->dyaw;

updateTurnHeldAmt(factor);
}
}
else
Expand Down Expand Up @@ -660,8 +662,6 @@ static double boatApplyTurn(player_struct *p, ControlInfo* const hidInput, bool

if (kbdLeft || p->moto_drink < 0 || hidInput->mouseturnx < 0 || hidInput->dyaw < 0)
{
updateTurnHeldAmt(factor);

if (!p->NotOnWater)
{
p->TiltStatus -= (float)factor;
Expand All @@ -677,12 +677,12 @@ static double boatApplyTurn(player_struct *p, ControlInfo* const hidInput, bool

if (hidInput->dyaw < 0)
turnvel += baseVel * hidInput->dyaw;

updateTurnHeldAmt(factor);
}

if (kbdRight || p->moto_drink > 0 || hidInput->mouseturnx > 0 || hidInput->dyaw > 0)
{
updateTurnHeldAmt(factor);

if (!p->NotOnWater)
{
p->TiltStatus += (float)factor;
Expand All @@ -698,6 +698,8 @@ static double boatApplyTurn(player_struct *p, ControlInfo* const hidInput, bool

if (hidInput->dyaw > 0)
turnvel += baseVel * hidInput->dyaw;

updateTurnHeldAmt(factor);
}
}
else if (!p->NotOnWater)
Expand Down

0 comments on commit 4324f92

Please sign in to comment.