]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/view.qc
Fix crosshair_chase not resetting player's alpha upon death
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / view.qc
index f3ffebac67e0dd2434466b15bfe711c297c1e3e9..7a8b5e705f7846bb7fecfc361a36cdb0ff0f2889 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