Skip to content
Permalink
Browse files

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

  • Loading branch information...
coelckers committed Apr 10, 2019
1 parent 5e5780d commit 6acfbf8e02fc5034d325db394d2e3ece9fee186e
Showing with 10 additions and 13 deletions.
  1. +2 −2 src/c_console.cpp
  2. +8 −10 src/g_statusbar/hudmessages.cpp
  3. +0 −1 src/g_statusbar/sbar.h
@@ -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,
@@ -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,
@@ -140,7 +140,6 @@ class DHUDMessage : public DHUDMessageBase
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;

0 comments on commit 6acfbf8

Please sign in to comment.
You can’t perform that action at this time.