diff --git a/src/d_main.c b/src/d_main.c index ebc618be8..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)) @@ -435,6 +438,15 @@ static void D_Display(void) if (rendermode != render_none) { F_WipeEndScreen(); + // Funny. + if (WipeStageTitle && st_overlay) + { + lt_ticker--; + lt_lasttic = lt_ticker; + ST_preLevelTitleCardDrawer(0, false); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); + F_WipeStartScreen(); + } F_RunWipe(wipetypepost, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN); } @@ -444,7 +456,7 @@ static void D_Display(void) framecount = 0; demostarttime = I_GetTime(); } - + wipetypepost = -1; } else diff --git a/src/dehacked.c b/src/dehacked.c index 164002ad1..be897b952 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1575,6 +1575,20 @@ static void readlevelheader(MYFILE *f, INT32 num) else mapheaderinfo[num-1]->levelflags &= ~LF_MIXNIGHTSCOUNTDOWN; } + else if (fastcmp(word, "WARNINGTITLE")) + { + if (i || word2[0] == 'T' || word2[0] == 'Y') + mapheaderinfo[num-1]->levelflags |= LF_WARNINGTITLE; + else + mapheaderinfo[num-1]->levelflags &= ~LF_WARNINGTITLE; + } + else if (fastcmp(word, "NOTITLECARD")) + { + if (i || word2[0] == 'T' || word2[0] == 'Y') + mapheaderinfo[num-1]->levelflags |= LF_NOTITLECARD; + else + mapheaderinfo[num-1]->levelflags &= ~LF_NOTITLECARD; + } // Individual triggers for menu flags else if (fastcmp(word, "HIDDEN")) @@ -9017,6 +9031,8 @@ struct { {"LF_NOZONE",LF_NOZONE}, {"LF_SAVEGAME",LF_SAVEGAME}, {"LF_MIXNIGHTSCOUNTDOWN",LF_MIXNIGHTSCOUNTDOWN}, + {"LF_NOTITLECARD",LF_NOTITLECARD}, + {"LF_WARNINGTITLE",LF_WARNINGTITLE}, // And map flags {"LF2_HIDEINMENU",LF2_HIDEINMENU}, {"LF2_HIDEINSTATS",LF2_HIDEINSTATS}, diff --git a/src/doomstat.h b/src/doomstat.h index 7d06f03e2..84939a8db 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -349,6 +349,8 @@ typedef struct #define LF_NOZONE 16 ///< Don't include "ZONE" on level title #define LF_SAVEGAME 32 ///< Save the game upon loading this level #define LF_MIXNIGHTSCOUNTDOWN 64 ///< Play sfx_timeup instead of music change for NiGHTS countdown +#define LF_WARNINGTITLE 128 ///< WARNING! WARNING! WARNING! WARNING! +#define LF_NOTITLECARD 256 ///< Don't start the title card #define LF2_HIDEINMENU 1 ///< Hide in the multiplayer menu #define LF2_HIDEINSTATS 2 ///< Hide in the statistics screen diff --git a/src/f_finale.h b/src/f_finale.h index 3fa7106a9..a2a96f2de 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -141,8 +141,13 @@ void F_MenuPresTicker(boolean run); #define FORCEWIPEOFF -2 extern boolean WipeInAction; +extern boolean WipeStageTitle; extern INT32 lastwipetic; +// Don't know where else to place this constant +// But this file seems appropriate +#define PRELEVELTIME 24 // frames in tics + void F_WipeStartScreen(void); void F_WipeEndScreen(void); void F_RunWipe(UINT8 wipetype, boolean drawMenu); diff --git a/src/f_wipe.c b/src/f_wipe.c index 05229f844..d3786c69f 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -18,6 +18,7 @@ #include "r_draw.h" // transtable #include "p_pspr.h" // tr_transxxx +#include "st_stuff.h" #include "w_wad.h" #include "z_zone.h" @@ -31,6 +32,10 @@ #include "hardware/hw_main.h" #endif +#ifdef HAVE_BLUA +#include "lua_hud.h" +#endif + #if NUMSCREENS < 5 #define NOWIPE // do not enable wipe image post processing for ARM, SH and MIPS CPUs #endif @@ -82,6 +87,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = { //-------------------------------------------------------------------------- boolean WipeInAction = false; +boolean WipeStageTitle = false; INT32 lastwipetic = 0; #ifndef NOWIPE @@ -366,6 +372,16 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu) else #endif F_DoWipe(fmask); + + // draw level title + if ((WipeStageTitle && st_overlay) + && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD) + && *mapheaderinfo[gamemap-1]->lvlttl != '\0') + { + ST_runTitleCard(); + ST_drawWipeTitleCard(); + } + I_OsPolling(); I_UpdateNoBlit(); @@ -377,7 +393,9 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu) if (moviemode) M_SaveFrame(); } + WipeInAction = false; + WipeStageTitle = false; #endif } diff --git a/src/g_game.c b/src/g_game.c index a41188ace..a0d8d5954 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -47,6 +47,10 @@ #include "m_cond.h" // condition sets #include "md5.h" // demo checksums +#ifdef HAVE_BLUA +#include "lua_hud.h" +#endif + gameaction_t gameaction; gamestate_t gamestate = GS_NULL; UINT8 ultimatemode = false; @@ -1703,6 +1707,58 @@ void G_DoLoadLevel(boolean resetplayer) CON_ClearHUD(); } +// +// Start the title card. +// +void G_StartTitleCard(void) +{ + // The title card has been disabled for this map. + // Oh well. + if (mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD) + { + WipeStageTitle = false; + return; + } + + // 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; @@ -1992,7 +2048,7 @@ void G_Ticker(boolean run) if (titledemo) F_TitleDemoTicker(); P_Ticker(run); // tic the game - ST_Ticker(); + ST_Ticker(run); F_TextPromptTicker(); AM_Ticker(); HU_Ticker(); diff --git a/src/g_game.h b/src/g_game.h index 43f651bd7..87232c823 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/hardware/hw_draw.c b/src/hardware/hw_draw.c index e493dafac..4519e1280 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -380,9 +380,9 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t { FSurfaceInfo Surf; Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0xff; - if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value]; - else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[cv_translucenthud.value]; - else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value]; + if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[st_translucency]; + else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[st_translucency]; + else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[st_translucency]; else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel]; flags |= PF_Modulated; HWD.pfnDrawPolygon(&Surf, v, 4, flags); @@ -538,9 +538,9 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal { FSurfaceInfo Surf; Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0xff; - if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value]; - else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[cv_translucenthud.value]; - else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value]; + if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[st_translucency]; + else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[st_translucency]; + else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[st_translucency]; else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel]; flags |= PF_Modulated; HWD.pfnDrawPolygon(&Surf, v, 4, flags); diff --git a/src/lua_hud.h b/src/lua_hud.h index 7f928f7c4..d1adef7dc 100644 --- a/src/lua_hud.h +++ b/src/lua_hud.h @@ -43,3 +43,4 @@ boolean LUA_HudEnabled(enum hud option); void LUAh_GameHUD(player_t *stplyr); void LUAh_ScoresHUD(void); void LUAh_TitleHUD(void); +void LUAh_TitleCardHUD(player_t *stplyr); diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 62be61283..9b12dd3c0 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -92,12 +92,14 @@ static const char *const patch_opt[] = { enum hudhook { hudhook_game = 0, hudhook_scores, - hudhook_title + hudhook_title, + hudhook_titlecard }; static const char *const hudhook_opt[] = { "game", "scores", "title", + "titlecard", NULL}; // alignment types for v.drawString @@ -910,9 +912,17 @@ static int libd_RandomChance(lua_State *L) return 1; } -// 30/10/18 Lat': Get cv_translucenthud's value for HUD rendering as a normal V_xxTRANS int +// 30/10/18 Lat': Get st_translucency's value for HUD rendering as a normal V_xxTRANS int // Could as well be thrown in global vars for ease of access but I guess it makes sense for it to be a HUD fn static int libd_getlocaltransflag(lua_State *L) +{ + HUDONLY + lua_pushinteger(L, (10-st_translucency)*V_10TRANS); + return 1; +} + +// Get cv_translucenthud's value for HUD rendering as a normal V_xxTRANS int +static int libd_getusertransflag(lua_State *L) { HUDONLY lua_pushinteger(L, (10-cv_translucenthud.value)*V_10TRANS); // A bit weird that it's called "translucenthud" yet 10 is fully opaque :V @@ -954,6 +964,7 @@ static luaL_Reg lib_draw[] = { {"dupy", libd_dupy}, {"renderer", libd_renderer}, {"localTransFlag", libd_getlocaltransflag}, + {"userTransFlag", libd_getusertransflag}, {NULL, NULL} }; @@ -1043,6 +1054,9 @@ int LUA_HudLib(lua_State *L) lua_newtable(L); lua_rawseti(L, -2, 4); // HUD[3] = title rendering functions array + + lua_newtable(L); + lua_rawseti(L, -2, 5); // HUD[4] = title card rendering functions array lua_setfield(L, LUA_REGISTRYINDEX, "HUD"); luaL_newmetatable(L, META_HUDINFO); @@ -1180,4 +1194,38 @@ void LUAh_TitleHUD(void) hud_running = false; } +void LUAh_TitleCardHUD(player_t *stplayr) +{ + if (!gL || !(hudAvailable & (1<lvlttl != '\0' -#ifdef HAVE_BLUA - && LUA_HudEnabled(hud_stagetitle) -#endif - ) - { - tic_t starttime = I_GetTime(); - tic_t endtime = starttime + (10*NEWTICRATERATIO); - tic_t nowtime = starttime; - tic_t lasttime = starttime; - while (nowtime < endtime) - { - // draw loop - while (!((nowtime = I_GetTime()) - lasttime)) - I_Sleep(); - lasttime = nowtime; + // No render mode, stop here. + if (rendermode == render_none) + return true; - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); - stplyr = &players[consoleplayer]; - ST_drawLevelTitle(nowtime - starttime); - if (splitscreen) - { - stplyr = &players[secondarydisplayplayer]; - ST_drawLevelTitle(nowtime - starttime); - } + // Title card! + G_StartTitleCard(); - I_OsPolling(); - I_UpdateNoBlit(); - I_FinishUpdate(); // page flip or blit buffer + // Can the title card actually run, though? + if (!WipeStageTitle) + return true; + if (ranspecialwipe == 2) + return true; - if (moviemode) // make sure we save frames for the white hold too - M_SaveFrame(); - } - } + // If so... + if ((!(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)) && (*mapheaderinfo[gamemap-1]->lvlttl != '\0')) + G_PreLevelTitleCard(lt_ticker, true); return true; } diff --git a/src/st_stuff.c b/src/st_stuff.c index 78ef1b958..a4c5246cb 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" @@ -186,14 +187,18 @@ boolean ST_SameTeam(player_t *a, player_t *b) static boolean st_stopped = true; -void ST_Ticker(void) +void ST_Ticker(boolean run) { if (st_stopped) return; + + if (run) + ST_runTitleCard(); } // 0 is default, any others are special palettes. INT32 st_palette = 0; +INT32 st_translucency = 0; void ST_doPaletteStuff(void) { @@ -818,7 +823,7 @@ static void ST_drawLivesArea(void) face = superprefix[stplyr->skin]; V_DrawSmallMappedPatch(hudinfo[HUD_LIVES].x, hudinfo[HUD_LIVES].y, hudinfo[HUD_LIVES].f|V_PERPLAYER|V_HUDTRANS, face, colormap); - if (cv_translucenthud.value == 10 && stplyr->powers[pw_super] == 1 && stplyr->mo->tracer) + if (st_translucency == 10 && stplyr->powers[pw_super] == 1 && stplyr->mo->tracer) { INT32 v_supertrans = (stplyr->mo->tracer->frame & FF_TRANSMASK) >> FF_TRANSSHIFT; if (v_supertrans < 10) @@ -1160,16 +1165,142 @@ static void ST_drawInput(void) V_DrawThinString(x, y, hudinfo[HUD_LIVES].f|((leveltime & 4) ? V_YELLOWMAP : V_REDMAP), "BAD DEMO!!"); } -void ST_drawLevelTitle(tic_t titletime) +static patch_t *lt_patches[3]; +static INT32 lt_scroll = 0; +static INT32 lt_mom = 0; +static INT32 lt_zigzag = 0; + +tic_t lt_ticker = 0, lt_lasttic = 0; +tic_t lt_exitticker = 0, lt_endtime = 0; + +// +// Load the graphics for the title card. +// +static void ST_cacheLevelTitle(void) +{ + if (!(mapheaderinfo[gamemap-1]->levelflags & LF_WARNINGTITLE)) + { + lt_patches[0] = (patch_t *)W_CachePatchName("LTACTBLU", PU_HUDGFX); + lt_patches[1] = (patch_t *)W_CachePatchName("LTZIGZAG", PU_HUDGFX); + lt_patches[2] = (patch_t *)W_CachePatchName("LTZZTEXT", PU_HUDGFX); + } + else // boss map + { + lt_patches[0] = (patch_t *)W_CachePatchName("LTACTRED", PU_HUDGFX); + lt_patches[1] = (patch_t *)W_CachePatchName("LTZIGRED", PU_HUDGFX); + lt_patches[2] = (patch_t *)W_CachePatchName("LTZZWARN", PU_HUDGFX); + } +} + +// +// Start the title card. +// +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; + lt_zigzag = -((lt_patches[1])->width * FRACUNIT); + lt_mom = 0; +} + +// +// What happens before drawing the title card. +// Which is just setting the HUD translucency. +// +void ST_preDrawTitleCard(void) +{ + if (lt_ticker >= (lt_endtime + TICRATE)) + return; + + if (!lt_exitticker) + st_translucency = 0; + else + st_translucency = max(0, min((INT32)lt_exitticker-4, cv_translucenthud.value)); +} + +// +// Run the title card. +// Called from ST_Ticker. +// +void ST_runTitleCard(void) +{ + if (lt_ticker >= (lt_endtime + TICRATE)) + return; + + if (!(paused || P_AutoPause())) + { + // tick + lt_ticker++; + if (lt_ticker >= lt_endtime) + lt_exitticker++; + + // scroll to screen (level title) + if (!lt_exitticker) + { + if (abs(lt_scroll) > FRACUNIT) + lt_scroll -= (lt_scroll>>2); + else + lt_scroll = 0; + } + // scroll away from screen (level title) + else + { + lt_mom -= FRACUNIT*6; + lt_scroll += lt_mom; + } + + // scroll to screen (zigzag) + if (!lt_exitticker) + { + if (abs(lt_zigzag) > FRACUNIT) + lt_zigzag -= (lt_zigzag>>2); + else + lt_zigzag = 0; + } + // scroll away from screen (zigzag) + else + lt_zigzag += lt_mom; + } +} + +// +// Draw the title card itself. +// +void ST_drawTitleCard(void) { char *lvlttl = mapheaderinfo[gamemap-1]->lvlttl; char *subttl = mapheaderinfo[gamemap-1]->subttl; INT32 actnum = mapheaderinfo[gamemap-1]->actnum; - INT32 lvlttly, zoney, lvlttlxpos, ttlnumxpos, zonexpos; + INT32 lvlttlxpos, ttlnumxpos, zonexpos; INT32 subttlxpos = BASEVIDWIDTH/2; + INT32 ttlscroll = FixedInt(lt_scroll); + INT32 zzticker; + patch_t *actpat, *zigzag, *zztext; - if (!(titletime > 2 && titletime-3 < 110)) +#ifdef HAVE_BLUA + if (!LUA_HudEnabled(hud_stagetitle)) + goto luahook; +#endif + + if (lt_ticker >= (lt_endtime + TICRATE)) +#ifdef HAVE_BLUA + goto luahook; +#else return; +#endif + + if ((lt_ticker-lt_lasttic) > 1) + lt_ticker = lt_lasttic+1; + + ST_cacheLevelTitle(); + actpat = lt_patches[0]; + zigzag = lt_patches[1]; + zztext = lt_patches[2]; lvlttlxpos = ((BASEVIDWIDTH/2) - (V_LevelNameWidth(lvlttl)/2)); @@ -1183,66 +1314,65 @@ void ST_drawLevelTitle(tic_t titletime) if (lvlttlxpos < 0) lvlttlxpos = 0; -#if 0 // toaster's experiment. srb2&toast.exe one day, maybe? Requires stuff below to be converted to fixed point. -#define MIDTTLY 79 -#define MIDZONEY 105 -#define MIDDIFF 4 - - if (titletime < 10) + if (!splitscreen || (splitscreen && stplyr == &players[displayplayer])) { - fixed_t z = ((titletime - 3)<height, V_SNAPTOTOP|V_SNAPTOLEFT, zigzag); + V_DrawScaledPatch(FixedInt(lt_zigzag), (zigzag->height-zzticker) % zigzag->height, V_SNAPTOTOP|V_SNAPTOLEFT, zigzag); + V_DrawScaledPatch(FixedInt(lt_zigzag), (-zigzag->height+zzticker) % zztext->height, V_SNAPTOTOP|V_SNAPTOLEFT, zztext); + V_DrawScaledPatch(FixedInt(lt_zigzag), (zzticker) % zztext->height, V_SNAPTOTOP|V_SNAPTOLEFT, zztext); } - else if (titletime < 105) - { - fixed_t z = (((titletime - 10)*MIDDIFF)<<(FRACBITS+1))/95; - zoney = ((MIDZONEY + MIDDIFF)<levelflags & LF_NOZONE)) - V_DrawLevelTitle(zonexpos, zoney, V_PERPLAYER, M_GetText("Zone")); + V_DrawLevelTitle(zonexpos + ttlscroll, 104, V_PERPLAYER, M_GetText("Zone")); + V_DrawCenteredString(subttlxpos - ttlnumxpos, 128, V_PERPLAYER|V_ALLOWLOWERCASE, subttl); - if (lvlttly+48 < 200) - V_DrawCenteredString(subttlxpos, lvlttly+48, V_PERPLAYER|V_ALLOWLOWERCASE, subttl); + lt_lasttic = lt_ticker; + +#ifdef HAVE_BLUA +luahook: + LUAh_TitleCardHUD(stplyr); +#endif +} + +// +// Drawer for G_PreLevelTitleCard. +// +void ST_preLevelTitleCardDrawer(tic_t ticker, boolean update) +{ + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); + if (ticker < PRELEVELTIME-1) + ST_drawWipeTitleCard(); + + I_OsPolling(); + I_UpdateNoBlit(); + if (update) + I_FinishUpdate(); // page flip or blit buffer +} + +// +// Draw the title card while on a wipe. +// Also used in G_PreLevelTitleCard. +// +void ST_drawWipeTitleCard(void) +{ + stplyr = &players[consoleplayer]; + ST_preDrawTitleCard(); + ST_drawTitleCard(); + if (splitscreen) + { + stplyr = &players[secondarydisplayplayer]; + ST_preDrawTitleCard(); + ST_drawTitleCard(); + } } static void ST_drawPowerupHUD(void) @@ -2394,12 +2524,25 @@ static void ST_doItemFinderIconsAndSound(void) S_StartSound(NULL, sfx_emfind); } +// // Draw the status bar overlay, customisable: the user chooses which // kind of information to overlay // static void ST_overlayDrawer(void) { - //hu_showscores = auto hide score/time/rings when tab rankings are shown + // Decide whether to draw the stage title or not + boolean stagetitle = false; + + // Check for a valid level title + // If the HUD is enabled + // And, if Lua is running, if the HUD library has the stage title enabled + if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD) && *mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer))) + { + stagetitle = true; + ST_preDrawTitleCard(); + } + + // hu_showscores = auto hide score/time/rings when tab rankings are shown if (!(hu_showscores && (netgame || multiplayer))) { if ((maptol & TOL_NIGHTS || G_IsSpecialStage(gamemap)) && @@ -2550,12 +2693,8 @@ static void ST_overlayDrawer(void) #endif // draw level title Tails - if (*mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer)) -#ifdef HAVE_BLUA - && LUA_HudEnabled(hud_stagetitle) -#endif - ) - ST_drawLevelTitle(timeinmap+70); + if (stagetitle && (!WipeInAction) && (!WipeStageTitle)) + ST_drawTitleCard(); if (!hu_showscores && (netgame || multiplayer) #ifdef HAVE_BLUA @@ -2631,6 +2770,8 @@ void ST_Drawer(void) } } + st_translucency = cv_translucenthud.value; + if (st_overlay) { // No deadview! diff --git a/src/st_stuff.h b/src/st_stuff.h index aaf01ca15..33ffa957a 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -24,7 +24,7 @@ // // Called by main loop. -void ST_Ticker(void); +void ST_Ticker(boolean run); // Called by main loop. void ST_Drawer(void); @@ -47,8 +47,16 @@ void ST_ReloadSkinFaceGraphics(void); void ST_doPaletteStuff(void); -// level title draw -void ST_drawLevelTitle(tic_t titletime); +// title card +void ST_startTitleCard(void); +void ST_runTitleCard(void); +void ST_drawTitleCard(void); +void ST_preDrawTitleCard(void); +void ST_preLevelTitleCardDrawer(tic_t ticker, boolean update); +void ST_drawWipeTitleCard(void); + +extern tic_t lt_ticker, lt_lasttic; +extern tic_t lt_exitticker, lt_endtime; // return if player a is in the same team as player b boolean ST_SameTeam(player_t *a, player_t *b); @@ -59,6 +67,7 @@ boolean ST_SameTeam(player_t *a, player_t *b); extern boolean st_overlay; // sb overlay on or off when fullscreen extern INT32 st_palette; // 0 is default, any others are special palettes. +extern INT32 st_translucency; extern lumpnum_t st_borderpatchnum; // patches, also used in intermission diff --git a/src/v_video.c b/src/v_video.c index de03fdfc4..58244531e 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -18,6 +18,7 @@ #include "p_local.h" // stplyr #include "g_game.h" // players #include "v_video.h" +#include "st_stuff.h" #include "hu_stuff.h" #include "r_draw.h" #include "console.h" @@ -574,11 +575,11 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT))) { if (alphalevel == 13) - alphalevel = hudminusalpha[cv_translucenthud.value]; + alphalevel = hudminusalpha[st_translucency]; else if (alphalevel == 14) - alphalevel = 10 - cv_translucenthud.value; + alphalevel = 10 - st_translucency; else if (alphalevel == 15) - alphalevel = hudplusalpha[cv_translucenthud.value]; + alphalevel = hudplusalpha[st_translucency]; if (alphalevel >= 10) return; // invis @@ -874,11 +875,11 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_ if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT))) { if (alphalevel == 13) - alphalevel = hudminusalpha[cv_translucenthud.value]; + alphalevel = hudminusalpha[st_translucency]; else if (alphalevel == 14) - alphalevel = 10 - cv_translucenthud.value; + alphalevel = 10 - st_translucency; else if (alphalevel == 15) - alphalevel = hudplusalpha[cv_translucenthud.value]; + alphalevel = hudplusalpha[st_translucency]; if (alphalevel >= 10) return; // invis @@ -1393,11 +1394,11 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT))) { if (alphalevel == 13) - alphalevel = hudminusalpha[cv_translucenthud.value]; + alphalevel = hudminusalpha[st_translucency]; else if (alphalevel == 14) - alphalevel = 10 - cv_translucenthud.value; + alphalevel = 10 - st_translucency; else if (alphalevel == 15) - alphalevel = hudplusalpha[cv_translucenthud.value]; + alphalevel = hudplusalpha[st_translucency]; if (alphalevel >= 10) return; // invis @@ -2964,7 +2965,7 @@ INT32 V_LevelNameHeight(const char *string) return w; } -// For ST_drawLevelTitle +// For ST_drawTitleCard // Returns the width of the act num patch INT32 V_LevelActNumWidth(INT32 num) {