From 3d8bc3294f63685ad19044a2fc896d593bfd4101 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 30 May 2022 20:46:01 +1000 Subject: [PATCH] - Slight cleanup to `I_GetInputFrac()`. --- source/common/utility/i_time.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/source/common/utility/i_time.cpp b/source/common/utility/i_time.cpp index 22516ed45..d0cbaf8f1 100644 --- a/source/common/utility/i_time.cpp +++ b/source/common/utility/i_time.cpp @@ -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()