Merge branch 'titlecard-options' into 'next'

Allow more options for when the titlecard shows up

See merge request STJr/SRB2!765
This commit is contained in:
James R 2020-02-18 21:52:03 -05:00
commit 2d8522b9ec
5 changed files with 48 additions and 13 deletions

View File

@ -1806,6 +1806,24 @@ static void readlevelheader(MYFILE *f, INT32 num)
else
mapheaderinfo[num-1]->levelflags &= ~LF_NOTITLECARD;
}
else if (fastcmp(word, "SHOWTITLECARDFOR"))
{
mapheaderinfo[num-1]->levelflags |= LF_NOTITLECARD;
tmp = strtok(word2,",");
do {
if (fastcmp(tmp, "FIRST"))
mapheaderinfo[num-1]->levelflags &= ~LF_NOTITLECARDFIRST;
else if (fastcmp(tmp, "RESPAWN"))
mapheaderinfo[num-1]->levelflags &= ~LF_NOTITLECARDRESPAWN;
else if (fastcmp(tmp, "RECORDATTACK"))
mapheaderinfo[num-1]->levelflags &= ~LF_NOTITLECARDRECORDATTACK;
else if (fastcmp(tmp, "ALL"))
mapheaderinfo[num-1]->levelflags &= ~LF_NOTITLECARD;
else if (!fastcmp(tmp, "NONE"))
deh_warning("Level header %d: unknown titlecard show option %s\n", num, tmp);
} while((tmp = strtok(NULL,",")) != NULL);
}
// Individual triggers for menu flags
else if (fastcmp(word, "HIDDEN"))
@ -9353,6 +9371,9 @@ struct {
{"LF_NOZONE",LF_NOZONE},
{"LF_SAVEGAME",LF_SAVEGAME},
{"LF_MIXNIGHTSCOUNTDOWN",LF_MIXNIGHTSCOUNTDOWN},
{"LF_NOTITLECARDFIRST",LF_NOTITLECARDFIRST},
{"LF_NOTITLECARDRESPAWN",LF_NOTITLECARDRESPAWN},
{"LF_NOTITLECARDRECORDATTACK",LF_NOTITLECARDRECORDATTACK},
{"LF_NOTITLECARD",LF_NOTITLECARD},
{"LF_WARNINGTITLE",LF_WARNINGTITLE},
// And map flags

View File

@ -351,15 +351,19 @@ typedef struct
} mapheader_t;
// level flags
#define LF_SCRIPTISFILE 1 ///< True if the script is a file, not a lump.
#define LF_SPEEDMUSIC 2 ///< Speed up act music for super sneakers
#define LF_NOSSMUSIC 4 ///< Disable Super Sonic music
#define LF_NORELOAD 8 ///< Don't reload level on death
#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 LF_SCRIPTISFILE (1<<0) ///< True if the script is a file, not a lump.
#define LF_SPEEDMUSIC (1<<1) ///< Speed up act music for super sneakers
#define LF_NOSSMUSIC (1<<2) ///< Disable Super Sonic music
#define LF_NORELOAD (1<<3) ///< Don't reload level on death
#define LF_NOZONE (1<<4) ///< Don't include "ZONE" on level title
#define LF_SAVEGAME (1<<5) ///< Save the game upon loading this level
#define LF_MIXNIGHTSCOUNTDOWN (1<<6) ///< Play sfx_timeup instead of music change for NiGHTS countdown
#define LF_WARNINGTITLE (1<<7) ///< WARNING! WARNING! WARNING! WARNING!
#define LF_NOTITLECARDFIRST (1<<8)
#define LF_NOTITLECARDRESPAWN (1<<9)
#define LF_NOTITLECARDRECORDATTACK (1<<10)
#define LF_NOTITLECARD (LF_NOTITLECARDFIRST|LF_NOTITLECARDRESPAWN|LF_NOTITLECARDRECORDATTACK) ///< Don't start the title card at all
#define LF2_HIDEINMENU 1 ///< Hide in the multiplayer menu
#define LF2_HIDEINSTATS 2 ///< Hide in the statistics screen

View File

@ -192,8 +192,7 @@ void F_WipeStageTitle(void)
// draw level title
if ((WipeStageTitle && st_overlay)
&& (wipestyle == WIPESTYLE_COLORMAP)
&& !(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
&& *mapheaderinfo[gamemap-1]->lvlttl != '\0')
&& G_IsTitleCardAvailable())
{
ST_runTitleCard();
ST_drawWipeTitleCard();

View File

@ -1928,13 +1928,22 @@ void G_PreLevelTitleCard(void)
wipestyleflags = WSF_CROSSFADE;
}
static boolean titlecardforreload = false;
//
// Returns true if the current level has a title card.
//
boolean G_IsTitleCardAvailable(void)
{
// The current level header explicitly disabled the title card.
if (mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
UINT16 titleflag = LF_NOTITLECARDFIRST;
if (modeattacking != ATTACKING_NONE)
titleflag = LF_NOTITLECARDRECORDATTACK;
else if (titlecardforreload)
titleflag = LF_NOTITLECARDRESPAWN;
if (mapheaderinfo[gamemap-1]->levelflags & titleflag)
return false;
// The current gametype doesn't have a title card.
@ -3024,7 +3033,9 @@ void G_DoReborn(INT32 playernum)
#ifdef HAVE_BLUA
LUAh_MapChange(gamemap);
#endif
titlecardforreload = true;
G_DoLoadLevel(true);
titlecardforreload = false;
if (metalrecording)
G_BeginMetal();
return;

View File

@ -2625,7 +2625,7 @@ static void ST_overlayDrawer(void)
// 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)))
if (G_IsTitleCardAvailable() && *mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer)))
{
stagetitle = true;
ST_preDrawTitleCard();