From 6acfbf8e02fc5034d325db394d2e3ece9fee186e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 10 Apr 2019 21:23:27 +0200 Subject: [PATCH] - cleaned out the unneeded scaling hacks from the HUD messages. --- src/c_console.cpp | 4 ++-- src/g_statusbar/hudmessages.cpp | 18 ++++++++---------- src/g_statusbar/sbar.h | 1 - 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/c_console.cpp b/src/c_console.cpp index bbdbf0c89..6a4f70d72 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -800,7 +800,7 @@ void FNotifyBuffer::AddString(int printlevel, FString source) con_notifylines == 0) return; - width = DisplayWidth / active_con_scaletext(hud_generic); + width = DisplayWidth / active_con_scaletext(generic_hud); FFont *font = hud_generic ? NewSmallFont : SmallFont; if (font == nullptr) return; // Without an initialized font we cannot handle the message (this is for those which come here before the font system is ready.) @@ -1109,7 +1109,7 @@ void FNotifyBuffer::Draw() else color = PrintColors[notify.PrintLevel]; - int scale = active_con_scaletext(hud_generic); + int scale = active_con_scaletext(generic_hud); if (!center) screen->DrawText (font, color, 0, line, notify.Text, DTA_VirtualWidth, screen->GetWidth() / scale, diff --git a/src/g_statusbar/hudmessages.cpp b/src/g_statusbar/hudmessages.cpp index 6dadfbaf8..fc495bac8 100644 --- a/src/g_statusbar/hudmessages.cpp +++ b/src/g_statusbar/hudmessages.cpp @@ -140,7 +140,6 @@ DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int h // for x range [0.0, 1.0]: Positions center of box // for x range [1.0, 2.0]: Positions center of box, and centers text inside it HUDWidth = HUDHeight = 0; - AltScale = font == nullptr && generic_hud; // generic_hud only takes effect for messages that do not scale the screen and use the default font. if (fabs (x) > 2.f) { CenterX = true; @@ -198,7 +197,7 @@ DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int h Top = y; HoldTics = (int)(holdTime * TICRATE); Tics = -1; // -1 to compensate for one additional Tick the message will receive. - Font = font? font : AltScale? NewSmallFont : SmallFont; + Font = font? font : generic_hud? NewSmallFont : SmallFont; TextColor = textColor; State = 0; SourceText = copystring (text); @@ -252,8 +251,7 @@ void DHUDMessage::Serialize(FSerializer &arc) ("handleaspect", HandleAspect) ("visibilityflags", VisibilityFlags) ("style", Style) - ("alpha", Alpha) - ("altscale", AltScale); + ("alpha", Alpha); if (arc.isReading()) { @@ -322,7 +320,7 @@ void DHUDMessage::ResetText (const char *text) } else { - width = SCREENWIDTH / active_con_scaletext(AltScale); + width = SCREENWIDTH / active_con_scaletext(); } Lines = V_BreakLines (Font, NoWrap ? INT_MAX : width, (uint8_t *)text); @@ -382,7 +380,7 @@ void DHUDMessage::Draw (int bottom, int visibility) xscale = yscale = 1; if (HUDWidth == 0) { - int scale = active_con_scaletext(AltScale); + int scale = active_con_scaletext(); screen_width /= scale; screen_height /= scale; bottom /= scale; @@ -486,7 +484,7 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight) { if (hudheight == 0) { - int scale = active_con_scaletext(AltScale); + int scale = active_con_scaletext(); screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, SCREENWIDTH / scale, DTA_VirtualHeight, SCREENHEIGHT / scale, @@ -579,7 +577,7 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh float trans = float(Alpha * -(Tics - FadeOutTics) / FadeOutTics); if (hudheight == 0) { - int scale = active_con_scaletext(AltScale); + int scale = active_con_scaletext(); screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, SCREENWIDTH / scale, DTA_VirtualHeight, SCREENHEIGHT / scale, @@ -668,7 +666,7 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu float trans = float(Alpha * Tics / FadeInTics); if (hudheight == 0) { - int scale = active_con_scaletext(AltScale); + int scale = active_con_scaletext(); screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, SCREENWIDTH / scale, DTA_VirtualHeight, SCREENHEIGHT / scale, @@ -839,7 +837,7 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in { if (hudheight == 0) { - int scale = active_con_scaletext(AltScale); + int scale = active_con_scaletext(); screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, SCREENWIDTH / scale, DTA_VirtualHeight, SCREENHEIGHT / scale, diff --git a/src/g_statusbar/sbar.h b/src/g_statusbar/sbar.h index bf516e3f0..55d26e71b 100644 --- a/src/g_statusbar/sbar.h +++ b/src/g_statusbar/sbar.h @@ -140,7 +140,6 @@ protected: int ClipX, ClipY, ClipWidth, ClipHeight, WrapWidth; // in HUD coords int ClipLeft, ClipTop, ClipRight, ClipBot; // in screen coords bool HandleAspect; - bool AltScale; EColorRange TextColor; FFont *Font; FRenderStyle Style;