mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 19:20:38 +00:00
Respect r_maxfps in menus and on startup/bonus/end screens
git-svn-id: https://svn.eduke32.com/eduke32@6237 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
4489e110de
commit
eae02b26a1
7 changed files with 490 additions and 489 deletions
|
@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "menus.h"
|
||||
#include "savegame.h"
|
||||
#include "input.h"
|
||||
#include "screens.h"
|
||||
|
||||
char g_firstDemoFile[BMAX_PATH];
|
||||
|
||||
|
@ -531,7 +532,6 @@ RECHECK:
|
|||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
|
||||
G_DrawBackground();
|
||||
M_DisplayMenus();
|
||||
//g_player[myconnectindex].ps->palette = palette;
|
||||
nextpage();
|
||||
fadepal(0,0,0, 252,0,-28);
|
||||
ud.reccnt = 0;
|
||||
|
@ -788,31 +788,22 @@ nextdemo_nomenu:
|
|||
if (Demo_IsProfiling())
|
||||
totalclock += TICSPERFRAME;
|
||||
|
||||
if (G_FPSLimit())
|
||||
{
|
||||
if (foundemo == 0)
|
||||
{
|
||||
G_DrawBackground();
|
||||
#ifdef LUNATIC
|
||||
#ifdef LUNATIC
|
||||
El_DisplayErrors();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
static uint32_t nextrender = 0, framewaiting = 0;
|
||||
uint32_t tt;
|
||||
|
||||
// NOTE: currently, no key/mouse events will be seen while
|
||||
// demo-profiling because we need 'totalclock' for ourselves.
|
||||
// And handleevents() -> sampletimer() would mess that up.
|
||||
G_HandleLocalKeys();
|
||||
|
||||
if (framewaiting)
|
||||
{
|
||||
framewaiting--;
|
||||
nextpage();
|
||||
}
|
||||
|
||||
tt = getticks();
|
||||
|
||||
// Render one frame (potentially many if profiling)
|
||||
if (Demo_IsProfiling())
|
||||
{
|
||||
|
@ -824,8 +815,8 @@ nextdemo_nomenu:
|
|||
{
|
||||
double t1 = gethiticks(), t2;
|
||||
|
||||
// initprintf("t=%d, o=%d, t-o = %d\n", totalclock,
|
||||
// ototalclock, totalclock-ototalclock);
|
||||
// initprintf("t=%d, o=%d, t-o = %d\n", totalclock,
|
||||
// ototalclock, totalclock-ototalclock);
|
||||
|
||||
// NOTE: G_DrawRooms() calculates smoothratio inside and
|
||||
// ignores the function argument, so we set totalclock
|
||||
|
@ -833,7 +824,7 @@ nextdemo_nomenu:
|
|||
j = (i<<16)/num;
|
||||
totalclock = ototalclock + (j>>16);
|
||||
|
||||
G_DrawRooms(screenpeek,j);
|
||||
G_DrawRooms(screenpeek, j);
|
||||
|
||||
t2 = gethiticks();
|
||||
|
||||
|
@ -850,24 +841,17 @@ nextdemo_nomenu:
|
|||
if (handleevents_peekkeys())
|
||||
Demo_StopProfiling();
|
||||
}
|
||||
else if (r_maxfps == 0 || tt >= nextrender)
|
||||
else
|
||||
{
|
||||
if (tt > nextrender+g_frameDelay)
|
||||
nextrender = tt;
|
||||
|
||||
nextrender += g_frameDelay;
|
||||
|
||||
j = calc_smoothratio(totalclock, ototalclock);
|
||||
if (g_demo_paused && g_demo_rewind)
|
||||
j = 65536-j;
|
||||
|
||||
G_DrawRooms(screenpeek,j);
|
||||
G_DrawRooms(screenpeek, j);
|
||||
G_DisplayRest(j);
|
||||
|
||||
framewaiting++;
|
||||
}
|
||||
else
|
||||
totalclocklock = totalclock;
|
||||
// totalclocklock = totalclock;
|
||||
|
||||
if (!Demo_IsProfiling() && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
|
||||
{
|
||||
|
@ -876,7 +860,7 @@ nextdemo_nomenu:
|
|||
|
||||
if (g_demo_showStats)
|
||||
{
|
||||
#if 0
|
||||
#if 0
|
||||
if (g_demo_cnt<tmpdifftime)
|
||||
gametext_center(100, "DIFF");
|
||||
|
||||
|
@ -885,21 +869,21 @@ nextdemo_nomenu:
|
|||
Bsprintf(buf, "RC:%4d TC:%5d", ud.reccnt, g_demo_cnt);
|
||||
gametext_center_number(100, buf);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
j=g_demo_cnt/REALGAMETICSPERSEC;
|
||||
Bsprintf(buf, "%02d:%02d", j/60, j%60);
|
||||
gametext_widenumber(18, 16, buf);
|
||||
|
||||
rotatesprite(60<<16,16<<16,32768,0,SLIDEBAR,0,0,2+8+16+1024,0,0,(xdim*95)/320,ydim-1);
|
||||
rotatesprite(90<<16,16<<16,32768,0,SLIDEBAR,0,0,2+8+16+1024,(xdim*95)/320,0,(xdim*125)/320,ydim-1);
|
||||
rotatesprite(120<<16,16<<16,32768,0,SLIDEBAR,0,0,2+8+16+1024,(xdim*125)/320,0,(xdim*155)/320,ydim-1);
|
||||
rotatesprite(150<<16,16<<16,32768,0,SLIDEBAR,0,0,2+8+16+1024,(xdim*155)/320,0,xdim-1,ydim-1);
|
||||
rotatesprite(60<<16, 16<<16, 32768, 0, SLIDEBAR, 0, 0, 2+8+16+1024, 0, 0, (xdim*95)/320, ydim-1);
|
||||
rotatesprite(90<<16, 16<<16, 32768, 0, SLIDEBAR, 0, 0, 2+8+16+1024, (xdim*95)/320, 0, (xdim*125)/320, ydim-1);
|
||||
rotatesprite(120<<16, 16<<16, 32768, 0, SLIDEBAR, 0, 0, 2+8+16+1024, (xdim*125)/320, 0, (xdim*155)/320, ydim-1);
|
||||
rotatesprite(150<<16, 16<<16, 32768, 0, SLIDEBAR, 0, 0, 2+8+16+1024, (xdim*155)/320, 0, xdim-1, ydim-1);
|
||||
|
||||
j = (182<<16) - (tabledivide32_noinline((120*(g_demo_totalCnt-g_demo_cnt))<<4, g_demo_totalCnt)<<12);
|
||||
rotatesprite_fs(j,(16<<16)+(1<<15),32768,0,SLIDEBAR+1,0,0,2+8+16+1024);
|
||||
rotatesprite_fs(j, (16<<16)+(1<<15), 32768, 0, SLIDEBAR+1, 0, 0, 2+8+16+1024);
|
||||
|
||||
j=(g_demo_totalCnt-g_demo_cnt)/REALGAMETICSPERSEC;
|
||||
Bsprintf(buf, "-%02d:%02d%s", j/60, j%60, g_demo_paused?" ^15PAUSED":"");
|
||||
Bsprintf(buf, "-%02d:%02d%s", j/60, j%60, g_demo_paused ? " ^15PAUSED" : "");
|
||||
gametext_widenumber(194, 16, buf);
|
||||
}
|
||||
}
|
||||
|
@ -970,7 +954,8 @@ nextdemo_nomenu:
|
|||
if (VOLUMEONE)
|
||||
{
|
||||
if (ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
|
||||
rotatesprite_fs((320-50)<<16,9<<16,65536L,0,BETAVERSION,0,0,2+8+16+128);
|
||||
rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, BETAVERSION, 0, 0, 2+8+16+128);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: We must prevent handleevents() and Net_GetPackets() from
|
||||
|
@ -978,9 +963,6 @@ nextdemo_nomenu:
|
|||
if (!Demo_IsProfiling())
|
||||
G_HandleAsync();
|
||||
|
||||
if (ud.recstat==0)
|
||||
nextpage();
|
||||
|
||||
if (g_player[myconnectindex].ps->gm == MODE_GAME)
|
||||
{
|
||||
// user wants to play a game, quit showing demo!
|
||||
|
|
|
@ -6053,6 +6053,33 @@ void G_MaybeAllocPlayer(int32_t pnum)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
int G_FPSLimit(void)
|
||||
{
|
||||
static uint32_t nextRender = 0, frameWaiting = 0;
|
||||
|
||||
if (frameWaiting)
|
||||
{
|
||||
frameWaiting--;
|
||||
nextpage();
|
||||
}
|
||||
|
||||
uint32_t frameTime = getticks();
|
||||
|
||||
if (r_maxfps == 0 || frameTime >= nextRender)
|
||||
{
|
||||
if (frameTime > nextRender + g_frameDelay)
|
||||
nextRender = frameTime;
|
||||
|
||||
nextRender += g_frameDelay;
|
||||
frameWaiting++;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: reorder (net)actor_t to eliminate slop and update assertion
|
||||
// EDUKE32_STATIC_ASSERT(sizeof(actor_t)==128);
|
||||
EDUKE32_STATIC_ASSERT(sizeof(DukePlayer_t)%4 == 0);
|
||||
|
@ -6571,9 +6598,6 @@ MAIN_LOOP_RESTART:
|
|||
|
||||
do //main loop
|
||||
{
|
||||
static uint32_t nextRender = 0, frameWaiting = 0;
|
||||
uint32_t frameTime;
|
||||
|
||||
if (handleevents() && quitevent)
|
||||
{
|
||||
KB_KeyDown[sc_Escape] = 1;
|
||||
|
@ -6700,21 +6724,8 @@ MAIN_LOOP_RESTART:
|
|||
goto skipframe;
|
||||
}
|
||||
|
||||
if (frameWaiting)
|
||||
if (G_FPSLimit())
|
||||
{
|
||||
frameWaiting--;
|
||||
nextpage();
|
||||
}
|
||||
|
||||
frameTime = getticks();
|
||||
|
||||
if (r_maxfps == 0 || frameTime >= nextRender)
|
||||
{
|
||||
if (frameTime > nextRender + g_frameDelay)
|
||||
nextRender = frameTime;
|
||||
|
||||
nextRender += g_frameDelay;
|
||||
|
||||
int const smoothRatio
|
||||
= ((ud.show_help == 0 && (!g_netServer && ud.multimode < 2) && !(g_player[myconnectindex].ps->gm & MODE_MENU))
|
||||
|| (g_netServer || ud.multimode > 1)
|
||||
|
@ -6726,8 +6737,6 @@ MAIN_LOOP_RESTART:
|
|||
if (getrendermode() >= REND_POLYMOST)
|
||||
G_DrawBackground();
|
||||
G_DisplayRest(smoothRatio);
|
||||
|
||||
frameWaiting++;
|
||||
}
|
||||
|
||||
skipframe:
|
||||
|
|
|
@ -333,7 +333,7 @@ void G_DrawFrags(void);
|
|||
void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, int32_t smoothratio);
|
||||
void G_DrawRooms(int32_t snum,int32_t smoothratio);
|
||||
void G_DrawTXDigiNumZ(int32_t starttile,int32_t x,int32_t y,int32_t n,int32_t s,int32_t pal,int32_t cs,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z);
|
||||
void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e);
|
||||
int G_FPSLimit(void);
|
||||
void G_GameExit(const char *t) ATTRIBUTE((noreturn));
|
||||
void G_GameQuit(void);
|
||||
void G_GetCrosshairColor(void);
|
||||
|
|
|
@ -3504,9 +3504,8 @@ nullquote:
|
|||
time_t timeStruct = time(NULL);
|
||||
struct tm *pTime = localtime(&timeStruct);
|
||||
|
||||
Bsnprintf(ud.savegame[requestedSlot], sizeof(ud.savegame[requestedSlot]),
|
||||
"Auto %.4d%.2d%.2d %.2d%.2d%.2d", pTime->tm_year + 1900, pTime->tm_mon + 1, pTime->tm_mday,
|
||||
pTime->tm_hour, pTime->tm_min, pTime->tm_sec);
|
||||
strftime(ud.savegame[requestedSlot], sizeof(ud.savegame[requestedSlot]),
|
||||
"%d %b %Y %I:%M%p", pTime);
|
||||
}
|
||||
|
||||
continue;
|
||||
|
|
|
@ -217,11 +217,13 @@ void Net_WaitForServer(void)
|
|||
{
|
||||
if (quitevent || keystatus[1]) G_GameExit("");
|
||||
|
||||
if (G_FPSLimit())
|
||||
{
|
||||
display_betascreen();
|
||||
|
||||
gametext_center_shade(170, "Waiting for server", 14);
|
||||
nextpage();
|
||||
}
|
||||
|
||||
// XXX: this looks like something that should be rate limited...
|
||||
packbuf[0] = PACKET_PLAYER_PING;
|
||||
packbuf[1] = myconnectindex;
|
||||
|
||||
|
|
|
@ -1290,11 +1290,10 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
|
||||
void G_FadePalette(int32_t r, int32_t g, int32_t b, int32_t e)
|
||||
{
|
||||
int32_t tc;
|
||||
setpalettefade(r, g, b, e);
|
||||
|
||||
nextpage();
|
||||
tc = totalclock;
|
||||
|
||||
int32_t tc = totalclock;
|
||||
while (totalclock < tc + 4)
|
||||
G_HandleAsync();
|
||||
}
|
||||
|
@ -1480,7 +1479,6 @@ void G_DisplayLogo(void)
|
|||
|
||||
if (logoflags & LOGO_3DRSCREEN)
|
||||
{
|
||||
|
||||
if (!I_CheckAllInput() && g_noLogoAnim == 0)
|
||||
{
|
||||
int32_t i;
|
||||
|
@ -1509,12 +1507,13 @@ void G_DisplayLogo(void)
|
|||
nextpage();
|
||||
fadepaltile(0, 0, 0, 252, 0, -28, DREALMS);
|
||||
totalclock = 0;
|
||||
|
||||
while (totalclock < (120 * 7) && !I_CheckAllInput())
|
||||
{
|
||||
if (G_FPSLimit())
|
||||
{
|
||||
clearallviews(0);
|
||||
|
||||
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH);
|
||||
|
||||
G_HandleAsync();
|
||||
|
||||
if (g_restorePalette)
|
||||
|
@ -1522,8 +1521,9 @@ void G_DisplayLogo(void)
|
|||
P_SetGamePalette(g_player[myconnectindex].ps, g_player[myconnectindex].ps->palette, 0);
|
||||
g_restorePalette = 0;
|
||||
}
|
||||
nextpage();
|
||||
}
|
||||
}
|
||||
|
||||
fadepaltile(0, 0, 0, 0, 252, 28, DREALMS);
|
||||
}
|
||||
}
|
||||
|
@ -1555,9 +1555,10 @@ void G_DisplayLogo(void)
|
|||
totalclock < (860+120) &&
|
||||
#endif
|
||||
!I_CheckAllInput())
|
||||
{
|
||||
if (G_FPSLimit())
|
||||
{
|
||||
clearallviews(0);
|
||||
|
||||
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BETASCREEN, 0, 0, 2+8+64+BGSTRETCH);
|
||||
if (logoflags & LOGO_DUKENUKEM)
|
||||
{
|
||||
|
@ -1620,7 +1621,6 @@ void G_DisplayLogo(void)
|
|||
g_elEventError = 0;
|
||||
#endif
|
||||
VM_OnEvent(EVENT_LOGO, -1, screenpeek);
|
||||
G_HandleAsync();
|
||||
|
||||
if (g_restorePalette)
|
||||
{
|
||||
|
@ -1631,9 +1631,12 @@ void G_DisplayLogo(void)
|
|||
if (g_elEventError)
|
||||
break;
|
||||
#endif
|
||||
nextpage();
|
||||
}
|
||||
|
||||
G_HandleAsync();
|
||||
}
|
||||
}
|
||||
|
||||
I_ClearAllInput();
|
||||
}
|
||||
|
||||
|
@ -1706,6 +1709,8 @@ static void G_BonusCutscenes(void)
|
|||
totalclock = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (G_FPSLimit())
|
||||
{
|
||||
clearallviews(0L);
|
||||
rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH);
|
||||
|
@ -1755,10 +1760,10 @@ static void G_BonusCutscenes(void)
|
|||
rotatesprite_fs(breathe[t+3]<<16, breathe[t+4]<<16, 65536L, 0, breathe[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G_HandleAsync();
|
||||
|
||||
nextpage();
|
||||
if (I_CheckAllInput()) break;
|
||||
}
|
||||
|
||||
|
@ -2168,12 +2173,13 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
while (totalclock < TICRATE*10)
|
||||
{
|
||||
G_HandleAsync();
|
||||
|
||||
MUSIC_Update();
|
||||
|
||||
if (G_FPSLimit())
|
||||
{
|
||||
clearallviews(0);
|
||||
G_DisplayMPResultsScreen();
|
||||
nextpage();
|
||||
}
|
||||
|
||||
if (I_CheckAllInput())
|
||||
{
|
||||
|
@ -2213,13 +2219,13 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
int32_t yy = 0, zz;
|
||||
|
||||
G_HandleAsync();
|
||||
|
||||
MUSIC_Update();
|
||||
|
||||
if (G_FPSLimit())
|
||||
{
|
||||
if (g_player[myconnectindex].ps->gm&MODE_EOL)
|
||||
{
|
||||
clearallviews(0);
|
||||
|
||||
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BONUSSCREEN+gfx_offset, 0, 0, 2+8+64+128+BGSTRETCH);
|
||||
|
||||
if (totalclock >= 1000000000 && totalclock < 1000000320)
|
||||
|
@ -2445,6 +2451,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
VM_OnEvent(EVENT_DISPLAYBONUSSCREEN, g_player[screenpeek].ps->i, screenpeek);
|
||||
nextpage();
|
||||
|
|
|
@ -42,3 +42,5 @@ extern sprstat_t g_spriteStat;
|
|||
|
||||
extern int32_t dr_yxaspect, dr_viewingrange;
|
||||
extern int32_t g_noLogoAnim, g_noLogo;
|
||||
|
||||
extern void G_FadePalette(int32_t r, int32_t g, int32_t b, int32_t e);
|
||||
|
|
Loading…
Reference in a new issue