]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
Access directly these autocvars
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index 2e99f1a40d8a83999c93634f57911819a5897d0a..8f690bb18adfcd3132832dae5f854393eac4a6ba 100644 (file)
@@ -773,7 +773,6 @@ void HUD_Weapons(void)
        }
 
        float weapons_st = getstati(STAT_WEAPONS);
-       float label = autocvar_hud_panel_weapons_label;
 
        for(i = 0; i < weapon_cnt; ++i)
        {
@@ -813,9 +812,9 @@ void HUD_Weapons(void)
                {
                        drawpic_aspect_skin(wpnpos, strcat("weapon", self.netname), wpnsize, '1 1 1', wpnalpha, DRAWFLAG_NORMAL);
 
-                       if(label == 1) // weapon number
+                       if(autocvar_hud_panel_weapons_label == 1) // weapon number
                                drawstring(wpnpos, ftos(weapid), '1 1 0' * 0.5 * wpnsize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-                       else if(label == 2) // bind
+                       else if(autocvar_hud_panel_weapons_label == 2) // bind
                                drawstring(wpnpos, getcommandkey(ftos(weapid), strcat("impulse ", ftos(weapid))), '1 1 0' * 0.5 * wpnsize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 
                        // draw ammo status bar
@@ -1190,117 +1189,86 @@ void HUD_Powerups(void)
                mySize -= '2 2 0' * panel_bg_padding;
        }
 
-       vector barsize;
-       vector picpos;
-       vector numpos;
-
-       string leftname, rightname;
-    string leftprogressname, rightprogressname;
-       float leftcnt, rightcnt;
-       float leftexact, rightexact;
-       if (autocvar_hud_panel_powerups_flip) {
-               leftname = "strength";
-        leftprogressname = autocvar_hud_panel_powerups_progressbar_strength;
-               leftcnt = ceil(strength_time);
-               leftexact = strength_time;
-
-               rightname = "shield";
-        rightprogressname = autocvar_hud_panel_powerups_progressbar_shield;
-               rightcnt = ceil(shield_time);
-               rightexact = shield_time;
-       } else {
-               leftname = "shield";
-        leftprogressname = autocvar_hud_panel_powerups_progressbar_shield;
-               leftcnt = ceil(shield_time);
-               leftexact = shield_time;
-
-               rightname = "strength";
-        rightprogressname = autocvar_hud_panel_powerups_progressbar_strength;
-               rightcnt = ceil(strength_time);
-               rightexact = strength_time;
-       }
-
-       float baralign = autocvar_hud_panel_powerups_baralign;
-       float iconalign = autocvar_hud_panel_powerups_iconalign;
-
        float panel_ar = mySize_x/mySize_y;
        float is_vertical = (panel_ar < 1);
+       vector shield_offset, strength_offset;
        if (panel_ar >= 4 || (panel_ar >= 1/4 && panel_ar < 1))
        {
-        barsize = eX * 0.5 * mySize_x + eY * mySize_y;
-               if(leftcnt)
+               mySize_x *= 0.5;
+               if (autocvar_hud_panel_powerups_flip)
+                       shield_offset_x = mySize_x;
+               else
+                       strength_offset_x = mySize_x;
+       }
+       else
+       {
+               mySize_y *= 0.5;
+               if (autocvar_hud_panel_powerups_flip)
+                       shield_offset_y = mySize_y;
+               else
+                       strength_offset_y = mySize_y;
+       }
+
+       float shield_baralign, strength_baralign;
+       float shield_iconalign, strength_iconalign;
+       if (autocvar_hud_panel_powerups_flip)
+       {
+               strength_baralign = (autocvar_hud_panel_powerups_baralign == 2 || autocvar_hud_panel_powerups_baralign == 1);
+               shield_baralign = (autocvar_hud_panel_powerups_baralign == 3 || autocvar_hud_panel_powerups_baralign == 1);
+               strength_iconalign = (autocvar_hud_panel_powerups_iconalign == 2 || autocvar_hud_panel_powerups_iconalign == 1);
+               shield_iconalign = (autocvar_hud_panel_powerups_iconalign == 3 || autocvar_hud_panel_powerups_iconalign == 1);
+       }
+       else
+       {
+               shield_baralign = (autocvar_hud_panel_powerups_baralign == 2 || autocvar_hud_panel_powerups_baralign == 1);
+               strength_baralign = (autocvar_hud_panel_powerups_baralign == 3 || autocvar_hud_panel_powerups_baralign == 1);
+               shield_iconalign = (autocvar_hud_panel_powerups_iconalign == 2 || autocvar_hud_panel_powerups_iconalign == 1);
+               strength_iconalign = (autocvar_hud_panel_powerups_iconalign == 3 || autocvar_hud_panel_powerups_iconalign == 1);
+       }
+
+       if(shield_time)
+       {
+               const float maxshield = 30;
+               float shield = ceil(shield_time);
+               if(autocvar_hud_panel_powerups_progressbar)
                {
-                       if(autocvar_hud_panel_powerups_progressbar)
-                       {
-                               HUD_Panel_GetProgressBarColorForString(leftname);
-                               HUD_Panel_DrawProgressBar(pos, barsize, leftprogressname, leftcnt/30, is_vertical, (baralign == 1 || baralign == 2), progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1), DRAWFLAG_NORMAL);
-                       }
-            if(autocvar_hud_panel_powerups_text)
-            {
-                               if(leftcnt > 1)
-                                       DrawNumIcon(pos, barsize, leftcnt, leftname, is_vertical, (iconalign == 1 || iconalign == 2), '1 1 1', 1);
-                               if(leftcnt <= 5)
-                                       DrawNumIcon_expanding(pos, barsize, leftcnt, leftname, is_vertical, (iconalign == 1 || iconalign == 2), '1 1 1', bound(0, (leftcnt - leftexact) / 0.5, 1));
-                       }
+                       HUD_Panel_GetProgressBarColor(shield);
+                       HUD_Panel_DrawProgressBar(pos + shield_offset, mySize, autocvar_hud_panel_powerups_progressbar_shield, shield/maxshield, is_vertical, shield_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                }
-
-               if(rightcnt)
+               if(autocvar_hud_panel_powerups_text)
                {
-                       pos_x += barsize_x;
-                       if(autocvar_hud_panel_powerups_progressbar)
-                       {
-                               HUD_Panel_GetProgressBarColorForString(rightname);
-                               HUD_Panel_DrawProgressBar(pos, barsize, rightprogressname, rightcnt/30, is_vertical, (baralign == 1 || baralign == 3), progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1), DRAWFLAG_NORMAL);
-                       }
-            if(autocvar_hud_panel_powerups_text)
-            {
-                               if(rightcnt > 1)
-                                       DrawNumIcon(pos, barsize, rightcnt, rightname, is_vertical, (iconalign == 1 || iconalign == 3), '1 1 1', 1);
-                               if(rightcnt <= 5)
-                                       DrawNumIcon_expanding(pos, eX * 0.5 * mySize_x + eY * mySize_y, rightcnt, rightname, is_vertical, (iconalign == 1 || iconalign == 3), '1 1 1', bound(0, (rightcnt - rightexact) / 0.5, 1));
-                       }
+                       if(shield > 1)
+                               DrawNumIcon(pos + shield_offset, mySize, shield, "shield", is_vertical, shield_iconalign, '1 1 1', 1);
+                       if(shield <= 5)
+                               DrawNumIcon_expanding(pos + shield_offset, mySize, shield, "shield", is_vertical, shield_iconalign, '1 1 1', bound(0, (shield - shield_time) / 0.5, 1));
                }
        }
-       else
+
+       if(strength_time)
        {
-        barsize = eX * mySize_x + eY * 0.5 * mySize_y;
-               if(leftcnt)
+               const float maxstrength = 30;
+               float strength = ceil(strength_time);
+               if(autocvar_hud_panel_powerups_progressbar)
                {
-                       if(autocvar_hud_panel_powerups_progressbar)
-                       {
-                               HUD_Panel_GetProgressBarColorForString(leftname);
-                               HUD_Panel_DrawProgressBar(pos, barsize, leftprogressname, leftcnt/30, is_vertical, (baralign == 1 || baralign == 2), progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1), DRAWFLAG_NORMAL);
-                       }
-            if(autocvar_hud_panel_powerups_text)
-            {
-                               if(leftcnt > 1)
-                                       DrawNumIcon(pos, barsize, leftcnt, leftname, is_vertical, (iconalign == 1 || iconalign == 2), '1 1 1', 1);
-                               if(leftcnt <= 5)
-                                       DrawNumIcon_expanding(pos, barsize, leftcnt, leftname, is_vertical, (iconalign == 1 || iconalign == 2), '1 1 1', bound(0, (leftcnt - leftexact) / 0.5, 1));
-                       }
+                       HUD_Panel_GetProgressBarColor(strength);
+                       HUD_Panel_DrawProgressBar(pos + strength_offset, mySize, autocvar_hud_panel_powerups_progressbar_strength, strength/maxstrength, is_vertical, strength_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                }
-
-               if(rightcnt)
+               if(autocvar_hud_panel_powerups_text)
                {
-                       pos_y += barsize_y;
-                       if(autocvar_hud_panel_powerups_progressbar)
-                       {
-                               HUD_Panel_GetProgressBarColorForString(rightname);
-                               HUD_Panel_DrawProgressBar(pos, barsize, rightprogressname, rightcnt/30, is_vertical, (baralign == 1 || baralign == 3), progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1), DRAWFLAG_NORMAL);
-                       }
-            if(autocvar_hud_panel_powerups_text)
-            {
-                               if(rightcnt > 1)
-                                       DrawNumIcon(pos, barsize, rightcnt, rightname, is_vertical, (iconalign == 1 || iconalign == 3), '1 1 1', 1);
-                               if(rightcnt <= 5)
-                                       DrawNumIcon_expanding(pos, barsize, rightcnt, rightname, is_vertical, (iconalign == 1 || iconalign == 3), '1 1 1', bound(0, (rightcnt - rightexact) / 0.5, 1));
-                       }
+                       if(strength > 1)
+                               DrawNumIcon(pos + strength_offset, mySize, strength, "strength", is_vertical, strength_iconalign, '1 1 1', 1);
+                       if(strength <= 5)
+                               DrawNumIcon_expanding(pos + strength_offset, mySize, strength, "strength", is_vertical, strength_iconalign, '1 1 1', bound(0, (strength - strength_time) / 0.5, 1));
                }
        }
 }
 
 // Health/armor (#3)
 //
+float health_time, prev_health;
+float armor_time, prev_armor;
+var float saved_health = -2;
+var float saved_armor = -2;
 void HUD_HealthArmor(void)
 {
        float armor, health, fuel;
@@ -1311,7 +1279,36 @@ void HUD_HealthArmor(void)
 
                health = getstati(STAT_HEALTH);
                if(health <= 0)
+               {
+                       health_time = -1;
                        return;
+               }
+               if (autocvar_hud_panel_healtharmor_progressbar_gfx)
+               {
+                       if ( (prev_spectatee_status == -1 && spectatee_status > 0) //before observing, now spectating
+                         || (prev_spectatee_status > 0 && spectatee_status > 0 && prev_spectatee_status != spectatee_status) //changed spectated player
+                       )
+                       {
+                               //no effect
+                               saved_health = 0;
+                               saved_armor = 0;
+                               health_time = 0;
+                               armor_time = 0;
+                       }
+                       else if(prev_spectatee_status == -1 || (prev_spectatee_status > 0 && !spectatee_status)) //before spectating/observing, now playing
+                               health_time = -1;
+
+                       if (health_time == -1)
+                       {
+                               //start the load effect
+                               saved_health = -2;
+                               saved_armor = -2;
+                               health_time = time;
+                               armor_time = time;
+                               prev_health = 0;
+                               prev_armor = 0;
+                       }
+               }
                armor = getstati(STAT_ARMOR);
                fuel = getstati(STAT_FUEL);
        }
@@ -1336,9 +1333,6 @@ void HUD_HealthArmor(void)
                mySize -= '2 2 0' * panel_bg_padding;
        }
 
-       vector barsize;
-       vector picpos, numpos;
-
        float baralign = autocvar_hud_panel_healtharmor_baralign;
        float iconalign = autocvar_hud_panel_healtharmor_iconalign;
 
@@ -1389,115 +1383,141 @@ void HUD_HealthArmor(void)
        }
        else
        {
-               string leftname, rightname;
-        string leftprogressname, rightprogressname;
-               float leftcnt, rightcnt;
-               float leftmax, rightmax;
-               float leftactive, rightactive;
-               float leftalpha, rightalpha;
-               if (autocvar_hud_panel_healtharmor_flip) { // old style layout with armor left/top of health
-                       leftname = "armor";
-            leftprogressname = autocvar_hud_panel_healtharmor_progressbar_armor;
-                       leftcnt = armor;
-                       if(leftcnt)
-                               leftactive = 1;
-                       leftalpha = min((armor+10)/55, 1);
-            leftmax = maxarmor;
-
-                       rightname = "health";
-            rightprogressname = autocvar_hud_panel_healtharmor_progressbar_health;
-                       rightcnt = health;
-                       rightactive = 1;
-                       rightalpha = 1;
-            rightmax = maxhealth;
-               } else {
-                       leftname = "health";
-            leftprogressname = autocvar_hud_panel_healtharmor_progressbar_health;
-                       leftcnt = health;
-                       leftactive = 1;
-                       leftalpha = 1;
-            leftmax = maxhealth;
-
-                       rightname = "armor";
-            rightprogressname = autocvar_hud_panel_healtharmor_progressbar_armor;
-                       rightcnt = armor;
-                       if(rightcnt)
-                               rightactive = 1;
-                       rightalpha = min((armor+10)/55, 1);
-            rightmax = maxarmor;
-               }
-
                float panel_ar = mySize_x/mySize_y;
                float is_vertical = (panel_ar < 1);
+               vector health_offset, armor_offset;
                if (panel_ar >= 4 || (panel_ar >= 1/4 && panel_ar < 1))
                {
-            barsize = eX * 0.5 * mySize_x + eY * mySize_y;
-                       if(leftactive)
-                       {
-                               if(autocvar_hud_panel_healtharmor_progressbar)
-                               {
-                                       HUD_Panel_GetProgressBarColorForString(leftname);
-                                       HUD_Panel_DrawProgressBar(pos, barsize, leftprogressname, leftcnt/leftmax, is_vertical, (baralign == 1 || baralign == 2), progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
-                               }
-                               if(autocvar_hud_panel_healtharmor_text)
-                                       DrawNumIcon(pos, barsize, leftcnt, leftname, is_vertical, (iconalign == 1 || iconalign == 2), HUD_Get_Num_Color(leftcnt, leftmax), 1);
-                       }
-
-                       if(rightactive)
-                       {
-                               if(autocvar_hud_panel_healtharmor_progressbar)
-                               {
-                                       HUD_Panel_GetProgressBarColorForString(rightname);
-                                       HUD_Panel_DrawProgressBar(pos + eX * 0.5 * mySize_x, barsize, rightprogressname, rightcnt/rightmax, is_vertical, (baralign == 1 || baralign == 3), progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
-                               }
-                               if(autocvar_hud_panel_healtharmor_text)
-                                       DrawNumIcon(pos + eX * 0.5 * mySize_x, barsize, rightcnt, rightname, is_vertical, (iconalign == 1 || iconalign == 3), HUD_Get_Num_Color(rightcnt, rightmax), 1);
-                       }
+                       mySize_x *= 0.5;
+                       if (autocvar_hud_panel_healtharmor_flip)
+                               health_offset_x = mySize_x;
+                       else
+                               armor_offset_x = mySize_x;
+               }
+               else
+               {
+                       mySize_y *= 0.5;
+                       if (autocvar_hud_panel_healtharmor_flip)
+                               health_offset_y = mySize_y;
+                       else
+                               armor_offset_y = mySize_y;
+               }
 
-                       if(fuel)
-                       {
-                               HUD_Panel_GetProgressBarColor(fuel);
-                               if (is_vertical) //if vertical always halve x to not cover too much numbers with 3 digits
-                                       mySize_x *= 0.2 * 0.5 / 2;
-                               else
-                                       mySize_y *= 0.2;
-                               HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", fuel/100, is_vertical, (baralign == 1 || baralign == 3), progressbar_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
-                       }
+               float health_baralign, armor_baralign, fuel_baralign;
+               float health_iconalign, armor_iconalign;
+               if (autocvar_hud_panel_healtharmor_flip)
+               {
+                       armor_baralign = (autocvar_hud_panel_healtharmor_baralign == 2 || autocvar_hud_panel_healtharmor_baralign == 1);
+                       health_baralign = (autocvar_hud_panel_healtharmor_baralign == 3 || autocvar_hud_panel_healtharmor_baralign == 1);
+                       fuel_baralign = health_baralign;
+                       armor_iconalign = (autocvar_hud_panel_healtharmor_iconalign == 2 || autocvar_hud_panel_healtharmor_iconalign == 1);
+                       health_iconalign = (autocvar_hud_panel_healtharmor_iconalign == 3 || autocvar_hud_panel_healtharmor_iconalign == 1);
                }
                else
                {
-            barsize = eX * mySize_x + eY * 0.5 * mySize_y;
-                       if(leftactive)
+                       health_baralign = (autocvar_hud_panel_healtharmor_baralign == 2 || autocvar_hud_panel_healtharmor_baralign == 1);
+                       armor_baralign = (autocvar_hud_panel_healtharmor_baralign == 3 || autocvar_hud_panel_healtharmor_baralign == 1);
+                       fuel_baralign = armor_baralign;
+                       health_iconalign = (autocvar_hud_panel_healtharmor_iconalign == 2 || autocvar_hud_panel_healtharmor_iconalign == 1);
+                       armor_iconalign = (autocvar_hud_panel_healtharmor_iconalign == 3 || autocvar_hud_panel_healtharmor_iconalign == 1);
+               }
+
+               //if(health)
+               {
+                       if(autocvar_hud_panel_healtharmor_progressbar)
                        {
-                               if(autocvar_hud_panel_healtharmor_progressbar)
+                               HUD_Panel_GetProgressBarColor(health);
+                               float p_health;
+                               p_health = health;
+                               if (autocvar_hud_panel_healtharmor_progressbar_gfx)
                                {
-                                       HUD_Panel_GetProgressBarColorForString(leftname);
-                                       HUD_Panel_DrawProgressBar(pos, barsize, leftprogressname, leftcnt/leftmax, is_vertical, (baralign == 1 || baralign == 2), progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                                       if (saved_health == -1)
+                                       {
+                                               if (prev_health == 0 || prev_health - health >= 3)
+                                               {
+                                                       health_time = time;
+                                                       saved_health = prev_health;
+                                               }
+                                       }
+                                       if (saved_health != -1)
+                                       {
+                                               float d = time - health_time;
+                                               if (d < 1)
+                                               {
+                                                       if (saved_health == -2)
+                                                               p_health *= sqrt(d);
+                                                       else
+                                                       {
+                                                               HUD_Panel_DrawProgressBar(pos + health_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_health, saved_health/maxhealth, is_vertical, health_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * (1 - d * d), DRAWFLAG_NORMAL);
+                                                               if (prev_health - health >= 1) //refresh the effect if repeatedly damaged
+                                                                       health_time = time;
+                                                       }
+                                               }
+                                               else
+                                                       saved_health = -1; //damage effect ended
+                                       }
+                                       prev_health = health;
                                }
-                               if(autocvar_hud_panel_healtharmor_text)
-                                       DrawNumIcon(pos, barsize, leftcnt, leftname, is_vertical, (iconalign == 1 || iconalign == 2), HUD_Get_Num_Color(leftcnt, leftmax), 1);
+                               HUD_Panel_DrawProgressBar(pos + health_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_health, p_health/maxhealth, is_vertical, health_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
+                       if(autocvar_hud_panel_healtharmor_text)
+                               DrawNumIcon(pos + health_offset, mySize, health, "health", is_vertical, health_iconalign, HUD_Get_Num_Color(health, maxhealth), 1);
+               }
 
-                       if(rightactive)
+               if(armor)
+               {
+                       if(autocvar_hud_panel_healtharmor_progressbar)
                        {
-                               if(autocvar_hud_panel_healtharmor_progressbar)
+                               HUD_Panel_GetProgressBarColor(armor);
+                               float p_armor;
+                               p_armor = armor;
+                               if (autocvar_hud_panel_healtharmor_progressbar_gfx)
                                {
-                                       HUD_Panel_GetProgressBarColorForString(rightname);
-                                       HUD_Panel_DrawProgressBar(pos + eY * 0.5 * mySize_y, barsize, rightprogressname, rightcnt/rightmax, is_vertical, (baralign == 1 || baralign == 3), progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                                       if (saved_armor == -1)
+                                       {
+                                               if (prev_armor == 0 || prev_armor - armor >= 3)
+                                               {
+                                                       armor_time = time;
+                                                       saved_armor = prev_armor;
+                                               }
+                                       }
+                                       if (saved_armor != -1)
+                                       {
+                                               float d = time - armor_time;
+                                               if (d < 1)
+                                               {
+                                                       if (saved_armor == -2)
+                                                               p_armor *= sqrt(d);
+                                                       else
+                                                       {
+                                                               HUD_Panel_DrawProgressBar(pos + armor_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, saved_armor/maxarmor, is_vertical, armor_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * (1 - d * d), DRAWFLAG_NORMAL);
+                                                               if (prev_armor - armor >= 1) //refresh the effect if repeatedly damaged
+                                                                       armor_time = time;
+                                                       }
+                                               }
+                                               else
+                                                       saved_armor = -1; //damage effect ended
+                                       }
+                                       prev_armor = armor;
                                }
-                               if(autocvar_hud_panel_healtharmor_text)
-                                       DrawNumIcon(pos + eY * 0.5 * mySize_y, barsize, rightcnt, rightname, is_vertical, (iconalign == 1 || iconalign == 3), HUD_Get_Num_Color(rightcnt, rightmax), 1);
+                               HUD_Panel_DrawProgressBar(pos + armor_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, p_armor/maxarmor, is_vertical, armor_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
+                       if(autocvar_hud_panel_healtharmor_text)
+                               DrawNumIcon(pos + armor_offset, mySize, armor, "armor", is_vertical, armor_iconalign, HUD_Get_Num_Color(armor, maxarmor), 1);
+               }
 
-                       if(fuel)
-                       {
-                               HUD_Panel_GetProgressBarColor(fuel);
-                               if (is_vertical) //if vertical always halve x to not cover numbers with 3 digits
-                                       mySize_x *= 0.2 / 2;
-                               else
-                                       mySize_y *= 0.2 * 0.5;
-                               HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", fuel/100, is_vertical, (baralign == 1 || baralign == 3), progressbar_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
-                       }
+               if(fuel)
+               {
+                       if (is_vertical)
+                               mySize_x *= 0.2 / 2; //if vertical always halve x to not cover too much numbers with 3 digits
+                       else
+                               mySize_y *= 0.2;
+                       if (panel_ar >= 4)
+                               mySize_x *= 2; //restore full panel size
+                       else if (panel_ar < 1/4)
+                               mySize_y *= 2; //restore full panel size
+                       HUD_Panel_GetProgressBarColor(fuel);
+                       HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", fuel/100, is_vertical, fuel_baralign, progressbar_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
                }
        }
 }
@@ -4149,7 +4169,7 @@ void HUD_Physics(void)
        if(!autocvar__hud_configure)
        {
                if(!autocvar_hud_panel_physics) return;
-               if(spectatee_status <= 0 && autocvar_hud_panel_physics < 2) return;
+               if(spectatee_status == -1 && autocvar_hud_panel_physics < 2) return;
        }
        else
                hud_configure_active_panel = HUD_PANEL_PHYSICS;