]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/csqcmodel_hooks.qc
Merge remote-tracking branch 'origin/master' into Mario/mutators
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / csqcmodel_hooks.qc
index 32ba8ddec5cd7fd14ca2c4f08b3f077f8b84e21b..264f4797e58915db809e3154ddfbf73a97305c83 100644 (file)
@@ -119,6 +119,7 @@ void CSQCPlayer_ModelAppearance_PostUpdate(void)
 }
 void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
 {
+       // FORCEMODEL
        // which one is ALWAYS good?
        if not(forceplayermodels_goodmodel)
        {
@@ -211,7 +212,6 @@ void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
                self.skin = self.forceplayermodels_saveskin;
        }
 
-       //float selected_colormap = cm;
        // forceplayercolors too
        if(teamplay)
        {
@@ -270,6 +270,7 @@ void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
                        self.colormap = player_localnum + 1;
        }
 
+       // GLOWMOD AND DEATH FADING
        if(self.colormap > 0)
                self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? self.colormap : stof(getplayerkeyvalue(self.colormap - 1, "colors"))) & 0x0F, TRUE) * 2;
        else
@@ -279,54 +280,21 @@ void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
        {
                if(self.csqcmodel_isdead)
                {
+                       // Fade out to black now...
                        if(self.old_glowmod == '0 0 0') { self.old_glowmod = self.glowmod; }
                        self.colormap = 0;
+                       
                        self.glowmod = self.old_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);
                }
                else if(self.old_glowmod != '0 0 0') { self.old_glowmod = '0 0 0'; }
        }
-       //self.colormap = selected_colormap;
 
-       print(sprintf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (self.csqcmodel_isdead ? "DEAD" : "ALIVE"), self.colormap, vtos(self.glowmod)));
+       //print(sprintf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (self.csqcmodel_isdead ? "DEAD" : "ALIVE"), self.colormap, vtos(self.glowmod)));
 }
 
-/*// 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(self.colormod != '0 0 0') { self.colormod = '0 0 0'; }
-
-       if(autocvar_cl_deathglow > 0)
-       {
-               if(self.csqcmodel_isdead)
-               {
-                       self.colormap = 0;
-                       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);
-               }
-               
-       }
-       
-       print(sprintf("CSQCPlayer_GlowMod_Apply(): state = %s, colormap = %f, colormod = %s, glowmod = %s\n", (self.csqcmodel_isdead ? "DEAD" : "ALIVE"), cm, vtos(self.colormod), vtos(self.glowmod)));
-}*/
-
 // FEATURE: fallback frames
 .float csqcmodel_saveframe;
 .float csqcmodel_saveframe2;
@@ -639,8 +607,7 @@ void CSQCModel_Hook_PreDraw(float isplayer)
 
        if(self.isplayermodel) // this checks if it's a player MODEL!
        {
-               float islocalplayer = (self.entnum == player_localnum + 1);
-               CSQCPlayer_ModelAppearance_Apply(islocalplayer);
+               CSQCPlayer_ModelAppearance_Apply(self.entnum == player_localnum + 1);
                CSQCPlayer_LOD_Apply();
                if(!isplayer)
                        CSQCPlayer_FallbackFrame_Apply();