]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fixed probable division by zero (didn't affect anything in test map, though).
authorPenguinum <penguinum@gmail.com>
Tue, 19 May 2015 09:14:21 +0000 (12:14 +0300)
committerPenguinum <penguinum@gmail.com>
Tue, 19 May 2015 09:14:21 +0000 (12:14 +0300)
qcsrc/client/wall.qc

index 6fc2e19261cf974c34838d1f0a254fed5773b35c..f1b250e324b2fa402f7605191149acca0a82c181 100644 (file)
@@ -13,10 +13,23 @@ void Ent_Wall_PreDraw()
                if(!checkpvs(org, self))
                        self.alpha = 0;
                else if(self.fade_start) {
-                       vector player_dist = org - self.origin - 0.5 * (self.mins + self.maxs);
-                       self.alpha = (self.alpha_min + self.alpha_max * bound(0,
-                                                          (self.fade_end - vlen(player_dist))
+                       float player_dist = vlen(org - self.origin - 0.5 * (self.mins + self.maxs));
+                       if (self.fade_end == self.fade_start)
+                       {
+                               if (player_dist >= self.fade_start) {
+                                       self.alpha = 0;
+                               }
+                               else
+                               {
+                                       self.alpha = 1;
+                               }
+                       }
+                       else
+                       {
+                               self.alpha = (self.alpha_min + self.alpha_max * bound(0,
+                                                          (self.fade_end - player_dist)
                                                           / (self.fade_end - self.fade_start), 1)) / 100.0;
+                       }
                }
                else
                {