mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
Merge pull request #532 from alexey-lysiuk/fix_althud_overlap
Improved layout of time/latency/artifacts in AltHUD
This commit is contained in:
commit
3f1740b944
3 changed files with 34 additions and 6 deletions
|
@ -57,6 +57,9 @@ class AWeapon;
|
|||
|
||||
void ST_SetNeedRefresh();
|
||||
|
||||
bool ST_IsTimeVisible();
|
||||
bool ST_IsLatencyVisible();
|
||||
|
||||
// HUD Message base object --------------------------------------------------
|
||||
|
||||
class DHUDMessage : public DObject
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
EXTERN_CVAR(Bool,am_follow)
|
||||
EXTERN_CVAR (Int, con_scaletext)
|
||||
EXTERN_CVAR (Bool, idmypos)
|
||||
EXTERN_CVAR (Int, screenblocks)
|
||||
|
||||
EXTERN_CVAR (Bool, am_showtime)
|
||||
EXTERN_CVAR (Bool, am_showtotaltime)
|
||||
|
@ -868,7 +869,7 @@ static void DrawCoordinates(player_t * CPlayer)
|
|||
|
||||
static void DrawTime()
|
||||
{
|
||||
if (hud_showtime <= 0 || hud_showtime > 9)
|
||||
if (!ST_IsTimeVisible())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -935,6 +936,21 @@ static void DrawTime()
|
|||
DrawHudText(SmallFont, hud_timecolor, timeString, hudwidth - width, height, FRACUNIT);
|
||||
}
|
||||
|
||||
static bool IsAltHUDTextVisible()
|
||||
{
|
||||
return hud_althud
|
||||
&& !automapactive
|
||||
&& (SCREENHEIGHT == viewheight)
|
||||
&& (11 == screenblocks);
|
||||
}
|
||||
|
||||
bool ST_IsTimeVisible()
|
||||
{
|
||||
return IsAltHUDTextVisible()
|
||||
&& (hud_showtime > 0)
|
||||
&& (hud_showtime <= 9);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Draw in-game latency
|
||||
|
@ -943,9 +959,7 @@ static void DrawTime()
|
|||
|
||||
static void DrawLatency()
|
||||
{
|
||||
if (hud_showlag <= 0 ||
|
||||
(hud_showlag == 1 && !netgame) ||
|
||||
hud_showlag > 2)
|
||||
if (!ST_IsLatencyVisible())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -975,11 +989,19 @@ static void DrawLatency()
|
|||
|
||||
const int characterCount = (int)strlen(tempstr);
|
||||
const int width = SmallFont->GetCharWidth('0') * characterCount + 2; // small offset from screen's border
|
||||
const int height = SmallFont->GetHeight() * 2;
|
||||
const int height = SmallFont->GetHeight() * (ST_IsTimeVisible() ? 2 : 1);
|
||||
|
||||
DrawHudText(SmallFont, color, tempstr, hudwidth - width, height, FRACUNIT);
|
||||
}
|
||||
|
||||
bool ST_IsLatencyVisible()
|
||||
{
|
||||
return IsAltHUDTextVisible()
|
||||
&& (hud_showlag > 0)
|
||||
&& (hud_showlag != 1 || netgame)
|
||||
&& (hud_showlag <= 2);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -1533,9 +1533,12 @@ void DBaseStatusBar::DrawPowerups ()
|
|||
// Each icon gets a 32x32 block to draw itself in.
|
||||
int x, y;
|
||||
AInventory *item;
|
||||
const int yshift = SmallFont->GetHeight();
|
||||
|
||||
x = -20;
|
||||
y = 17;
|
||||
y = 17
|
||||
+ (ST_IsTimeVisible() ? yshift : 0)
|
||||
+ (ST_IsLatencyVisible() ? yshift : 0);
|
||||
for (item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory)
|
||||
{
|
||||
if (item->DrawPowerup (x, y))
|
||||
|
|
Loading…
Reference in a new issue