mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 15:22:08 +00:00
- removed I_MSTime entirely after checking how the wipe code actually works.
Since this calls I_WaitVBL, which resets the frame time, it was essentially just like calling a real-time timer anyway and nothing in it required a specific 0-timepoint. The same applies to the ZScript interface. All it needs is a millisecond-precise timer with no semantics attached.
This commit is contained in:
parent
2c65f08011
commit
96e9eadd97
4 changed files with 5 additions and 32 deletions
|
@ -945,7 +945,7 @@ void D_Display ()
|
||||||
I_FreezeTime(true);
|
I_FreezeTime(true);
|
||||||
screen->WipeEndScreen ();
|
screen->WipeEndScreen ();
|
||||||
|
|
||||||
wipestart = I_MSTime();
|
wipestart = I_FPSTime();
|
||||||
NetUpdate(); // send out any new accumulation
|
NetUpdate(); // send out any new accumulation
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -953,7 +953,7 @@ void D_Display ()
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
I_WaitVBL(2);
|
I_WaitVBL(2);
|
||||||
nowtime = I_MSTime();
|
nowtime = I_FPSTime();
|
||||||
diff = (nowtime - wipestart) * 40 / 1000; // Using 35 here feels too slow.
|
diff = (nowtime - wipestart) * 40 / 1000; // Using 35 here feels too slow.
|
||||||
} while (diff < 1);
|
} while (diff < 1);
|
||||||
wipestart = nowtime;
|
wipestart = nowtime;
|
||||||
|
|
|
@ -615,7 +615,7 @@ void DObject::CheckIfSerialized () const
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(DObject, MSTime)
|
DEFINE_ACTION_FUNCTION(DObject, MSTime)
|
||||||
{
|
{
|
||||||
ACTION_RETURN_INT(I_MSTime());
|
ACTION_RETURN_INT(I_FPSTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void *DObject::ScriptVar(FName field, PType *type)
|
void *DObject::ScriptVar(FName field, PType *type)
|
||||||
|
|
|
@ -80,7 +80,7 @@ void I_SetFrameTime()
|
||||||
// Must only be called once per frame/swapbuffers.
|
// Must only be called once per frame/swapbuffers.
|
||||||
//
|
//
|
||||||
// Caches all timing information for the current rendered frame so that any
|
// Caches all timing information for the current rendered frame so that any
|
||||||
// calls to I_FPSTime, I_MSTime, I_GetTime or I_GetTimeFrac will return
|
// calls to I_GetTime or I_GetTimeFrac will return
|
||||||
// the same time.
|
// the same time.
|
||||||
|
|
||||||
if (FreezeTime == 0)
|
if (FreezeTime == 0)
|
||||||
|
@ -120,36 +120,11 @@ int I_WaitForTic(int prevtic)
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t I_NSTime()
|
|
||||||
{
|
|
||||||
if (FreezeTime == 0)
|
|
||||||
{
|
|
||||||
return CurrentFrameStartTime - FirstFrameStartTime;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (FirstFrameStartTime == 0)
|
|
||||||
{
|
|
||||||
FirstFrameStartTime = GetClockTimeNS();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return GetClockTimeNS() - FirstFrameStartTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t I_FPSTimeNS()
|
uint64_t I_FPSTimeNS()
|
||||||
{
|
{
|
||||||
return GetClockTimeNS();
|
return GetClockTimeNS();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int I_MSTime()
|
|
||||||
{
|
|
||||||
return NSToMS(I_NSTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int I_FPSTime()
|
unsigned int I_FPSTime()
|
||||||
{
|
{
|
||||||
return NSToMS(I_FPSTimeNS());
|
return NSToMS(I_FPSTimeNS());
|
||||||
|
|
|
@ -14,15 +14,13 @@ double I_GetTimeFrac(uint32_t *ms);
|
||||||
int I_WaitForTic(int);
|
int I_WaitForTic(int);
|
||||||
|
|
||||||
// Freezes tic counting temporarily. While frozen, calls to I_GetTime()
|
// Freezes tic counting temporarily. While frozen, calls to I_GetTime()
|
||||||
// will always return the same value. This does not affect I_MSTime().
|
// will always return the same value.
|
||||||
// You must also not call I_WaitForTic() while freezing time, since the
|
// You must also not call I_WaitForTic() while freezing time, since the
|
||||||
// tic will never arrive (unless it's the current one).
|
// tic will never arrive (unless it's the current one).
|
||||||
void I_FreezeTime(bool frozen);
|
void I_FreezeTime(bool frozen);
|
||||||
|
|
||||||
// [RH] Returns millisecond-accurate time
|
// [RH] Returns millisecond-accurate time
|
||||||
unsigned int I_MSTime();
|
|
||||||
unsigned int I_FPSTime();
|
unsigned int I_FPSTime();
|
||||||
|
|
||||||
// Nanosecond-accurate time
|
// Nanosecond-accurate time
|
||||||
uint64_t I_NSTime();
|
|
||||||
uint64_t I_FPSTimeNS();
|
uint64_t I_FPSTimeNS();
|
||||||
|
|
Loading…
Reference in a new issue