Skip to content

Commit

Permalink
- Duke: Clamp RRRA vehicle input in processVehicleInput().
Browse files Browse the repository at this point in the history
  • Loading branch information
mjr4077au committed Apr 15, 2021
1 parent aeb16e3 commit e79c6ba
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions source/games/duke/src/input.cpp
Expand Up @@ -755,7 +755,7 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I
input.avel = boatApplyTurn(p, hidInput, kbdLeft, kbdRight, scaleAdjust);
}

input.fvel = xs_CRoundToInt(p->MotoSpeed);
input.fvel = clamp(xs_CRoundToInt(p->MotoSpeed), -(MAXVELMOTO >> 3), MAXVELMOTO);
input.avel *= BAngToDegree;
loc.avel += input.avel;
}
Expand All @@ -766,7 +766,7 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I
//
//---------------------------------------------------------------------------

static void FinalizeInput(player_struct *p, InputPacket& input, bool vehicle)
static void FinalizeInput(player_struct *p, InputPacket& input)
{
if (movementBlocked(p) || p->GetActor()->s.extra <= 0 || (p->dead_flag && !ud.god && !p->resurrected))
{
Expand All @@ -777,14 +777,7 @@ static void FinalizeInput(player_struct *p, InputPacket& input, bool vehicle)
}
else
{
if (p->on_crane == nullptr)
{
if (vehicle)
{
loc.fvel = clamp(input.fvel, -(MAXVELMOTO >> 3), MAXVELMOTO);
}
}
else
if (p->on_crane != nullptr)
{
loc.fvel = input.fvel = 0;
loc.svel = input.svel = 0;
Expand Down Expand Up @@ -833,7 +826,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
processMovement(&input, &loc, hidInput, scaleAdjust, p->drink_amt);
}

FinalizeInput(p, input, rrraVehicle);
FinalizeInput(p, input);

if (!SyncInput())
{
Expand Down

0 comments on commit e79c6ba

Please sign in to comment.