]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix spect HUD, high bound for health and armor bars
authorz411 <z411@omaera.org>
Thu, 25 Nov 2021 20:00:21 +0000 (17:00 -0300)
committerz411 <z411@omaera.org>
Thu, 25 Nov 2021 20:00:21 +0000 (17:00 -0300)
qcsrc/client/hud/panel/spect.qc

index ae0f7be72218f9c169694091259636737c6aff37..6867accfb23bc44ccbff0999e47d7f71b704ca38 100644 (file)
@@ -67,8 +67,8 @@ void HUD_SpectHUD_drawTeamPlayers(vector pos, entity tm, vector rgb, bool invert
                } else {
                        entity entcs = entcs_receiver(pl.sv_entnum);
                        if(entcs.m_entcs_private) {
-                               health = (entcs.healthvalue / autocvar_hud_panel_healtharmor_maxhealth) * line_sz.x;
-                               armor = (GetResource(entcs, RES_ARMOR) / autocvar_hud_panel_healtharmor_maxarmor) * line_sz_sub.x;
+                               health = (min(entcs.healthvalue, autocvar_hud_panel_healtharmor_maxhealth) / autocvar_hud_panel_healtharmor_maxhealth) * line_sz.x;
+                               armor = (min(GetResource(entcs, RES_ARMOR), autocvar_hud_panel_healtharmor_maxarmor) / autocvar_hud_panel_healtharmor_maxarmor) * line_sz_sub.x;
                                        
                                Weapon wep = REGISTRY_GET(Weapons, entcs.activewepid);
                                icon = strcat("gfx/hud/luma/", wep.model2);
@@ -178,8 +178,8 @@ void HUD_SpectHUD_drawDuelScore(vector pos, entity pl, bool invert)
        
        entity entcs = entcs_receiver(pl.sv_entnum);
        if(entcs.m_entcs_private) {
-               health = (entcs.healthvalue / autocvar_hud_panel_healtharmor_maxhealth) * health_sz.x;
-               armor = (GetResource(entcs, RES_ARMOR) / autocvar_hud_panel_healtharmor_maxarmor) * armor_sz.x;
+               health = (min(entcs.healthvalue, autocvar_hud_panel_healtharmor_maxhealth) / autocvar_hud_panel_healtharmor_maxhealth) * health_sz.x;
+               armor = (min(GetResource(entcs, RES_ARMOR), autocvar_hud_panel_healtharmor_maxarmor) / autocvar_hud_panel_healtharmor_maxarmor) * armor_sz.x;
        }
        
        if(invert)