- made author names work with title patches.

Most importantly, specifying a patch may optionally disallow showing the autor's name - this is for cases where a styled patch gets used for English but text-based translations of the map name should still be possible.
This commit is contained in:
Christoph Oelckers 2019-08-07 12:09:47 +02:00
parent be0478972a
commit 43041c21d8
4 changed files with 38 additions and 13 deletions

View file

@ -834,13 +834,13 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
// [RH] Mark this level as having been visited
if (!(flags & LEVEL_CHANGEMAPCHEAT))
FindLevelInfo (MapName)->flags |= LEVEL_VISITED;
info->flags |= LEVEL_VISITED;
uint32_t langtable[2] = {};
wminfo.finished_ep = cluster - 1;
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.thisauthor = info->AuthorName;
if (!wminfo.LName0.isValid() || !(info->flags3 & LEVEL3_HIDEAUTHORNAME)) wminfo.thisauthor = info->AuthorName;
wminfo.current = MapName;
if (deathmatch &&
@ -867,7 +867,7 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
wminfo.next = nextinfo->MapName;
wminfo.LName1 = TexMan.CheckForTexture(nextinfo->PName, ETextureType::MiscPatch);
wminfo.nextname = nextinfo->LookupLevelName(&langtable[1]);
wminfo.nextauthor = nextinfo->AuthorName;
if (!wminfo.LName1.isValid() || !(nextinfo->flags3 & LEVEL3_HIDEAUTHORNAME)) wminfo.nextauthor = nextinfo->AuthorName;
}
}

View file

@ -1020,6 +1020,15 @@ DEFINE_MAP_OPTION(titlepatch, true)
{
parse.ParseAssign();
parse.ParseLumpOrTextureName(info->PName);
if (parse.format_type == FMapInfoParser::FMT_New)
{
if (parse.sc.CheckString(","))
{
parse.sc.MustGetNumber();
if (parse.sc.Number) info->flags3 |= LEVEL3_HIDEAUTHORNAME;
else info->flags3 &= ~LEVEL3_HIDEAUTHORNAME;
}
}
}
DEFINE_MAP_OPTION(partime, true)

View file

@ -248,6 +248,7 @@ enum ELevelFlags : unsigned int
LEVEL3_EXITNORMALUSED = 0x00000020,
LEVEL3_EXITSECRETUSED = 0x00000040,
LEVEL3_FORCEWORLDPANNING = 0x00000080, // Forces the world panning flag for all textures, even those without it explicitly set.
LEVEL3_HIDEAUTHORNAME = 0x00000100,
};

View file

@ -206,7 +206,7 @@ class StatusScreen abstract play version("2.5")
}
return y + h;
}
return 0;
return y;
}
//====================================================================
@ -278,18 +278,27 @@ class StatusScreen abstract play version("2.5")
// If the displayed info is made of patches we need some additional offsetting here.
if (ispatch)
{
int h1 = BigFont.GetHeight() - BigFont.GetDisplacement();
int h2 = (y - oldy) / CleanYfac / 4;
let disp = min(h1, h2);
int disp = 0;
// The offset getting applied here must at least be as tall as the largest ascender in the following text to avoid overlaps.
if (!TexMan.OkForLocalization(finishedPatch, "$WI_FINISHED"))
if (authortexts[0].length() == 0)
{
disp += finished.mFont.GetMaxAscender("$WI_FINISHED");
}
int h1 = BigFont.GetHeight() - BigFont.GetDisplacement();
int h2 = (y - oldy) / CleanYfac / 4;
disp = min(h1, h2);
if (!TexMan.OkForLocalization(finishedPatch, "$WI_FINISHED"))
{
disp += finished.mFont.GetMaxAscender("$WI_FINISHED");
}
}
else
{
disp += author.mFont.GetMaxAscender(authortexts[0]);
}
y += disp * CleanYfac;
}
if (!ispatch) y = DrawAuthor(y, authortexts[0]);
y = DrawAuthor(y, authortexts[0]);
// draw "Finished!"
@ -345,8 +354,14 @@ class StatusScreen abstract play version("2.5")
}
y = DrawName(y, wbs.LName1, lnametexts[1]);
ispatch = wbs.LName1.isValid();
if (!ispatch) DrawAuthor(y, authortexts[1]);
if (wbs.LName1.isValid() && authortexts[1].length() > 0)
{
// Consdider the ascender height of the following text.
y += author.mFont.GetMaxAscender(authortexts[1]) * CleanYfac;
}
DrawAuthor(y, authortexts[1]);
}