From 2f6ddf68bbb1ca1452e34b00342245b6bad954ad Mon Sep 17 00:00:00 2001 From: pierow Date: Thu, 9 May 2024 14:57:20 -0400 Subject: [PATCH] add 4 digit health and armor support - fix armor number spacing --- main/source/cl_dll/battery.cpp | 1 + main/source/cl_dll/health.cpp | 2 +- main/source/cl_dll/hud_redraw.cpp | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/main/source/cl_dll/battery.cpp b/main/source/cl_dll/battery.cpp index 141771b5..4a8bf1be 100644 --- a/main/source/cl_dll/battery.cpp +++ b/main/source/cl_dll/battery.cpp @@ -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; diff --git a/main/source/cl_dll/health.cpp b/main/source/cl_dll/health.cpp index d26ed1c0..fc904fed 100644 --- a/main/source/cl_dll/health.cpp +++ b/main/source/cl_dll/health.cpp @@ -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; } diff --git a/main/source/cl_dll/hud_redraw.cpp b/main/source/cl_dll/hud_redraw.cpp index 589f7a0f..2d26cb28 100644 --- a/main/source/cl_dll/hud_redraw.cpp +++ b/main/source/cl_dll/hud_redraw.cpp @@ -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; }