mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +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),
|
DrawText(twod, stats.font, stats.standardColor, 2 * hud_statscale, y, GStrings.localize(volname),
|
||||||
DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||||
DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
|
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;
|
return SBarTop;
|
||||||
}
|
}
|
||||||
void DoDrawAutomapHUD(int crdefault, int highlight);
|
void DoDrawAutomapHUD(int crdefault, int highlight);
|
||||||
|
short CalcMagazineAmount(short ammo_remaining, short clip_capacity, bool reloading);
|
||||||
|
|
||||||
//protected:
|
//protected:
|
||||||
void DrawPowerups ();
|
void DrawPowerups ();
|
||||||
|
|
Loading…
Reference in a new issue