Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Simon 2023-02-04 22:59:30 +00:00
commit df2d0b2f0b
6 changed files with 13 additions and 20 deletions

View file

@ -210,17 +210,12 @@ void I_ResetFrameTime()
FirstFrameStartTime += (CurrentFrameStartTime - ft);
}
double I_GetInputFrac(bool const synchronised)
double I_GetInputFrac()
{
if (!synchronised)
{
const double now = I_msTimeF();
const double result = (now - lastinputtime) * GameTicRate * (1. / 1000.);
lastinputtime = now;
return result;
}
return 1;
const double now = I_msTimeF();
const double result = (now - lastinputtime) * GameTicRate * (1. / 1000.);
lastinputtime = now;
return result;
}
void I_ResetInputTime()

View file

@ -42,7 +42,7 @@ uint64_t I_nsTime();
void I_ResetFrameTime();
// Return a decimal fraction to scale input operations at framerate
double I_GetInputFrac(bool const synchronised);
double I_GetInputFrac();
// Reset the last input check to after a lengthy operation
void I_ResetInputTime();

View file

@ -73,13 +73,12 @@ static inline DAngle getscaledangle(const DAngle angle, const double scale, cons
static inline bool scaletozero(DAngle& angle, const double scale, const DAngle push = DAngle::fromDeg(32. / 465.))
{
if (auto sgn = angle.Sgn())
auto sgn = angle.Sgn();
if (!sgn || sgn != (angle -= getscaledangle(angle, scale, push * sgn)).Sgn())
{
if (sgn != (angle -= getscaledangle(angle, scale, push * sgn)).Sgn())
{
angle = nullAngle;
return true;
}
angle = nullAngle;
return true;
}
return false;
}

View file

@ -50,7 +50,6 @@ ESyncBits ActionsToSend = 0;
static int dpad_lock = 0;
bool sendPause;
bool crouch_toggle;
double inputScale;
// Mouse speeds
CVAR(Float, m_pitch, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)

View file

@ -105,7 +105,6 @@ void SetupGameButtons();
void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput, bool const crouchable = true, bool const disableToggle = false);
extern ESyncBits ActionsToSend;
extern bool gamesetinput;
extern double inputScale;
inline bool SyncInput()
{

View file

@ -104,6 +104,7 @@ ticcmd_t playercmds[MAXPLAYERS];
static uint64_t stabilityticduration = 0;
static uint64_t stabilitystarttime = 0;
static double inputScale;
bool r_NoInterpolate;
int entertic;
@ -589,7 +590,7 @@ void TryRunTics (void)
oldentertics = entertic;
// update the scale factor for unsynchronised input here.
inputScale = I_GetInputFrac(SyncInput());
inputScale = !SyncInput() ? I_GetInputFrac() : 1.;
// get available tics
NetUpdate ();