]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/csqcmodel_hooks.qc
Merge remote branch 'origin/master' into samual/menu_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / csqcmodel_hooks.qc
index c4767c63e7ccbb840d0ad58ad4ffcd436eeb1c7c..a0a6e150e373dee3a051e175a75e8842cd4a4618 100644 (file)
@@ -207,8 +207,6 @@ void CSQCPlayer_ForceModel_Apply(float islocalplayer)
 .float csqcmodel_saveframe4;
 .float csqcmodel_framecount;
 
-.float csqcmodel_isdead; // for utility code
-
 #define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1)
 void CSQCPlayer_FallbackFrame_PreUpdate(void)
 {
@@ -266,16 +264,6 @@ void CSQCPlayer_FallbackFrame_Apply(void)
        self.frame4 = CSQCPlayer_FallbackFrame(self.frame4);
 }
 
-// FEATURE: auto glowmod
-.vector glowmod;
-void CSQCPlayer_GlowMod_Apply(void)
-{
-       if(self.colormap > 0)
-               self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? self.colormap : stof(getplayerkeyvalue(self.colormap - 1, "colors"))) & 0x0F, TRUE) * 2;
-       else
-               self.glowmod = '1 1 1';
-}
-
 // FEATURE: auto tag_index
 .entity tag_entity;
 .float tag_entity_lastmodelindex;
@@ -386,6 +374,7 @@ void CSQCModel_Effects_PostUpdate(void)
 void CSQCModel_Effects_Apply(void)
 {
        float eff = self.csqcmodel_effects;
+       eff &~= CSQCMODEL_EF_RESPAWNGHOST;
 
        self.renderflags &~= (RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
        self.effects = 0;
@@ -449,6 +438,35 @@ void CSQCModel_Effects_Apply(void)
                Projectile_DrawTrail(self.origin);
        else
                Projectile_ResetTrail(self.origin);
+
+       if(self.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST)
+               self.renderflags |= RF_ADDITIVE;
+               // also special in CSQCPlayer_GlowMod_Apply
+}
+
+// FEATURE: auto glowmod
+.vector glowmod;
+void CSQCPlayer_GlowMod_Apply(void)
+{
+       float cm = self.colormap;
+
+       if(self.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST)
+               cm = 1024;
+
+       if(self.colormap > 0)
+               self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? self.colormap : stof(getplayerkeyvalue(self.colormap - 1, "colors"))) & 0x0F, TRUE) * 2;
+       else
+               self.glowmod = '1 1 1';
+
+       if(autocvar_cl_deathglow > 0)
+               if(self.csqcmodel_isdead)
+               {
+                       self.glowmod = self.glowmod * bound(0, 1 - (time - self.death_time) / autocvar_cl_deathglow, 1);
+                       // prevent the zero vector
+                       self.glowmod_x = max(self.glowmod_x, 0.0001);
+                       self.glowmod_y = max(self.glowmod_y, 0.0001);
+                       self.glowmod_z = max(self.glowmod_z, 0.0001);
+               }
 }
 
 // general functions