try and fix some fudge timing stuff
This commit is contained in:
1 parent
fa64d48099
commit
81aba34c6b
4 files changed
+13
-9
No files matched your search
+2
-2
@@ -6195,8 +6195,8 @@ boolean TryRunTics(tic_t realtics)
|
||||
}
|
||||
|
||||
// Get packets from the server
|
||||
double frame = ((double)I_GetPreciseTime() / I_GetPrecisePrecision());
|
||||
netUpdateFudge = (((double)I_GetPreciseTime() / I_GetPrecisePrecision()) - frame); // record the timefudge where the net update typically occurs
|
||||
double frame = ((double)I_GetPreciseTime() / tic_frequency);
|
||||
netUpdateFudge = (((double)I_GetPreciseTime() / tic_frequency) - frame); // record the timefudge where the net update typically occurs
|
||||
|
||||
NetUpdate();
|
||||
|
||||
|
||||
+6
-6
@@ -577,7 +577,7 @@ static CV_PossibleValue_t netdelay_cons_t[] = { {0, "MIN"}, {250, "MAX"}, {0, NU
|
||||
consvar_t cv_netdelay = { "netdelay", "0", 0, netdelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t netjitter_cons_t[] = { {0, "MIN"}, {5, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_netjitter = { "netjitter", "0", 0, netdelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
consvar_t cv_netjitter = { "netjitter", "0", 0, netjitter_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
consvar_t cv_netsmoothing = { "netsmoothing", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
@@ -858,7 +858,7 @@ extern double netUpdateFudge;
|
||||
void Command_Autotimefudge(void)
|
||||
{
|
||||
// you can use SDL_GetPerformanceFrequency() instead of tic_frequency to get more precise timings
|
||||
double startTime = ((double)I_GetPreciseTime() / I_GetPrecisePrecision());
|
||||
double startTime = ((double)I_GetPreciseTime() / tic_frequency);
|
||||
double packetTimeFudge[64];
|
||||
int numReceivedPackets = 0;
|
||||
const double numSampleTics = 10;
|
||||
@@ -871,16 +871,16 @@ void Command_Autotimefudge(void)
|
||||
return;
|
||||
}
|
||||
|
||||
lastTimeReceivedPacket = (double)SDL_GetPerformanceCounter() / I_GetPrecisePrecision();
|
||||
while ((abs((double)SDL_GetPerformanceCounter() / I_GetPrecisePrecision() - startTime) < numSampleTics) || numReceivedPackets < 10)
|
||||
lastTimeReceivedPacket = (double)SDL_GetPerformanceCounter() / tic_frequency;
|
||||
while ((abs((double)SDL_GetPerformanceCounter() / tic_frequency - startTime) < numSampleTics) || numReceivedPackets < 10)
|
||||
{
|
||||
I_NetGet();
|
||||
if ((doomcom->remotenode != -1)) // Packet received
|
||||
{
|
||||
packetTimeFudge[numReceivedPackets] = 100 * abs(((double)I_GetPreciseTime() / I_GetPrecisePrecision() - lastTimeReceivedPacket) - netUpdateFudge); // gets the time fudge offset (0-100)
|
||||
packetTimeFudge[numReceivedPackets] = 100 * abs(((double)I_GetPreciseTime() / tic_frequency - lastTimeReceivedPacket) - netUpdateFudge); // gets the time fudge offset (0-100)
|
||||
CONS_Printf("%i: %d\n", numReceivedPackets, packetTimeFudge[numReceivedPackets]);
|
||||
numReceivedPackets++;
|
||||
lastTimeReceivedPacket = (double)I_GetPreciseTime() / I_GetPrecisePrecision();
|
||||
lastTimeReceivedPacket = (double)I_GetPreciseTime() / tic_frequency;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
#define MAX_QUIT_FUNCS 16
|
||||
|
||||
extern double tic_frequency;
|
||||
|
||||
/** \brief Graphic system had started up
|
||||
*/
|
||||
|
||||
+4
-1
@@ -3180,6 +3180,7 @@ static int lastTimeFudge = -1;
|
||||
extern consvar_t cv_timefudge;
|
||||
|
||||
static Uint64 timer_frequency;
|
||||
double tic_frequency;
|
||||
|
||||
precise_t I_GetPreciseTime(void)
|
||||
{
|
||||
@@ -3197,7 +3198,7 @@ void I_SetTime(tic_t tic, int fudge, boolean useAbsoluteFudge)
|
||||
{
|
||||
tic = max(tic, SDL_GetTicks());
|
||||
if (useAbsoluteFudge)
|
||||
elapsed = elapsed + (fudge / 100) * SDL_GetPerformanceFrequency();
|
||||
elapsed = elapsed + (fudge / 100) * tic_frequency;
|
||||
}
|
||||
|
||||
|
||||
@@ -3258,6 +3259,8 @@ void I_StartupTimer(void)
|
||||
|
||||
I_InitFrameTime(0, R_GetFramerateCap());
|
||||
elapsed_frames = 0.0;
|
||||
|
||||
tic_frequency = timer_frequency / (double)NEWTICRATE;
|
||||
}
|
||||
|
||||
void I_Sleep(UINT32 ms)
|
||||
|
||||
Reference in new issue
Block a user