From: terencehill Date: Sun, 24 Apr 2011 23:13:35 +0000 (+0200) Subject: Check for spectatee_status changes only when it's updated; also write a check properl... X-Git-Tag: xonotic-v0.5.0~269^2~12 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=28affac529709f77f261b7f353f63b52eb3da0ec;p=xonotic%2Fxonotic-data.pk3dir.git Check for spectatee_status changes only when it's updated; also write a check properly to fix effects behaviour moving from observer to player --- diff --git a/qcsrc/client/Defs.qc b/qcsrc/client/Defs.qc index afdd9f31f..b3b056948 100644 --- a/qcsrc/client/Defs.qc +++ b/qcsrc/client/Defs.qc @@ -221,7 +221,6 @@ float nb_pb_period; // Spectating float spectatee_status; -float prev_spectatee_status; // short mapname string shortmapname; diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index e9a4c4017..84fe1ff39 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -835,6 +835,23 @@ void Ent_ClientData() race_laptime = 0; race_checkpointtime = 0; } + if (autocvar_hud_panel_healtharmor_progressbar_gfx) + { + 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; + } + else if(spectatee_status && !newspectatee_status) //before observing/spectating, now playing + { + health_time = -1; + } + } spectatee_status = newspectatee_status; } diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 10f60613e..7ae320b89 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -1253,8 +1253,6 @@ void CSQC_UpdateView(float w, float h) cvar_set("vid_conheight", h0); } - prev_spectatee_status = spectatee_status; - if(autocvar__hud_configure) HUD_Panel_Mouse(); diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 7203c87ec..05b268d63 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -1330,31 +1330,18 @@ void HUD_HealthArmor(void) health_time = -1; return; } - if (autocvar_hud_panel_healtharmor_progressbar_gfx) - { - if ( (prev_spectatee_status == -1 && spectatee_status > 0) //before observing, now spectating - || (prev_spectatee_status > 0 && spectatee_status > 0 && prev_spectatee_status != spectatee_status) //changed spectated player - ) - { - //no effect - saved_health = 0; - saved_armor = 0; - health_time = 0; - armor_time = 0; - } - else if(prev_spectatee_status == -1 || (prev_spectatee_status > 0 && !spectatee_status)) //before spectating/observing, now playing - health_time = -1; - if (health_time == -1) - { - //start the load effect - saved_health = -2; - saved_armor = -2; - health_time = time; - armor_time = time; - prev_health = 0; - prev_armor = 0; - } + // code to check for spectatee_status changes is in Ent_ClientData() + + if (health_time == -1) + { + //start the load effect + saved_health = -2; + saved_armor = -2; + health_time = time; + armor_time = time; + prev_health = 0; + prev_armor = 0; } armor = getstati(STAT_ARMOR); fuel = getstati(STAT_FUEL);