diff --git a/src/d_main.c b/src/d_main.c index 9ffed4461..475aa6531 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -180,6 +180,9 @@ void D_ProcessEvents(void) if (M_ScreenshotResponder(ev)) continue; // ate the event + if (WipeStageTitle) + continue; + if (gameaction == ga_nothing && gamestate == GS_TITLESCREEN) { if (cht_Responder(ev)) @@ -440,7 +443,7 @@ static void D_Display(void) { lt_ticker--; lt_lasttic = lt_ticker; - ST_preLevelTitleCardLoop(0, false); + ST_preLevelTitleCardDrawer(0, false); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); F_WipeStartScreen(); } diff --git a/src/g_game.c b/src/g_game.c index 2119c3fe0..3b38c367d 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1703,6 +1703,50 @@ void G_DoLoadLevel(boolean resetplayer) CON_ClearHUD(); } +// +// Start the title card. +// +void G_StartTitleCard(void) +{ + // clear the hud + CON_ClearHUD(); + + // prepare status bar + ST_startTitleCard(); + + // start the title card + WipeStageTitle = (!titlemapinaction); +} + +// +// Run the title card before fading in to the level. +// +void G_PreLevelTitleCard(tic_t ticker, boolean update) +{ + tic_t starttime = I_GetTime(); + tic_t endtime = starttime + (PRELEVELTIME*NEWTICRATERATIO); + tic_t nowtime = starttime; + tic_t lasttime = starttime; + while (nowtime < endtime) + { + // draw loop + while (!((nowtime = I_GetTime()) - lasttime)) + I_Sleep(); + lasttime = nowtime; + + // Run some bullshit whatever + D_ProcessEvents(); + + ST_runTitleCard(); + ST_preLevelTitleCardDrawer(ticker, update); + + if (moviemode) + M_SaveFrame(); + if (takescreenshot) // Only take screenshots after drawing. + M_DoScreenShot(); + } +} + INT32 pausedelay = 0; boolean pausebreakkey = false; static INT32 camtoggledelay, camtoggledelay2 = 0; diff --git a/src/g_game.h b/src/g_game.h index 2489ff097..782b8ff5e 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -140,7 +140,8 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost); void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, boolean SSSG, boolean FLS); void G_DoLoadLevel(boolean resetplayer); - +void G_StartTitleCard(void); +void G_PreLevelTitleCard(tic_t ticker, boolean update); void G_DeferedPlayDemo(const char *demo); // Can be called by the startup code or M_Responder, calls P_SetupLevel. diff --git a/src/p_setup.c b/src/p_setup.c index 21c24e2f4..f143193c9 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3227,8 +3227,9 @@ boolean P_SetupLevel(boolean skipprecip) } // Stage title! - WipeStageTitle = (!titlemapinaction); - ST_startTitleCard(); + G_StartTitleCard(); + + // Can the title card actually run, though? if (rendermode != render_none && WipeStageTitle && ranspecialwipe != 2 @@ -3237,10 +3238,7 @@ boolean P_SetupLevel(boolean skipprecip) && LUA_HudEnabled(hud_stagetitle) #endif ) - { - ST_runTitleCard(); - ST_runPreLevelTitleCard(lt_ticker, true); - } + G_PreLevelTitleCard(lt_ticker, true); return true; } diff --git a/src/st_stuff.c b/src/st_stuff.c index 74e9d40da..c555c8b66 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -23,6 +23,7 @@ #include "v_video.h" #include "z_zone.h" #include "hu_stuff.h" +#include "console.h" #include "s_sound.h" #include "i_system.h" #include "m_menu.h" @@ -1197,7 +1198,10 @@ static void ST_cacheLevelTitle(void) // void ST_startTitleCard(void) { + // cache every HUD patch used ST_cacheLevelTitle(); + + // initialize HUD variables lt_ticker = lt_exitticker = lt_lasttic = 0; lt_endtime = 2*TICRATE; lt_scroll = BASEVIDWIDTH * FRACUNIT; @@ -1323,9 +1327,9 @@ void ST_drawTitleCard(void) } // -// Drawer for ST_runPreLevelTitleCard. +// Drawer for G_PreLevelTitleCard. // -void ST_preLevelTitleCardLoop(tic_t ticker, boolean update) +void ST_preLevelTitleCardDrawer(tic_t ticker, boolean update) { V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); if (ticker < PRELEVELTIME-1) @@ -1335,34 +1339,11 @@ void ST_preLevelTitleCardLoop(tic_t ticker, boolean update) I_UpdateNoBlit(); if (update) I_FinishUpdate(); // page flip or blit buffer - - if (moviemode) // make sure we save frames for the white hold too - M_SaveFrame(); -} - -// -// Run the title card before fading in to the level. -// -void ST_runPreLevelTitleCard(tic_t ticker, boolean update) -{ - tic_t starttime = I_GetTime(); - tic_t endtime = starttime + (PRELEVELTIME*NEWTICRATERATIO); - tic_t nowtime = starttime; - tic_t lasttime = starttime; - while (nowtime < endtime) - { - // draw loop - while (!((nowtime = I_GetTime()) - lasttime)) - I_Sleep(); - lasttime = nowtime; - ST_runTitleCard(); - ST_preLevelTitleCardLoop(ticker, update); - } } // // Draw the title card while on a wipe. -// Also used in ST_runPreLevelTitleCard. +// Also used in G_PreLevelTitleCard. // void ST_drawWipeTitleCard(void) { @@ -1375,6 +1356,12 @@ void ST_drawWipeTitleCard(void) ST_preDrawTitleCard(); ST_drawTitleCard(); } + + // Draw on top of the title card, + // which is already on top of the wipe + // What a mess + CON_Drawer(); + M_Drawer(); } static void ST_drawPowerupHUD(void) diff --git a/src/st_stuff.h b/src/st_stuff.h index 5897a48b0..7130855c6 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -52,8 +52,7 @@ void ST_startTitleCard(void); void ST_preDrawTitleCard(void); void ST_runTitleCard(void); void ST_drawTitleCard(void); -void ST_preLevelTitleCardLoop(tic_t ticker, boolean update); -void ST_runPreLevelTitleCard(tic_t ticker, boolean update); +void ST_preLevelTitleCardDrawer(tic_t ticker, boolean update); void ST_drawWipeTitleCard(void); extern tic_t lt_ticker, lt_lasttic;