Unnecessary type casts in alt hud.

This commit is contained in:
Mari the Deer 2022-06-13 15:49:43 +02:00
commit ed22a1f604
2 changed files with 9 additions and 11 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r118 \cu(Mon 13 Jun 10:05:16 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r118 \cu(2022-06-13 10:05:16)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r119 \cu(Mon 13 Jun 15:49:43 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r119 \cu(2022-06-13 15:49:43)\c-";

View file

@ -590,25 +590,23 @@ extend Class SWWMStatusBar
Screen.DrawTexture(AltAmmoTex[1],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
xx += 2;
let a = AmmoSlots[i];
let cur = Ammo(CPlayer.mo.FindInventory(a));
let cur = SWWMAmmo(CPlayer.mo.FindInventory(a));
int amt, amax;
if ( !cur )
{
amt = 0;
amax = GetDefaultByType(a).MaxAmount;
if ( a is 'SWWMAmmo' )
{
let def = GetDefaultByType((Class<SWWMAmmo>)(a));
if ( def.MagAmmoType ) amax *= GetDefaultByType(def.MagAmmoType).ClipSize;
}
let def = GetDefaultByType(a);
if ( def.MagAmmoType )
amax *= GetDefaultByType(def.MagAmmoType).ClipSize;
}
else
{
amt = cur.Amount;
amax = cur.MaxAmount;
if ( (cur is 'SWWMAmmo') && SWWMAmmo(cur).MagAmmoType )
if ( cur.MagAmmoType )
{
let mag = MagAmmo(CPlayer.mo.FindInventory(SWWMAmmo(cur).MagAmmoType));
let mag = MagAmmo(CPlayer.mo.FindInventory(cur.MagAmmoType));
// theoretically this should never be null, but nevertheless...
if ( mag )
{
@ -617,7 +615,7 @@ extend Class SWWMStatusBar
}
else
{
let def = GetDefaultByType(SWWMAmmo(cur).MagAmmoType);
let def = GetDefaultByType(cur.MagAmmoType);
amt = amt*def.ClipSize;
amax = amax*def.ClipSize+def.MaxAmount;
}