From e3f44e222503fcd4fc5ef3ab4ea2e3b7eb4d5b77 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Fri, 22 Dec 2023 10:06:52 +0300 Subject: [PATCH] client: ammo: increase ammobar size depending on sprites size (extra change, not fixed in HL25 yet) See ValveSoftware/halflife#3728 comment --- cl_dll/ammo.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/cl_dll/ammo.cpp b/cl_dll/ammo.cpp index c511d0b2ff..81302a35a6 100644 --- a/cl_dll/ammo.cpp +++ b/cl_dll/ammo.cpp @@ -325,16 +325,19 @@ int CHudAmmo::VidInit( void ) // If we've already loaded weapons, let's get new sprites gWR.LoadAllWeaponSprites(); - if( ScreenWidth >= 640 ) - { - giABWidth = 20; - giABHeight = 4; - } + const int res = GetSpriteRes( ScreenWidth, ScreenHeight ); + int factor; + if( res >= 2560 ) + factor = 4; + else if( res >= 1280 ) + factor = 3; + else if( res >= 640 ) + factor = 2; else - { - giABWidth = 10; - giABHeight = 2; - } + factor = 1; + + giABWidth = 10 * factor; + giABHeight = 2 * factor; return 1; }