- for the map name on the automap, fall back to the original SmallFont if the actual one cannot print it.

This is mainly for mods which provide a new font but do not alter the automap texts, a good example is Hell Revealed 2.
This commit is contained in:
Christoph Oelckers 2019-07-17 20:28:07 +02:00
parent b360f04e28
commit 95349822c4
2 changed files with 10 additions and 2 deletions

View file

@ -661,6 +661,11 @@ void DBaseStatusBar::DoDrawAutomapHUD(int crdefault, int highlight)
FormatMapName(primaryLevel, crdefault, &textbuffer);
if (!generic_ui)
{
if (!font->CanPrint(textbuffer)) font = OriginalSmallFont;
}
auto lines = V_BreakLines(font, vwidth - 32, textbuffer, true);
auto numlines = lines.Size();
auto finalwidth = lines.Last().Width;

View file

@ -731,7 +731,7 @@ class AltHud ui
if (withmapname)
{
let font = generic_ui? NewSmallFont : SmallFont;
let font = generic_ui? NewSmallFont : SmallFont.CanPrint(Level.LevelName)? SmallFont : OriginalSmallFont;
int hh = font.GetHeight();
screen.DrawText(font, hudcolor_titl, hudwidth - 6 - font.StringWidth(Level.MapName), ypos, Level.MapName,
@ -953,7 +953,10 @@ class AltHud ui
DrawTimeString(font, hudcolor_ltim, Level.maptime, hudwidth-2, bottom, 1);
}
screen.DrawText(font, Font.CR_BRICK, 2, hudheight - fonth - 1, Level.FormatMapName(hudcolor_titl),
let amstr = Level.FormatMapName(hudcolor_titl);
font = generic_ui? NewSmallFont : SmallFont.CanPrint(amstr)? SmallFont : OriginalSmallFont;
screen.DrawText(font, Font.CR_BRICK, 2, hudheight - fonth - 1, amstr,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);