mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-08 17:22:18 +00:00
Fix frame pacing when game lags behind
The frame timestamp should've been made at the start of the frame, not the end.
This commit is contained in:
parent
833777d773
commit
9b4e485686
2 changed files with 9 additions and 2 deletions
|
@ -755,6 +755,8 @@ void D_SRB2Loop(void)
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
frameEnd = I_GetFrameTime();
|
||||||
|
|
||||||
if (lastwipetic)
|
if (lastwipetic)
|
||||||
{
|
{
|
||||||
oldentertics = lastwipetic;
|
oldentertics = lastwipetic;
|
||||||
|
@ -890,7 +892,6 @@ void D_SRB2Loop(void)
|
||||||
LUA_Step();
|
LUA_Step();
|
||||||
|
|
||||||
// Fully completed frame made.
|
// Fully completed frame made.
|
||||||
frameEnd = I_GetFrameTime();
|
|
||||||
if (!singletics && !dedicated)
|
if (!singletics && !dedicated)
|
||||||
{
|
{
|
||||||
I_FrameCapSleep(frameEnd);
|
I_FrameCapSleep(frameEnd);
|
||||||
|
|
|
@ -2157,8 +2157,14 @@ static void UpdateElapsedTics(void)
|
||||||
|
|
||||||
tic_t I_GetTime(void)
|
tic_t I_GetTime(void)
|
||||||
{
|
{
|
||||||
|
float f = 0.0f;
|
||||||
|
|
||||||
UpdateElapsedTics();
|
UpdateElapsedTics();
|
||||||
return (tic_t) floor(elapsed_tics);
|
|
||||||
|
// This needs kept in a separate variable before converting
|
||||||
|
// to tic_t, due to stupid -Wbad-function-cast error.
|
||||||
|
f = floor(elapsed_tics);
|
||||||
|
return (tic_t)f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float I_GetTimeFrac(void)
|
float I_GetTimeFrac(void)
|
||||||
|
|
Loading…
Reference in a new issue