proper init enterprecise

This commit is contained in:
Alug committed 2025-06-01 01:35:14 +02:00
1 parent 00d55ba058
commit cbfbbccd6d
2 files changed
+11 -9

No files matched your search

+1 -1
View File
@@ -986,7 +986,7 @@ void D_SRB2Loop(void)
if ((elapsed > 0) && ((INT64)capbudget > elapsed) && !vsync_with_match_refresh)
{
I_SleepDuration(capbudget - (finishprecise - enterprecise));
I_SleepDuration(capbudget - elapsed);
}
}
// Capture the time once more to get the real delta time.
+10 -8
View File
@@ -37,18 +37,20 @@ tic_t I_GetTime(void)
void I_InitializeTime(void)
{
g_time.time = 0;
g_time.timefrac = 0;
enterprecise = 0;
oldenterprecise = 0;
tictimer = 0.0;
CV_RegisterVar(&cv_timescale);
// I_StartupTimer is preserved for potential subsystems that need to setup
// timing information for I_GetPreciseTime and sleeping
I_StartupTimer();
g_time.time = 0;
g_time.timefrac = 0;
enterprecise = I_GetPreciseTime();
oldenterprecise = enterprecise;
entertic = 0;
oldentertics = 0;
tictimer = 0.0;
}
void I_UpdateTime(fixed_t timescale)
@@ -61,7 +63,7 @@ void I_UpdateTime(fixed_t timescale)
ticratescaled = (double)TICRATE * FixedToFloat(timescale);
enterprecise = I_GetPreciseTime();
elapsedseconds = (double)((INT64)enterprecise - oldenterprecise) / I_GetPrecisePrecision();
elapsedseconds = (double)(enterprecise - oldenterprecise) / I_GetPrecisePrecision();
tictimer += elapsedseconds;
while (tictimer > 1.0/ticratescaled)
{