From: terencehill Date: Thu, 15 Feb 2024 15:01:35 +0000 (+0100) Subject: HUD hit indicator: if dead remove all indicators; if an attacker dies or disconnects... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6413874bf13bf01a35f85705638b6a25d3910d1b;p=xonotic%2Fxonotic-data.pk3dir.git HUD hit indicator: if dead remove all indicators; if an attacker dies or disconnects remove the related indicator --- 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);