- Clamp applied mouse input to be within safe ranges to interpolate with.

* Input greater than 180 degrees in a single tic can cause the input to be applied backwards.
This commit is contained in:
Mitchell Richters 2022-11-07 19:38:22 +11:00
parent ff7e0afa6f
commit 817a0cb94a

View file

@ -160,10 +160,10 @@ void processMovement(InputPacket* const currInput, InputPacket* const inputBuffe
currInput->svel += drink_amt & 1 ? -currInput->fvel : currInput->fvel;
// add collected input to game's local input accumulation packet.
inputBuffer->fvel = clamp<float>(inputBuffer->fvel + currInput->fvel, -(float)keymove, (float)keymove);
inputBuffer->svel = clamp<float>(inputBuffer->svel + currInput->svel, -(float)keymove, (float)keymove);
inputBuffer->avel += currInput->avel;
inputBuffer->horz += currInput->horz;
inputBuffer->fvel = clamp(inputBuffer->fvel + currInput->fvel, -(float)keymove, (float)keymove);
inputBuffer->svel = clamp(inputBuffer->svel + currInput->svel, -(float)keymove, (float)keymove);
inputBuffer->avel = clamp(inputBuffer->avel + currInput->avel, -179.f, 179.f);
inputBuffer->horz = clamp(inputBuffer->horz + currInput->horz, -179.f, 179.f);
}