From 2bd13e55872fa1d11468c95f8901b5a2eee7e2b6 Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 19 May 2020 23:38:46 +0200 Subject: [PATCH] Tweak the cl_deathglow effect to end with a min glow color factor (default value 0.5) instead of 0. Besides black bodies weren't good looking at all for fullbright models, now players can distinguish the bodies of teammates from the bodies of enemies if the models are the same. --- qcsrc/client/autocvars.qh | 1 + qcsrc/client/csqcmodel_hooks.qc | 12 +++++++----- xonotic-client.cfg | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 4c6696cde..90bf6fb91 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -446,6 +446,7 @@ int autocvar__cl_color; int autocvar__cl_playerskin; string autocvar__cl_playermodel; float autocvar_cl_deathglow; +float autocvar_cl_deathglow_min = 0.5; bool autocvar_developer_csqcentities; float autocvar_cl_jetpack_attenuation = 2; bool autocvar_cl_showspectators; diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 1272758f7..7835463ae 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -296,12 +296,14 @@ void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer) { // Fade out to black now... if(this.old_glowmod == '0 0 0') { this.old_glowmod = this.glowmod; } - this.colormap = 0; - this.glowmod = this.old_glowmod * bound(0, 1 - (time - this.death_time) / autocvar_cl_deathglow, 1); - this.glowmod_x = max(this.glowmod.x, 0.0001); - this.glowmod_y = max(this.glowmod.y, 0.0001); - this.glowmod_z = max(this.glowmod.z, 0.0001); + float min_factor = bound(0, autocvar_cl_deathglow_min, 1); + if(this.colormap > 0) + min_factor /= 2; + float glow_fade = bound(0, 1 - (time - this.death_time) / autocvar_cl_deathglow, 1); + this.glowmod *= (min_factor + glow_fade * (1 - min_factor)); + if (this.glowmod == '0 0 0') + this.glowmod.x = 0.000001; } else if(this.old_glowmod != '0 0 0') { this.old_glowmod = '0 0 0'; } } diff --git a/xonotic-client.cfg b/xonotic-client.cfg index f1335c9d2..389da6f74 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -228,7 +228,8 @@ seta cl_damageeffect_lifetime 0.1 "how much a damage effect lasts, based on dama seta cl_damageeffect_lifetime_min 3 "minimum lifetime a damage effect may have" seta cl_damageeffect_lifetime_max 6 "maximum lifetime a damage effect may have" -set cl_deathglow 0.8 "number of seconds during which dead bodies glow out" +set cl_deathglow 2 "number of seconds during which dead bodies glow out" +set cl_deathglow_min 0.5 "glow out up to this glow factor" cl_movement 1 cl_movement_track_canjump 0 -- 2.39.2