From 9c60fd054fadb226838cf82dd79a8498415c6146 Mon Sep 17 00:00:00 2001 From: plagman Date: Thu, 3 Mar 2011 06:57:42 +0000 Subject: [PATCH] Slight tweak to the main loop to be more interactive when the game code runs really slow (as opposed to the renderer). git-svn-id: https://svn.eduke32.com/eduke32@1817 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 8f387c0fe..5d42ea06f 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -10110,23 +10110,34 @@ MAIN_LOOP_RESTART: } */ - j = 0; - do { + int32_t clockbeforetic; + sampletimer(); if (ready2send == 0) break; ototalclock += TICSPERFRAME; + clockbeforetic = totalclock; + if (((ud.show_help == 0 && (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()) - j++; + (g_player[myconnectindex].ps->gm&MODE_GAME)) { + G_MoveLoop(); + } + + sampletimer(); + + if (totalclock - clockbeforetic >= 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); - if (j) continue; } G_DoCheats();