]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Small clean up and more comments
authorterencehill <piuntn@gmail.com>
Mon, 25 Apr 2011 16:11:49 +0000 (18:11 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 25 Apr 2011 16:11:49 +0000 (18:11 +0200)
qcsrc/client/Main.qc
qcsrc/client/hud.qc

index e5359f8a7ab3376e4d9d78c1512811a71e94a6a4..f2311200e3cddcfbaba68061fe1e727866f9d127 100644 (file)
@@ -840,18 +840,9 @@ void Ent_ClientData()
                if ( (spectatee_status == -1 && newspectatee_status > 0) //before observing, now spectating
                  || (spectatee_status > 0 && newspectatee_status > 0 && spectatee_status != newspectatee_status) //changed spectated player
                )
-               {
-                       //no effect
-                       saved_health = 0;
-                       saved_armor = 0;
-                       health_time = 0;
-                       armor_time = 0;
                        last_p_health = -1;
-               }
                else if(spectatee_status && !newspectatee_status) //before observing/spectating, now playing
-               {
                        health_time = -1;
-               }
        }
        spectatee_status = newspectatee_status;
 }
index 3681a0fb20c8cc91aa932857a68caedff3a8fc4b..40ea4dadcd8ac3aecd653408ef44ec5e84f38e7a 100644 (file)
@@ -1309,14 +1309,15 @@ float prev_health, prev_armor;
 float health_time, armor_time;
 
 // saved_* vars contain the old health/armor value (before the damage happened)
-       // special cases:
-       // -1: load or damage effect are ended normally
-       //  0: when effects are forcedly stopped; this is to avoid unintended effects as soon as we switch spectated player (e.g. from playerX: 70h to playerY: 50h)
+// set to -1 when load or damage effect are ended normally
 float saved_health;
 var float saved_armor = -2;
 
+// old_* vars keep track of previous values when smoothing value changes of the progressbar
 float old_health;
 float old_healthtime;
+
+// set to -1 to forcedly stop effects when we switch spectated player (e.g. from playerX: 70h to playerY: 50h)
 float last_p_health;
 
 void HUD_HealthArmor(void)
@@ -1335,10 +1336,15 @@ void HUD_HealthArmor(void)
                }
 
                // code to check for spectatee_status changes is in Ent_ClientData()
+               // last_p_health and health_time can be set to -1 there
 
                if (last_p_health == -1)
                {
                        // no effect
+                       saved_health = 0;
+                       saved_armor = 0;
+                       health_time = 0;
+                       armor_time = 0;
                        prev_health = health;
                        old_health = health;
                        last_p_health = health;