- use REALGAMETICSPERSEC as maximum value for elapsedInputTicks in GetInput().

Hard-coded value of `10.0` was too low and was always being used instead of the value of `(now - lastCheck)`. This made `scaleAdjust` inaccurate and not fast enough.
This commit is contained in:
Mitchell Richters 2020-07-23 19:16:51 +10:00
parent 54d73ce9f8
commit eadb31f9cd

View file

@ -1231,7 +1231,7 @@ void GetInput()
auto now = I_msTimeF(); auto now = I_msTimeF();
// do not let this become too large - it would create overflows resulting in undefined behavior. The very first tic must not use the timer difference at all because the timer has not been set yet. // do not let this become too large - it would create overflows resulting in undefined behavior. The very first tic must not use the timer difference at all because the timer has not been set yet.
// This really needs to have the timer fixed to be robust, doing it ad-hoc here is not really safe. // This really needs to have the timer fixed to be robust, doing it ad-hoc here is not really safe.
if (lastCheck > 0) elapsedInputTicks = min(now - lastCheck, 10.); if (lastCheck > 0) elapsedInputTicks = min(now - lastCheck, (double)(REALGAMETICSPERSEC));
else elapsedInputTicks = 1; else elapsedInputTicks = 1;
lastCheck = now; lastCheck = now;