From: terencehill Date: Mon, 25 Apr 2011 16:11:49 +0000 (+0200) Subject: Small clean up and more comments X-Git-Tag: xonotic-v0.5.0~269^2~8 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=98d04c15e6c5409e72f9da76b7fa473ec563050a;p=xonotic%2Fxonotic-data.pk3dir.git Small clean up and more comments --- diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index e5359f8a7..f2311200e 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -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; } diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 3681a0fb2..40ea4dadc 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -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;