- added option to print a map author's name on the summary screen

For now only with font-printed map names. Allowing this with titlepatches will require more work and an option to disable.
This commit is contained in:
Christoph Oelckers 2019-08-02 09:11:40 +02:00
parent 154af34cd9
commit 3e99216967
19 changed files with 72 additions and 1 deletions

View file

@ -134,6 +134,7 @@ void G_LeavingHub(FLevelLocals *Level, int mode, cluster_info_t * cluster, wbsta
else else
{ {
wbs->thisname = cluster->ClusterName; wbs->thisname = cluster->ClusterName;
wbs->thisauthor = "";
} }
wbs->LName0.SetInvalid(); // The level's own name was just invalidated, and so was its name patch. wbs->LName0.SetInvalid(); // The level's own name was just invalidated, and so was its name patch.
} }

View file

@ -840,6 +840,7 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
wminfo.finished_ep = cluster - 1; wminfo.finished_ep = cluster - 1;
wminfo.LName0 = TexMan.CheckForTexture(info->PName, ETextureType::MiscPatch); wminfo.LName0 = TexMan.CheckForTexture(info->PName, ETextureType::MiscPatch);
wminfo.thisname = info->LookupLevelName(&langtable[0]); // re-get the name so we have more info about its origin. wminfo.thisname = info->LookupLevelName(&langtable[0]); // re-get the name so we have more info about its origin.
wminfo.thisauthor = info->AuthorName;
wminfo.current = MapName; wminfo.current = MapName;
if (deathmatch && if (deathmatch &&
@ -849,6 +850,7 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
wminfo.next = MapName; wminfo.next = MapName;
wminfo.LName1 = wminfo.LName0; wminfo.LName1 = wminfo.LName0;
wminfo.nextname = wminfo.thisname; wminfo.nextname = wminfo.thisname;
wminfo.nextauthor = wminfo.thisauthor;
} }
else else
{ {
@ -858,12 +860,14 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
wminfo.next = ""; wminfo.next = "";
wminfo.LName1.SetInvalid(); wminfo.LName1.SetInvalid();
wminfo.nextname = ""; wminfo.nextname = "";
wminfo.nextauthor = "";
} }
else else
{ {
wminfo.next = nextinfo->MapName; wminfo.next = nextinfo->MapName;
wminfo.LName1 = TexMan.CheckForTexture(nextinfo->PName, ETextureType::MiscPatch); wminfo.LName1 = TexMan.CheckForTexture(nextinfo->PName, ETextureType::MiscPatch);
wminfo.nextname = nextinfo->LookupLevelName(&langtable[1]); wminfo.nextname = nextinfo->LookupLevelName(&langtable[1]);
wminfo.nextauthor = nextinfo->AuthorName;
} }
} }
@ -1637,6 +1641,7 @@ void FLevelLocals::Init()
NextMap = info->NextMap; NextMap = info->NextMap;
NextSecretMap = info->NextSecretMap; NextSecretMap = info->NextSecretMap;
F1Pic = info->F1Pic; F1Pic = info->F1Pic;
AuthorName = info->AuthorName;
hazardcolor = info->hazardcolor; hazardcolor = info->hazardcolor;
hazardflash = info->hazardflash; hazardflash = info->hazardflash;

View file

@ -512,6 +512,7 @@ public:
FString MapName; // the lump name (E1M1, MAP01, etc) FString MapName; // the lump name (E1M1, MAP01, etc)
FString NextMap; // go here when using the regular exit FString NextMap; // go here when using the regular exit
FString NextSecretMap; // map to go to when used secret exit FString NextSecretMap; // map to go to when used secret exit
FString AuthorName;
FString F1Pic; FString F1Pic;
FTranslator *Translator; FTranslator *Translator;
EMapType maptype; EMapType maptype;

View file

@ -242,6 +242,7 @@ void level_info_t::Reset()
flags3 = 0; flags3 = 0;
Music = ""; Music = "";
LevelName = ""; LevelName = "";
AuthorName = "";
FadeTable = "COLORMAP"; FadeTable = "COLORMAP";
WallHorizLight = -8; WallHorizLight = -8;
WallVertLight = +8; WallVertLight = +8;
@ -923,6 +924,13 @@ DEFINE_MAP_OPTION(next, true)
parse.ParseNextMap(info->NextMap); parse.ParseNextMap(info->NextMap);
} }
DEFINE_MAP_OPTION(author, true)
{
parse.ParseAssign();
parse.sc.MustGetString();
info->AuthorName = parse.sc.String;
}
DEFINE_MAP_OPTION(secretnext, true) DEFINE_MAP_OPTION(secretnext, true)
{ {
parse.ParseAssign(); parse.ParseAssign();

View file

@ -323,6 +323,7 @@ struct level_info_t
FString Music; FString Music;
FString LevelName; FString LevelName;
FString AuthorName;
int8_t WallVertLight, WallHorizLight; int8_t WallVertLight, WallHorizLight;
int musicorder; int musicorder;
FCompressedBuffer Snapshot; FCompressedBuffer Snapshot;

View file

@ -60,6 +60,7 @@ DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenMapNameFont)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenEnteringFont) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenEnteringFont)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenFinishedFont) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenFinishedFont)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenContentFont) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenContentFont)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenAuthorFont)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, gibfactor) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, gibfactor)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, intermissioncounter) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, intermissioncounter)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, statusscreen_single) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, statusscreen_single)
@ -427,6 +428,7 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_FONT(mStatscreenFinishedFont, "statscreen_finishedfont") GAMEINFOKEY_FONT(mStatscreenFinishedFont, "statscreen_finishedfont")
GAMEINFOKEY_FONT(mStatscreenEnteringFont, "statscreen_enteringfont") GAMEINFOKEY_FONT(mStatscreenEnteringFont, "statscreen_enteringfont")
GAMEINFOKEY_FONT(mStatscreenContentFont, "statscreen_contentfont") GAMEINFOKEY_FONT(mStatscreenContentFont, "statscreen_contentfont")
GAMEINFOKEY_FONT(mStatscreenAuthorFont, "statscreen_authorfont")
GAMEINFOKEY_BOOL(norandomplayerclass, "norandomplayerclass") GAMEINFOKEY_BOOL(norandomplayerclass, "norandomplayerclass")
GAMEINFOKEY_BOOL(forcekillscripts, "forcekillscripts") // [JM] Force kill scripts on thing death. (MF7_NOKILLSCRIPTS overrides.) GAMEINFOKEY_BOOL(forcekillscripts, "forcekillscripts") // [JM] Force kill scripts on thing death. (MF7_NOKILLSCRIPTS overrides.)
GAMEINFOKEY_STRING(Dialogue, "dialogue") GAMEINFOKEY_STRING(Dialogue, "dialogue")

View file

@ -192,6 +192,7 @@ struct gameinfo_t
FGIFont mStatscreenFinishedFont; FGIFont mStatscreenFinishedFont;
FGIFont mStatscreenEnteringFont; FGIFont mStatscreenEnteringFont;
FGIFont mStatscreenContentFont; FGIFont mStatscreenContentFont;
FGIFont mStatscreenAuthorFont;
bool norandomplayerclass; bool norandomplayerclass;
bool forcekillscripts; bool forcekillscripts;
FName statusscreen_single; FName statusscreen_single;

View file

@ -3061,6 +3061,7 @@ DEFINE_FIELD(FLevelLocals, MapName)
DEFINE_FIELD(FLevelLocals, NextMap) DEFINE_FIELD(FLevelLocals, NextMap)
DEFINE_FIELD(FLevelLocals, NextSecretMap) DEFINE_FIELD(FLevelLocals, NextSecretMap)
DEFINE_FIELD(FLevelLocals, F1Pic) DEFINE_FIELD(FLevelLocals, F1Pic)
DEFINE_FIELD(FLevelLocals, AuthorName)
DEFINE_FIELD(FLevelLocals, maptype) DEFINE_FIELD(FLevelLocals, maptype)
DEFINE_FIELD(FLevelLocals, Music) DEFINE_FIELD(FLevelLocals, Music)
DEFINE_FIELD(FLevelLocals, musicorder) DEFINE_FIELD(FLevelLocals, musicorder)

View file

@ -860,6 +860,8 @@ DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, current);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, next); DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, next);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, nextname); DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, nextname);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, thisname); DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, thisname);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, nextauthor);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, thisauthor);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, LName0); DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, LName0);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, LName1); DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, LName1);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, maxkills); DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, maxkills);

View file

@ -56,6 +56,8 @@ struct wbstartstruct_t
FString next; // next level, [RH] actual map name FString next; // next level, [RH] actual map name
FString nextname; // printable name for next level. FString nextname; // printable name for next level.
FString thisname; // printable name for next level. FString thisname; // printable name for next level.
FString nextauthor; // printable name for next level.
FString thisauthor; // printable name for next level.
FTextureID LName0; FTextureID LName0;
FTextureID LName1; FTextureID LName1;

View file

@ -68,6 +68,7 @@ gameinfo
statscreen_finishedfont = "*BigFont" statscreen_finishedfont = "*BigFont"
statscreen_enteringfont = "*BigFont" statscreen_enteringfont = "*BigFont"
statscreen_contentfont = "*BigFont" statscreen_contentfont = "*BigFont"
statscreen_authorFont = "*SmallFont", "gray"
statscreen_coop = "CoopStatusScreen" statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen" statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "DoomStatusScreen" statscreen_single = "DoomStatusScreen"

View file

@ -68,6 +68,8 @@ gameinfo
statscreen_finishedfont = "*BigFont", "red" statscreen_finishedfont = "*BigFont", "red"
statscreen_enteringfont = "*BigFont", "red" statscreen_enteringfont = "*BigFont", "red"
statscreen_contentfont = "*BigFont", "red" statscreen_contentfont = "*BigFont", "red"
statscreen_authorFont = "*SmallFont", "brick"
statscreen_coop = "CoopStatusScreen" statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen" statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "DoomStatusScreen" statscreen_single = "DoomStatusScreen"

View file

@ -67,6 +67,7 @@ gameinfo
statscreen_finishedfont = "*SmallFont" statscreen_finishedfont = "*SmallFont"
statscreen_enteringfont = "*SmallFont" statscreen_enteringfont = "*SmallFont"
statscreen_contentfont = "*BigFont" statscreen_contentfont = "*BigFont"
statscreen_authorFont = "*SmallFont"
statscreen_coop = "CoopStatusScreen" statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen" statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "RavenStatusScreen" statscreen_single = "RavenStatusScreen"

View file

@ -65,6 +65,7 @@ gameinfo
statscreen_finishedfont = "*SmallFont" statscreen_finishedfont = "*SmallFont"
statscreen_enteringfont = "*SmallFont" statscreen_enteringfont = "*SmallFont"
statscreen_contentfont = "*BigFont" statscreen_contentfont = "*BigFont"
statscreen_authorFont = "*SmallFont"
statscreen_coop = "CoopStatusScreen" statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen" statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "RavenStatusScreen" statscreen_single = "RavenStatusScreen"

View file

@ -58,6 +58,7 @@ gameinfo
statscreen_finishedfont = "*BigFont" statscreen_finishedfont = "*BigFont"
statscreen_enteringfont = "*BigFont" statscreen_enteringfont = "*BigFont"
statscreen_contentfont = "*BigFont" statscreen_contentfont = "*BigFont"
statscreen_authorFont = "*SmallFont"
messageboxclass = "MessageBoxMenu" messageboxclass = "MessageBoxMenu"
} }

View file

@ -66,6 +66,7 @@ gameinfo
statscreen_finishedfont = "*BigFont", "white" statscreen_finishedfont = "*BigFont", "white"
statscreen_enteringfont = "*BigFont", "white" statscreen_enteringfont = "*BigFont", "white"
statscreen_contentfont = "*BigFont" statscreen_contentfont = "*BigFont"
statscreen_authorFont = "*SmallFont"
statscreen_coop = "CoopStatusScreen" statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen" statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "RavenStatusScreen" statscreen_single = "RavenStatusScreen"

View file

@ -404,6 +404,7 @@ struct GameInfoStruct native
native GIFont mStatscreenEnteringFont; native GIFont mStatscreenEnteringFont;
native GIFont mStatscreenFinishedFont; native GIFont mStatscreenFinishedFont;
native GIFont mStatscreenContentFont; native GIFont mStatscreenContentFont;
native GIFont mStatscreenAuthorFont;
native double gibfactor; native double gibfactor;
native bool intermissioncounter; native bool intermissioncounter;
native Name mSliderColor; native Name mSliderColor;
@ -685,6 +686,7 @@ struct LevelLocals native
native String NextSecretMap; native String NextSecretMap;
native readonly String F1Pic; native readonly String F1Pic;
native readonly int maptype; native readonly int maptype;
native readonly String AuthorName;
native readonly String Music; native readonly String Music;
native readonly int musicorder; native readonly int musicorder;
native readonly TextureID skytexture1; native readonly TextureID skytexture1;

View file

@ -107,6 +107,7 @@ class StatusScreen abstract play version("2.5")
PatchInfo finished; PatchInfo finished;
PatchInfo entering; PatchInfo entering;
PatchInfo content; PatchInfo content;
PatchInfo author;
TextureID p_secret; TextureID p_secret;
TextureID kills; TextureID kills;
@ -120,6 +121,7 @@ class StatusScreen abstract play version("2.5")
// [RH] Info to dynamically generate the level name graphics // [RH] Info to dynamically generate the level name graphics
String lnametexts[2]; String lnametexts[2];
String authortexts[2];
bool snl_pointeron; bool snl_pointeron;
@ -181,6 +183,32 @@ class StatusScreen abstract play version("2.5")
return 0; return 0;
} }
//====================================================================
//
// Draws a level author's name with the big font
//
//====================================================================
int DrawAuthor(int y, String levelname)
{
if (levelname.Length() > 0)
{
int h = 0;
int lumph = author.mFont.GetHeight() * CleanYfac;
BrokenLines lines = author.mFont.BreakLines(levelname, screen.GetWidth() / CleanXfac);
int count = lines.Count();
for (int i = 0; i < count; i++)
{
screen.DrawText(author.mFont, author.mColor, (screen.GetWidth() - lines.StringWidth(i) * CleanXfac) / 2, y + h, lines.StringAt(i), DTA_CleanNoMove, true);
h += lumph;
}
return y + h;
}
return 0;
}
//==================================================================== //====================================================================
// //
// Only kept so that mods that were accessing it continue to compile // Only kept so that mods that were accessing it continue to compile
@ -261,6 +289,8 @@ class StatusScreen abstract play version("2.5")
y += disp * CleanYfac; y += disp * CleanYfac;
} }
if (!ispatch) y = DrawAuthor(y, authortexts[0]);
// draw "Finished!" // draw "Finished!"
int statsy = multiplayer? NG_STATSY : SP_STATSY * CleanYFac; int statsy = multiplayer? NG_STATSY : SP_STATSY * CleanYFac;
@ -314,7 +344,10 @@ class StatusScreen abstract play version("2.5")
y += disp * CleanYfac; y += disp * CleanYfac;
} }
DrawName(y, wbs.LName1, lnametexts[1]); y = DrawName(y, wbs.LName1, lnametexts[1]);
ispatch = wbs.LName1.isValid();
if (!ispatch) DrawAuthor(y, authortexts[1]);
} }
@ -802,6 +835,7 @@ class StatusScreen abstract play version("2.5")
finished.Init(gameinfo.mStatscreenFinishedFont); finished.Init(gameinfo.mStatscreenFinishedFont);
mapname.Init(gameinfo.mStatscreenMapNameFont); mapname.Init(gameinfo.mStatscreenMapNameFont);
content.Init(gameinfo.mStatscreenContentFont); content.Init(gameinfo.mStatscreenContentFont);
author.Init(gameinfo.mStatscreenAuthorFont);
Kills = TexMan.CheckForTexture("WIOSTK", TexMan.Type_MiscPatch); // "kills" Kills = TexMan.CheckForTexture("WIOSTK", TexMan.Type_MiscPatch); // "kills"
Secret = TexMan.CheckForTexture("WIOSTS", TexMan.Type_MiscPatch); // "scrt", not used Secret = TexMan.CheckForTexture("WIOSTS", TexMan.Type_MiscPatch); // "scrt", not used
@ -815,6 +849,8 @@ class StatusScreen abstract play version("2.5")
lnametexts[0] = wbstartstruct.thisname; lnametexts[0] = wbstartstruct.thisname;
lnametexts[1] = wbstartstruct.nextname; lnametexts[1] = wbstartstruct.nextname;
authortexts[0] = wbstartstruct.thisauthor;
authortexts[1] = wbstartstruct.nextauthor;
bg = InterBackground.Create(wbs); bg = InterBackground.Create(wbs);
noautostartmap = bg.LoadBackground(false); noautostartmap = bg.LoadBackground(false);

View file

@ -24,6 +24,8 @@ struct WBStartStruct native version("2.4")
native String next; // next level, [RH] actual map name native String next; // next level, [RH] actual map name
native String nextname; // next level, printable name native String nextname; // next level, printable name
native String thisname; // this level, printable name native String thisname; // this level, printable name
native String nextauthor; // next level, printable name
native String thisauthor; // this level, printable name
native TextureID LName0; native TextureID LName0;
native TextureID LName1; native TextureID LName1;