1 #include "csqcmodel_hooks.qh"
5 #include "player_skeleton.qh"
8 #include "weapons/projectile.qh"
10 #include "../common/animdecide.qh"
11 #include "../common/csqcmodel_settings.qh"
12 #include "../common/teams.qh"
14 #include "../csqcmodellib/cl_model.qh"
15 #include "../csqcmodellib/cl_player.qh"
16 #include "../csqcmodellib/interpolate.qh"
18 #include "../warpzonelib/mathlib.qh"
23 void CSQCModel_Hook_PreDraw(bool isplayer);
31 void CSQCPlayer_LOD_Apply(void)
34 if(self.lodmodelindex0 != self.modelindex)
36 string modelname = self.model;
39 vector mi = self.mins;
40 vector ma = self.maxs;
43 self.lodmodelindex0 = self.modelindex;
44 self.lodmodelindex1 = self.modelindex;
45 self.lodmodelindex2 = self.modelindex;
47 // FIXME: this only supports 3-letter extensions
48 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod1", substring(modelname, -4, 4));
54 self.lodmodelindex1 = self.modelindex;
57 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod2", substring(modelname, -4, 4));
63 self.lodmodelindex2 = self.modelindex;
66 setmodel(self, modelname); // make everything normal again
67 setsize(self, mi, ma);
71 if(autocvar_cl_playerdetailreduction <= 0)
73 if(autocvar_cl_playerdetailreduction <= -2)
74 self.modelindex = self.lodmodelindex2;
75 else if(autocvar_cl_playerdetailreduction <= -1)
76 self.modelindex = self.lodmodelindex1;
78 self.modelindex = self.lodmodelindex0;
82 float distance = vlen(self.origin - view_origin);
83 float f = (distance * current_viewzoom + 100.0) * autocvar_cl_playerdetailreduction;
84 f *= 1.0 / bound(0.01, view_quality, 1);
85 if(f > autocvar_cl_loddistance2)
86 self.modelindex = self.lodmodelindex2;
87 else if(f > autocvar_cl_loddistance1)
88 self.modelindex = self.lodmodelindex1;
90 self.modelindex = self.lodmodelindex0;
94 // FEATURE: forcemodel and model color selection (MUST be called BEFORE LOD!)
95 string forceplayermodels_model;
96 bool forceplayermodels_modelisgoodmodel;
97 int forceplayermodels_modelindex;
98 int forceplayermodels_skin;
100 string forceplayermodels_mymodel;
101 bool forceplayermodels_myisgoodmodel;
102 int forceplayermodels_mymodelindex;
104 bool forceplayermodels_attempted;
106 .string forceplayermodels_savemodel;
107 .int forceplayermodels_savemodelindex;
108 .int forceplayermodels_saveskin;
109 .int forceplayermodels_savecolormap;
111 .string forceplayermodels_isgoodmodel_mdl;
112 .bool forceplayermodels_isgoodmodel;
114 string forceplayermodels_goodmodel;
115 int forceplayermodels_goodmodelindex;
120 void CSQCPlayer_ModelAppearance_PreUpdate(void)
122 self.model = self.forceplayermodels_savemodel;
123 self.modelindex = self.forceplayermodels_savemodelindex;
124 self.skin = self.forceplayermodels_saveskin;
125 self.colormap = self.forceplayermodels_savecolormap;
127 void CSQCPlayer_ModelAppearance_PostUpdate(void)
129 self.forceplayermodels_savemodel = self.model;
130 self.forceplayermodels_savemodelindex = self.modelindex;
131 self.forceplayermodels_saveskin = self.skin;
132 self.forceplayermodels_savecolormap = self.colormap;
134 if(self.forceplayermodels_savemodel != self.forceplayermodels_isgoodmodel_mdl)
136 self.forceplayermodels_isgoodmodel = fexists(self.forceplayermodels_savemodel);
137 self.forceplayermodels_isgoodmodel_mdl = self.forceplayermodels_savemodel;
138 if(!self.forceplayermodels_isgoodmodel)
139 printf("Warning: missing model %s has been used\n", self.forceplayermodels_savemodel);
142 void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer)
145 // which one is ALWAYS good?
146 if (!forceplayermodels_goodmodel)
150 precache_model(cvar_defstring("_cl_playermodel"));
151 setmodel(e, cvar_defstring("_cl_playermodel"));
152 forceplayermodels_goodmodel = e.model;
153 forceplayermodels_goodmodelindex = e.modelindex;
157 // first, try finding it from the server
158 if(self.forceplayermodels_savemodelindex && self.forceplayermodels_savemodel != "null")
162 if(!isdemo()) // this is mainly cheat protection; not needed for demos
164 // trust server's idea of "own player model"
165 forceplayermodels_modelisgoodmodel = self.forceplayermodels_isgoodmodel;
166 forceplayermodels_model = self.forceplayermodels_savemodel;
167 forceplayermodels_modelindex = self.forceplayermodels_savemodelindex;
168 forceplayermodels_skin = self.forceplayermodels_saveskin;
169 forceplayermodels_attempted = 1;
174 // forcemodel finding
175 if(!forceplayermodels_attempted)
177 forceplayermodels_attempted = 1;
179 // only if this failed, find it out on our own
182 setmodel(e, autocvar__cl_playermodel); // this is harmless, see below
183 forceplayermodels_modelisgoodmodel = fexists(e.model);
184 forceplayermodels_model = e.model;
185 forceplayermodels_modelindex = e.modelindex;
186 forceplayermodels_skin = autocvar__cl_playerskin;
190 if(autocvar_cl_forcemyplayermodel != "" && autocvar_cl_forcemyplayermodel != forceplayermodels_mymodel)
194 setmodel(e, autocvar_cl_forcemyplayermodel); // this is harmless, see below
195 forceplayermodels_myisgoodmodel = fexists(e.model);
196 forceplayermodels_mymodel = e.model;
197 forceplayermodels_mymodelindex = e.modelindex;
204 cm = self.forceplayermodels_savecolormap;
205 cm = (cm >= 1024) ? cm : (stof(getplayerkeyvalue(cm - 1, "colors")) + 1024);
208 isfriend = (cm == 1024 + 17 * myteam);
210 isfriend = islocalplayer;
212 if(autocvar_cl_forcemyplayermodel != "" && forceplayermodels_myisgoodmodel && isfriend)
214 self.model = forceplayermodels_mymodel;
215 self.modelindex = forceplayermodels_mymodelindex;
216 self.skin = autocvar_cl_forcemyplayerskin;
218 else if(autocvar_cl_forceplayermodels && forceplayermodels_modelisgoodmodel)
220 self.model = forceplayermodels_model;
221 self.modelindex = forceplayermodels_modelindex;
222 self.skin = forceplayermodels_skin;
224 else if(self.forceplayermodels_isgoodmodel)
226 self.model = self.forceplayermodels_savemodel;
227 self.modelindex = self.forceplayermodels_savemodelindex;
228 self.skin = self.forceplayermodels_saveskin;
232 self.model = forceplayermodels_goodmodel;
233 self.modelindex = forceplayermodels_goodmodelindex;
234 self.skin = self.forceplayermodels_saveskin;
237 // forceplayercolors too
240 // own team's color is never forced
241 int forcecolor_friend = 0;
242 int forcecolor_enemy = 0;
245 if(autocvar_cl_forcemyplayercolors)
246 forcecolor_friend = 1024 + autocvar_cl_forcemyplayercolors;
247 if(autocvar_cl_forceplayercolors && team_count == 2)
248 forcecolor_enemy = 1024 + autocvar__cl_color;
250 if(forcecolor_enemy && !forcecolor_friend)
252 // only enemy color is forced?
253 // verify it is not equal to the friend color
254 if(forcecolor_enemy == 1024 + 17 * myteam)
255 forcecolor_enemy = 0;
258 if(forcecolor_friend && !forcecolor_enemy)
260 // only friend color is forced?
261 // verify it is not equal to the enemy color
262 for(tm = teams.sort_next; tm; tm = tm.sort_next)
263 // note: we even compare against our own team.
264 // if we rejected because we matched our OWN team color,
265 // this is not bad; we then simply keep our color as is
267 if(forcecolor_friend == 1024 + 17 * tm.team)
268 forcecolor_friend = 0;
271 if(cm == 1024 + 17 * myteam)
273 if(forcecolor_friend)
274 self.colormap = forcecolor_friend;
279 self.colormap = forcecolor_enemy;
284 if(autocvar_cl_forcemyplayercolors && islocalplayer)
285 self.colormap = 1024 + autocvar_cl_forcemyplayercolors;
286 else if(autocvar_cl_forceplayercolors)
287 self.colormap = player_localnum + 1;
290 // GLOWMOD AND DEATH FADING
291 if(self.colormap > 0)
292 self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? self.colormap : stof(getplayerkeyvalue(self.colormap - 1, "colors"))) & 0x0F, true) * 2;
294 self.glowmod = '1 1 1';
296 if(autocvar_cl_deathglow > 0)
298 if(self.csqcmodel_isdead)
300 // Fade out to black now...
301 if(self.old_glowmod == '0 0 0') { self.old_glowmod = self.glowmod; }
304 self.glowmod = self.old_glowmod * bound(0, 1 - (time - self.death_time) / autocvar_cl_deathglow, 1);
305 self.glowmod_x = max(self.glowmod.x, 0.0001);
306 self.glowmod_y = max(self.glowmod.y, 0.0001);
307 self.glowmod_z = max(self.glowmod.z, 0.0001);
309 else if(self.old_glowmod != '0 0 0') { self.old_glowmod = '0 0 0'; }
312 //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (self.csqcmodel_isdead ? "DEAD" : "ALIVE"), self.colormap, vtos(self.glowmod));
315 // FEATURE: fallback frames
316 .int csqcmodel_saveframe;
317 .int csqcmodel_saveframe2;
318 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
319 .int csqcmodel_saveframe3;
320 .int csqcmodel_saveframe4;
322 .int csqcmodel_framecount;
324 #define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1)
325 void CSQCPlayer_FallbackFrame_PreUpdate(void)
327 self.frame = self.csqcmodel_saveframe;
328 self.frame2 = self.csqcmodel_saveframe2;
329 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
330 self.frame3 = self.csqcmodel_saveframe3;
331 self.frame4 = self.csqcmodel_saveframe4;
334 void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew)
336 self.csqcmodel_saveframe = self.frame;
337 self.csqcmodel_saveframe2 = self.frame2;
338 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
339 self.csqcmodel_saveframe3 = self.frame3;
340 self.csqcmodel_saveframe4 = self.frame4;
343 // hack for death animations: set their frametime to zero in case a
347 #define FIX_FRAMETIME(f,ft) do { \
348 if(IS_DEAD_FRAME(self.f) && self.ft != 0 && self.death_time != 0) \
349 self.ft = self.death_time; \
351 FIX_FRAMETIME(frame, frame1time);
352 FIX_FRAMETIME(frame2, frame2time);
353 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
354 FIX_FRAMETIME(frame3, frame3time);
355 FIX_FRAMETIME(frame4, frame4time);
358 self.csqcmodel_isdead = IS_DEAD_FRAME(self.frame);
360 void CSQCPlayer_AnimDecide_PostUpdate(bool isnew)
362 self.csqcmodel_isdead = !!(self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
364 int CSQCPlayer_FallbackFrame(int f)
366 if(frameduration(self.modelindex, f) > 0)
367 return f; // goooooood
368 if(frameduration(self.modelindex, 1) <= 0)
369 return f; // this is a static model. We can't fix it if we wanted to
372 case 23: return 11; // anim_melee -> anim_shoot
373 case 24: return 4; // anim_duckwalkbackwards -> anim_duckwalk
374 case 25: return 4; // anim_duckwalkstrafeleft -> anim_duckwalk
375 case 26: return 4; // anim_duckwalkstraferight -> anim_duckwalk
376 case 27: return 4; // anim_duckwalkforwardright -> anim_duckwalk
377 case 28: return 4; // anim_duckwalkforwardleft -> anim_duckwalk
378 case 29: return 4; // anim_duckwalkbackright -> anim_duckwalk
379 case 30: return 4; // anim_duckwalkbackleft -> anim_duckwalk
381 printf("Frame %d missing in model %s, and we have no fallback - FAIL!\n", f, self.model);
384 void CSQCPlayer_FallbackFrame_Apply(void)
386 self.frame = CSQCPlayer_FallbackFrame(self.frame);
387 self.frame2 = CSQCPlayer_FallbackFrame(self.frame2);
388 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
389 self.frame3 = CSQCPlayer_FallbackFrame(self.frame3);
390 self.frame4 = CSQCPlayer_FallbackFrame(self.frame4);
394 // FEATURE: auto tag_index
396 .int tag_entity_lastmodelindex;
398 void CSQCModel_AutoTagIndex_Apply(void)
400 if(self.tag_entity && wasfreed(self.tag_entity))
401 self.tag_entity = world;
403 if(self.tag_networkentity)
407 if(self.tag_entity.entnum != self.tag_networkentity)
409 self.tag_entity = findfloat(world, entnum, self.tag_networkentity);
413 // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
414 if(self.tag_entity.classname == "csqcmodel")
416 entity oldself = self;
417 self = self.tag_entity;
418 CSQCModel_Hook_PreDraw((self.entnum >= 1 && self.entnum <= maxclients));
422 if(self.tag_entity.modelindex != self.tag_entity_lastmodelindex)
424 self.tag_entity_lastmodelindex = self.tag_entity.modelindex;
431 // the best part is: IT EXISTS
432 if(substring(self.model, 0, 17) == "models/weapons/v_")
434 if(substring(self.tag_entity.model, 0, 17) == "models/weapons/h_")
436 self.tag_index = gettagindex(self.tag_entity, "weapon");
438 self.tag_index = gettagindex(self.tag_entity, "tag_weapon");
441 // we need to prevent this from 'appening
442 self.tag_entity = world;
444 dprint("h_ model lacks weapon attachment, but v_ model is attached to it\n");
447 else if(self.tag_entity.isplayermodel)
449 skeleton_loadinfo(self.tag_entity);
450 self.tag_index = self.tag_entity.bone_weapon;
454 if(substring(self.tag_entity.model, 0, 17) == "models/weapons/v_")
456 self.tag_index = gettagindex(self.tag_entity, "shot");
458 self.tag_index = gettagindex(self.tag_entity, "tag_shot");
463 // damn, see you next frame
470 // FEATURE: EF_NODRAW workalike
471 const int EF_BRIGHTFIELD = 1;
472 const int EF_BRIGHTLIGHT = 4;
473 const int EF_DIMLIGHT = 8;
474 const int EF_DOUBLESIDED = 32768;
475 const int EF_NOSELFSHADOW = 65536;
476 const int EF_DYNAMICMODELLIGHT = 131072;
477 const int EF_RESTARTANIM_BIT = 1048576;
478 const int EF_TELEPORT_BIT = 2097152;
479 const int MF_ROCKET = 1; // leave a trail
480 const int MF_GRENADE = 2; // leave a trail
481 const int MF_GIB = 4; // leave a trail
482 const int MF_ROTATE = 8; // rotate (bonus items)
483 const int MF_TRACER = 16; // green split trail
484 const int MF_ZOMGIB = 32; // small blood trail
485 const int MF_TRACER2 = 64; // orange split trail
486 const int MF_TRACER3 = 128; // purple trail
487 .int csqcmodel_effects;
488 .int csqcmodel_modelflags;
489 void CSQCModel_Effects_PreUpdate(void)
491 self.effects = self.csqcmodel_effects;
492 self.modelflags = self.csqcmodel_modelflags;
494 void Reset_ArcBeam(void);
495 void CSQCModel_Effects_PostUpdate(void)
497 if (self == csqcplayer) {
498 if (self.csqcmodel_teleported) {
502 self.csqcmodel_effects = self.effects;
503 self.csqcmodel_modelflags = self.modelflags;
506 if(self.csqcmodel_teleported)
507 Projectile_ResetTrail(self.origin);
510 void CSQCModel_Effects_Apply(void)
512 int eff = self.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST;
514 self.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
516 self.traileffect = 0;
518 if(eff & EF_BRIGHTFIELD)
519 self.traileffect = particleeffectnum("TR_NEXUIZPLASMA");
520 // ignoring EF_MUZZLEFLASH
521 if(eff & EF_BRIGHTLIGHT)
522 adddynamiclight(self.origin, 400, '3 3 3');
523 if(eff & EF_DIMLIGHT)
524 adddynamiclight(self.origin, 200, '1.5 1.5 1.5');
525 if((eff & EF_NODRAW) || (self.alpha < 0))
527 if(eff & EF_ADDITIVE)
528 self.renderflags |= RF_ADDITIVE;
530 adddynamiclight(self.origin, 200, '0.15 0.15 1.5');
532 adddynamiclight(self.origin, 200, '1.5 0.15 0.15');
533 // ignoring EF_NOGUNBOB
534 if(eff & EF_FULLBRIGHT)
535 self.renderflags |= RF_FULLBRIGHT;
537 pointparticles(particleeffectnum("EF_FLAME"), self.origin, '0 0 0', bound(0, frametime, 0.1));
538 if(eff & EF_STARDUST)
539 pointparticles(particleeffectnum("EF_STARDUST"), self.origin, '0 0 0', bound(0, frametime, 0.1));
540 if(eff & EF_NOSHADOW)
541 self.renderflags |= RF_NOSHADOW;
542 if(eff & EF_NODEPTHTEST)
543 self.renderflags |= RF_DEPTHHACK;
544 // ignoring EF_SELECTABLE
545 if(eff & EF_DOUBLESIDED)
546 self.effects |= EF_DOUBLESIDED;
547 if(eff & EF_NOSELFSHADOW)
548 self.effects |= EF_NOSELFSHADOW;
549 if(eff & EF_DYNAMICMODELLIGHT)
550 self.renderflags |= RF_DYNAMICMODELLIGHT;
551 // ignoring EF_UNUSED18, EF_UNUSED19, EF_RESTARTANIM_BIT, EF_TELEPORT_BIT, EF_LOWPRECISION
552 if(self.csqcmodel_modelflags & MF_ROCKET)
553 self.traileffect = particleeffectnum("TR_ROCKET");
554 if(self.csqcmodel_modelflags & MF_GRENADE)
555 self.traileffect = particleeffectnum("TR_GRENADE");
556 if(self.csqcmodel_modelflags & MF_GIB)
557 self.traileffect = particleeffectnum("TR_BLOOD");
558 if(self.csqcmodel_modelflags & MF_ROTATE)
560 self.renderflags |= RF_USEAXIS;
561 makevectors(self.angles + '0 100 0' * fmod(time, 3.6));
563 if(self.csqcmodel_modelflags & MF_TRACER)
564 self.traileffect = particleeffectnum("TR_WIZSPIKE");
565 if(self.csqcmodel_modelflags & MF_ZOMGIB)
566 self.traileffect = particleeffectnum("TR_SLIGHTBLOOD");
567 if(self.csqcmodel_modelflags & MF_TRACER2)
568 self.traileffect = particleeffectnum("TR_KNIGHTSPIKE");
569 if(self.csqcmodel_modelflags & MF_TRACER3)
570 self.traileffect = particleeffectnum("TR_VORESPIKE");
573 Projectile_DrawTrail(self.origin);
575 Projectile_ResetTrail(self.origin);
577 if(self.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST)
578 self.renderflags |= RF_ADDITIVE;
579 // also special in CSQCPlayer_GlowMod_Apply
581 if(self.csqcmodel_modelflags & MF_ROCKET)
583 if(!self.snd_looping)
585 sound(self, CH_TRIGGER_SINGLE, "misc/jetpack_fly.wav", VOL_BASE, autocvar_g_jetpack_attenuation);
586 self.snd_looping = CH_TRIGGER_SINGLE;
593 sound(self, self.snd_looping, "misc/null.wav", VOL_BASE, autocvar_g_jetpack_attenuation);
594 self.snd_looping = 0;
599 void CSQCPlayer_Precache()
601 precache_sound("misc/jetpack_fly.wav");
605 .int csqcmodel_predraw_run;
607 .int anim_frame1time;
609 .int anim_frame2time;
611 .int anim_saveframe1time;
612 .int anim_saveframe2;
613 .int anim_saveframe2time;
614 .int anim_prev_pmove_flags;
615 void CSQCModel_Hook_PreDraw(bool isplayer)
617 if(self.csqcmodel_predraw_run == framecount)
619 self.csqcmodel_predraw_run = framecount;
621 if(!self.modelindex || self.model == "null")
627 self.drawmask = MASK_NORMAL;
629 if(self.isplayermodel) // this checks if it's a player MODEL!
631 CSQCPlayer_ModelAppearance_Apply(self.entnum == player_localnum + 1);
632 CSQCPlayer_LOD_Apply();
635 skeleton_loadinfo(self);
636 bool doblend = (self.bone_upperbody >= 0);
637 CSQCPlayer_FallbackFrame_Apply();
640 skeleton_from_frames(self, self.csqcmodel_isdead);
644 free_skeleton_from_frames(self);
645 // just in case, clear these (we're animating in frame and frame3)
652 // we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know!
653 skeleton_loadinfo(self);
654 bool doblend = (self.bone_upperbody >= 0);
656 if(self == csqcplayer)
658 if(self.pmove_flags & PMF_ONGROUND)
660 self.anim_prev_pmove_flags = self.pmove_flags;
661 if(self.pmove_flags & PMF_DUCKED)
662 animdecide_setstate(self, self.anim_state | ANIMSTATE_DUCK, false);
663 else if(self.anim_state & ANIMSTATE_DUCK)
664 animdecide_setstate(self, self.anim_state - ANIMSTATE_DUCK, false);
668 tracebox(self.origin + '0 0 1', self.mins, self.maxs, self.origin - '0 0 4', MOVE_NORMAL, self);
669 if(trace_startsolid || trace_fraction < 1)
672 animdecide_load_if_needed(self);
673 animdecide_setimplicitstate(self, onground);
674 animdecide_setframes(self, doblend, anim_frame, anim_frame1time, anim_frame2, anim_frame2time);
676 if(self.anim_saveframe != self.anim_frame || self.anim_saveframe1time != self.anim_frame1time)
677 sf |= CSQCMODEL_PROPERTY_FRAME;
678 if(self.anim_saveframe2 != self.anim_frame2 || self.anim_saveframe2time != self.anim_frame2time)
679 sf |= CSQCMODEL_PROPERTY_FRAME2;
680 self.anim_saveframe = self.anim_frame;
681 self.anim_saveframe1time = self.anim_frame1time;
682 self.anim_saveframe2 = self.anim_frame2;
683 self.anim_saveframe2time = self.anim_frame2time;
684 // Note: we always consider lerpfrac "changed", as it uses fixed values every time anyway.
685 // This ensures that .frame etc. are always written.
686 CSQCModel_InterpolateAnimation_2To4_PreNote(sf | CSQCMODEL_PROPERTY_LERPFRAC);
687 self.lerpfrac = (doblend ? 0.5 : 0);
688 self.frame = self.anim_frame;
689 self.frame1time = self.anim_frame1time;
690 self.frame2 = self.anim_frame2;
691 self.frame2time = self.anim_frame2time;
692 CSQCModel_InterpolateAnimation_2To4_Note(sf | CSQCMODEL_PROPERTY_LERPFRAC, false);
693 CSQCModel_InterpolateAnimation_2To4_Do();
696 skeleton_from_frames(self, self.csqcmodel_isdead);
700 free_skeleton_from_frames(self);
701 // just in case, clear these (we're animating in frame and frame3)
708 CSQCModel_AutoTagIndex_Apply();
710 CSQCModel_Effects_Apply();
713 void CSQCModel_Hook_PreUpdate(bool isnew, bool isplayer, bool islocalplayer)
715 // interpolate v_angle
716 self.iflags |= IFLAG_V_ANGLE_X;
717 // revert to values from server
718 CSQCModel_Effects_PreUpdate();
719 if(self.isplayermodel)
722 CSQCPlayer_FallbackFrame_PreUpdate();
723 CSQCPlayer_ModelAppearance_PreUpdate();
727 void CSQCModel_Hook_PostUpdate(bool isnew, bool isplayer, bool islocalplayer)
729 // is it a player model? (shared state)
730 self.isplayermodel = (substring(self.model, 0, 14) == "models/player/" || substring(self.model, 0, 17) == "models/ok_player/");
732 // save values set by server
733 if(self.isplayermodel)
735 CSQCPlayer_ModelAppearance_PostUpdate();
737 CSQCPlayer_AnimDecide_PostUpdate(isnew);
739 CSQCPlayer_FallbackFrame_PostUpdate(isnew);
741 CSQCModel_Effects_PostUpdate();