- 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
1 changed files with 13 additions and 0 deletions

View File

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