1 #include "csqcmodel_hooks.qh"
2 #include "mutators/events.qh"
3 #include "player_skeleton.qh"
4 #include "weapons/projectile.qh"
5 #include <common/animdecide.qh>
6 #include <common/ent_cs.qh>
7 #include <common/physics/movetypes/movetypes.qh>
8 #include <common/viewloc.qh>
9 #include <lib/csqcmodel/cl_model.qh>
10 #include <lib/csqcmodel/cl_player.qh>
11 #include <lib/csqcmodel/interpolate.qh>
16 void CSQCModel_Hook_PreDraw(entity this, bool isplayer);
24 void CSQCPlayer_LOD_Apply(entity this)
27 if(this.lodmodelindex0 != this.modelindex)
29 string modelname = this.model;
32 vector mi = this.mins;
33 vector ma = this.maxs;
36 this.lodmodelindex0 = this.modelindex;
37 this.lodmodelindex1 = this.modelindex;
38 this.lodmodelindex2 = this.modelindex;
40 // FIXME: this only supports 3-letter extensions
41 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod1", substring(modelname, -4, 4));
47 this.lodmodelindex1 = this.modelindex;
50 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod2", substring(modelname, -4, 4));
56 this.lodmodelindex2 = this.modelindex;
59 _setmodel(this, modelname); // make everything normal again
60 setsize(this, mi, ma);
64 if(autocvar_cl_playerdetailreduction <= 0)
66 if(autocvar_cl_playerdetailreduction <= -2)
67 this.modelindex = this.lodmodelindex2;
68 else if(autocvar_cl_playerdetailreduction <= -1)
69 this.modelindex = this.lodmodelindex1;
71 this.modelindex = this.lodmodelindex0;
75 float distance = vlen(this.origin - view_origin);
76 float f = (distance * current_viewzoom + 100.0) * autocvar_cl_playerdetailreduction;
77 f *= 1.0 / bound(0.01, view_quality, 1);
78 if(f > autocvar_cl_loddistance2)
79 this.modelindex = this.lodmodelindex2;
80 else if(f > autocvar_cl_loddistance1)
81 this.modelindex = this.lodmodelindex1;
83 this.modelindex = this.lodmodelindex0;
87 // FEATURE: forcemodel and model color selection (MUST be called BEFORE LOD!)
88 string forceplayermodels_model;
89 bool forceplayermodels_modelisgoodmodel;
90 int forceplayermodels_modelindex;
91 int forceplayermodels_skin;
93 string forceplayermodels_mymodel;
94 bool forceplayermodels_myisgoodmodel;
95 int forceplayermodels_mymodelindex;
97 bool forceplayermodels_attempted;
99 .string forceplayermodels_savemodel;
100 .int forceplayermodels_savemodelindex;
101 .int forceplayermodels_saveskin;
102 .int forceplayermodels_savecolormap;
104 .string forceplayermodels_isgoodmodel_mdl;
105 .bool forceplayermodels_isgoodmodel;
107 string forceplayermodels_goodmodel;
108 int forceplayermodels_goodmodelindex;
113 void CSQCPlayer_ModelAppearance_PreUpdate(entity this)
115 this.model = this.forceplayermodels_savemodel;
116 this.modelindex = this.forceplayermodels_savemodelindex;
117 this.skin = this.forceplayermodels_saveskin;
118 this.colormap = this.forceplayermodels_savecolormap;
120 void CSQCPlayer_ModelAppearance_PostUpdate(entity this)
122 this.forceplayermodels_savemodel = this.model;
123 this.forceplayermodels_savemodelindex = this.modelindex;
124 this.forceplayermodels_saveskin = this.skin;
125 this.forceplayermodels_savecolormap = this.colormap;
127 if(this.forceplayermodels_savemodel != this.forceplayermodels_isgoodmodel_mdl)
129 this.forceplayermodels_isgoodmodel = fexists(this.forceplayermodels_savemodel);
130 this.forceplayermodels_isgoodmodel_mdl = this.forceplayermodels_savemodel;
131 if(!this.forceplayermodels_isgoodmodel)
132 LOG_INFOF("Warning: missing model %s has been used\n", this.forceplayermodels_savemodel);
135 void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
138 // which one is ALWAYS good?
139 if (!forceplayermodels_goodmodel)
142 precache_model(cvar_defstring("_cl_playermodel"));
143 _setmodel(e, cvar_defstring("_cl_playermodel"));
144 forceplayermodels_goodmodel = e.model;
145 forceplayermodels_goodmodelindex = e.modelindex;
149 // first, try finding it from the server
150 if(this.forceplayermodels_savemodelindex && this.forceplayermodels_savemodel != "null")
154 if(!isdemo()) // this is mainly cheat protection; not needed for demos
156 // trust server's idea of "own player model"
157 forceplayermodels_modelisgoodmodel = this.forceplayermodels_isgoodmodel;
158 forceplayermodels_model = this.forceplayermodels_savemodel;
159 forceplayermodels_modelindex = this.forceplayermodels_savemodelindex;
160 forceplayermodels_skin = this.forceplayermodels_saveskin;
161 forceplayermodels_attempted = 1;
166 // forcemodel finding
167 if(!forceplayermodels_attempted)
169 forceplayermodels_attempted = 1;
171 // only if this failed, find it out on our own
173 precache_model(autocvar__cl_playermodel);
174 _setmodel(e, autocvar__cl_playermodel); // this is harmless, see below
175 forceplayermodels_modelisgoodmodel = fexists(e.model);
176 forceplayermodels_model = e.model;
177 forceplayermodels_modelindex = e.modelindex;
178 forceplayermodels_skin = autocvar__cl_playerskin;
182 if(autocvar_cl_forcemyplayermodel != "" && autocvar_cl_forcemyplayermodel != forceplayermodels_mymodel)
185 _setmodel(e, autocvar_cl_forcemyplayermodel); // this is harmless, see below
186 forceplayermodels_myisgoodmodel = fexists(e.model);
187 forceplayermodels_mymodel = e.model;
188 forceplayermodels_mymodelindex = e.modelindex;
195 cm = this.forceplayermodels_savecolormap;
196 cm = (cm >= 1024) ? cm : (entcs_GetClientColors(cm - 1) + 1024);
199 isfriend = (cm == 1024 + 17 * myteam);
201 isfriend = islocalplayer;
203 if(autocvar_cl_forcemyplayermodel != "" && forceplayermodels_myisgoodmodel && isfriend)
205 this.model = forceplayermodels_mymodel;
206 this.modelindex = forceplayermodels_mymodelindex;
207 this.skin = autocvar_cl_forcemyplayerskin;
209 else if(autocvar_cl_forceplayermodels && forceplayermodels_modelisgoodmodel)
211 this.model = forceplayermodels_model;
212 this.modelindex = forceplayermodels_modelindex;
213 this.skin = forceplayermodels_skin;
215 else if(this.forceplayermodels_isgoodmodel)
217 this.model = this.forceplayermodels_savemodel;
218 this.modelindex = this.forceplayermodels_savemodelindex;
219 this.skin = this.forceplayermodels_saveskin;
223 this.model = forceplayermodels_goodmodel;
224 this.modelindex = forceplayermodels_goodmodelindex;
225 this.skin = this.forceplayermodels_saveskin;
228 // forceplayercolors too
231 // own team's color is never forced
232 int forcecolor_friend = 0;
233 int forcecolor_enemy = 0;
236 if(autocvar_cl_forcemyplayercolors)
237 forcecolor_friend = 1024 + autocvar_cl_forcemyplayercolors;
238 if(autocvar_cl_forceplayercolors == 2 && team_count == 2)
239 forcecolor_enemy = 1024 + autocvar__cl_color;
241 if(forcecolor_enemy && !forcecolor_friend)
243 // only enemy color is forced?
244 // verify it is not equal to the friend color
245 if(forcecolor_enemy == 1024 + 17 * myteam)
246 forcecolor_enemy = 0;
249 if(forcecolor_friend && !forcecolor_enemy)
251 // only friend color is forced?
252 // verify it is not equal to the enemy color
253 for(tm = teams.sort_next; tm; tm = tm.sort_next)
254 // note: we even compare against our own team.
255 // if we rejected because we matched our OWN team color,
256 // this is not bad; we then simply keep our color as is
258 if(forcecolor_friend == 1024 + 17 * tm.team)
259 forcecolor_friend = 0;
262 if(cm == 1024 + 17 * myteam)
264 if(forcecolor_friend)
265 this.colormap = forcecolor_friend;
270 this.colormap = forcecolor_enemy;
275 if(autocvar_cl_forcemyplayercolors && islocalplayer)
276 this.colormap = 1024 + autocvar_cl_forcemyplayercolors;
277 else if(autocvar_cl_forceplayercolors)
278 this.colormap = player_localnum + 1;
281 // GLOWMOD AND DEATH FADING
282 if(this.colormap > 0)
283 this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : entcs_GetClientColors(this.colormap - 1)) & 0x0F, true) * 2;
285 this.glowmod = '1 1 1';
287 if(autocvar_cl_deathglow > 0)
289 if(this.csqcmodel_isdead)
291 // Fade out to black now...
292 if(this.old_glowmod == '0 0 0') { this.old_glowmod = this.glowmod; }
295 this.glowmod = this.old_glowmod * bound(0, 1 - (time - this.death_time) / autocvar_cl_deathglow, 1);
296 this.glowmod_x = max(this.glowmod.x, 0.0001);
297 this.glowmod_y = max(this.glowmod.y, 0.0001);
298 this.glowmod_z = max(this.glowmod.z, 0.0001);
300 else if(this.old_glowmod != '0 0 0') { this.old_glowmod = '0 0 0'; }
303 //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (this.csqcmodel_isdead ? "DEAD" : "ALIVE"), this.colormap, vtos(this.glowmod));
306 // FEATURE: fallback frames
307 .int csqcmodel_saveframe;
308 .int csqcmodel_saveframe2;
309 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
310 .int csqcmodel_saveframe3;
311 .int csqcmodel_saveframe4;
313 .int csqcmodel_framecount;
315 #define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1)
316 void CSQCPlayer_FallbackFrame_PreUpdate(entity this)
318 this.frame = this.csqcmodel_saveframe;
319 this.frame2 = this.csqcmodel_saveframe2;
320 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
321 this.frame3 = this.csqcmodel_saveframe3;
322 this.frame4 = this.csqcmodel_saveframe4;
325 void CSQCPlayer_FallbackFrame_PostUpdate(entity this, bool isnew)
327 this.csqcmodel_saveframe = this.frame;
328 this.csqcmodel_saveframe2 = this.frame2;
329 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
330 this.csqcmodel_saveframe3 = this.frame3;
331 this.csqcmodel_saveframe4 = this.frame4;
334 // hack for death animations: set their frametime to zero in case a
338 #define FIX_FRAMETIME(f,ft) MACRO_BEGIN { \
339 if(IS_DEAD_FRAME(this.f) && this.ft != 0 && this.death_time != 0) \
340 this.ft = this.death_time; \
342 FIX_FRAMETIME(frame, frame1time);
343 FIX_FRAMETIME(frame2, frame2time);
344 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
345 FIX_FRAMETIME(frame3, frame3time);
346 FIX_FRAMETIME(frame4, frame4time);
349 this.csqcmodel_isdead = IS_DEAD_FRAME(this.frame);
351 void CSQCPlayer_AnimDecide_PostUpdate(entity this, bool isnew)
353 this.csqcmodel_isdead = boolean(this.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
355 int CSQCPlayer_FallbackFrame(entity this, int f)
358 if(frameduration(this.modelindex, f) > 0)
359 return f; // goooooood
360 if(frameduration(this.modelindex, 1) <= 0)
361 return f; // this is a static model. We can't fix it if we wanted to
364 case 23: return 11; // anim_melee -> anim_shoot
365 case 24: return 4; // anim_duckwalkbackwards -> anim_duckwalk
366 case 25: return 4; // anim_duckwalkstrafeleft -> anim_duckwalk
367 case 26: return 4; // anim_duckwalkstraferight -> anim_duckwalk
368 case 27: return 4; // anim_duckwalkforwardright -> anim_duckwalk
369 case 28: return 4; // anim_duckwalkforwardleft -> anim_duckwalk
370 case 29: return 4; // anim_duckwalkbackright -> anim_duckwalk
371 case 30: return 4; // anim_duckwalkbackleft -> anim_duckwalk
373 LOG_DEBUGF("Frame %d missing in model %s, and we have no fallback - FAIL!", f, this.model);
376 void CSQCPlayer_FallbackFrame_Apply(entity this)
378 this.frame = CSQCPlayer_FallbackFrame(this, this.frame);
379 this.frame2 = CSQCPlayer_FallbackFrame(this, this.frame2);
380 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
381 this.frame3 = CSQCPlayer_FallbackFrame(this, this.frame3);
382 this.frame4 = CSQCPlayer_FallbackFrame(this, this.frame4);
386 // FEATURE: auto tag_index
388 .int tag_entity_lastmodelindex;
390 void CSQCModel_AutoTagIndex_Apply(entity this)
392 if(this.tag_entity && wasfreed(this.tag_entity))
393 this.tag_entity = NULL;
395 MUTATOR_CALLHOOK(TagIndex_Update, this);
397 if(this.tag_networkentity)
401 if(this.tag_entity.entnum != this.tag_networkentity)
403 this.tag_entity = findfloat(NULL, entnum, this.tag_networkentity);
407 // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
408 if(this.tag_entity.classname == "csqcmodel")
410 CSQCModel_Hook_PreDraw(this.tag_entity, (this.tag_entity.entnum >= 1 && this.tag_entity.entnum <= maxclients));
413 if(this.tag_entity.modelindex != this.tag_entity_lastmodelindex)
415 this.tag_entity_lastmodelindex = this.tag_entity.modelindex;
422 // the best part is: IT EXISTS
423 if(substring(this.model, 0, 14) == "models/weapons")
425 if(substring(this.tag_entity.model, 0, 14) == "models/weapons")
427 this.tag_index = gettagindex(this.tag_entity, "weapon");
429 this.tag_index = gettagindex(this.tag_entity, "tag_weapon");
432 // we need to prevent this from 'appening
433 this.tag_entity = NULL;
435 LOG_TRACE("h_ model lacks weapon attachment, but v_ model is attached to it");
438 else if(this.tag_entity.isplayermodel)
440 skeleton_loadinfo(this.tag_entity);
441 this.tag_index = this.tag_entity.bone_weapon;
445 if(substring(this.tag_entity.model, 0, 14) == "models/weapons")
447 this.tag_index = gettagindex(this.tag_entity, "shot");
449 this.tag_index = gettagindex(this.tag_entity, "tag_shot");
452 MUTATOR_CALLHOOK(TagIndex_Apply, this);
456 // damn, see you next frame
463 void CSQCModel_Effects_PreUpdate(entity this)
465 this.effects = this.csqcmodel_effects;
466 this.modelflags = this.csqcmodel_modelflags;
467 this.traileffect = this.csqcmodel_traileffect;
469 void Reset_ArcBeam();
470 void CSQCModel_Effects_PostUpdate(entity this)
472 if (this == csqcplayer) {
473 if (this.csqcmodel_teleported) {
477 this.csqcmodel_effects = this.effects;
478 this.csqcmodel_modelflags = this.modelflags;
479 this.csqcmodel_traileffect = this.traileffect;
482 if(this.csqcmodel_teleported)
483 Projectile_ResetTrail(this, this.origin);
486 void CSQCModel_Effects_Apply(entity this)
488 int eff = this.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST;
489 int tref = this.csqcmodel_traileffect;
491 this.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
493 this.traileffect = 0;
495 if(eff & EF_BRIGHTFIELD)
496 tref = EFFECT_TR_NEXUIZPLASMA.m_id;
497 // ignoring EF_MUZZLEFLASH
498 if(eff & EF_BRIGHTLIGHT)
499 adddynamiclight(this.origin, 400, '3 3 3');
500 if(eff & EF_DIMLIGHT)
501 adddynamiclight(this.origin, 200, '1.5 1.5 1.5');
502 if((eff & EF_NODRAW) || (this.alpha < 0))
504 if(eff & EF_ADDITIVE)
505 this.renderflags |= RF_ADDITIVE;
507 adddynamiclight(this.origin, 200, '0.15 0.15 1.5');
509 adddynamiclight(this.origin, 200, '1.5 0.15 0.15');
510 // ignoring EF_NOGUNBOB
511 if(eff & EF_FULLBRIGHT)
512 this.renderflags |= RF_FULLBRIGHT;
514 pointparticles(EFFECT_EF_FLAME, this.origin, '0 0 0', bound(0, frametime, 0.1));
515 if(eff & EF_STARDUST)
516 pointparticles(EFFECT_EF_STARDUST, this.origin, '0 0 0', bound(0, frametime, 0.1));
517 if(eff & EF_NOSHADOW)
518 this.renderflags |= RF_NOSHADOW;
519 if(eff & EF_NODEPTHTEST)
520 this.renderflags |= RF_DEPTHHACK;
521 // ignoring EF_SELECTABLE
522 if(eff & EF_DOUBLESIDED)
523 this.effects |= EF_DOUBLESIDED;
524 if(eff & EF_NOSELFSHADOW)
525 this.effects |= EF_NOSELFSHADOW;
526 if(eff & EF_DYNAMICMODELLIGHT)
527 this.renderflags |= RF_DYNAMICMODELLIGHT;
528 // ignoring EF_UNUSED18, EF_UNUSED19, EF_RESTARTANIM_BIT, EF_TELEPORT_BIT, EF_LOWPRECISION
529 if(this.csqcmodel_modelflags & MF_ROCKET)
530 tref = EFFECT_TR_ROCKET.m_id;
531 if(this.csqcmodel_modelflags & MF_GRENADE)
532 tref = EFFECT_TR_GRENADE.m_id;
533 if(this.csqcmodel_modelflags & MF_GIB)
534 tref = EFFECT_TR_BLOOD.m_id;
535 if(this.csqcmodel_modelflags & MF_ROTATE)
537 this.renderflags |= RF_USEAXIS;
538 makevectors(this.angles + '0 100 0' * fmod(time, 3.6));
540 if(this.csqcmodel_modelflags & MF_TRACER)
541 tref = EFFECT_TR_WIZSPIKE.m_id;
542 if(this.csqcmodel_modelflags & MF_ZOMGIB)
543 tref = EFFECT_TR_SLIGHTBLOOD.m_id;
544 if(this.csqcmodel_modelflags & MF_TRACER2)
545 tref = EFFECT_TR_KNIGHTSPIKE.m_id;
546 if(this.csqcmodel_modelflags & MF_TRACER3)
547 tref = EFFECT_TR_VORESPIKE.m_id;
549 this.traileffect = tref;
552 Projectile_DrawTrail(this, this.origin);
554 Projectile_ResetTrail(this, this.origin);
556 if(this.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST)
557 this.renderflags |= RF_ADDITIVE;
558 // also special in CSQCPlayer_GlowMod_Apply
560 if(this.csqcmodel_modelflags & MF_ROCKET)
562 if(!this.snd_looping)
564 sound(this, CH_TRIGGER_SINGLE, SND_JETPACK_FLY, VOL_BASE, autocvar_g_jetpack_attenuation);
565 this.snd_looping = CH_TRIGGER_SINGLE;
572 sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation);
573 this.snd_looping = 0;
579 .int csqcmodel_predraw_run;
581 .int anim_frame1time;
583 .int anim_frame2time;
585 .int anim_saveframe1time;
586 .int anim_saveframe2;
587 .int anim_saveframe2time;
588 .int anim_prev_pmove_flags;
589 void CSQCModel_Hook_PreDraw(entity this, bool isplayer)
591 if(this.csqcmodel_predraw_run == framecount)
593 this.csqcmodel_predraw_run = framecount;
595 if(!this.modelindex || this.model == "null")
601 this.drawmask = MASK_NORMAL;
603 if(this.isplayermodel) // this checks if it's a player MODEL!
605 CSQCPlayer_ModelAppearance_Apply(this, this.entnum == player_localnum + 1);
606 CSQCPlayer_LOD_Apply(this);
610 skeleton_loadinfo(this);
611 bool doblend = (this.bone_upperbody >= 0);
612 CSQCPlayer_FallbackFrame_Apply(this);
615 skeleton_from_frames(this, this.csqcmodel_isdead);
619 free_skeleton_from_frames(this);
620 // just in case, clear these (we're animating in frame and frame3)
627 // we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know!
628 skeleton_loadinfo(this);
629 bool doblend = (this.bone_upperbody >= 0);
631 if(this == csqcplayer)
633 if(IS_ONGROUND(this))
635 this.anim_prev_pmove_flags = this.flags;
636 if(this.flags & FL_DUCKED)
637 animdecide_setstate(this, this.anim_state | ANIMSTATE_DUCK, false);
638 else if(this.anim_state & ANIMSTATE_DUCK)
639 animdecide_setstate(this, this.anim_state - ANIMSTATE_DUCK, false);
643 tracebox(this.origin + '0 0 1', this.mins, this.maxs, this.origin - '0 0 4', MOVE_NORMAL, this);
644 if(trace_startsolid || trace_fraction < 1)
647 animdecide_load_if_needed(this);
648 animdecide_setimplicitstate(this, onground);
649 animdecide_setframes(this, doblend, anim_frame, anim_frame1time, anim_frame2, anim_frame2time);
651 if(this.anim_saveframe != this.anim_frame || this.anim_saveframe1time != this.anim_frame1time)
652 sf |= CSQCMODEL_PROPERTY_FRAME;
653 if(this.anim_saveframe2 != this.anim_frame2 || this.anim_saveframe2time != this.anim_frame2time)
654 sf |= CSQCMODEL_PROPERTY_FRAME2;
655 this.anim_saveframe = this.anim_frame;
656 this.anim_saveframe1time = this.anim_frame1time;
657 this.anim_saveframe2 = this.anim_frame2;
658 this.anim_saveframe2time = this.anim_frame2time;
659 // Note: we always consider lerpfrac "changed", as it uses fixed values every time anyway.
660 // This ensures that .frame etc. are always written.
661 CSQCModel_InterpolateAnimation_2To4_PreNote(this, sf | CSQCMODEL_PROPERTY_LERPFRAC);
662 this.lerpfrac = (doblend ? 0.5 : 0);
663 this.frame = this.anim_frame;
664 this.frame1time = this.anim_frame1time;
665 this.frame2 = this.anim_frame2;
666 this.frame2time = this.anim_frame2time;
667 CSQCModel_InterpolateAnimation_2To4_Note(this, sf | CSQCMODEL_PROPERTY_LERPFRAC, false);
668 CSQCModel_InterpolateAnimation_2To4_Do(this);
671 skeleton_from_frames(this, this.csqcmodel_isdead);
675 free_skeleton_from_frames(this);
676 // just in case, clear these (we're animating in frame and frame3)
683 CSQCModel_AutoTagIndex_Apply(this);
685 CSQCModel_Effects_Apply(this);
688 void CSQCModel_Hook_PreUpdate(entity this, bool isnew, bool isplayer, bool islocalplayer)
690 // interpolate v_angle
691 this.iflags |= IFLAG_V_ANGLE_X;
692 // revert to values from server
693 CSQCModel_Effects_PreUpdate(this);
694 if(this.isplayermodel)
697 CSQCPlayer_FallbackFrame_PreUpdate(this);
698 CSQCPlayer_ModelAppearance_PreUpdate(this);
702 void CSQCModel_Hook_PostUpdate(entity this, bool isnew, bool isplayer, bool islocalplayer)
704 // is it a player model? (shared state)
705 this.isplayermodel = (substring(this.model, 0, 14) == "models/player/" || substring(this.model, 0, 17) == "models/ok_player/" || (substring(this.model, 0, 16) == "models/monsters/" && (this.entnum >= 1 && this.entnum <= maxclients)));
707 // save values set by server
708 if(this.isplayermodel)
710 CSQCPlayer_ModelAppearance_PostUpdate(this);
712 CSQCPlayer_AnimDecide_PostUpdate(this, isnew);
714 CSQCPlayer_FallbackFrame_PostUpdate(this, isnew);
716 CSQCModel_Effects_PostUpdate(this);