- Exhumed: Extend 7b8dcde5d2 by showing the M60's clip/magazine amount available when cl_showmagamt 1 is set.

This commit is contained in:
Mitchell Richters 2021-07-17 14:57:43 +10:00
parent 6940384625
commit 2a8e636066
3 changed files with 16 additions and 5 deletions

View file

@ -2801,6 +2801,11 @@ DEFINE_ACTION_FUNCTION(_Exhumed, GetPistolClip)
ACTION_RETURN_POINTER(&nPistolClip[nLocalPlayer]); ACTION_RETURN_POINTER(&nPistolClip[nLocalPlayer]);
} }
DEFINE_ACTION_FUNCTION(_Exhumed, GetPlayerClip)
{
ACTION_RETURN_POINTER(&nPlayerClip[nLocalPlayer]);
}
DEFINE_ACTION_FUNCTION(_ExhumedPlayer, IsUnderwater) DEFINE_ACTION_FUNCTION(_ExhumedPlayer, IsUnderwater)
{ {
PARAM_SELF_STRUCT_PROLOGUE(Player); PARAM_SELF_STRUCT_PROLOGUE(Player);

View file

@ -12,6 +12,7 @@ struct Exhumed native
native static int SizeOfStatusSequence(int s1); native static int SizeOfStatusSequence(int s1);
native static ExhumedPlayer GetViewPlayer(); native static ExhumedPlayer GetViewPlayer();
native static int GetPistolClip(); native static int GetPistolClip();
native static int GetPlayerClip();
static void DrawAbs(String img, int x, int y, int shade = 0) static void DrawAbs(String img, int x, int y, int shade = 0)
{ {

View file

@ -307,15 +307,20 @@ class ExhumedStatusBar : RazeStatusBar
int ammo = pp.nAmmo[weapon]; int ammo = pp.nAmmo[weapon];
if (ammo > 0) // wicon > 0 if (ammo > 0) // wicon > 0
{ {
if (weapon != kWeaponPistol || (weapon == kWeaponPistol && !cl_showmagamt)) if (weapon == kWeaponPistol && cl_showmagamt)
{
format = String.Format("%d", ammo);
}
else
{ {
int clip = CalcMagazineAmount(ammo, 6, Exhumed.GetPistolClip() == 0); int clip = CalcMagazineAmount(ammo, 6, Exhumed.GetPistolClip() == 0);
format = String.Format("%d/%d", clip, ammo - clip); 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. /* non-implemented weapon icon.
int wicon = 0;// ammo_sprites[weapon]; int wicon = 0;// ammo_sprites[weapon];
img = tileGetTexture(wicon); img = tileGetTexture(wicon);