- cleaned out the unneeded scaling hacks from the HUD messages.

This commit is contained in:
Christoph Oelckers 2019-04-10 21:23:27 +02:00
parent 5e5780dd65
commit 6acfbf8e02
3 changed files with 10 additions and 13 deletions

View file

@ -800,7 +800,7 @@ void FNotifyBuffer::AddString(int printlevel, FString source)
con_notifylines == 0) con_notifylines == 0)
return; return;
width = DisplayWidth / active_con_scaletext(hud_generic); width = DisplayWidth / active_con_scaletext(generic_hud);
FFont *font = hud_generic ? NewSmallFont : SmallFont; 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.) 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 else
color = PrintColors[notify.PrintLevel]; color = PrintColors[notify.PrintLevel];
int scale = active_con_scaletext(hud_generic); int scale = active_con_scaletext(generic_hud);
if (!center) if (!center)
screen->DrawText (font, color, 0, line, notify.Text, screen->DrawText (font, color, 0, line, notify.Text,
DTA_VirtualWidth, screen->GetWidth() / scale, DTA_VirtualWidth, screen->GetWidth() / scale,

View file

@ -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 [0.0, 1.0]: Positions center of box
// for x range [1.0, 2.0]: Positions center of box, and centers text inside it // for x range [1.0, 2.0]: Positions center of box, and centers text inside it
HUDWidth = HUDHeight = 0; 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) if (fabs (x) > 2.f)
{ {
CenterX = true; CenterX = true;
@ -198,7 +197,7 @@ DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int h
Top = y; Top = y;
HoldTics = (int)(holdTime * TICRATE); HoldTics = (int)(holdTime * TICRATE);
Tics = -1; // -1 to compensate for one additional Tick the message will receive. 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; TextColor = textColor;
State = 0; State = 0;
SourceText = copystring (text); SourceText = copystring (text);
@ -252,8 +251,7 @@ void DHUDMessage::Serialize(FSerializer &arc)
("handleaspect", HandleAspect) ("handleaspect", HandleAspect)
("visibilityflags", VisibilityFlags) ("visibilityflags", VisibilityFlags)
("style", Style) ("style", Style)
("alpha", Alpha) ("alpha", Alpha);
("altscale", AltScale);
if (arc.isReading()) if (arc.isReading())
{ {
@ -322,7 +320,7 @@ void DHUDMessage::ResetText (const char *text)
} }
else else
{ {
width = SCREENWIDTH / active_con_scaletext(AltScale); width = SCREENWIDTH / active_con_scaletext();
} }
Lines = V_BreakLines (Font, NoWrap ? INT_MAX : width, (uint8_t *)text); 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; xscale = yscale = 1;
if (HUDWidth == 0) if (HUDWidth == 0)
{ {
int scale = active_con_scaletext(AltScale); int scale = active_con_scaletext();
screen_width /= scale; screen_width /= scale;
screen_height /= scale; screen_height /= scale;
bottom /= scale; bottom /= scale;
@ -486,7 +484,7 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight)
{ {
if (hudheight == 0) if (hudheight == 0)
{ {
int scale = active_con_scaletext(AltScale); int scale = active_con_scaletext();
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / scale, DTA_VirtualWidth, SCREENWIDTH / scale,
DTA_VirtualHeight, SCREENHEIGHT / 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); float trans = float(Alpha * -(Tics - FadeOutTics) / FadeOutTics);
if (hudheight == 0) if (hudheight == 0)
{ {
int scale = active_con_scaletext(AltScale); int scale = active_con_scaletext();
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / scale, DTA_VirtualWidth, SCREENWIDTH / scale,
DTA_VirtualHeight, SCREENHEIGHT / 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); float trans = float(Alpha * Tics / FadeInTics);
if (hudheight == 0) if (hudheight == 0)
{ {
int scale = active_con_scaletext(AltScale); int scale = active_con_scaletext();
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / scale, DTA_VirtualWidth, SCREENWIDTH / scale,
DTA_VirtualHeight, SCREENHEIGHT / scale, DTA_VirtualHeight, SCREENHEIGHT / scale,
@ -839,7 +837,7 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in
{ {
if (hudheight == 0) if (hudheight == 0)
{ {
int scale = active_con_scaletext(AltScale); int scale = active_con_scaletext();
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / scale, DTA_VirtualWidth, SCREENWIDTH / scale,
DTA_VirtualHeight, SCREENHEIGHT / scale, DTA_VirtualHeight, SCREENHEIGHT / scale,

View file

@ -140,7 +140,6 @@ protected:
int ClipX, ClipY, ClipWidth, ClipHeight, WrapWidth; // in HUD coords int ClipX, ClipY, ClipWidth, ClipHeight, WrapWidth; // in HUD coords
int ClipLeft, ClipTop, ClipRight, ClipBot; // in screen coords int ClipLeft, ClipTop, ClipRight, ClipBot; // in screen coords
bool HandleAspect; bool HandleAspect;
bool AltScale;
EColorRange TextColor; EColorRange TextColor;
FFont *Font; FFont *Font;
FRenderStyle Style; FRenderStyle Style;