Skip to content

Commit

Permalink
HUD: Allow toggling icons
Browse files Browse the repository at this point in the history
  • Loading branch information
dastrukar committed Jan 27, 2021
1 parent af27973 commit 9dd1270
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions fdhud.zs
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,16 @@ class fdhud : BaseStatusBar
{
DrawImage("FDSTAMM", (x, y), DI_ITEM_OFFSETS);

if (GetCurrentAmmo() != null) {
// Draw icon
let ammotype = GetInventoryIcon(GetCurrentAmmo(), 0);
let adjustment = GetTextureOffsetCorrection(ammotype);

DrawInventoryIcon(GetCurrentAmmo(), (x+24+adjustment.X, y+21+adjustment.Y), DI_ITEM_OFFSETS, 0.25);

if (GetCurrentAmmo() != null) {
if (!CVar.GetCVar("fdhud_hideammoicon", CPlayer).GetBool())
{
// Draw icon
let ammotype = GetInventoryIcon(GetCurrentAmmo(), 0);
let adjustment = GetTextureOffsetCorrection(ammotype);

DrawInventoryIcon(GetCurrentAmmo(), (x+24+adjustment.X, y+21+adjustment.Y), DI_ITEM_OFFSETS, 0.25);
}

DrawString(mHUDFont, FormatNumber(mAmmoInterpolator.GetValue(), 3), (x+44, y+3), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW);
}
}
Expand All @@ -215,13 +218,14 @@ class fdhud : BaseStatusBar
let berserk = CPlayer.mo.FindInventory("PowerStrength");

// Get icon center
let hpTexID = TexMan.CheckForTexture(berserk? "PSTRA0" : "MEDIA0");

let adjustment = GetTextureOffsetCorrection(hpTexID);

DrawImage(berserk? "PSTRA0" : "MEDIA0", (x+29+adjustment.X, y+21+adjustment.Y), DI_ITEM_OFFSETS, 0.25);
//DrawImage(berserk? "PSTRA0" : "MEDIA0", (x+29, y+21), DI_ITEM_OFFSETS, 0.25);

if (!CVar.GetCVar("fdhud_hidehpicon", CPlayer).GetBool())
{
let hpTexID = TexMan.CheckForTexture(berserk? "PSTRA0" : "MEDIA0");

let adjustment = GetTextureOffsetCorrection(hpTexID);

DrawImage(berserk? "PSTRA0" : "MEDIA0", (x+29+adjustment.X, y+21+adjustment.Y), DI_ITEM_OFFSETS, 0.25);
}

DrawString(mHUDFont, FormatNumber(mHealthInterpolator.GetValue(), 3), (x+43, y+3), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW);
DrawImage("STTPRCNT", (x+43, y+3), DI_ITEM_OFFSETS);
Expand All @@ -233,7 +237,7 @@ class fdhud : BaseStatusBar

// Draw icon
let armor = CPlayer.mo.FindInventory("BasicArmor");
if (armor != null && armor.Amount > 0)
if (armor != null && armor.Amount > 0 && !CVar.GetCVar("fdhud_hidearmoicon", CPlayer).GetBool())
{
let armorTexID = GetInventoryIcon(armor, 0);
let adjustment = GetTextureOffsetCorrection(armorTexID);
Expand Down

0 comments on commit 9dd1270

Please sign in to comment.