- 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.

# Conflicts:
#	src/g_level.cpp
#	src/gamedata/g_mapinfo.h
#	src/gi.cpp
#	wadsrc/static/zscript/ui/statscreen/statscreen.zs
This commit is contained in:
Christoph Oelckers 2019-08-02 09:11:40 +02:00 committed by drfrag
parent 149a294a49
commit 78fa0a6f95
19 changed files with 73 additions and 1 deletions

View file

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

View file

@ -772,6 +772,7 @@ void G_DoCompleted (void)
wminfo.finished_ep = level.cluster - 1;
wminfo.LName0 = TexMan.CheckForTexture(level.info->PName, ETextureType::MiscPatch);
wminfo.thisname = level.info->LookupLevelName(&langtable[0]); // re-get the name so we have more info about its origin.
wminfo.thisauthor = level.info->AuthorName;
wminfo.current = level.MapName;
if (deathmatch &&
@ -781,6 +782,7 @@ void G_DoCompleted (void)
wminfo.next = level.MapName;
wminfo.LName1 = wminfo.LName0;
wminfo.nextname = wminfo.thisname;
wminfo.nextauthor = wminfo.thisauthor;
}
else
{
@ -790,12 +792,14 @@ void G_DoCompleted (void)
wminfo.next = "";
wminfo.LName1.SetInvalid();
wminfo.nextname = "";
wminfo.nextauthor = "";
}
else
{
wminfo.next = nextinfo->MapName;
wminfo.LName1 = TexMan.CheckForTexture(nextinfo->PName, ETextureType::MiscPatch);
wminfo.nextname = nextinfo->LookupLevelName(&langtable[1]);
wminfo.nextauthor = nextinfo->AuthorName;
}
}
@ -1551,6 +1555,7 @@ void G_InitLevelLocals ()
level.NextMap = info->NextMap;
level.NextSecretMap = info->NextSecretMap;
level.F1Pic = info->F1Pic;
level.AuthorName = info->AuthorName;
level.hazardcolor = info->hazardcolor;
level.hazardflash = info->hazardflash;

View file

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

View file

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

View file

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

View file

@ -63,6 +63,7 @@ DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenMapNameFont)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenEnteringFont)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenFinishedFont)
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, intermissioncounter)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, statusscreen_single)
@ -431,6 +432,7 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_FONT(mStatscreenContentFont, "statscreen_contentfont")
GAMEINFOKEY_PATCH(mStatscreenFinishedFont, "statscreen_finishedpatch")
GAMEINFOKEY_PATCH(mStatscreenEnteringFont, "statscreen_enteringpatch")
GAMEINFOKEY_FONT(mStatscreenAuthorFont, "statscreen_authorfont")
GAMEINFOKEY_BOOL(norandomplayerclass, "norandomplayerclass")
GAMEINFOKEY_BOOL(forcekillscripts, "forcekillscripts") // [JM] Force kill scripts on thing death. (MF7_NOKILLSCRIPTS overrides.)
GAMEINFOKEY_STRING(Dialogue, "dialogue")

View file

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

View file

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

View file

@ -861,6 +861,8 @@ DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, current);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, next);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, nextname);
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, LName1);
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 nextname; // 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 LName1;

View file

@ -68,6 +68,7 @@ gameinfo
statscreen_finishedpatch = "WIF"
statscreen_enteringpatch = "WIENTER"
statscreen_contentfont = "*BigFont"
statscreen_authorFont = "*SmallFont", "gray"
statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "DoomStatusScreen"

View file

@ -68,6 +68,8 @@ gameinfo
statscreen_finishedpatch = "WIF"
statscreen_enteringpatch = "WIENTER"
statscreen_contentfont = "*BigFont", "red"
statscreen_authorFont = "*SmallFont", "brick"
statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "DoomStatusScreen"

View file

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

View file

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

View file

@ -58,6 +58,7 @@ gameinfo
statscreen_finishedpatch = "WIF"
statscreen_enteringpatch = "WIENTER"
statscreen_contentfont = "*BigFont"
statscreen_authorFont = "*SmallFont"
messageboxclass = "MessageBoxMenu"
}

View file

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

View file

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

View file

@ -104,6 +104,7 @@ class StatusScreen abstract play version("2.5")
PatchInfo finished;
PatchInfo entering;
PatchInfo content;
PatchInfo author;
TextureID p_secret;
TextureID kills;
@ -115,6 +116,7 @@ class StatusScreen abstract play version("2.5")
// [RH] Info to dynamically generate the level name graphics
String lnametexts[2];
String authortexts[2];
bool snl_pointeron;
@ -178,6 +180,32 @@ class StatusScreen abstract play version("2.5")
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;
}
//====================================================================
//
// Draws a text, either as patch or as string from the string table
@ -246,6 +274,9 @@ class StatusScreen abstract play version("2.5")
// Adjustment for different font sizes for map name and 'finished'.
y -= ((mapname.mFont.GetHeight() - finished.mFont.GetHeight()) * CleanYfac) / 4;
if (authortexts[0].Length() != 0)
y = DrawAuthor(y, authortexts[0]);
// draw "Finished!"
if (y < (NG_STATSY - finished.mFont.GetHeight()*3/4) * CleanYfac)
{
@ -271,7 +302,10 @@ class StatusScreen abstract play version("2.5")
y = DrawPatchText(y, entering, "$WI_ENTERING");
y += entering.mFont.GetHeight() * CleanYfac / 4;
DrawName(y, wbs.LName1, lnametexts[1]);
y = DrawName(y, wbs.LName1, lnametexts[1]);
DrawAuthor(y, authortexts[1]);
}
@ -734,6 +768,7 @@ class StatusScreen abstract play version("2.5")
finished.Init(gameinfo.mStatscreenFinishedFont);
mapname.Init(gameinfo.mStatscreenMapNameFont);
content.Init(gameinfo.mStatscreenContentFont);
author.Init(gameinfo.mStatscreenAuthorFont);
Kills = TexMan.CheckForTexture("WIOSTK", TexMan.Type_MiscPatch); // "kills"
Secret = TexMan.CheckForTexture("WIOSTS", TexMan.Type_MiscPatch); // "scrt"
@ -745,6 +780,8 @@ class StatusScreen abstract play version("2.5")
lnametexts[0] = wbstartstruct.thisname;
lnametexts[1] = wbstartstruct.nextname;
authortexts[0] = wbstartstruct.thisauthor;
authortexts[1] = wbstartstruct.nextauthor;
bg = InterBackground.Create(wbs);
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 nextname; // next 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 LName1;