- Backend update from Raze
Mostly cleanup and better separation of game/backend concerns.
This commit is contained in:
parent
b7f3cc157d
commit
c62e14d2c1
30 changed files with 200 additions and 196 deletions
|
|
@ -198,34 +198,26 @@ void I_ResetFrameTime()
|
|||
FirstFrameStartTime += (CurrentFrameStartTime - ft);
|
||||
}
|
||||
|
||||
double I_GetInputFrac(bool const synchronised, double const ticrate)
|
||||
double I_GetInputFrac(bool const synchronised)
|
||||
{
|
||||
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) * GameTicRate * (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;
|
||||
return result * (1. + 0.35 * (1. - GameTicRate * (1. / 50.)) * (1. - result));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void I_ResetInputTime()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue