]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/cl_deathglow_min' into 'master'
authorMario <mario.mario@y7mail.com>
Sat, 23 May 2020 09:04:59 +0000 (09:04 +0000)
committerMario <mario.mario@y7mail.com>
Sat, 23 May 2020 09:04:59 +0000 (09:04 +0000)
Min deathglow

See merge request xonotic/xonotic-data.pk3dir!811

qcsrc/client/autocvars.qh
qcsrc/client/csqcmodel_hooks.qc
xonotic-client.cfg

index 4c6696cde139325c341095c9f5a612aee0850d60..90bf6fb91ffa0cccbb9ef81320af6047ed59e7ba 100644 (file)
@@ -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;
index 1272758f76cee3de642322d9ce6ffb2419660e7a..624d997fecd7cc5bb5b51cc83fb106c72755a079 100644 (file)
@@ -1,6 +1,5 @@
 #include "csqcmodel_hooks.qh"
 #include "autocvars.qh"
-#include "csqcmodel_hooks.qh"
 #include "miscfunctions.qh"
 #include <client/mutators/_mod.qh>
 #include "player_skeleton.qh"
@@ -109,7 +108,6 @@ string forceplayermodels_goodmodel;
 int forceplayermodels_goodmodelindex;
 
 .vector glowmod;
-.vector old_glowmod;
 
 void CSQCPlayer_ModelAppearance_PreUpdate(entity this)
 {
@@ -294,16 +292,14 @@ void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
        {
                if(this.csqcmodel_isdead)
                {
-                       // 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'; }
        }
 
        //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (this.csqcmodel_isdead ? "DEAD" : "ALIVE"), this.colormap, vtos(this.glowmod));
index f1335c9d29b185978c78baa09d773f5f74dd1043..389da6f74cb35b5340e0644530f2ce2291da9bcd 100644 (file)
@@ -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