From 7b8dcde5d24ef60b03b0067fc530d5f65b5da00c Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 16 Jul 2021 23:52:56 +1000 Subject: [PATCH] - Exhumed: Make use of `cl_showmagamt`. * Fixes #463. --- source/games/exhumed/src/player.cpp | 5 +++++ wadsrc/static/menudef.txt | 8 +++----- wadsrc/static/zscript/games/exhumed/exhumedgame.zs | 1 + wadsrc/static/zscript/games/exhumed/ui/sbar.zs | 12 ++++++++++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 3c25d47aa..fe955b528 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -2796,6 +2796,11 @@ DEFINE_ACTION_FUNCTION(_Exhumed, GetViewPlayer) ACTION_RETURN_POINTER(&PlayerList[nLocalPlayer]); } +DEFINE_ACTION_FUNCTION(_Exhumed, GetPistolClip) +{ + ACTION_RETURN_POINTER(&nPistolClip[nLocalPlayer]); +} + DEFINE_ACTION_FUNCTION(_ExhumedPlayer, IsUnderwater) { PARAM_SELF_STRUCT_PROLOGUE(Player); diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index cff36270d..be7e7d20d 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1229,11 +1229,9 @@ OptionMenu "HUDOptions" protected Option "$MSGMNU_PULSEMESSAGES", "con_pulsetext", "OnOff", "con_notify_advanced" Slider "$MSGMNU_MESSAGESCALE", "con_notifyscale", 0.36, 1.0, 0.04, 2 - ifnotgame(Exhumed) - { - StaticText "" - Option "$DSPLYMNU_CLIPAMT", "cl_showmagamt", OnOff - } + StaticText "" + Option "$DSPLYMNU_CLIPAMT", "cl_showmagamt", OnOff + StaticText "" Option "$DSPLYMNU_CROSSHAIR", "cl_crosshair", OnOff Slider "$DSPLYMNU_CROSSHAIRSCALE", "crosshairscale", 0.25, 1.0, 0.125, 2 diff --git a/wadsrc/static/zscript/games/exhumed/exhumedgame.zs b/wadsrc/static/zscript/games/exhumed/exhumedgame.zs index 33382b585..5ac1376e3 100644 --- a/wadsrc/static/zscript/games/exhumed/exhumedgame.zs +++ b/wadsrc/static/zscript/games/exhumed/exhumedgame.zs @@ -11,6 +11,7 @@ struct Exhumed native native static int MoveStatusSequence(int s1, int s2); native static int SizeOfStatusSequence(int s1); native static ExhumedPlayer GetViewPlayer(); + native static int GetPistolClip(); static void DrawAbs(String img, int x, int y, int shade = 0) { diff --git a/wadsrc/static/zscript/games/exhumed/ui/sbar.zs b/wadsrc/static/zscript/games/exhumed/ui/sbar.zs index 39b313e83..6b5c6c157 100644 --- a/wadsrc/static/zscript/games/exhumed/ui/sbar.zs +++ b/wadsrc/static/zscript/games/exhumed/ui/sbar.zs @@ -304,10 +304,18 @@ class ExhumedStatusBar : RazeStatusBar // Weapon // int weapon = pp.nCurrentWeapon; - int ammo = nCounterDest; + int ammo = pp.nAmmo[weapon]; if (ammo > 0) // wicon > 0 { - format = String.Format("%d", ammo); + if (weapon != kWeaponPistol || (weapon == kWeaponPistol && !cl_showmagamt)) + { + format = String.Format("%d", ammo); + } + else + { + int clip = CalcMagazineAmount(ammo, 6, Exhumed.GetPistolClip() == 0); + format = String.Format("%d/%d", clip, ammo - clip); + } /* non-implemented weapon icon. int wicon = 0;// ammo_sprites[weapon]; img = tileGetTexture(wicon);