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:
terminx 2017-06-23 03:59:26 +00:00
parent 4489e110de
commit eae02b26a1
7 changed files with 490 additions and 489 deletions

View file

@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "menus.h" #include "menus.h"
#include "savegame.h" #include "savegame.h"
#include "input.h" #include "input.h"
#include "screens.h"
char g_firstDemoFile[BMAX_PATH]; char g_firstDemoFile[BMAX_PATH];
@ -531,7 +532,6 @@ RECHECK:
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
G_DrawBackground(); G_DrawBackground();
M_DisplayMenus(); M_DisplayMenus();
//g_player[myconnectindex].ps->palette = palette;
nextpage(); nextpage();
fadepal(0,0,0, 252,0,-28); fadepal(0,0,0, 252,0,-28);
ud.reccnt = 0; ud.reccnt = 0;
@ -788,189 +788,174 @@ nextdemo_nomenu:
if (Demo_IsProfiling()) if (Demo_IsProfiling())
totalclock += TICSPERFRAME; totalclock += TICSPERFRAME;
if (foundemo == 0) if (G_FPSLimit())
{ {
G_DrawBackground(); if (foundemo == 0)
#ifdef LUNATIC
El_DisplayErrors();
#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--; G_DrawBackground();
nextpage(); #ifdef LUNATIC
} El_DisplayErrors();
#endif
tt = getticks();
// Render one frame (potentially many if profiling)
if (Demo_IsProfiling())
{
int32_t i, num = g_demo_profile-1;
Bassert(totalclock-ototalclock==4);
for (i=0; i<num; i++)
{
double t1 = gethiticks(), t2;
// 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
// accordingly.
j = (i<<16)/num;
totalclock = ototalclock + (j>>16);
G_DrawRooms(screenpeek,j);
t2 = gethiticks();
G_DisplayRest(j);
Demo_RToc(t1, t2);
}
totalclock = ototalclock+4;
// draw status
Demo_DisplayProfStatus();
if (handleevents_peekkeys())
Demo_StopProfiling();
}
else if (r_maxfps == 0 || tt >= nextrender)
{
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_DisplayRest(j);
framewaiting++;
} }
else else
totalclocklock = totalclock;
if (!Demo_IsProfiling() && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
{ {
if (demoplay_showsync && outofsync) // NOTE: currently, no key/mouse events will be seen while
gametext_center(100, "OUT OF SYNC"); // demo-profiling because we need 'totalclock' for ourselves.
// And handleevents() -> sampletimer() would mess that up.
G_HandleLocalKeys();
if (g_demo_showStats) // Render one frame (potentially many if profiling)
if (Demo_IsProfiling())
{ {
#if 0 int32_t i, num = g_demo_profile-1;
if (g_demo_cnt<tmpdifftime)
gametext_center(100, "DIFF");
Bassert(totalclock-ototalclock==4);
for (i=0; i<num; i++)
{ {
char buf[32]; double t1 = gethiticks(), t2;
Bsprintf(buf, "RC:%4d TC:%5d", ud.reccnt, g_demo_cnt);
gametext_center_number(100, buf); // 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
// accordingly.
j = (i<<16)/num;
totalclock = ototalclock + (j>>16);
G_DrawRooms(screenpeek, j);
t2 = gethiticks();
G_DisplayRest(j);
Demo_RToc(t1, t2);
} }
#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); totalclock = ototalclock+4;
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); // draw status
rotatesprite_fs(j,(16<<16)+(1<<15),32768,0,SLIDEBAR+1,0,0,2+8+16+1024); Demo_DisplayProfStatus();
j=(g_demo_totalCnt-g_demo_cnt)/REALGAMETICSPERSEC; if (handleevents_peekkeys())
Bsprintf(buf, "-%02d:%02d%s", j/60, j%60, g_demo_paused?" ^15PAUSED":""); Demo_StopProfiling();
gametext_widenumber(194, 16, buf);
} }
} else
if ((g_netServer || ud.multimode > 1) && g_player[myconnectindex].ps->gm)
Net_GetPackets();
if (g_player[myconnectindex].gotvote == 0 && voting != -1 && voting != myconnectindex)
gametext_center(60, "Press F1 to Accept, F2 to Decline");
}
if ((g_player[myconnectindex].ps->gm&MODE_MENU) && (g_player[myconnectindex].ps->gm&MODE_EOL))
{
Demo_FinishProfile();
goto RECHECK;
}
if (I_EscapeTrigger() && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0 && (g_player[myconnectindex].ps->gm&MODE_TYPE) == 0)
{
I_EscapeTriggerClear();
FX_StopAllSounds();
S_ClearSoundLocks();
Menu_Open(myconnectindex);
Menu_Change(MENU_MAIN);
S_MenuSound();
}
if (Demo_IsProfiling())
{
// Do nothing: sampletimer() is reached from M_DisplayMenus() ->
// Net_GetPackets() else.
}
else if (g_player[myconnectindex].ps->gm&MODE_TYPE)
{
Net_SendMessage();
if ((g_player[myconnectindex].ps->gm&MODE_TYPE) != MODE_TYPE)
{
g_player[myconnectindex].ps->gm = 0;
Menu_Open(myconnectindex);
}
}
else
{
if (ud.recstat != 2)
M_DisplayMenus();
if ((g_netServer || ud.multimode > 1) && !Menu_IsTextInput(m_currentMenu))
{
ControlInfo noshareinfo;
CONTROL_GetInput(&noshareinfo);
if (BUTTON(gamefunc_SendMessage))
{ {
KB_FlushKeyboardQueue(); j = calc_smoothratio(totalclock, ototalclock);
CONTROL_ClearButton(gamefunc_SendMessage); if (g_demo_paused && g_demo_rewind)
g_player[myconnectindex].ps->gm = MODE_TYPE; j = 65536-j;
typebuf[0] = 0;
G_DrawRooms(screenpeek, j);
G_DisplayRest(j);
}
// totalclocklock = totalclock;
if (!Demo_IsProfiling() && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
{
if (demoplay_showsync && outofsync)
gametext_center(100, "OUT OF SYNC");
if (g_demo_showStats)
{
#if 0
if (g_demo_cnt<tmpdifftime)
gametext_center(100, "DIFF");
{
char buf[32];
Bsprintf(buf, "RC:%4d TC:%5d", ud.reccnt, g_demo_cnt);
gametext_center_number(100, buf);
}
#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);
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);
j=(g_demo_totalCnt-g_demo_cnt)/REALGAMETICSPERSEC;
Bsprintf(buf, "-%02d:%02d%s", j/60, j%60, g_demo_paused ? " ^15PAUSED" : "");
gametext_widenumber(194, 16, buf);
}
}
if ((g_netServer || ud.multimode > 1) && g_player[myconnectindex].ps->gm)
Net_GetPackets();
if (g_player[myconnectindex].gotvote == 0 && voting != -1 && voting != myconnectindex)
gametext_center(60, "Press F1 to Accept, F2 to Decline");
}
if ((g_player[myconnectindex].ps->gm&MODE_MENU) && (g_player[myconnectindex].ps->gm&MODE_EOL))
{
Demo_FinishProfile();
goto RECHECK;
}
if (I_EscapeTrigger() && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0 && (g_player[myconnectindex].ps->gm&MODE_TYPE) == 0)
{
I_EscapeTriggerClear();
FX_StopAllSounds();
S_ClearSoundLocks();
Menu_Open(myconnectindex);
Menu_Change(MENU_MAIN);
S_MenuSound();
}
if (Demo_IsProfiling())
{
// Do nothing: sampletimer() is reached from M_DisplayMenus() ->
// Net_GetPackets() else.
}
else if (g_player[myconnectindex].ps->gm&MODE_TYPE)
{
Net_SendMessage();
if ((g_player[myconnectindex].ps->gm&MODE_TYPE) != MODE_TYPE)
{
g_player[myconnectindex].ps->gm = 0;
Menu_Open(myconnectindex);
} }
} }
} else
{
if (ud.recstat != 2)
M_DisplayMenus();
if (!Demo_IsProfiling()) if ((g_netServer || ud.multimode > 1) && !Menu_IsTextInput(m_currentMenu))
G_PrintGameQuotes(screenpeek); {
ControlInfo noshareinfo;
CONTROL_GetInput(&noshareinfo);
if (BUTTON(gamefunc_SendMessage))
{
KB_FlushKeyboardQueue();
CONTROL_ClearButton(gamefunc_SendMessage);
g_player[myconnectindex].ps->gm = MODE_TYPE;
typebuf[0] = 0;
}
}
}
if (ud.last_camsprite != ud.camerasprite) if (!Demo_IsProfiling())
ud.last_camsprite = ud.camerasprite; G_PrintGameQuotes(screenpeek);
if (VOLUMEONE) if (ud.last_camsprite != ud.camerasprite)
{ ud.last_camsprite = ud.camerasprite;
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); 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);
}
} }
// NOTE: We must prevent handleevents() and Net_GetPackets() from // NOTE: We must prevent handleevents() and Net_GetPackets() from
@ -978,9 +963,6 @@ nextdemo_nomenu:
if (!Demo_IsProfiling()) if (!Demo_IsProfiling())
G_HandleAsync(); G_HandleAsync();
if (ud.recstat==0)
nextpage();
if (g_player[myconnectindex].ps->gm == MODE_GAME) if (g_player[myconnectindex].ps->gm == MODE_GAME)
{ {
// user wants to play a game, quit showing demo! // user wants to play a game, quit showing demo!

View file

@ -6053,6 +6053,33 @@ void G_MaybeAllocPlayer(int32_t pnum)
#endif #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 // TODO: reorder (net)actor_t to eliminate slop and update assertion
// EDUKE32_STATIC_ASSERT(sizeof(actor_t)==128); // EDUKE32_STATIC_ASSERT(sizeof(actor_t)==128);
EDUKE32_STATIC_ASSERT(sizeof(DukePlayer_t)%4 == 0); EDUKE32_STATIC_ASSERT(sizeof(DukePlayer_t)%4 == 0);
@ -6571,9 +6598,6 @@ MAIN_LOOP_RESTART:
do //main loop do //main loop
{ {
static uint32_t nextRender = 0, frameWaiting = 0;
uint32_t frameTime;
if (handleevents() && quitevent) if (handleevents() && quitevent)
{ {
KB_KeyDown[sc_Escape] = 1; KB_KeyDown[sc_Escape] = 1;
@ -6700,21 +6724,8 @@ MAIN_LOOP_RESTART:
goto skipframe; 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 int const smoothRatio
= ((ud.show_help == 0 && (!g_netServer && ud.multimode < 2) && !(g_player[myconnectindex].ps->gm & MODE_MENU)) = ((ud.show_help == 0 && (!g_netServer && ud.multimode < 2) && !(g_player[myconnectindex].ps->gm & MODE_MENU))
|| (g_netServer || ud.multimode > 1) || (g_netServer || ud.multimode > 1)
@ -6726,8 +6737,6 @@ MAIN_LOOP_RESTART:
if (getrendermode() >= REND_POLYMOST) if (getrendermode() >= REND_POLYMOST)
G_DrawBackground(); G_DrawBackground();
G_DisplayRest(smoothRatio); G_DisplayRest(smoothRatio);
frameWaiting++;
} }
skipframe: skipframe:

View file

@ -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_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_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_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_GameExit(const char *t) ATTRIBUTE((noreturn));
void G_GameQuit(void); void G_GameQuit(void);
void G_GetCrosshairColor(void); void G_GetCrosshairColor(void);

View file

@ -3504,9 +3504,8 @@ nullquote:
time_t timeStruct = time(NULL); time_t timeStruct = time(NULL);
struct tm *pTime = localtime(&timeStruct); struct tm *pTime = localtime(&timeStruct);
Bsnprintf(ud.savegame[requestedSlot], sizeof(ud.savegame[requestedSlot]), strftime(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, "%d %b %Y %I:%M%p", pTime);
pTime->tm_hour, pTime->tm_min, pTime->tm_sec);
} }
continue; continue;

View file

@ -217,11 +217,13 @@ void Net_WaitForServer(void)
{ {
if (quitevent || keystatus[1]) G_GameExit(""); if (quitevent || keystatus[1]) G_GameExit("");
display_betascreen(); if (G_FPSLimit())
{
gametext_center_shade(170, "Waiting for server", 14); display_betascreen();
nextpage(); gametext_center_shade(170, "Waiting for server", 14);
}
// XXX: this looks like something that should be rate limited...
packbuf[0] = PACKET_PLAYER_PING; packbuf[0] = PACKET_PLAYER_PING;
packbuf[1] = myconnectindex; packbuf[1] = myconnectindex;

View file

@ -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) void G_FadePalette(int32_t r, int32_t g, int32_t b, int32_t e)
{ {
int32_t tc;
setpalettefade(r, g, b, e); setpalettefade(r, g, b, e);
nextpage(); nextpage();
tc = totalclock;
int32_t tc = totalclock;
while (totalclock < tc + 4) while (totalclock < tc + 4)
G_HandleAsync(); G_HandleAsync();
} }
@ -1480,7 +1479,6 @@ void G_DisplayLogo(void)
if (logoflags & LOGO_3DRSCREEN) if (logoflags & LOGO_3DRSCREEN)
{ {
if (!I_CheckAllInput() && g_noLogoAnim == 0) if (!I_CheckAllInput() && g_noLogoAnim == 0)
{ {
int32_t i; int32_t i;
@ -1509,21 +1507,23 @@ void G_DisplayLogo(void)
nextpage(); nextpage();
fadepaltile(0, 0, 0, 252, 0, -28, DREALMS); fadepaltile(0, 0, 0, 252, 0, -28, DREALMS);
totalclock = 0; totalclock = 0;
while (totalclock < (120 * 7) && !I_CheckAllInput()) while (totalclock < (120 * 7) && !I_CheckAllInput())
{ {
clearallviews(0); if (G_FPSLimit())
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH);
G_HandleAsync();
if (g_restorePalette)
{ {
P_SetGamePalette(g_player[myconnectindex].ps, g_player[myconnectindex].ps->palette, 0); clearallviews(0);
g_restorePalette = 0; rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH);
G_HandleAsync();
if (g_restorePalette)
{
P_SetGamePalette(g_player[myconnectindex].ps, g_player[myconnectindex].ps->palette, 0);
g_restorePalette = 0;
}
} }
nextpage();
} }
fadepaltile(0, 0, 0, 0, 252, 28, DREALMS); fadepaltile(0, 0, 0, 0, 252, 28, DREALMS);
} }
} }
@ -1556,84 +1556,87 @@ void G_DisplayLogo(void)
#endif #endif
!I_CheckAllInput()) !I_CheckAllInput())
{ {
clearallviews(0); if (G_FPSLimit())
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BETASCREEN, 0, 0, 2+8+64+BGSTRETCH);
if (logoflags & LOGO_DUKENUKEM)
{ {
if (totalclock > 120 && totalclock < (120+60)) clearallviews(0);
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BETASCREEN, 0, 0, 2+8+64+BGSTRETCH);
if (logoflags & LOGO_DUKENUKEM)
{ {
if (soundanm == 0) if (totalclock > 120 && totalclock < (120+60))
{ {
soundanm++; if (soundanm == 0)
S_PlaySound(PIPEBOMB_EXPLODE); {
soundanm++;
S_PlaySound(PIPEBOMB_EXPLODE);
}
rotatesprite_fs(160<<16, 104<<16, (totalclock-120)<<10, 0, DUKENUKEM, 0, 0, 2+8);
} }
rotatesprite_fs(160<<16, 104<<16, (totalclock-120)<<10, 0, DUKENUKEM, 0, 0, 2+8); else if (totalclock >= (120+60))
rotatesprite_fs(160<<16, (104)<<16, 60<<10, 0, DUKENUKEM, 0, 0, 2+8);
} }
else if (totalclock >= (120+60)) else soundanm++;
rotatesprite_fs(160<<16, (104)<<16, 60<<10, 0, DUKENUKEM, 0, 0, 2+8);
}
else soundanm++;
if (logoflags & LOGO_THREEDEE) if (logoflags & LOGO_THREEDEE)
{
if (totalclock > 220 && totalclock < (220+30))
{ {
if (soundanm == 1) if (totalclock > 220 && totalclock < (220+30))
{ {
soundanm++; if (soundanm == 1)
S_PlaySound(PIPEBOMB_EXPLODE); {
} soundanm++;
S_PlaySound(PIPEBOMB_EXPLODE);
}
rotatesprite_fs(160<<16, (104)<<16, 60<<10, 0, DUKENUKEM, 0, 0, 2+8); rotatesprite_fs(160<<16, (104)<<16, 60<<10, 0, DUKENUKEM, 0, 0, 2+8);
rotatesprite_fs(160<<16, (129)<<16, (totalclock - 220)<<11, 0, THREEDEE, 0, 0, 2+8); rotatesprite_fs(160<<16, (129)<<16, (totalclock - 220)<<11, 0, THREEDEE, 0, 0, 2+8);
}
else if (totalclock >= (220+30))
rotatesprite_fs(160<<16, (129)<<16, 30<<11, 0, THREEDEE, 0, 0, 2+8);
} }
else if (totalclock >= (220+30)) else soundanm++;
rotatesprite_fs(160<<16, (129)<<16, 30<<11, 0, THREEDEE, 0, 0, 2+8);
}
else soundanm++;
if (PLUTOPAK && (logoflags & LOGO_PLUTOPAKSPRITE)) if (PLUTOPAK && (logoflags & LOGO_PLUTOPAKSPRITE))
{
// JBF 20030804
if (totalclock >= 280 && totalclock < 395)
{ {
rotatesprite_fs(160<<16, (151)<<16, (410-totalclock)<<12, 0, PLUTOPAKSPRITE+1, (sintable[(totalclock<<4)&2047]>>11), 0, 2+8); // JBF 20030804
if (soundanm == 2) if (totalclock >= 280 && totalclock < 395)
{ {
soundanm++; rotatesprite_fs(160<<16, (151)<<16, (410-totalclock)<<12, 0, PLUTOPAKSPRITE+1, (sintable[(totalclock<<4)&2047]>>11), 0, 2+8);
S_PlaySound(FLY_BY); if (soundanm == 2)
{
soundanm++;
S_PlaySound(FLY_BY);
}
}
else if (totalclock >= 395)
{
if (soundanm == 3)
{
soundanm++;
S_PlaySound(PIPEBOMB_EXPLODE);
}
rotatesprite_fs(160<<16, (151)<<16, 30<<11, 0, PLUTOPAKSPRITE+1, (sintable[(totalclock<<4)&2047]>>11), 0, 2+8);
} }
} }
else if (totalclock >= 395)
{
if (soundanm == 3)
{
soundanm++;
S_PlaySound(PIPEBOMB_EXPLODE);
}
rotatesprite_fs(160<<16, (151)<<16, 30<<11, 0, PLUTOPAKSPRITE+1, (sintable[(totalclock<<4)&2047]>>11), 0, 2+8);
}
}
#ifdef LUNATIC #ifdef LUNATIC
g_elEventError = 0; g_elEventError = 0;
#endif #endif
VM_OnEvent(EVENT_LOGO, -1, screenpeek); VM_OnEvent(EVENT_LOGO, -1, screenpeek);
if (g_restorePalette)
{
P_SetGamePalette(g_player[myconnectindex].ps, g_player[myconnectindex].ps->palette, 0);
g_restorePalette = 0;
}
#ifdef LUNATIC
if (g_elEventError)
break;
#endif
}
G_HandleAsync(); G_HandleAsync();
if (g_restorePalette)
{
P_SetGamePalette(g_player[myconnectindex].ps, g_player[myconnectindex].ps->palette, 0);
g_restorePalette = 0;
}
#ifdef LUNATIC
if (g_elEventError)
break;
#endif
nextpage();
} }
} }
I_ClearAllInput(); I_ClearAllInput();
} }
@ -1707,58 +1710,60 @@ static void G_BonusCutscenes(void)
while (1) while (1)
{ {
clearallviews(0L); if (G_FPSLimit())
rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH);
// boss
if (totalclock > 390 && totalclock < 780)
for (bssize_t t=0; t<35; t+=5) if (bossmove[t+2] && (totalclock%390) > bossmove[t] && (totalclock%390) <= bossmove[t+1])
{
if (t==10 && bonuscnt == 1)
{
S_PlaySound(SHOTGUN_FIRE);
S_PlaySound(SQUISHED);
bonuscnt++;
}
rotatesprite_fs(bossmove[t+3]<<16, bossmove[t+4]<<16, 65536L, 0, bossmove[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH);
}
// Breathe
if (totalclock < 450 || totalclock >= 750)
{ {
int32_t const breathe [] = clearallviews(0L);
{ rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH);
0, 30, VICTORY1+1, 176, 59,
30, 60, VICTORY1+2, 176, 59,
60, 90, VICTORY1+1, 176, 59,
90, 120, 0, 176, 59
};
if (totalclock >= 750) // boss
{ if (totalclock > 390 && totalclock < 780)
rotatesprite_fs(86<<16, 59<<16, 65536L, 0, VICTORY1+8, 0, 0, 2+8+16+64+128+BGSTRETCH); for (bssize_t t=0; t<35; t+=5) if (bossmove[t+2] && (totalclock%390) > bossmove[t] && (totalclock%390) <= bossmove[t+1])
if (totalclock >= 750 && bonuscnt == 2)
{ {
S_PlaySound(DUKETALKTOBOSS); if (t==10 && bonuscnt == 1)
bonuscnt++;
}
}
for (bssize_t t=0; t<20; t+=5)
if (breathe[t+2] && (totalclock%120) > breathe[t] && (totalclock%120) <= breathe[t+1])
{
if (t==5 && bonuscnt == 0)
{ {
S_PlaySound(BOSSTALKTODUKE); S_PlaySound(SHOTGUN_FIRE);
S_PlaySound(SQUISHED);
bonuscnt++; bonuscnt++;
} }
rotatesprite_fs(breathe[t+3]<<16, breathe[t+4]<<16, 65536L, 0, breathe[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH); rotatesprite_fs(bossmove[t+3]<<16, bossmove[t+4]<<16, 65536L, 0, bossmove[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH);
} }
// Breathe
if (totalclock < 450 || totalclock >= 750)
{
int32_t const breathe [] =
{
0, 30, VICTORY1+1, 176, 59,
30, 60, VICTORY1+2, 176, 59,
60, 90, VICTORY1+1, 176, 59,
90, 120, 0, 176, 59
};
if (totalclock >= 750)
{
rotatesprite_fs(86<<16, 59<<16, 65536L, 0, VICTORY1+8, 0, 0, 2+8+16+64+128+BGSTRETCH);
if (totalclock >= 750 && bonuscnt == 2)
{
S_PlaySound(DUKETALKTOBOSS);
bonuscnt++;
}
}
for (bssize_t t=0; t<20; t+=5)
if (breathe[t+2] && (totalclock%120) > breathe[t] && (totalclock%120) <= breathe[t+1])
{
if (t==5 && bonuscnt == 0)
{
S_PlaySound(BOSSTALKTODUKE);
bonuscnt++;
}
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(); G_HandleAsync();
nextpage();
if (I_CheckAllInput()) break; if (I_CheckAllInput()) break;
} }
@ -2168,12 +2173,13 @@ void G_BonusScreen(int32_t bonusonly)
while (totalclock < TICRATE*10) while (totalclock < TICRATE*10)
{ {
G_HandleAsync(); G_HandleAsync();
MUSIC_Update(); MUSIC_Update();
clearallviews(0); if (G_FPSLimit())
G_DisplayMPResultsScreen(); {
nextpage(); clearallviews(0);
G_DisplayMPResultsScreen();
}
if (I_CheckAllInput()) if (I_CheckAllInput())
{ {
@ -2213,238 +2219,239 @@ void G_BonusScreen(int32_t bonusonly)
int32_t yy = 0, zz; int32_t yy = 0, zz;
G_HandleAsync(); G_HandleAsync();
MUSIC_Update(); MUSIC_Update();
if (g_player[myconnectindex].ps->gm&MODE_EOL) if (G_FPSLimit())
{ {
clearallviews(0); if (g_player[myconnectindex].ps->gm&MODE_EOL)
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BONUSSCREEN+gfx_offset, 0, 0, 2+8+64+128+BGSTRETCH);
if (totalclock >= 1000000000 && totalclock < 1000000320)
{ {
switch ((totalclock>>4)%15) 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)
{ {
case 0: switch ((totalclock>>4)%15)
if (bonuscnt == 6)
{ {
bonuscnt++; case 0:
S_PlaySound(SHOTGUN_COCK); if (bonuscnt == 6)
switch (rand()&3)
{ {
case 0: bonuscnt++;
S_PlaySound(BONUS_SPEECH1); S_PlaySound(SHOTGUN_COCK);
break; switch (rand()&3)
case 1: {
S_PlaySound(BONUS_SPEECH2); case 0:
break; S_PlaySound(BONUS_SPEECH1);
case 2: break;
S_PlaySound(BONUS_SPEECH3); case 1:
break; S_PlaySound(BONUS_SPEECH2);
case 3: break;
S_PlaySound(BONUS_SPEECH4); case 2:
break; S_PlaySound(BONUS_SPEECH3);
break;
case 3:
S_PlaySound(BONUS_SPEECH4);
break;
}
} }
case 1:
case 4:
case 5:
rotatesprite_fs(199<<16, 31<<16, 65536L, 0, BONUSSCREEN+3+gfx_offset, 0, 0, 2+8+16+64+128+BGSTRETCH);
break;
case 2:
case 3:
rotatesprite_fs(199<<16, 31<<16, 65536L, 0, BONUSSCREEN+4+gfx_offset, 0, 0, 2+8+16+64+128+BGSTRETCH);
break;
} }
case 1:
case 4:
case 5:
rotatesprite_fs(199<<16, 31<<16, 65536L, 0, BONUSSCREEN+3+gfx_offset, 0, 0, 2+8+16+64+128+BGSTRETCH);
break;
case 2:
case 3:
rotatesprite_fs(199<<16, 31<<16, 65536L, 0, BONUSSCREEN+4+gfx_offset, 0, 0, 2+8+16+64+128+BGSTRETCH);
break;
} }
} else if (totalclock > (10240+120L)) break;
else if (totalclock > (10240+120L)) break; else
else
{
switch ((totalclock>>5)&3)
{ {
case 1: switch ((totalclock>>5)&3)
case 3:
rotatesprite_fs(199<<16, 31<<16, 65536L, 0, BONUSSCREEN+1+gfx_offset, 0, 0, 2+8+16+64+128+BGSTRETCH);
break;
case 2:
rotatesprite_fs(199<<16, 31<<16, 65536L, 0, BONUSSCREEN+2+gfx_offset, 0, 0, 2+8+16+64+128+BGSTRETCH);
break;
}
}
if (lastmapname)
menutext_center(20-6, lastmapname);
menutext_center(36-6, "Completed");
gametext_center_shade(192, "Press any key or button to continue", quotepulseshade);
if (totalclock > (60*3))
{
yy = zz = 59;
gametext(10, yy+9, "Your Time:");
yy+=10;
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
{
if (g_mapInfo[G_LastMapInfoIndex()].partime)
{ {
gametext(10, yy+9, "Par Time:"); case 1:
yy+=10; case 3:
rotatesprite_fs(199<<16, 31<<16, 65536L, 0, BONUSSCREEN+1+gfx_offset, 0, 0, 2+8+16+64+128+BGSTRETCH);
break;
case 2:
rotatesprite_fs(199<<16, 31<<16, 65536L, 0, BONUSSCREEN+2+gfx_offset, 0, 0, 2+8+16+64+128+BGSTRETCH);
break;
} }
if (!NAM_WW2GI && !DUKEBETA && g_mapInfo[G_LastMapInfoIndex()].designertime)
{
// EDuke 2.0 / NAM source suggests "Green Beret's Time:"
gametext(10, yy+9, "3D Realms' Time:");
yy+=10;
}
}
if (ud.playerbest > 0)
{
gametext(10, yy+9, (g_player[myconnectindex].ps->player_par > 0 && g_player[myconnectindex].ps->player_par < ud.playerbest) ? "Prev Best Time:" : "Your Best Time:");
yy += 10;
} }
if (bonuscnt == 0) if (lastmapname)
bonuscnt++; menutext_center(20-6, lastmapname);
menutext_center(36-6, "Completed");
yy = zz; gametext_center_shade(192, "Press any key or button to continue", quotepulseshade);
if (totalclock >(60*4))
if (totalclock > (60*3))
{ {
if (bonuscnt == 1) yy = zz = 59;
{
bonuscnt++; gametext(10, yy+9, "Your Time:");
S_PlaySound(PIPEBOMB_EXPLODE);
}
if (g_player[myconnectindex].ps->player_par > 0)
{
G_PrintYourTime();
gametext_number((320>>2)+71, yy+9, tempbuf);
if (g_player[myconnectindex].ps->player_par < ud.playerbest)
gametext((320>>2)+89+(clockpad*24), yy+9, "New record!");
}
else
gametext_pal((320>>2)+71, yy+9, "Cheated!", 2);
yy+=10; yy+=10;
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0])) if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
{ {
if (g_mapInfo[G_LastMapInfoIndex()].partime) if (g_mapInfo[G_LastMapInfoIndex()].partime)
{ {
G_PrintParTime(); gametext(10, yy+9, "Par Time:");
gametext_number((320>>2)+71, yy+9, tempbuf);
yy+=10; yy+=10;
} }
if (!NAM_WW2GI && !DUKEBETA && g_mapInfo[G_LastMapInfoIndex()].designertime) if (!NAM_WW2GI && !DUKEBETA && g_mapInfo[G_LastMapInfoIndex()].designertime)
{ {
G_PrintDesignerTime(); // EDuke 2.0 / NAM source suggests "Green Beret's Time:"
gametext(10, yy+9, "3D Realms' Time:");
yy+=10;
}
}
if (ud.playerbest > 0)
{
gametext(10, yy+9, (g_player[myconnectindex].ps->player_par > 0 && g_player[myconnectindex].ps->player_par < ud.playerbest) ? "Prev Best Time:" : "Your Best Time:");
yy += 10;
}
if (bonuscnt == 0)
bonuscnt++;
yy = zz;
if (totalclock >(60*4))
{
if (bonuscnt == 1)
{
bonuscnt++;
S_PlaySound(PIPEBOMB_EXPLODE);
}
if (g_player[myconnectindex].ps->player_par > 0)
{
G_PrintYourTime();
gametext_number((320>>2)+71, yy+9, tempbuf);
if (g_player[myconnectindex].ps->player_par < ud.playerbest)
gametext((320>>2)+89+(clockpad*24), yy+9, "New record!");
}
else
gametext_pal((320>>2)+71, yy+9, "Cheated!", 2);
yy+=10;
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
{
if (g_mapInfo[G_LastMapInfoIndex()].partime)
{
G_PrintParTime();
gametext_number((320>>2)+71, yy+9, tempbuf);
yy+=10;
}
if (!NAM_WW2GI && !DUKEBETA && g_mapInfo[G_LastMapInfoIndex()].designertime)
{
G_PrintDesignerTime();
gametext_number((320>>2)+71, yy+9, tempbuf);
yy+=10;
}
}
if (ud.playerbest > 0)
{
G_PrintBestTime();
gametext_number((320>>2)+71, yy+9, tempbuf); gametext_number((320>>2)+71, yy+9, tempbuf);
yy+=10; yy+=10;
} }
} }
if (ud.playerbest > 0)
{
G_PrintBestTime();
gametext_number((320>>2)+71, yy+9, tempbuf);
yy+=10;
}
}
}
zz = yy += 5;
if (totalclock > (60*6))
{
gametext(10, yy+9, "Enemies Killed:");
yy += 10;
gametext(10, yy+9, "Enemies Left:");
yy += 10;
if (bonuscnt == 2)
{
bonuscnt++;
S_PlaySound(FLY_BY);
} }
yy = zz; zz = yy += 5;
if (totalclock > (60*6))
if (totalclock > (60*7))
{ {
if (bonuscnt == 3) gametext(10, yy+9, "Enemies Killed:");
yy += 10;
gametext(10, yy+9, "Enemies Left:");
yy += 10;
if (bonuscnt == 2)
{ {
bonuscnt++; bonuscnt++;
S_PlaySound(PIPEBOMB_EXPLODE); S_PlaySound(FLY_BY);
} }
Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->actors_killed);
gametext_number((320>>2)+70, yy+9, tempbuf); yy = zz;
yy += 10;
if (ud.player_skill > 3) if (totalclock > (60*7))
{ {
gametext((320>>2)+70, yy+9, "N/A"); if (bonuscnt == 3)
yy += 10; {
} bonuscnt++;
else S_PlaySound(PIPEBOMB_EXPLODE);
{ }
if ((g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed) < 0) Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->actors_killed);
Bsprintf(tempbuf, "%-3d", 0);
else Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed);
gametext_number((320>>2)+70, yy+9, tempbuf); gametext_number((320>>2)+70, yy+9, tempbuf);
yy += 10; yy += 10;
if (ud.player_skill > 3)
{
gametext((320>>2)+70, yy+9, "N/A");
yy += 10;
}
else
{
if ((g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed) < 0)
Bsprintf(tempbuf, "%-3d", 0);
else Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed);
gametext_number((320>>2)+70, yy+9, tempbuf);
yy += 10;
}
} }
} }
}
zz = yy += 5; zz = yy += 5;
if (totalclock > (60*9)) if (totalclock > (60*9))
{
gametext(10, yy+9, "Secrets Found:");
yy += 10;
gametext(10, yy+9, "Secrets Missed:");
yy += 10;
if (bonuscnt == 4) bonuscnt++;
yy = zz;
if (totalclock > (60*10))
{ {
if (bonuscnt == 5) gametext(10, yy+9, "Secrets Found:");
yy += 10;
gametext(10, yy+9, "Secrets Missed:");
yy += 10;
if (bonuscnt == 4) bonuscnt++;
yy = zz;
if (totalclock > (60*10))
{ {
bonuscnt++; if (bonuscnt == 5)
S_PlaySound(PIPEBOMB_EXPLODE); {
} bonuscnt++;
Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->secret_rooms); S_PlaySound(PIPEBOMB_EXPLODE);
gametext_number((320>>2)+70, yy+9, tempbuf); }
yy += 10; Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->secret_rooms);
gametext_number((320>>2)+70, yy+9, tempbuf);
yy += 10;
#if 0 #if 0
// Always overwritten. // Always overwritten.
if (g_player[myconnectindex].ps->secret_rooms > 0) if (g_player[myconnectindex].ps->secret_rooms > 0)
Bsprintf(tempbuf, "%-3d%%", (100*g_player[myconnectindex].ps->secret_rooms/g_player[myconnectindex].ps->max_secret_rooms)); Bsprintf(tempbuf, "%-3d%%", (100*g_player[myconnectindex].ps->secret_rooms/g_player[myconnectindex].ps->max_secret_rooms));
#endif #endif
Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->max_secret_rooms-g_player[myconnectindex].ps->secret_rooms); Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->max_secret_rooms-g_player[myconnectindex].ps->secret_rooms);
gametext_number((320>>2)+70, yy+9, tempbuf); gametext_number((320>>2)+70, yy+9, tempbuf);
yy += 10; yy += 10;
} }
} }
if (totalclock > 10240 && totalclock < 10240+10240) if (totalclock > 10240 && totalclock < 10240+10240)
totalclock = 1024; totalclock = 1024;
if (I_CheckAllInput() && totalclock >(60*2)) // JBF 20030809 if (I_CheckAllInput() && totalclock >(60*2)) // JBF 20030809
{
I_ClearAllInput();
if (totalclock < (60*13))
{ {
KB_FlushKeyboardQueue(); I_ClearAllInput();
totalclock = (60*13); if (totalclock < (60*13))
{
KB_FlushKeyboardQueue();
totalclock = (60*13);
}
else if (totalclock < 1000000000)
totalclock = 1000000000;
} }
else if (totalclock < 1000000000)
totalclock = 1000000000;
} }
else
break;
} }
else
break;
VM_OnEvent(EVENT_DISPLAYBONUSSCREEN, g_player[screenpeek].ps->i, screenpeek); VM_OnEvent(EVENT_DISPLAYBONUSSCREEN, g_player[screenpeek].ps->i, screenpeek);
nextpage(); nextpage();

View file

@ -42,3 +42,5 @@ extern sprstat_t g_spriteStat;
extern int32_t dr_yxaspect, dr_viewingrange; extern int32_t dr_yxaspect, dr_viewingrange;
extern int32_t g_noLogoAnim, g_noLogo; extern int32_t g_noLogoAnim, g_noLogo;
extern void G_FadePalette(int32_t r, int32_t g, int32_t b, int32_t e);