From 5e5780dd6579953a71fd0bd662a98e4f1f2fdd4b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 10 Apr 2019 21:21:33 +0200 Subject: [PATCH] - allow using the VGA font for map name display on the alternative HUD. --- wadsrc/static/zscript/ui/statusbar/alt_hud.zs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/wadsrc/static/zscript/ui/statusbar/alt_hud.zs b/wadsrc/static/zscript/ui/statusbar/alt_hud.zs index cd834725e..0755c1858 100644 --- a/wadsrc/static/zscript/ui/statusbar/alt_hud.zs +++ b/wadsrc/static/zscript/ui/statusbar/alt_hud.zs @@ -159,7 +159,7 @@ class AltHud ui let seconds = Thinker.Tics2Seconds(timer); String s = String.Format("%02i:%02i:%02i", seconds / 3600, (seconds % 3600) / 60, seconds % 60); int length = 8 * fnt.GetCharWidth("0"); - DrawHudText(SmallFont, color, s, x-length, y, trans); + DrawHudText(fnt, color, s, x-length, y, trans); } //=========================================================================== @@ -759,15 +759,18 @@ class AltHud ui if (withmapname) { - screen.DrawText(SmallFont, hudcolor_titl, hudwidth - 6 - SmallFont.StringWidth(Level.MapName), ypos, Level.MapName, + let font = generic_hud? NewSmallFont : SmallFont; + int hh = font.GetHeight(); + + screen.DrawText(font, hudcolor_titl, hudwidth - 6 - font.StringWidth(Level.MapName), ypos, Level.MapName, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight); - screen.DrawText(SmallFont, hudcolor_titl, hudwidth - 6 - SmallFont.StringWidth(Level.LevelName), ypos + h, Level.LevelName, + screen.DrawText(font, hudcolor_titl, hudwidth - 6 - font.StringWidth(Level.LevelName), ypos + hh, Level.LevelName, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight); - ypos += 3 * h; + ypos += 2 * hh + h; } DrawCoordinateEntry(xpos, ypos, String.Format("X: %.0f", pos.X)); @@ -955,12 +958,14 @@ class AltHud ui virtual void DrawAutomap(PlayerInfo CPlayer) { - int fonth=SmallFont.GetHeight() + 1; + let font = generic_hud? NewSmallFont : SmallFont; + + int fonth = font.GetHeight() + 1; int bottom = hudheight - 1; if (am_showtotaltime) { - DrawTimeString(SmallFont, hudcolor_ttim, Level.totaltime, hudwidth-2, bottom, 1); + DrawTimeString(font, hudcolor_ttim, Level.totaltime, hudwidth-2, bottom, 1); bottom -= fonth; } @@ -968,15 +973,15 @@ class AltHud ui { if (Level.clusterflags & Level.CLUSTER_HUB) { - DrawTimeString(SmallFont, hudcolor_time, Level.time, hudwidth-2, bottom, 1); + DrawTimeString(font, hudcolor_time, Level.time, hudwidth-2, bottom, 1); bottom -= fonth; } // Single level time for hubs - DrawTimeString(SmallFont, hudcolor_ltim, Level.maptime, hudwidth-2, bottom, 1); + DrawTimeString(font, hudcolor_ltim, Level.maptime, hudwidth-2, bottom, 1); } - screen.DrawText(SmallFont, 0, 1, hudheight - fonth - 1, Level.FormatMapName(hudcolor_titl), + screen.DrawText(font, Font.CR_BRICK, 2, hudheight - fonth - 1, Level.FormatMapName(hudcolor_titl), DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);