mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- Fix freeze interpolation bug
This commit is contained in:
parent
28401cd674
commit
090943eaa4
1 changed files with 12 additions and 9 deletions
|
@ -198,7 +198,7 @@ static uint32_t performanceGetTime()
|
||||||
|
|
||||||
static unsigned int FirstFrameStartTime;
|
static unsigned int FirstFrameStartTime;
|
||||||
static unsigned int CurrentFrameStartTime;
|
static unsigned int CurrentFrameStartTime;
|
||||||
static bool TimeFrozen;
|
static unsigned int FreezeTime;
|
||||||
|
|
||||||
void I_SetFrameTime()
|
void I_SetFrameTime()
|
||||||
{
|
{
|
||||||
|
@ -207,7 +207,7 @@ void I_SetFrameTime()
|
||||||
// performanceGetTime() must only ever be called once or otherwise the playsim
|
// performanceGetTime() must only ever be called once or otherwise the playsim
|
||||||
// processing time will affect the interpolation done by the renderer.
|
// processing time will affect the interpolation done by the renderer.
|
||||||
|
|
||||||
if (!TimeFrozen)
|
if (FreezeTime == 0)
|
||||||
{
|
{
|
||||||
CurrentFrameStartTime = performanceGetTime();
|
CurrentFrameStartTime = performanceGetTime();
|
||||||
if (FirstFrameStartTime == 0)
|
if (FirstFrameStartTime == 0)
|
||||||
|
@ -247,7 +247,7 @@ static int I_WaitForTicWin32(int prevtic)
|
||||||
|
|
||||||
unsigned int I_FPSTime()
|
unsigned int I_FPSTime()
|
||||||
{
|
{
|
||||||
if (!TimeFrozen)
|
if (FreezeTime == 0)
|
||||||
return CurrentFrameStartTime;
|
return CurrentFrameStartTime;
|
||||||
else
|
else
|
||||||
return performanceGetTime();
|
return performanceGetTime();
|
||||||
|
@ -255,7 +255,7 @@ unsigned int I_FPSTime()
|
||||||
|
|
||||||
unsigned int I_MSTime()
|
unsigned int I_MSTime()
|
||||||
{
|
{
|
||||||
if (!TimeFrozen)
|
if (FreezeTime == 0)
|
||||||
{
|
{
|
||||||
return CurrentFrameStartTime - FirstFrameStartTime;
|
return CurrentFrameStartTime - FirstFrameStartTime;
|
||||||
}
|
}
|
||||||
|
@ -292,13 +292,16 @@ double I_GetTimeFrac(uint32_t *ms)
|
||||||
|
|
||||||
void I_FreezeTimeWin32(bool frozen)
|
void I_FreezeTimeWin32(bool frozen)
|
||||||
{
|
{
|
||||||
if (TimeFrozen && !frozen)
|
if (frozen)
|
||||||
{
|
{
|
||||||
unsigned int timeFrozen = performanceGetTime() - CurrentFrameStartTime;
|
FreezeTime = performanceGetTime();
|
||||||
FirstFrameStartTime += timeFrozen;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FirstFrameStartTime += performanceGetTime() - FreezeTime;
|
||||||
|
FreezeTime = 0;
|
||||||
|
I_SetFrameTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeFrozen = frozen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int(*I_GetTime)(bool saveMS) = I_GetTimeWin32;
|
int(*I_GetTime)(bool saveMS) = I_GetTimeWin32;
|
||||||
|
|
Loading…
Reference in a new issue