1 #include "csqcmodel_hooks.qh"
2 #include "autocvars.qh"
3 #include "miscfunctions.qh"
4 #include <client/mutators/_mod.qh>
5 #include "player_skeleton.qh"
6 #include "weapons/projectile.qh"
7 #include <common/animdecide.qh>
8 #include <common/ent_cs.qh>
9 #include <common/physics/movetypes/movetypes.qh>
10 #include <common/viewloc.qh>
11 #include <common/effects/all.qh>
12 #include <common/effects/all.inc>
13 #include <lib/csqcmodel/cl_model.qh>
14 #include <lib/csqcmodel/cl_player.qh>
15 #include <lib/csqcmodel/interpolate.qh>
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;
112 void CSQCPlayer_ModelAppearance_PreUpdate(entity this)
114 this.model = this.forceplayermodels_savemodel;
115 this.modelindex = this.forceplayermodels_savemodelindex;
116 this.skin = this.forceplayermodels_saveskin;
117 this.colormap = this.forceplayermodels_savecolormap;
119 void CSQCPlayer_ModelAppearance_PostUpdate(entity this)
121 this.forceplayermodels_savemodel = this.model;
122 this.forceplayermodels_savemodelindex = this.modelindex;
123 this.forceplayermodels_saveskin = this.skin;
124 this.forceplayermodels_savecolormap = this.colormap;
126 if(this.forceplayermodels_savemodel != this.forceplayermodels_isgoodmodel_mdl)
128 this.forceplayermodels_isgoodmodel = fexists(this.forceplayermodels_savemodel);
129 this.forceplayermodels_isgoodmodel_mdl = this.forceplayermodels_savemodel;
130 if(!this.forceplayermodels_isgoodmodel)
131 LOG_INFOF("Warning: missing model %s has been used", this.forceplayermodels_savemodel);
134 void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
136 if(MUTATOR_CALLHOOK(ForcePlayermodels_Skip, this, islocalplayer))
137 goto skipforcemodels;
140 // which one is ALWAYS good?
141 if (!forceplayermodels_goodmodel)
144 precache_model(cvar_defstring("_cl_playermodel"));
145 _setmodel(e, cvar_defstring("_cl_playermodel"));
146 forceplayermodels_goodmodel = e.model;
147 forceplayermodels_goodmodelindex = e.modelindex;
151 // first, try finding it from the server
152 if(this.forceplayermodels_savemodelindex && this.forceplayermodels_savemodel != "null")
156 if(!isdemo()) // this is mainly cheat protection; not needed for demos
158 // trust server's idea of "own player model"
159 forceplayermodels_modelisgoodmodel = this.forceplayermodels_isgoodmodel;
160 forceplayermodels_model = this.forceplayermodels_savemodel;
161 forceplayermodels_modelindex = this.forceplayermodels_savemodelindex;
162 forceplayermodels_skin = this.forceplayermodels_saveskin;
163 forceplayermodels_attempted = 1;
168 // forcemodel finding
169 if(!forceplayermodels_attempted)
171 forceplayermodels_attempted = 1;
173 // only if this failed, find it out on our own
175 precache_model(autocvar__cl_playermodel);
176 _setmodel(e, autocvar__cl_playermodel); // this is harmless, see below
177 forceplayermodels_modelisgoodmodel = fexists(e.model);
178 forceplayermodels_model = e.model;
179 forceplayermodels_modelindex = e.modelindex;
180 forceplayermodels_skin = autocvar__cl_playerskin;
184 if(autocvar_cl_forcemyplayermodel != "" && autocvar_cl_forcemyplayermodel != forceplayermodels_mymodel)
187 _setmodel(e, autocvar_cl_forcemyplayermodel); // this is harmless, see below
188 forceplayermodels_myisgoodmodel = fexists(e.model);
189 forceplayermodels_mymodel = e.model;
190 forceplayermodels_mymodelindex = e.modelindex;
197 cm = this.forceplayermodels_savecolormap;
198 cm = (cm >= 1024) ? cm : (entcs_GetClientColors(cm - 1) + 1024);
201 isfriend = (cm == 1024 + 17 * myteam);
203 isfriend = islocalplayer;
205 if(autocvar_cl_forcemyplayermodel != "" && forceplayermodels_myisgoodmodel && isfriend)
207 this.model = forceplayermodels_mymodel;
208 this.modelindex = forceplayermodels_mymodelindex;
209 this.skin = autocvar_cl_forcemyplayerskin;
211 else if(autocvar_cl_forceplayermodels && forceplayermodels_modelisgoodmodel)
213 this.model = forceplayermodels_model;
214 this.modelindex = forceplayermodels_modelindex;
215 this.skin = forceplayermodels_skin;
217 else if(this.forceplayermodels_isgoodmodel)
219 this.model = this.forceplayermodels_savemodel;
220 this.modelindex = this.forceplayermodels_savemodelindex;
221 this.skin = this.forceplayermodels_saveskin;
225 this.model = forceplayermodels_goodmodel;
226 this.modelindex = forceplayermodels_goodmodelindex;
227 this.skin = this.forceplayermodels_saveskin;
230 // forceplayercolors too
233 // own team's color is never forced
234 int forcecolor_friend = 0;
235 int forcecolor_enemy = 0;
238 if(autocvar_cl_forcemyplayercolors)
239 forcecolor_friend = 1024 + autocvar_cl_forcemyplayercolors;
240 if(autocvar_cl_forceplayercolors == 2 && team_count == 2)
241 forcecolor_enemy = 1024 + autocvar__cl_color;
243 if(forcecolor_enemy && !forcecolor_friend)
245 // only enemy color is forced?
246 // verify it is not equal to the friend color
247 if(forcecolor_enemy == 1024 + 17 * myteam)
248 forcecolor_enemy = 0;
251 if(forcecolor_friend && !forcecolor_enemy)
253 // only friend color is forced?
254 // verify it is not equal to the enemy color
255 for(tm = teams.sort_next; tm; tm = tm.sort_next)
256 // note: we even compare against our own team.
257 // if we rejected because we matched our OWN team color,
258 // this is not bad; we then simply keep our color as is
260 if(forcecolor_friend == 1024 + 17 * tm.team)
261 forcecolor_friend = 0;
264 if(cm == 1024 + 17 * myteam)
266 if(forcecolor_friend)
267 this.colormap = forcecolor_friend;
272 this.colormap = forcecolor_enemy;
277 if(autocvar_cl_forcemyplayercolors && islocalplayer)
278 this.colormap = 1024 + autocvar_cl_forcemyplayercolors;
279 else if(autocvar_cl_forceplayercolors)
280 this.colormap = player_localnum + 1;
283 LABEL(skipforcemodels)
285 // GLOWMOD AND DEATH FADING
286 if(this.colormap > 0)
287 this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : entcs_GetClientColors(this.colormap - 1)) & 0x0F, true) * 2;
289 this.glowmod = '1 1 1';
291 if(autocvar_cl_deathglow > 0)
293 if(this.csqcmodel_isdead)
295 float min_factor = bound(0, autocvar_cl_deathglow_min, 1);
296 if(this.colormap > 0)
298 float glow_fade = bound(0, 1 - (time - this.death_time) / autocvar_cl_deathglow, 1);
299 this.glowmod *= (min_factor + glow_fade * (1 - min_factor));
300 if (this.glowmod == '0 0 0')
301 this.glowmod.x = 0.000001;
305 //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (this.csqcmodel_isdead ? "DEAD" : "ALIVE"), this.colormap, vtos(this.glowmod));
308 // FEATURE: fallback frames
309 .int csqcmodel_saveframe;
310 .int csqcmodel_saveframe2;
311 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
312 .int csqcmodel_saveframe3;
313 .int csqcmodel_saveframe4;
315 .int csqcmodel_framecount;
317 #define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1)
318 void CSQCPlayer_FallbackFrame_PreUpdate(entity this)
320 this.frame = this.csqcmodel_saveframe;
321 this.frame2 = this.csqcmodel_saveframe2;
322 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
323 this.frame3 = this.csqcmodel_saveframe3;
324 this.frame4 = this.csqcmodel_saveframe4;
327 void CSQCPlayer_FallbackFrame_PostUpdate(entity this, bool isnew)
329 this.csqcmodel_saveframe = this.frame;
330 this.csqcmodel_saveframe2 = this.frame2;
331 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
332 this.csqcmodel_saveframe3 = this.frame3;
333 this.csqcmodel_saveframe4 = this.frame4;
336 // hack for death animations: set their frametime to zero in case a
340 #define FIX_FRAMETIME(f,ft) MACRO_BEGIN \
341 if(IS_DEAD_FRAME(this.f) && this.ft != 0 && this.death_time != 0) \
342 this.ft = this.death_time; \
344 FIX_FRAMETIME(frame, frame1time);
345 FIX_FRAMETIME(frame2, frame2time);
346 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
347 FIX_FRAMETIME(frame3, frame3time);
348 FIX_FRAMETIME(frame4, frame4time);
351 this.csqcmodel_isdead = IS_DEAD_FRAME(this.frame);
353 void CSQCPlayer_AnimDecide_PostUpdate(entity this, bool isnew)
355 this.csqcmodel_isdead = boolean(this.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
357 int CSQCPlayer_FallbackFrame(entity this, int f)
360 if(frameduration(this.modelindex, f) > 0)
361 return f; // goooooood
362 if(frameduration(this.modelindex, 1) <= 0)
363 return f; // this is a static model. We can't fix it if we wanted to
366 case 23: return 11; // anim_melee -> anim_shoot
367 case 24: return 4; // anim_duckwalkbackwards -> anim_duckwalk
368 case 25: return 4; // anim_duckwalkstrafeleft -> anim_duckwalk
369 case 26: return 4; // anim_duckwalkstraferight -> anim_duckwalk
370 case 27: return 4; // anim_duckwalkforwardright -> anim_duckwalk
371 case 28: return 4; // anim_duckwalkforwardleft -> anim_duckwalk
372 case 29: return 4; // anim_duckwalkbackright -> anim_duckwalk
373 case 30: return 4; // anim_duckwalkbackleft -> anim_duckwalk
375 LOG_DEBUGF("Frame %d missing in model %s, and we have no fallback - FAIL!", f, this.model);
378 void CSQCPlayer_FallbackFrame_Apply(entity this)
380 this.frame = CSQCPlayer_FallbackFrame(this, this.frame);
381 this.frame2 = CSQCPlayer_FallbackFrame(this, this.frame2);
382 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
383 this.frame3 = CSQCPlayer_FallbackFrame(this, this.frame3);
384 this.frame4 = CSQCPlayer_FallbackFrame(this, this.frame4);
388 // FEATURE: auto tag_index
390 .int tag_entity_lastmodelindex;
392 void CSQCModel_AutoTagIndex_Apply(entity this)
394 if(this.tag_entity && wasfreed(this.tag_entity))
395 this.tag_entity = NULL;
397 MUTATOR_CALLHOOK(TagIndex_Update, this);
399 if(this.tag_networkentity)
403 if(this.tag_entity.entnum != this.tag_networkentity)
405 this.tag_entity = findfloat(NULL, entnum, this.tag_networkentity);
409 // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
410 if(this.tag_entity.classname == "csqcmodel")
412 CSQCModel_Hook_PreDraw(this.tag_entity, (this.tag_entity.isplayermodel & ISPLAYER_CLIENT));
415 if(this.tag_entity.modelindex != this.tag_entity_lastmodelindex)
417 this.tag_entity_lastmodelindex = this.tag_entity.modelindex;
424 // the best part is: IT EXISTS
425 if(substring(this.model, 0, 14) == "models/weapons")
427 if(substring(this.tag_entity.model, 0, 14) == "models/weapons")
429 this.tag_index = gettagindex(this.tag_entity, "weapon");
431 this.tag_index = gettagindex(this.tag_entity, "tag_weapon");
434 // we need to prevent this from 'appening
435 this.tag_entity = NULL;
437 LOG_TRACE("h_ model lacks weapon attachment, but v_ model is attached to it");
440 else if((this.tag_entity.isplayermodel & ISPLAYER_MODEL))
442 skeleton_loadinfo(this.tag_entity);
443 this.tag_index = this.tag_entity.bone_weapon;
447 if(substring(this.tag_entity.model, 0, 14) == "models/weapons")
449 this.tag_index = gettagindex(this.tag_entity, "shot");
451 this.tag_index = gettagindex(this.tag_entity, "tag_shot");
454 MUTATOR_CALLHOOK(TagIndex_Apply, this);
458 // damn, see you next frame
465 void CSQCModel_Effects_PreUpdate(entity this)
467 this.effects = this.csqcmodel_effects;
468 this.modelflags = this.csqcmodel_modelflags;
469 this.traileffect = this.csqcmodel_traileffect;
471 void Reset_ArcBeam();
472 void CSQCModel_Effects_PostUpdate(entity this)
474 if (this == csqcplayer) {
475 if (this.csqcmodel_teleported) {
479 this.csqcmodel_effects = this.effects;
480 this.csqcmodel_modelflags = this.modelflags;
481 this.csqcmodel_traileffect = this.traileffect;
484 if(this.csqcmodel_teleported)
485 Projectile_ResetTrail(this, this.origin);
488 void CSQCModel_Effects_Apply(entity this)
490 int eff = this.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST;
491 int tref = this.csqcmodel_traileffect;
493 this.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
495 this.traileffect = 0;
497 if(eff & EF_BRIGHTFIELD)
498 tref = EFFECT_TR_NEXUIZPLASMA.m_id;
499 // ignoring EF_MUZZLEFLASH
500 if(eff & EF_BRIGHTLIGHT)
501 adddynamiclight(this.origin, 400, '3 3 3');
502 if(eff & EF_DIMLIGHT)
503 adddynamiclight(this.origin, 200, '1.5 1.5 1.5');
504 if((eff & EF_NODRAW) || (this.alpha < 0))
506 if(eff & EF_ADDITIVE)
507 this.renderflags |= RF_ADDITIVE;
509 adddynamiclight(this.origin, 200, '0.15 0.15 1.5');
511 adddynamiclight(this.origin, 200, '1.5 0.15 0.15');
512 // ignoring EF_NOGUNBOB
513 if(eff & EF_FULLBRIGHT)
514 this.renderflags |= RF_FULLBRIGHT;
516 pointparticles(EFFECT_EF_FLAME, this.origin, '0 0 0', bound(0, frametime, 0.1));
517 if(eff & EF_STARDUST)
518 pointparticles(EFFECT_EF_STARDUST, this.origin, '0 0 0', bound(0, frametime, 0.1));
519 if(eff & EF_NOSHADOW)
520 this.renderflags |= RF_NOSHADOW;
521 if(eff & EF_NODEPTHTEST)
522 this.renderflags |= RF_DEPTHHACK;
523 // ignoring EF_SELECTABLE
524 if(eff & EF_DOUBLESIDED)
525 this.effects |= EF_DOUBLESIDED;
526 if(eff & EF_NOSELFSHADOW)
527 this.effects |= EF_NOSELFSHADOW;
528 if(eff & EF_DYNAMICMODELLIGHT)
529 this.renderflags |= RF_DYNAMICMODELLIGHT;
530 // ignoring EF_UNUSED18, EF_UNUSED19, EF_RESTARTANIM_BIT, EF_TELEPORT_BIT, EF_LOWPRECISION
531 if(this.csqcmodel_modelflags & MF_ROCKET)
532 tref = EFFECT_TR_ROCKET.m_id;
533 if(this.csqcmodel_modelflags & MF_GRENADE)
534 tref = EFFECT_TR_GRENADE.m_id;
535 if(this.csqcmodel_modelflags & MF_GIB)
536 tref = EFFECT_TR_BLOOD.m_id;
537 if(this.csqcmodel_modelflags & MF_ROTATE)
539 // This will be hard to replace with MAKE_VECTORS because it's called as part of the predraw function
540 // as documented in csprogs.h in the engine. The globals can then be read in many places in the engine.
541 // However MF_ROTATE is currently only used in one place - might be possible to get rid of it entirely.
542 this.renderflags |= RF_USEAXIS;
543 makevectors(this.angles + '0 100 0' * fmod(time, 3.6));
545 if(this.csqcmodel_modelflags & MF_TRACER)
546 tref = EFFECT_TR_WIZSPIKE.m_id;
547 if(this.csqcmodel_modelflags & MF_ZOMGIB)
548 tref = EFFECT_TR_SLIGHTBLOOD.m_id;
549 if(this.csqcmodel_modelflags & MF_TRACER2)
550 tref = EFFECT_TR_KNIGHTSPIKE.m_id;
551 if(this.csqcmodel_modelflags & MF_TRACER3)
552 tref = EFFECT_TR_VORESPIKE.m_id;
554 this.traileffect = tref;
557 Projectile_DrawTrail(this, this.origin);
559 Projectile_ResetTrail(this, this.origin);
561 if(this.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST)
562 this.renderflags |= RF_ADDITIVE;
563 // also special in CSQCPlayer_GlowMod_Apply
565 if(this.csqcmodel_modelflags & MF_ROCKET)
567 if(!this.snd_looping)
569 sound(this, CH_TRIGGER_SINGLE, SND_JETPACK_FLY, VOL_BASE, autocvar_cl_jetpack_attenuation);
570 this.snd_looping = CH_TRIGGER_SINGLE;
577 sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_cl_jetpack_attenuation);
578 this.snd_looping = 0;
584 .int csqcmodel_predraw_run;
586 .int anim_frame1time;
588 .int anim_frame2time;
590 .int anim_saveframe1time;
591 .int anim_saveframe2;
592 .int anim_saveframe2time;
593 .int anim_prev_pmove_flags;
594 void CSQCModel_Hook_PreDraw(entity this, bool isplayer)
596 if(this.csqcmodel_predraw_run == framecount)
598 this.csqcmodel_predraw_run = framecount;
600 if(!this.modelindex || this.model == "null" || this.alpha < 0)
603 if(this.snd_looping > 0)
605 sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_cl_jetpack_attenuation);
606 this.snd_looping = 0;
611 this.drawmask = MASK_NORMAL;
613 if((this.isplayermodel & ISPLAYER_MODEL) && this.drawmask) // this checks if it's a player MODEL!
615 CSQCPlayer_ModelAppearance_Apply(this, (this.isplayermodel & ISPLAYER_LOCAL));
616 CSQCPlayer_LOD_Apply(this);
620 skeleton_loadinfo(this);
621 bool doblend = (this.bone_upperbody >= 0);
622 CSQCPlayer_FallbackFrame_Apply(this);
625 skeleton_from_frames(this, this.csqcmodel_isdead);
629 free_skeleton_from_frames(this);
630 // just in case, clear these (we're animating in frame and frame3)
637 // we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know!
638 skeleton_loadinfo(this);
639 bool doblend = (this.bone_upperbody >= 0);
641 if(this == csqcplayer)
643 if(IS_ONGROUND(this))
645 this.anim_prev_pmove_flags = this.flags;
646 if(this.flags & FL_DUCKED)
647 animdecide_setstate(this, this.anim_state | ANIMSTATE_DUCK, false);
648 else if(this.anim_state & ANIMSTATE_DUCK)
649 animdecide_setstate(this, this.anim_state - ANIMSTATE_DUCK, false);
653 tracebox(this.origin + '0 0 1', this.mins, this.maxs, this.origin - '0 0 4', MOVE_NORMAL, this);
654 if(trace_startsolid || trace_fraction < 1)
657 animdecide_load_if_needed(this);
658 animdecide_setimplicitstate(this, onground);
659 animdecide_setframes(this, doblend, anim_frame, anim_frame1time, anim_frame2, anim_frame2time);
661 if(this.anim_saveframe != this.anim_frame || this.anim_saveframe1time != this.anim_frame1time)
662 sf |= CSQCMODEL_PROPERTY_FRAME;
663 if(this.anim_saveframe2 != this.anim_frame2 || this.anim_saveframe2time != this.anim_frame2time)
664 sf |= CSQCMODEL_PROPERTY_FRAME2;
665 this.anim_saveframe = this.anim_frame;
666 this.anim_saveframe1time = this.anim_frame1time;
667 this.anim_saveframe2 = this.anim_frame2;
668 this.anim_saveframe2time = this.anim_frame2time;
669 // Note: we always consider lerpfrac "changed", as it uses fixed values every time anyway.
670 // This ensures that .frame etc. are always written.
671 CSQCModel_InterpolateAnimation_2To4_PreNote(this, sf | CSQCMODEL_PROPERTY_LERPFRAC);
672 this.lerpfrac = (doblend ? 0.5 : 0);
673 this.frame = this.anim_frame;
674 this.frame1time = this.anim_frame1time;
675 this.frame2 = this.anim_frame2;
676 this.frame2time = this.anim_frame2time;
677 CSQCModel_InterpolateAnimation_2To4_Note(this, sf | CSQCMODEL_PROPERTY_LERPFRAC, false);
678 CSQCModel_InterpolateAnimation_2To4_Do(this);
681 skeleton_from_frames(this, this.csqcmodel_isdead);
685 free_skeleton_from_frames(this);
686 // just in case, clear these (we're animating in frame and frame3)
693 CSQCModel_AutoTagIndex_Apply(this);
695 CSQCModel_Effects_Apply(this);
698 void CSQCModel_Hook_PreUpdate(entity this, bool isnew, bool isplayer, bool islocalplayer)
700 // interpolate v_angle
701 this.iflags |= IFLAG_V_ANGLE_X;
702 // revert to values from server
703 CSQCModel_Effects_PreUpdate(this);
704 if((this.isplayermodel & ISPLAYER_MODEL))
707 CSQCPlayer_FallbackFrame_PreUpdate(this);
708 CSQCPlayer_ModelAppearance_PreUpdate(this);
712 void CSQCModel_Hook_PostUpdate(entity this, bool isnew, bool isplayer, bool islocalplayer)
714 // is it a player model? (shared state)
715 bool is_playermodel = (substring(this.model, 0, 14) == "models/player/" || substring(this.model, 0, 17) == "models/ok_player/" ||
716 (substring(this.model, 0, 16) == "models/monsters/" && (this.isplayermodel & BIT(1))));
717 this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_MODEL, is_playermodel);
719 // save values set by server
720 if((this.isplayermodel & ISPLAYER_MODEL))
722 CSQCPlayer_ModelAppearance_PostUpdate(this);
724 CSQCPlayer_AnimDecide_PostUpdate(this, isnew);
726 CSQCPlayer_FallbackFrame_PostUpdate(this, isnew);
728 CSQCModel_Effects_PostUpdate(this);