Add a cvar to swap health and armor position on alternative HUD

When enabled, this makes the layout identical to the standard HUD
(similar to how most other games lay out health and armor on a HUD).
This commit is contained in:
Hugo Locurcio 2023-02-03 16:23:19 +01:00 committed by Ricardo Luís Vaz Silva
parent 5b793958f9
commit 97cfd32677
3 changed files with 8 additions and 3 deletions

View File

@ -74,6 +74,7 @@ CVAR (Int , hud_showlag, 0, CVAR_ARCHIVE); // Show input latency (maketic - g
CVAR (Int, hud_ammo_order, 0, CVAR_ARCHIVE); // ammo image and text order
CVAR (Int, hud_ammo_red, 25, CVAR_ARCHIVE) // ammo percent less than which status is red
CVAR (Int, hud_ammo_yellow, 50, CVAR_ARCHIVE) // ammo percent less is yellow more green
CVAR (Bool, hud_swaphealtharmor, false, CVAR_ARCHIVE); // swap health and armor position on HUD
CVAR (Int, hud_health_red, 25, CVAR_ARCHIVE) // health amount less than which status is red
CVAR (Int, hud_health_yellow, 50, CVAR_ARCHIVE) // health amount less than which status is yellow
CVAR (Int, hud_health_green, 100, CVAR_ARCHIVE) // health amount above is blue, below is green
@ -193,4 +194,3 @@ void DBaseStatusBar::DrawAltHUD()
VMCall(func, params, countof(params), nullptr, 0);
}
}

View File

@ -1155,6 +1155,7 @@ OptionMenu "AltHUDOptions" protected
Option "$ALTHUDMNU_AMMOORDER", "hud_ammo_order", "AltHUDAmmoOrder"
Slider "$ALTHUDMNU_AMMORED", "hud_ammo_red", 0, 100, 1, 0
Slider "$ALTHUDMNU_AMMOYELLOW", "hud_ammo_yellow", 0, 100, 1, 0
Option "$ALTHUDMNU_SWAPHEALTHARMOR", "hud_swaphealtharmor", "OnOff"
Slider "$ALTHUDMNU_HEALTHRED", "hud_health_red", 0, 100, 1, 0
Slider "$ALTHUDMNU_HEALTHYELLOW", "hud_health_yellow", 0, 100, 1, 0
Slider "$ALTHUDMNU_HEALTHGREEN", "hud_health_green", 0, 100, 1, 0

View File

@ -926,8 +926,12 @@ class AltHud ui
DrawStatus(CPlayer, 5, hudheight-75);
DrawFrags(CPlayer, 5, hudheight-70);
}
DrawHealth(CPlayer, 5, hudheight-45);
DrawArmor(BasicArmor(CPlayer.mo.FindInventory('BasicArmor')), HexenArmor(CPlayer.mo.FindInventory('HexenArmor')), 5, hudheight-20);
int armory = hud_swaphealtharmor ? hudheight-45 : hudheight-20;
int healthy = hud_swaphealtharmor ? hudheight-20 : hudheight-45;
DrawHealth(CPlayer, 5, healthy);
DrawArmor(BasicArmor(CPlayer.mo.FindInventory('BasicArmor')), HexenArmor(CPlayer.mo.FindInventory('HexenArmor')), 5, armory);
int y = DrawKeys(CPlayer, hudwidth-4, hudheight-10);
y = DrawAmmo(CPlayer, hudwidth-5, y);
if (hud_showweapons) DrawWeapons(CPlayer, hudwidth - 5, y);