From 6413874bf13bf01a35f85705638b6a25d3910d1b Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 15 Feb 2024 16:01:35 +0100 Subject: [PATCH] HUD hit indicator: if dead remove all indicators; if an attacker dies or disconnects remove the related indicator --- qcsrc/client/view.qc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 211076f83..5294e99c6 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -788,14 +788,29 @@ void HitIndicatorUpdate(float dmg, entity attacker) void HitIndicatorShow() { + if (STAT(HEALTH) <= 0 && HitIndicator_time[0] >= 0) + { + // if dead remove all indicators + for (int i = 0; i < HITINDICATOR_MAX_COUNT; ++i) + HitIndicator_attacker[i] = NULL; + HitIndicator_time[0] = -1; // this is to avoid removing indicators every frame + return; + } + if (!autocvar_cl_hit_indicator || autocvar_cl_hit_indicator_size <= 0 || autocvar_chase_active) return; for (int i = 0; i < HITINDICATOR_MAX_COUNT; ++i) { entity attacker = HitIndicator_attacker[i]; - if (!attacker || HITINDICATOR_EXPIRED(i)) + if (!attacker) continue; + if (HITINDICATOR_EXPIRED(i) || entcs_IsDead(attacker.sv_entnum) || wasfreed(attacker)) + { + // if the attacker dies or disconnects remove the related hit indicator + HitIndicator_attacker[i] = NULL; + continue; + } // hide indicator if attacker is not visible (check ported from shownames.qc) traceline(view_origin, attacker.origin, MOVE_NOMONSTERS, attacker); -- 2.39.2