Menu titles for level headers

For the tutorials. Replaces the no longer visible subtitle, since it's roughly analagous in purpose.
This commit is contained in:
toaster 2023-08-08 12:38:03 +01:00
parent b669f8484f
commit 8d7c9dd6ce
5 changed files with 31 additions and 15 deletions

View file

@ -1041,10 +1041,10 @@ void readlevelheader(MYFILE *f, char * name)
continue; continue;
} }
if (fastcmp(word, "SUBTITLE")) if (fastcmp(word, "MENUTITLE"))
{ {
deh_strlcpy(mapheaderinfo[num]->subttl, word2, deh_strlcpy(mapheaderinfo[num]->menuttl, word2,
sizeof(mapheaderinfo[num]->subttl), va("Level header %d: subtitle", num)); sizeof(mapheaderinfo[num]->menuttl), va("Level header %d: menutitle", num));
continue; continue;
} }

View file

@ -466,7 +466,7 @@ struct mapheader_t
// Titlecard information // Titlecard information
char lvlttl[22]; ///< Level name without "Zone". (21 character limit instead of 32, 21 characters can display on screen max anyway) char lvlttl[22]; ///< Level name without "Zone". (21 character limit instead of 32, 21 characters can display on screen max anyway)
char subttl[33]; ///< Subtitle for level char menuttl[22]; ///< Menu title for level
char zonttl[22]; ///< "ZONE" replacement name char zonttl[22]; ///< "ZONE" replacement name
UINT8 actnum; ///< Act number or 0 for none. UINT8 actnum; ///< Act number or 0 for none.

View file

@ -2744,16 +2744,22 @@ void M_DrawCupSelect(void)
static void M_DrawHighLowLevelTitle(INT16 x, INT16 y, INT16 map) static void M_DrawHighLowLevelTitle(INT16 x, INT16 y, INT16 map)
{ {
char word1[22]; char word1[22];
char word2[22]; char word2[22 + 2]; // actnum
UINT8 word1len = 0; UINT8 word1len = 0;
UINT8 word2len = 0; UINT8 word2len = 0;
INT16 x2 = x; INT16 x2 = x;
UINT8 i; UINT8 i;
if (!mapheaderinfo[map] || !mapheaderinfo[map]->lvlttl[0]) if (!mapheaderinfo[map]
|| (
!mapheaderinfo[map]->menuttl[0]
&& !mapheaderinfo[map]->lvlttl[0]
)
)
return; return;
if (mapheaderinfo[map]->zonttl[0]) if (!mapheaderinfo[map]->menuttl[0]
&& mapheaderinfo[map]->zonttl[0])
{ {
boolean one = true; boolean one = true;
boolean two = true; boolean two = true;
@ -2784,12 +2790,17 @@ static void M_DrawHighLowLevelTitle(INT16 x, INT16 y, INT16 map)
{ {
boolean donewithone = false; boolean donewithone = false;
char *ttlsource =
mapheaderinfo[map]->menuttl[0]
? mapheaderinfo[map]->menuttl
: mapheaderinfo[map]->lvlttl;
for (i = 0; i < 22; i++) for (i = 0; i < 22; i++)
{ {
if (!mapheaderinfo[map]->lvlttl[i]) if (!ttlsource[i])
break; break;
if (mapheaderinfo[map]->lvlttl[i] == ' ') if (ttlsource[i] == ' ')
{ {
if (!donewithone) if (!donewithone)
{ {
@ -2800,18 +2811,18 @@ static void M_DrawHighLowLevelTitle(INT16 x, INT16 y, INT16 map)
if (donewithone) if (donewithone)
{ {
word2[word2len] = mapheaderinfo[map]->lvlttl[i]; word2[word2len] = ttlsource[i];
word2len++; word2len++;
} }
else else
{ {
word1[word1len] = mapheaderinfo[map]->lvlttl[i]; word1[word1len] = ttlsource[i];
word1len++; word1len++;
} }
} }
} }
if (mapheaderinfo[map]->actnum) if (!mapheaderinfo[map]->menuttl[0] && mapheaderinfo[map]->actnum)
{ {
word2[word2len] = ' '; word2[word2len] = ' ';
word2len++; word2len++;
@ -6187,6 +6198,11 @@ static void M_DrawStatsMaps(void)
M_DrawMapMedals(mnum+1, 291, y); M_DrawMapMedals(mnum+1, 291, y);
if (mapheaderinfo[mnum]->menuttl[0])
{
V_DrawThinString(24, y, V_FORCEUPPERCASE, mapheaderinfo[mnum]->menuttl);
}
else
{ {
char *title = G_BuildMapTitle(mnum+1); char *title = G_BuildMapTitle(mnum+1);
V_DrawThinString(24, y, V_FORCEUPPERCASE, title); V_DrawThinString(24, y, V_FORCEUPPERCASE, title);

View file

@ -2487,8 +2487,8 @@ static int mapheaderinfo_get(lua_State *L)
const char *field = luaL_checkstring(L, 2); const char *field = luaL_checkstring(L, 2);
if (fastcmp(field,"lvlttl")) if (fastcmp(field,"lvlttl"))
lua_pushstring(L, header->lvlttl); lua_pushstring(L, header->lvlttl);
else if (fastcmp(field,"subttl")) else if (fastcmp(field,"menuttl"))
lua_pushstring(L, header->subttl); lua_pushstring(L, header->menuttl);
else if (fastcmp(field,"zonttl")) else if (fastcmp(field,"zonttl"))
lua_pushstring(L, header->zonttl); lua_pushstring(L, header->zonttl);
else if (fastcmp(field,"actnum")) else if (fastcmp(field,"actnum"))

View file

@ -406,7 +406,7 @@ void P_DeleteHeaderFollowers(UINT16 i)
static void P_ClearSingleMapHeaderInfo(INT16 num) static void P_ClearSingleMapHeaderInfo(INT16 num)
{ {
mapheaderinfo[num]->lvlttl[0] = '\0'; mapheaderinfo[num]->lvlttl[0] = '\0';
mapheaderinfo[num]->subttl[0] = '\0'; mapheaderinfo[num]->menuttl[0] = '\0';
mapheaderinfo[num]->zonttl[0] = '\0'; mapheaderinfo[num]->zonttl[0] = '\0';
mapheaderinfo[num]->actnum = 0; mapheaderinfo[num]->actnum = 0;
mapheaderinfo[num]->typeoflevel = 0; mapheaderinfo[num]->typeoflevel = 0;