}
}
-// FEATURE: forcemodel (MUST be called BEFORE LOD!)
+// FEATURE: forcemodel and model color selection (MUST be called BEFORE LOD!)
string forceplayermodels_model;
float forceplayermodels_modelisgoodmodel;
float forceplayermodels_modelindex;
string forceplayermodels_goodmodel;
float forceplayermodels_goodmodelindex;
-void CSQCPlayer_ForceModel_PreUpdate(void)
+.vector glowmod;
+.vector old_glowmod;
+
+void CSQCPlayer_ModelAppearance_PreUpdate(void)
{
self.model = self.forceplayermodels_savemodel;
self.modelindex = self.forceplayermodels_savemodelindex;
self.skin = self.forceplayermodels_saveskin;
self.colormap = self.forceplayermodels_savecolormap;
}
-void CSQCPlayer_ForceModel_PostUpdate(void)
+void CSQCPlayer_ModelAppearance_PostUpdate(void)
{
self.forceplayermodels_savemodel = self.model;
self.forceplayermodels_savemodelindex = self.modelindex;
print(sprintf("Warning: missing model %s has been used\n", self.forceplayermodels_savemodel));
}
}
-void CSQCPlayer_ForceModel_Apply(float islocalplayer)
+void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
{
// which one is ALWAYS good?
if not(forceplayermodels_goodmodel)
self.skin = self.forceplayermodels_saveskin;
}
+ //float selected_colormap = cm;
// forceplayercolors too
if(teamplay)
{
entity tm;
for(tm = teams.sort_next; tm; tm = tm.sort_next)
- if(tm.team != COLOR_SPECTATOR)
+ if(tm.team != NUM_SPECTATOR)
++teams_count;
if(autocvar_cl_forcemyplayercolors)
else if(autocvar_cl_forceplayercolors)
self.colormap = player_localnum + 1;
}
+
+ 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)
+ {
+ // 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);
+ 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'; }
+ }
+
+ //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;
}
self.csqcmodel_isdead = IS_DEAD_FRAME(self.frame);
}
+void CSQCPlayer_AnimDecide_PostUpdate(float isnew)
+{
+ self.csqcmodel_isdead = !!(self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
+}
float CSQCPlayer_FallbackFrame(float f)
{
if(frameduration(self.modelindex, f) > 0)
precache_sound("misc/jetpack_fly.wav");
}
-// 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
.float csqcmodel_predraw_run;
.float anim_frame;
if(self.isplayermodel) // this checks if it's a player MODEL!
{
- CSQCPlayer_ForceModel_Apply(self.entnum == player_localnum + 1);
- CSQCPlayer_GlowMod_Apply();
+ float islocalplayer = (self.entnum == player_localnum + 1);
+ CSQCPlayer_ModelAppearance_Apply(islocalplayer);
CSQCPlayer_LOD_Apply();
if(!isplayer)
CSQCPlayer_FallbackFrame_Apply();
}
else
{
- tracebox(self.origin + '0 0 1', self.mins, self.maxs, self.origin - '0 0 1', MOVE_NORMAL, self);
- if(trace_fraction < 1 && trace_plane_normal_z > 0.7)
+ tracebox(self.origin + '0 0 1', self.mins, self.maxs, self.origin - '0 0 4', MOVE_NORMAL, self);
+ if(trace_startsolid || trace_fraction < 1)
onground = 1;
}
animdecide_init(self);
{
if(!isplayer)
CSQCPlayer_FallbackFrame_PreUpdate();
- CSQCPlayer_ForceModel_PreUpdate();
+ CSQCPlayer_ModelAppearance_PreUpdate();
}
}
// save values set by server
if(self.isplayermodel)
{
- CSQCPlayer_ForceModel_PostUpdate();
- if(!isplayer)
+ CSQCPlayer_ModelAppearance_PostUpdate();
+ if(isplayer)
+ CSQCPlayer_AnimDecide_PostUpdate(isnew);
+ else
CSQCPlayer_FallbackFrame_PostUpdate(isnew);
}
CSQCModel_Effects_PostUpdate();