]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
cvar hud_panel_healtharmor_progressbar_gfx_damage to customize the amount of damage...
authorterencehill <piuntn@gmail.com>
Mon, 25 Apr 2011 10:34:19 +0000 (12:34 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 25 Apr 2011 10:34:19 +0000 (12:34 +0200)
Use it when refreshing the effect too; in this case when damaged and health quickly rotting the previous value of 1 caused the effect to look like it get stuck

defaultXonotic.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc

index 675034af3b8459a43afe146f60cd6b7c1f693826..b6200b11c329386db38930bde5e1757745377892 100644 (file)
@@ -1422,6 +1422,7 @@ seta hud_panel_ammo_maxammo "40" "when you have this much ammo, the ammo status
 seta hud_panel_healtharmor_maxhealth "200" "when you have this much health, the health status bar is full"
 seta hud_panel_healtharmor_maxarmor "200" "when you have this much armor, the armor status bar is full"
 seta hud_panel_healtharmor_progressbar_gfx 1 "add graphic effects to the progressbars when spawning and when being damaged"
+seta hud_panel_healtharmor_progressbar_gfx_damage 5 "show damage effect when damaged at least by this amount; 0 disables damage effect"
 
 seta hud_panel_notify_time 10 "time that a new entry stays until it fades out"
 seta hud_panel_notify_fadetime 3 "fade out time"
index d06c31a12934ea3cf090c31a099d67bf8a25b3a1..a623a39c91a59e44862a720ae0784c66292b80b6 100644 (file)
@@ -198,7 +198,8 @@ float autocvar_hud_panel_healtharmor_maxhealth;
 float autocvar_hud_panel_healtharmor_progressbar;
 string autocvar_hud_panel_healtharmor_progressbar_armor;
 string autocvar_hud_panel_healtharmor_progressbar_health;
-string autocvar_hud_panel_healtharmor_progressbar_gfx;
+float autocvar_hud_panel_healtharmor_progressbar_gfx;
+float autocvar_hud_panel_healtharmor_progressbar_gfx_damage;
 float autocvar_hud_panel_healtharmor_text;
 float autocvar_hud_panel_infomessages;
 float autocvar_hud_panel_infomessages_flip;
index 05b268d63a109655797fe8d4426740c187baa7d3..886fd8fee5b8250590d5c7357e6aeb18572c3b57 100644 (file)
@@ -1466,9 +1466,9 @@ void HUD_HealthArmor(void)
                                pain_health_alpha = 1;
                                if (autocvar_hud_panel_healtharmor_progressbar_gfx)
                                {
-                                       if (saved_health == -1)
+                                       if (autocvar_hud_panel_healtharmor_progressbar_gfx_damage > 0 && saved_health == -1)
                                        {
-                                               if (prev_health == 0 || prev_health - health >= 3)
+                                               if (prev_health == 0 || prev_health - health >= autocvar_hud_panel_healtharmor_progressbar_gfx_damage)
                                                {
                                                        health_time = time;
                                                        saved_health = prev_health;
@@ -1484,7 +1484,7 @@ void HUD_HealthArmor(void)
                                                        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
+                                                               if (prev_health - health >= autocvar_hud_panel_healtharmor_progressbar_gfx_damage) //refresh the effect if repeatedly damaged
                                                                        health_time = time;
                                                        }
                                                }
@@ -1516,9 +1516,9 @@ void HUD_HealthArmor(void)
                                p_armor = armor;
                                if (autocvar_hud_panel_healtharmor_progressbar_gfx)
                                {
-                                       if (saved_armor == -1)
+                                       if (autocvar_hud_panel_healtharmor_progressbar_gfx_damage > 0 && saved_armor == -1)
                                        {
-                                               if (prev_armor == 0 || prev_armor - armor >= 3)
+                                               if (prev_armor == 0 || prev_armor - armor >= autocvar_hud_panel_healtharmor_progressbar_gfx_damage)
                                                {
                                                        armor_time = time;
                                                        saved_armor = prev_armor;
@@ -1534,7 +1534,7 @@ void HUD_HealthArmor(void)
                                                        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
+                                                               if (prev_armor - armor >= autocvar_hud_panel_healtharmor_progressbar_gfx_damage) //refresh the effect if repeatedly damaged
                                                                        armor_time = time;
                                                        }
                                                }