]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix health/armor wrapping around when someone was fragged
authorFruitieX <fruitiex@gmail.com>
Wed, 13 Apr 2011 15:58:50 +0000 (18:58 +0300)
committerFruitieX <fruitiex@gmail.com>
Wed, 13 Apr 2011 15:58:50 +0000 (18:58 +0300)
defaultXonotic.cfg
qcsrc/client/shownames.qc
qcsrc/server/cl_player.qc

index ccb04f6c165304e1bc5b11ab284f55b37c3f1831..cec44a57125323c06f28a7a8c233cf2a0e648e90 100644 (file)
@@ -1490,7 +1490,7 @@ seta hud_shownames_fontsize 8 "font size"
 seta hud_shownames_decolorize 1 "1 = decolorize name in team games, 2 = decolorize always"
 seta hud_shownames_alpha 0.7 "alpha"
 seta hud_shownames_resize 1 "enable resizing of the names, then the size cvars will correspond to the maximum size"
-seta hud_shownames_mindistance 1000 "start fading alpha/size at this distance"
+seta hud_shownames_mindistance 1500 "start fading alpha/size at this distance"
 seta hud_shownames_maxdistance 2000 "alpha/size is 0 at this distance"
 
 // scoreboard
index 5cbcfcea4bf612ba8a37d08c8576225dca2f122e..1c3eeb629dd4befa0913d1be3357ad2d2df5bd43 100644 (file)
@@ -91,11 +91,17 @@ void Draw_ShowNames()
                     drawpic_aspect_skin(iconpos, "health", '1 1 0' * iconsize_y, '0 0 0', a * 0.5, DRAWFLAG_NORMAL);
                     drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor", '1 1 0' * iconsize_y, '0 0 0', a * 0.5, DRAWFLAG_NORMAL);
 
-                    drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, self.healthvalue/autocvar_hud_panel_healtharmor_maxhealth), vid_conwidth, myPos_y + iconsize_y);
-                    drawpic_aspect_skin(iconpos, "health", '1 1 0' * iconsize_y, '1 1 1', a, DRAWFLAG_NORMAL);
-
-                    drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, self.armorvalue/autocvar_hud_panel_healtharmor_maxarmor), vid_conwidth, myPos_y + iconsize_y);
-                    drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor", '1 1 0' * iconsize_y, '1 1 1', a, DRAWFLAG_NORMAL);
+                    if(self.healthvalue > 0)
+                    {
+                        drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, self.healthvalue/autocvar_hud_panel_healtharmor_maxhealth), vid_conwidth, myPos_y + iconsize_y);
+                        drawpic_aspect_skin(iconpos, "health", '1 1 0' * iconsize_y, '1 1 1', a, DRAWFLAG_NORMAL);
+                    }
+
+                    if(self.armorvalue > 0)
+                    {
+                        drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, self.armorvalue/autocvar_hud_panel_healtharmor_maxarmor), vid_conwidth, myPos_y + iconsize_y);
+                        drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor", '1 1 0' * iconsize_y, '1 1 1', a, DRAWFLAG_NORMAL);
+                    }
                     drawresetcliparea();
                 }
                 else if(autocvar_hud_shownames_status == 2 && teamplay)
index 6c662cf5c58091ce5e0bef942907b217f88bebab..bd5bb8d1c21c10a63458c4cfeabaea77e214fc08 100644 (file)
@@ -766,10 +766,10 @@ void shownames_think()
         setorigin(self, self.owner.origin + SHOWNAMES_ORIGIN_OFFSET);
         self.SendFlags |= 1;
     }
-    if(self.health != floor(self.owner.health) || self.armorvalue != floor(self.owner.armorvalue))
+    if(self.health != max(0, floor(self.owner.health)) || self.armorvalue != max(0, floor(self.owner.armorvalue)))
     {
-        self.health = floor(self.owner.health);
-        self.armorvalue = floor(self.owner.armorvalue);
+        self.health = max(0, floor(self.owner.health));
+        self.armorvalue = max(0, floor(self.owner.armorvalue));
         self.SendFlags |= 2;
     }
     self.nextthink = time;