mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-20 10:32:27 +00:00
- Slight cleanup to I_GetInputFrac()
.
This commit is contained in:
parent
7282e0d8bf
commit
3d8bc3294f
1 changed files with 4 additions and 12 deletions
|
@ -202,30 +202,22 @@ double I_GetInputFrac(bool const synchronised, double const ticrate)
|
|||
{
|
||||
if (!synchronised)
|
||||
{
|
||||
const double max = 1000. / ticrate;
|
||||
const double now = I_msTimeF();
|
||||
const double elapsedInputTicks = std::min(now - lastinputtime, max);
|
||||
const double result = (now - lastinputtime) * ticrate * (1. / 1000.);
|
||||
lastinputtime = now;
|
||||
|
||||
if (elapsedInputTicks < max)
|
||||
if (result < 1)
|
||||
{
|
||||
// Calculate an amplification to apply to the result before returning,
|
||||
// factoring in the game's ticrate and the value of the result.
|
||||
// This rectifies a deviation of 100+ ms or more depending on the length
|
||||
// of the operation to be within 1-2 ms of synchronised input
|
||||
// from 60 fps to at least 1000 fps at ticrates of 30 and 40 Hz.
|
||||
const double result = elapsedInputTicks * ticrate * (1. / 1000.);
|
||||
return result * (1. + 0.35 * (1. - ticrate * (1. / 50.)) * (1. - result));
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void I_ResetInputTime()
|
||||
|
|
Loading…
Reference in a new issue