mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-23 03:52:12 -04:00
Merge branch 'master' of github.com:fabiangreffrath/woof
This commit is contained in:
commit
323674e18d
@ -34,6 +34,7 @@ HANDLE hTimer = NULL;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint64_t basecounter = 0;
|
static uint64_t basecounter = 0;
|
||||||
|
static uint64_t basecounter_scaled = 0;
|
||||||
static uint64_t basefreq = 0;
|
static uint64_t basefreq = 0;
|
||||||
|
|
||||||
static int MSToTic(uint32_t time)
|
static int MSToTic(uint32_t time)
|
||||||
@ -78,12 +79,12 @@ static uint64_t GetPerfCounter_Scaled(void)
|
|||||||
|
|
||||||
counter = SDL_GetPerformanceCounter() * time_scale / 100;
|
counter = SDL_GetPerformanceCounter() * time_scale / 100;
|
||||||
|
|
||||||
if (basecounter == 0)
|
if (basecounter_scaled == 0)
|
||||||
{
|
{
|
||||||
basecounter = counter;
|
basecounter_scaled = counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
return counter - basecounter;
|
return counter - basecounter_scaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t GetTimeMS_Scaled(void)
|
static uint32_t GetTimeMS_Scaled(void)
|
||||||
@ -92,12 +93,12 @@ static uint32_t GetTimeMS_Scaled(void)
|
|||||||
|
|
||||||
counter = SDL_GetPerformanceCounter() * time_scale / 100;
|
counter = SDL_GetPerformanceCounter() * time_scale / 100;
|
||||||
|
|
||||||
if (basecounter == 0)
|
if (basecounter_scaled == 0)
|
||||||
{
|
{
|
||||||
basecounter = counter;
|
basecounter_scaled = counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((counter - basecounter) * 1000ull) / basefreq;
|
return ((counter - basecounter_scaled) * 1000ull) / basefreq;
|
||||||
}
|
}
|
||||||
|
|
||||||
int I_GetTime_RealTime(void)
|
int I_GetTime_RealTime(void)
|
||||||
@ -170,7 +171,7 @@ void I_SetTimeScale(int scale)
|
|||||||
|
|
||||||
time_scale = scale;
|
time_scale = scale;
|
||||||
|
|
||||||
basecounter += (GetPerfCounter_Scaled() - counter);
|
basecounter_scaled += (GetPerfCounter_Scaled() - counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_SetFastdemoTimer(boolean on)
|
void I_SetFastdemoTimer(boolean on)
|
||||||
@ -188,7 +189,7 @@ void I_SetFastdemoTimer(boolean on)
|
|||||||
|
|
||||||
counter = TicToCounter(I_GetTime_FastDemo());
|
counter = TicToCounter(I_GetTime_FastDemo());
|
||||||
|
|
||||||
basecounter += (GetPerfCounter_Scaled() - counter);
|
basecounter_scaled += (GetPerfCounter_Scaled() - counter);
|
||||||
|
|
||||||
I_GetTime = I_GetTime_Scaled;
|
I_GetTime = I_GetTime_Scaled;
|
||||||
I_GetFracTime = I_GetFracTime_Scaled;
|
I_GetFracTime = I_GetFracTime_Scaled;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user