mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 03:00:38 +00:00
Further improve Duke3D and RR main game loop.
- Replace if statement containing nested do/while loop with a while loop.
This commit is contained in:
parent
d4dd737cd5
commit
9e8e441d02
2 changed files with 71 additions and 78 deletions
|
@ -5759,9 +5759,7 @@ MAIN_LOOP_RESTART:
|
||||||
bool gameUpdate = false;
|
bool gameUpdate = false;
|
||||||
double gameUpdateStartTime = timerGetHiTicks();
|
double gameUpdateStartTime = timerGetHiTicks();
|
||||||
|
|
||||||
if (((g_netClient || g_netServer) || (myplayer.gm & (MODE_MENU|MODE_DEMO)) == 0) && totalclock >= ototalclock+TICSPERFRAME)
|
while (((g_netClient || g_netServer) || (myplayer.gm & (MODE_MENU | MODE_DEMO)) == 0) && (int)(totalclock - ototalclock) >= TICSPERFRAME)
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
ototalclock += TICSPERFRAME;
|
ototalclock += TICSPERFRAME;
|
||||||
|
|
||||||
|
@ -5793,7 +5791,6 @@ MAIN_LOOP_RESTART:
|
||||||
G_DoMoveThings();
|
G_DoMoveThings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (((g_netClient || g_netServer) || (myplayer.gm & (MODE_MENU | MODE_DEMO)) == 0) && (int)(totalclock - ototalclock) >= TICSPERFRAME);
|
|
||||||
|
|
||||||
gameUpdate = true;
|
gameUpdate = true;
|
||||||
g_gameUpdateTime = timerGetHiTicks() - gameUpdateStartTime;
|
g_gameUpdateTime = timerGetHiTicks() - gameUpdateStartTime;
|
||||||
|
@ -5803,7 +5800,6 @@ MAIN_LOOP_RESTART:
|
||||||
|
|
||||||
g_gameUpdateAvgTime
|
g_gameUpdateAvgTime
|
||||||
= ((GAMEUPDATEAVGTIMENUMSAMPLES - 1.f) * g_gameUpdateAvgTime + g_gameUpdateTime) / ((float)GAMEUPDATEAVGTIMENUMSAMPLES);
|
= ((GAMEUPDATEAVGTIMENUMSAMPLES - 1.f) * g_gameUpdateAvgTime + g_gameUpdateTime) / ((float)GAMEUPDATEAVGTIMENUMSAMPLES);
|
||||||
}
|
|
||||||
|
|
||||||
G_DoCheats();
|
G_DoCheats();
|
||||||
|
|
||||||
|
|
|
@ -7228,9 +7228,8 @@ MAIN_LOOP_RESTART:
|
||||||
|
|
||||||
char gameUpdate = false;
|
char gameUpdate = false;
|
||||||
double const gameUpdateStartTime = timerGetHiTicks();
|
double const gameUpdateStartTime = timerGetHiTicks();
|
||||||
if (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME)
|
|
||||||
{
|
while (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && (int)(totalclock - ototalclock) >= TICSPERFRAME)
|
||||||
do
|
|
||||||
{
|
{
|
||||||
ototalclock += TICSPERFRAME;
|
ototalclock += TICSPERFRAME;
|
||||||
|
|
||||||
|
@ -7263,14 +7262,12 @@ MAIN_LOOP_RESTART:
|
||||||
G_MoveLoop();
|
G_MoveLoop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && (int)(totalclock - ototalclock) >= TICSPERFRAME);
|
|
||||||
|
|
||||||
gameUpdate = true;
|
gameUpdate = true;
|
||||||
g_gameUpdateTime = timerGetHiTicks()-gameUpdateStartTime;
|
g_gameUpdateTime = timerGetHiTicks()-gameUpdateStartTime;
|
||||||
if (g_gameUpdateAvgTime < 0.f)
|
if (g_gameUpdateAvgTime < 0.f)
|
||||||
g_gameUpdateAvgTime = g_gameUpdateTime;
|
g_gameUpdateAvgTime = g_gameUpdateTime;
|
||||||
g_gameUpdateAvgTime = ((GAMEUPDATEAVGTIMENUMSAMPLES-1.f)*g_gameUpdateAvgTime+g_gameUpdateTime)/((float) GAMEUPDATEAVGTIMENUMSAMPLES);
|
g_gameUpdateAvgTime = ((GAMEUPDATEAVGTIMENUMSAMPLES-1.f)*g_gameUpdateAvgTime+g_gameUpdateTime)/((float) GAMEUPDATEAVGTIMENUMSAMPLES);
|
||||||
}
|
|
||||||
|
|
||||||
G_DoCheats();
|
G_DoCheats();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue