Tiny tweak to generic ammo display to match sidemods.

This commit is contained in:
Mari the Deer 2023-11-26 18:33:42 +01:00
commit 5a53f52472
2 changed files with 13 additions and 9 deletions

View file

@ -264,34 +264,38 @@ extend Class SWWMStatusBar
// generic display
double xx = ss.x-(xmargin+bx+2), yy = ss.y-(ymargin+22);
String str;
int len;
int dlen, dcnt;
if ( CPlayer.ReadyWeapon.Ammo2 && (CPlayer.ReadyWeapon.Ammo2 != CPlayer.ReadyWeapon.Ammo1) )
{
str = String.Format("%d",CPlayer.ReadyWeapon.Ammo2.Amount);
len = str.Length();
dlen = 1+int(Log10(max(1,CPlayer.ReadyWeapon.Ammo2.MaxAmount)));
str = String.Format("%*d",dlen,CPlayer.ReadyWeapon.Ammo2.Amount);
yy -= 12;
Screen.DrawTexture(GenericAmmoTex[2],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
for ( int i=0; i<len; i++ )
for ( int i=0; i<dlen; i++ )
{
xx -= 4;
Screen.DrawTexture(GenericAmmoTex[1],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
Screen.DrawTexture(GenericAmmoTex[0],false,xx-2,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
dcnt = (dlen-1)-int(Log10(max(1,CPlayer.ReadyWeapon.Ammo2.Amount)));
for ( int i=0; i<dlen; i++ ) Screen.DrawChar(MiniHUDFont,mhudfontcol[(CPlayer.ReadyWeapon.Ammo2.Amount<=0)?MCR_RED:MCR_BRASS],xx+i*4,yy+2,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
Screen.DrawText(MiniHUDFont,mhudfontcol[(CPlayer.ReadyWeapon.Ammo2.Amount<=0)?MCR_RED:MCR_BRASS],xx,yy+2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += 12;
}
xx = ss.x-(xmargin+bx+2);
if ( CPlayer.ReadyWeapon.Ammo1 )
{
str = String.Format("%d",CPlayer.ReadyWeapon.Ammo1.Amount);
len = str.Length();
dlen = 1+int(Log10(max(1,CPlayer.ReadyWeapon.Ammo1.MaxAmount)));
str = String.Format("%*d",dlen,CPlayer.ReadyWeapon.Ammo1.Amount);
Screen.DrawTexture(GenericAmmoTex[2],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
for ( int i=0; i<len; i++ )
for ( int i=0; i<dlen; i++ )
{
xx -= 4;
Screen.DrawTexture(GenericAmmoTex[1],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
Screen.DrawTexture(GenericAmmoTex[0],false,xx-2,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
dcnt = (dlen-1)-int(Log10(max(1,CPlayer.ReadyWeapon.Ammo1.Amount)));
for ( int i=0; i<dlen; i++ ) Screen.DrawChar(MiniHUDFont,mhudfontcol[(CPlayer.ReadyWeapon.Ammo1.Amount<=0)?MCR_RED:MCR_BRASS],xx+i*4,yy+2,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
Screen.DrawText(MiniHUDFont,mhudfontcol[(CPlayer.ReadyWeapon.Ammo1.Amount<=0)?MCR_RED:MCR_BRASS],xx,yy+2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
}