float forceplayermodels_goodmodelindex;
.vector glowmod;
-.vector old_glowmod;
+.vector old_glowmod;
void CSQCPlayer_ModelAppearance_PreUpdate(void)
{
self.forceplayermodels_isgoodmodel = fexists(self.forceplayermodels_savemodel);
self.forceplayermodels_isgoodmodel_mdl = self.forceplayermodels_savemodel;
if(!self.forceplayermodels_isgoodmodel)
- print(sprintf("Warning: missing model %s has been used\n", self.forceplayermodels_savemodel));
+ printf("Warning: missing model %s has been used\n", self.forceplayermodels_savemodel);
}
}
void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
{
+ // FORCEMODEL
// which one is ALWAYS good?
- if not(forceplayermodels_goodmodel)
+ if (!forceplayermodels_goodmodel)
{
entity e;
e = spawn();
float isfriend;
float cm;
cm = self.forceplayermodels_savecolormap;
- cm = (cm >= 1024) ? cm : (stof(getplayerkeyvalue(self.colormap - 1, "colors")) + 1024);
+ cm = (cm >= 1024) ? cm : (stof(getplayerkeyvalue(cm - 1, "colors")) + 1024);
if(teamplay)
isfriend = (cm == 1024 + 17 * myteam);
self.skin = self.forceplayermodels_saveskin;
}
- //float selected_colormap = cm;
// forceplayercolors too
if(teamplay)
{
// own team's color is never forced
float forcecolor_friend = 0;
float forcecolor_enemy = 0;
- float teams_count = 0;
entity tm;
- for(tm = teams.sort_next; tm; tm = tm.sort_next)
- if(tm.team != NUM_SPECTATOR)
- ++teams_count;
-
if(autocvar_cl_forcemyplayercolors)
forcecolor_friend = 1024 + autocvar_cl_forcemyplayercolors;
- if(autocvar_cl_forceplayercolors && teams_count == 2)
+ if(autocvar_cl_forceplayercolors && team_count == 2)
forcecolor_enemy = 1024 + autocvar__cl_color;
if(forcecolor_enemy && !forcecolor_friend)
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
{
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)));
+ //printf("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;
case 29: return 4; // anim_duckwalkbackright -> anim_duckwalk
case 30: return 4; // anim_duckwalkbackleft -> anim_duckwalk
}
- print(sprintf("Frame %d missing in model %s, and we have no fallback - FAIL!\n", f, self.model));
+ printf("Frame %d missing in model %s, and we have no fallback - FAIL!\n", f, self.model);
return f;
}
void CSQCPlayer_FallbackFrame_Apply(void)
}
// FEATURE: EF_NODRAW workalike
-float EF_BRIGHTFIELD = 1;
-float EF_BRIGHTLIGHT = 4;
-float EF_DIMLIGHT = 8;
-float EF_DOUBLESIDED = 32768;
-float EF_NOSELFSHADOW = 65536;
-float EF_DYNAMICMODELLIGHT = 131072;
-float EF_RESTARTANIM_BIT = 1048576;
-float EF_TELEPORT_BIT = 2097152;
-float MF_ROCKET = 1; // leave a trail
-float MF_GRENADE = 2; // leave a trail
-float MF_GIB = 4; // leave a trail
-float MF_ROTATE = 8; // rotate (bonus items)
-float MF_TRACER = 16; // green split trail
-float MF_ZOMGIB = 32; // small blood trail
-float MF_TRACER2 = 64; // orange split trail
-float MF_TRACER3 = 128; // purple trail
+const float EF_BRIGHTFIELD = 1;
+const float EF_BRIGHTLIGHT = 4;
+const float EF_DIMLIGHT = 8;
+const float EF_DOUBLESIDED = 32768;
+const float EF_NOSELFSHADOW = 65536;
+const float EF_DYNAMICMODELLIGHT = 131072;
+const float EF_RESTARTANIM_BIT = 1048576;
+const float EF_TELEPORT_BIT = 2097152;
+const float MF_ROCKET = 1; // leave a trail
+const float MF_GRENADE = 2; // leave a trail
+const float MF_GIB = 4; // leave a trail
+const float MF_ROTATE = 8; // rotate (bonus items)
+const float MF_TRACER = 16; // green split trail
+const float MF_ZOMGIB = 32; // small blood trail
+const float MF_TRACER2 = 64; // orange split trail
+const float MF_TRACER3 = 128; // purple trail
.float csqcmodel_effects;
.float csqcmodel_modelflags;
void CSQCModel_Effects_PreUpdate(void)
self.effects = self.csqcmodel_effects;
self.modelflags = self.csqcmodel_modelflags;
}
+void Reset_ArcBeam(void);
void CSQCModel_Effects_PostUpdate(void)
{
+ if (self == csqcplayer) {
+ if (self.csqcmodel_teleported) {
+ Reset_ArcBeam();
+ }
+ }
self.csqcmodel_effects = self.effects;
self.csqcmodel_modelflags = self.modelflags;
self.effects = 0;
void CSQCModel_Effects_Apply(void)
{
float eff = self.csqcmodel_effects;
- eff &~= CSQCMODEL_EF_RESPAWNGHOST;
+ eff &= ~CSQCMODEL_EF_RESPAWNGHOST;
- self.renderflags &~= (RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
+ self.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
self.effects = 0;
self.traileffect = 0;
-
+
if(eff & EF_BRIGHTFIELD)
self.traileffect = particleeffectnum("TR_NEXUIZPLASMA");
// ignoring EF_MUZZLEFLASH
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)
+ {
+ skeleton_loadinfo(self);
+ float doblend = (self.bone_upperbody >= 0);
CSQCPlayer_FallbackFrame_Apply();
+ if(doblend)
+ {
+ skeleton_from_frames(self, self.csqcmodel_isdead);
+ }
+ else
+ {
+ free_skeleton_from_frames(self);
+ // just in case, clear these (we're animating in frame and frame3)
+ self.lerpfrac = 0;
+ self.lerpfrac4 = 0;
+ }
+ }
else
{
// we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know!