mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- Move Duke's input scaling for unsynchronised input to backend as InputScale()
.
This commit is contained in:
parent
722537a1f0
commit
290e615807
3 changed files with 20 additions and 10 deletions
|
@ -47,6 +47,8 @@ ESyncBits ActionsToSend = 0;
|
||||||
static int dpad_lock = 0;
|
static int dpad_lock = 0;
|
||||||
bool sendPause;
|
bool sendPause;
|
||||||
|
|
||||||
|
static double lastCheck;
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -402,3 +404,18 @@ void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double InputScale()
|
||||||
|
{
|
||||||
|
if (!cl_syncinput)
|
||||||
|
{
|
||||||
|
double now = I_msTimeF();
|
||||||
|
double elapsedInputTicks = lastCheck > 0 ? min(now - lastCheck, 1000.0 / GameTicRate) : 1;
|
||||||
|
lastCheck = now;
|
||||||
|
return elapsedInputTicks * GameTicRate / 1000.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,4 +97,5 @@ enum GameFunction_t
|
||||||
|
|
||||||
void SetupGameButtons();
|
void SetupGameButtons();
|
||||||
void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput);
|
void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput);
|
||||||
extern ESyncBits ActionsToSend;
|
extern ESyncBits ActionsToSend;
|
||||||
|
double InputScale();
|
||||||
|
|
|
@ -1001,16 +1001,8 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
|
||||||
|
|
||||||
static void GetInputInternal(InputPacket &locInput, ControlInfo* const hidInput)
|
static void GetInputInternal(InputPacket &locInput, ControlInfo* const hidInput)
|
||||||
{
|
{
|
||||||
double elapsedInputTicks;
|
|
||||||
auto const p = &ps[myconnectindex];
|
auto const p = &ps[myconnectindex];
|
||||||
|
|
||||||
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.
|
|
||||||
// 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, 1000.0 / REALGAMETICSPERSEC);
|
|
||||||
else elapsedInputTicks = 1;
|
|
||||||
lastCheck = now;
|
|
||||||
|
|
||||||
if (paused)
|
if (paused)
|
||||||
{
|
{
|
||||||
loc = {};
|
loc = {};
|
||||||
|
@ -1022,7 +1014,7 @@ static void GetInputInternal(InputPacket &locInput, ControlInfo* const hidInput)
|
||||||
setlocalplayerinput(p);
|
setlocalplayerinput(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
double scaleAdjust = !cl_syncinput ? elapsedInputTicks * REALGAMETICSPERSEC / 1000.0 : 1;
|
double const scaleAdjust = InputScale();
|
||||||
InputPacket input{};
|
InputPacket input{};
|
||||||
|
|
||||||
if (isRRRA() && (p->OnMotorcycle || p->OnBoat))
|
if (isRRRA() && (p->OnMotorcycle || p->OnBoat))
|
||||||
|
|
Loading…
Reference in a new issue