From 1719b705597507b7ba77c0a656a938de61e41cb9 Mon Sep 17 00:00:00 2001 From: nukeykt Date: Sun, 15 Dec 2019 10:48:04 +0900 Subject: [PATCH] Oops, i've missed do while here # Conflicts: # source/rr/src/game.cpp --- source/rr/src/game.cpp | 85 ++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 360c055db..8033a6990 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -7624,54 +7624,57 @@ MAIN_LOOP_RESTART: double const gameUpdateStartTime = timerGetHiTicks(); if (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME) { - //if (g_networkMode != NET_DEDICATED_SERVER) - //{ - // if (RRRA && g_player[myconnectindex].ps->on_motorcycle) - // P_GetInputMotorcycle(myconnectindex); - // else if (RRRA && g_player[myconnectindex].ps->on_boat) - // P_GetInputBoat(myconnectindex); - // else - // P_GetInput(myconnectindex); - //} - - //Bmemcpy(&inputfifo[0][myconnectindex], &localInput, sizeof(input_t)); - - if (!frameJustDrawn) - break; - - frameJustDrawn = false; - do { - if (ready2send == 0) break; - Net_GetInput(); + //if (g_networkMode != NET_DEDICATED_SERVER) + //{ + // if (RRRA && g_player[myconnectindex].ps->on_motorcycle) + // P_GetInputMotorcycle(myconnectindex); + // else if (RRRA && g_player[myconnectindex].ps->on_boat) + // P_GetInputBoat(myconnectindex); + // else + // P_GetInput(myconnectindex); + //} - ototalclock += TICSPERFRAME; + //Bmemcpy(&inputfifo[0][myconnectindex], &localInput, sizeof(input_t)); - int const moveClock = (int) totalclock; + if (!frameJustDrawn) + break; - if (((ud.show_help == 0 && !GUICapture && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) && - (g_player[myconnectindex].ps->gm&MODE_GAME)) - { - G_MoveLoop(); - S_Update(); - } + frameJustDrawn = false; - if (totalclock - moveClock >= TICSPERFRAME) - { - // computing a tic takes longer than a tic, so we're slowing - // the game down. rather than tightly spinning here, go draw - // a frame since we're fucked anyway - break; - } - } - while (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME); + do + { + if (ready2send == 0) break; + Net_GetInput(); - 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); + ototalclock += TICSPERFRAME; + + int const moveClock = (int) totalclock; + + if (((ud.show_help == 0 && !GUICapture && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) && + (g_player[myconnectindex].ps->gm&MODE_GAME)) + { + G_MoveLoop(); + S_Update(); + } + + if (totalclock - moveClock >= TICSPERFRAME) + { + // computing a tic takes longer than a tic, so we're slowing + // the game down. rather than tightly spinning here, go draw + // a frame since we're fucked anyway + break; + } + } + while (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && 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); + } while(0); } G_DoCheats();