From 2a8e636066f475681c504dee98662fc04c8e0e3f Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sat, 17 Jul 2021 14:57:43 +1000 Subject: [PATCH] - Exhumed: Extend 7b8dcde5d24ef60b03b0067fc530d5f65b5da00c by showing the M60's clip/magazine amount available when `cl_showmagamt 1` is set. --- source/games/exhumed/src/player.cpp | 5 +++++ .../static/zscript/games/exhumed/exhumedgame.zs | 1 + wadsrc/static/zscript/games/exhumed/ui/sbar.zs | 15 ++++++++++----- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index fe955b528..e1f2b5518 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -2801,6 +2801,11 @@ DEFINE_ACTION_FUNCTION(_Exhumed, GetPistolClip) ACTION_RETURN_POINTER(&nPistolClip[nLocalPlayer]); } +DEFINE_ACTION_FUNCTION(_Exhumed, GetPlayerClip) +{ + ACTION_RETURN_POINTER(&nPlayerClip[nLocalPlayer]); +} + DEFINE_ACTION_FUNCTION(_ExhumedPlayer, IsUnderwater) { PARAM_SELF_STRUCT_PROLOGUE(Player); diff --git a/wadsrc/static/zscript/games/exhumed/exhumedgame.zs b/wadsrc/static/zscript/games/exhumed/exhumedgame.zs index 5ac1376e3..52ce9b896 100644 --- a/wadsrc/static/zscript/games/exhumed/exhumedgame.zs +++ b/wadsrc/static/zscript/games/exhumed/exhumedgame.zs @@ -12,6 +12,7 @@ struct Exhumed native native static int SizeOfStatusSequence(int s1); native static ExhumedPlayer GetViewPlayer(); native static int GetPistolClip(); + native static int GetPlayerClip(); 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 6b5c6c157..103100564 100644 --- a/wadsrc/static/zscript/games/exhumed/ui/sbar.zs +++ b/wadsrc/static/zscript/games/exhumed/ui/sbar.zs @@ -307,15 +307,20 @@ class ExhumedStatusBar : RazeStatusBar int ammo = pp.nAmmo[weapon]; if (ammo > 0) // wicon > 0 { - if (weapon != kWeaponPistol || (weapon == kWeaponPistol && !cl_showmagamt)) - { - format = String.Format("%d", ammo); - } - else + if (weapon == kWeaponPistol && cl_showmagamt) { int clip = CalcMagazineAmount(ammo, 6, Exhumed.GetPistolClip() == 0); format = String.Format("%d/%d", clip, ammo - clip); } + else if (weapon == kWeaponM60 && cl_showmagamt) + { + int clip = CalcMagazineAmount(ammo, 100, Exhumed.GetPlayerClip() == 0); + format = String.Format("%d/%d", clip, ammo - clip); + } + else + { + format = String.Format("%d", ammo); + } /* non-implemented weapon icon. int wicon = 0;// ammo_sprites[weapon]; img = tileGetTexture(wicon);