Skip to content

Commit

Permalink
- for the map name on the automap, fall back to the original SmallFon…
Browse files Browse the repository at this point in the history
…t 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.
  • Loading branch information
coelckers committed Jul 17, 2019
1 parent b360f04 commit 9534982
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/g_statusbar/shared_sbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions wadsrc/static/zscript/ui/statusbar/alt_hud.zs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 9534982

Please sign in to comment.