mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +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;
|
||||
double gameUpdateStartTime = timerGetHiTicks();
|
||||
|
||||
if (((g_netClient || g_netServer) || (myplayer.gm & (MODE_MENU|MODE_DEMO)) == 0) && totalclock >= ototalclock+TICSPERFRAME)
|
||||
{
|
||||
do
|
||||
while (((g_netClient || g_netServer) || (myplayer.gm & (MODE_MENU | MODE_DEMO)) == 0) && (int)(totalclock - ototalclock) >= TICSPERFRAME)
|
||||
{
|
||||
ototalclock += TICSPERFRAME;
|
||||
|
||||
|
@ -5793,7 +5791,6 @@ MAIN_LOOP_RESTART:
|
|||
G_DoMoveThings();
|
||||
}
|
||||
}
|
||||
while (((g_netClient || g_netServer) || (myplayer.gm & (MODE_MENU | MODE_DEMO)) == 0) && (int)(totalclock - ototalclock) >= TICSPERFRAME);
|
||||
|
||||
gameUpdate = true;
|
||||
g_gameUpdateTime = timerGetHiTicks() - gameUpdateStartTime;
|
||||
|
@ -5803,7 +5800,6 @@ MAIN_LOOP_RESTART:
|
|||
|
||||
g_gameUpdateAvgTime
|
||||
= ((GAMEUPDATEAVGTIMENUMSAMPLES - 1.f) * g_gameUpdateAvgTime + g_gameUpdateTime) / ((float)GAMEUPDATEAVGTIMENUMSAMPLES);
|
||||
}
|
||||
|
||||
G_DoCheats();
|
||||
|
||||
|
|
|
@ -7228,9 +7228,8 @@ MAIN_LOOP_RESTART:
|
|||
|
||||
char gameUpdate = false;
|
||||
double const gameUpdateStartTime = timerGetHiTicks();
|
||||
if (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME)
|
||||
{
|
||||
do
|
||||
|
||||
while (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && (int)(totalclock - ototalclock) >= TICSPERFRAME)
|
||||
{
|
||||
ototalclock += TICSPERFRAME;
|
||||
|
||||
|
@ -7263,14 +7262,12 @@ MAIN_LOOP_RESTART:
|
|||
G_MoveLoop();
|
||||
}
|
||||
}
|
||||
while (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && (int)(totalclock - ototalclock) >= TICSPERFRAME);
|
||||
|
||||
gameUpdate = true;
|
||||
g_gameUpdateTime = timerGetHiTicks()-gameUpdateStartTime;
|
||||
if (g_gameUpdateAvgTime < 0.f)
|
||||
g_gameUpdateAvgTime = g_gameUpdateTime;
|
||||
g_gameUpdateAvgTime = ((GAMEUPDATEAVGTIMENUMSAMPLES-1.f)*g_gameUpdateAvgTime+g_gameUpdateTime)/((float) GAMEUPDATEAVGTIMENUMSAMPLES);
|
||||
}
|
||||
|
||||
G_DoCheats();
|
||||
|
||||
|
|
Loading…
Reference in a new issue