From 1ada6d0529f3cb95b8b99b1e4224af7b63973b6f Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 9 Feb 2012 22:44:09 +0000 Subject: [PATCH] Make r_maxfps functional in demo playback. git-svn-id: https://svn.eduke32.com/eduke32@2326 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/demo.c | 41 ++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/polymer/eduke32/source/demo.c b/polymer/eduke32/source/demo.c index 1e1e4b4cd..43bbd73ab 100644 --- a/polymer/eduke32/source/demo.c +++ b/polymer/eduke32/source/demo.c @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "duke3d.h" #include "demo.h" +//#include "premap.h" // G_UpdateScreenArea() #include "menus.h" #include "savegame.h" @@ -554,16 +555,44 @@ nextdemo: G_DrawBackground(); else { + static uint32_t nextrender = 0, framewaiting = 0; + uint32_t tt; + G_HandleLocalKeys(); // j = min(max((totalclock-lockclock)*(65536/TICSPERFRAME),0),65536); - j = min(max((totalclock - ototalclock) * (65536 / 4),0),65536); - if (g_demo_paused && g_demo_rewind) - j = 65536-j; + if (framewaiting) + { + framewaiting--; +#if 0 + if (ud.statusbarmode == 1 && (ud.statusbarscale == 100 || !getrendermode())) + { + ud.statusbarmode = 0; + G_UpdateScreenArea(); + } +#endif + nextpage(); + } - G_DrawRooms(screenpeek,j); - G_DisplayRest(j); + tt = getticks(); + + if (r_maxfps == 0 || tt >= nextrender) + { + if (tt > nextrender+g_frameDelay) + nextrender = tt; + + nextrender += g_frameDelay; + + j = min(max((totalclock - ototalclock) * (65536 / 4),0),65536); + if (g_demo_paused && g_demo_rewind) + j = 65536-j; + + G_DrawRooms(screenpeek,j); + G_DisplayRest(j); + + framewaiting++; + } if ((g_player[myconnectindex].ps->gm&MODE_MENU) == 0) { @@ -658,7 +687,7 @@ nextdemo: } handleevents(); Net_GetPackets(); - nextpage(); +// nextpage(); if (g_player[myconnectindex].ps->gm == MODE_GAME) {