mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- DBaseStatusBar: Create function DBaseStatusBar::CalcMagazineAmount()
for use with calculating magazine values when drawing the HUD.
This commit is contained in:
parent
aeb807bea1
commit
6f653da0fc
2 changed files with 20 additions and 1 deletions
|
@ -809,8 +809,26 @@ void DBaseStatusBar::PrintAutomapInfo(FLevelStats& stats)
|
|||
DrawText(twod, stats.font, stats.standardColor, 2 * hud_statscale, y, GStrings.localize(volname),
|
||||
DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||
DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
|
||||
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
short DBaseStatusBar::CalcMagazineAmount(short ammo_remaining, short clip_capacity, bool reloading)
|
||||
{
|
||||
// Determine amount in clip.
|
||||
short clip_amount = ammo_remaining % clip_capacity;
|
||||
|
||||
// Set current clip value to clip capacity if wrapped around to zero, otherwise use determined value.
|
||||
short clip_current = ammo_remaining != 0 && clip_amount == 0 ? clip_capacity : clip_amount;
|
||||
|
||||
// Return current clip value if weapon has rounds or is not on a reload cycle.
|
||||
return ammo_remaining == 0 || reloading && clip_amount == 0 ? 0 : clip_current;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -196,6 +196,7 @@ public:
|
|||
return SBarTop;
|
||||
}
|
||||
void DoDrawAutomapHUD(int crdefault, int highlight);
|
||||
short CalcMagazineAmount(short ammo_remaining, short clip_capacity, bool reloading);
|
||||
|
||||
//protected:
|
||||
void DrawPowerups ();
|
||||
|
|
Loading…
Reference in a new issue