- harden FinalizeInput() with else blocks on each if statement after checking whether all movement is blocked.

Fixes #105.
This commit is contained in:
Mitchell Richters 2020-08-06 07:25:04 +10:00
parent 3e8ff96e6b
commit bbe05b0c81

View file

@ -1183,6 +1183,11 @@ static void FinalizeInput(int playerNum, input_t& input, bool vehicle)
else
loc.fvel = clamp(input.fvel, -(MAXVELMOTO / 8), MAXVELMOTO);
}
else
{
loc.fvel = input.fvel = 0;
loc.svel = input.svel = 0;
}
if (p->on_crane < 0 && p->newowner == -1)
{
@ -1192,11 +1197,19 @@ static void FinalizeInput(int playerNum, input_t& input, bool vehicle)
p->one_eighty_count = 0;
}
}
else
{
loc.q16avel = input.q16avel = 0;
}
if (p->newowner == -1 && p->return_to_center <= 0)
{
loc.q16horz = fix16_clamp(loc.q16horz + input.q16horz, F16(-MAXHORIZVEL), F16(MAXHORIZVEL));
}
else
{
loc.q16horz = input.q16horz = 0;
}
}
}