Fix crosshair_chase not resetting player's alpha upon death
authorterencehill <piuntn@gmail.com>
Fri, 29 May 2020 20:25:54 +0000 (22:25 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 29 May 2020 20:25:54 +0000 (22:25 +0200)
qcsrc/client/view.qc
qcsrc/common/weapons/weapon/arc.qc

index f3ffeba..7a8b5e7 100644 (file)
@@ -1079,6 +1079,10 @@ LABEL(normalcolor)
 
 void HUD_Crosshair(entity this)
 {
+       // reset player's alpha here upon death since forced scoreboard prevents running the crosshair_chase code
+       if(autocvar_chase_active > 0 && autocvar_crosshair_chase && STAT(HEALTH) <= 0 && csqcplayer)
+               csqcplayer.alpha = csqcplayer.m_alpha;
+
        float f, i, j;
        vector v;
        if(!scoreboard_active && !camera_active && intermission != 2 && !STAT(GAME_STOPPED) &&
@@ -1124,7 +1128,7 @@ void HUD_Crosshair(entity this)
                        {
                                traceline(view_origin, view_origin + max_shot_distance * view_forward, MOVE_NORMAL, NULL);
                                float myalpha = (!csqcplayer.m_alpha) ? 1 : csqcplayer.m_alpha;
-                               if(trace_ent == csqcplayer && STAT(HEALTH) > 0)
+                               if(trace_ent == csqcplayer)
                                        csqcplayer.alpha = min(autocvar_crosshair_chase_playeralpha, myalpha);
                                else
                                        csqcplayer.alpha = csqcplayer.m_alpha;
@@ -1159,7 +1163,7 @@ void HUD_Crosshair(entity this)
                string wcross_name = "";
                float wcross_scale, wcross_blur;
 
-        entity e = WEP_Null;
+               entity e = WEP_Null;
                if(autocvar_crosshair_per_weapon || (autocvar_crosshair_color_special == 1))
                {
                        entity wepent = viewmodels[0]; // TODO: unhardcode
index ae2dbf0..ff663e3 100644 (file)
@@ -897,10 +897,7 @@ void Draw_ArcBeam(entity this)
                MAKE_VECTORS(myviewangle, forward, right, up);
                entity wepent = viewmodels[this.beam_slot];
 
-               if(autocvar_chase_active)
-                       this.beam_usevieworigin = 1;
-               else
-                       this.beam_usevieworigin = 2;
+               this.beam_usevieworigin = (autocvar_chase_active) ? 1 : 2;
 
                // decide upon start position
                if(this.beam_usevieworigin == 2)
@@ -1231,10 +1228,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
 
                if(ReadByte())
                {
-                       if(autocvar_chase_active)
-                               { this.beam_usevieworigin = 1; }
-                       else // use view origin
-                               { this.beam_usevieworigin = 2; }
+                       this.beam_usevieworigin = (autocvar_chase_active) ? 1 : 2;
                }
                else
                {