add 4 digit health and armor support

- fix armor number spacing
This commit is contained in:
pierow 2024-05-09 14:57:20 -04:00
parent 92db73eb89
commit 2f6ddf68bb
3 changed files with 11 additions and 2 deletions

View file

@ -154,6 +154,7 @@ int CHudBattery::Draw(float flTime)
}
x += (m_prc1->right - m_prc1->left) * gHUD.m_Health.m_fHealthScale;
x += ((gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left) / 2) * gHUD.m_Health.m_fHealthScale;
x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b, 255, gHUD.m_Health.m_fHealthScale, CHud::a_southwest);
return 1;

View file

@ -340,7 +340,7 @@ int CHudHealth::Draw(float flTime)
gHUD.DrawHudFill(x, y, iWidth, iHeight, r ,g , b, a, m_fHealthScale);
gHUD.m_Battery.m_iAnchorX = x + + iWidth + HealthWidth / 2;
gHUD.m_Battery.m_iAnchorX = x + iWidth + HealthWidth / 2;
gHUD.m_Battery.m_iAnchorY = initialY;
}

View file

@ -577,10 +577,18 @@ int CHud::DrawHudNumber(int x, int y, int iFlags, int iNumber, int r, int g, int
if (iNumber > 0)
{
// Draw 1000's
if (iNumber >= 1000)
{
k = iNumber / 1000;
DrawHudSpriteIndex(m_HUD_number_0 + k, x, y, r, g, b, a, scale, alignment);
x += iWidth;
}
// SPR_Draw 100's
if (iNumber >= 100)
{
k = iNumber / 100;
k = (iNumber % 1000) / 100;
DrawHudSpriteIndex(m_HUD_number_0 + k, x, y, r, g, b, a, scale, alignment);
x += iWidth;
}