1 #include "csqcmodel_hooks.qh"
6 #include "miscfunctions.qh"
7 #include "player_skeleton.qh"
9 #include "../client/autocvars.qh"
10 #include "../client/weapons/projectile.qh"
11 #include "../common/animdecide.qh"
12 #include "../common/csqcmodel_settings.qh"
13 #include "../common/teams.qh"
14 #include "../csqcmodellib/cl_model.qh"
15 #include "../csqcmodellib/cl_player.qh"
16 #include "../csqcmodellib/interpolate.qh"
17 #include "../warpzonelib/mathlib.qh"
22 void CSQCModel_Hook_PreDraw(bool isplayer);
30 void CSQCPlayer_LOD_Apply(void)
33 if(self.lodmodelindex0 != self.modelindex)
35 string modelname = self.model;
38 vector mi = self.mins;
39 vector ma = self.maxs;
42 self.lodmodelindex0 = self.modelindex;
43 self.lodmodelindex1 = self.modelindex;
44 self.lodmodelindex2 = self.modelindex;
46 // FIXME: this only supports 3-letter extensions
47 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod1", substring(modelname, -4, 4));
53 self.lodmodelindex1 = self.modelindex;
56 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod2", substring(modelname, -4, 4));
62 self.lodmodelindex2 = self.modelindex;
65 setmodel(self, modelname); // make everything normal again
66 setsize(self, mi, ma);
70 if(autocvar_cl_playerdetailreduction <= 0)
72 if(autocvar_cl_playerdetailreduction <= -2)
73 self.modelindex = self.lodmodelindex2;
74 else if(autocvar_cl_playerdetailreduction <= -1)
75 self.modelindex = self.lodmodelindex1;
77 self.modelindex = self.lodmodelindex0;
81 float distance = vlen(self.origin - view_origin);
82 float f = (distance * current_viewzoom + 100.0) * autocvar_cl_playerdetailreduction;
83 f *= 1.0 / bound(0.01, view_quality, 1);
84 if(f > autocvar_cl_loddistance2)
85 self.modelindex = self.lodmodelindex2;
86 else if(f > autocvar_cl_loddistance1)
87 self.modelindex = self.lodmodelindex1;
89 self.modelindex = self.lodmodelindex0;
93 // FEATURE: forcemodel and model color selection (MUST be called BEFORE LOD!)
94 string forceplayermodels_model;
95 bool forceplayermodels_modelisgoodmodel;
96 int forceplayermodels_modelindex;
97 int forceplayermodels_skin;
99 string forceplayermodels_mymodel;
100 bool forceplayermodels_myisgoodmodel;
101 int forceplayermodels_mymodelindex;
103 bool forceplayermodels_attempted;
105 .string forceplayermodels_savemodel;
106 .int forceplayermodels_savemodelindex;
107 .int forceplayermodels_saveskin;
108 .int forceplayermodels_savecolormap;
110 .string forceplayermodels_isgoodmodel_mdl;
111 .bool forceplayermodels_isgoodmodel;
113 string forceplayermodels_goodmodel;
114 int forceplayermodels_goodmodelindex;
119 void CSQCPlayer_ModelAppearance_PreUpdate(void)
121 self.model = self.forceplayermodels_savemodel;
122 self.modelindex = self.forceplayermodels_savemodelindex;
123 self.skin = self.forceplayermodels_saveskin;
124 self.colormap = self.forceplayermodels_savecolormap;
126 void CSQCPlayer_ModelAppearance_PostUpdate(void)
128 self.forceplayermodels_savemodel = self.model;
129 self.forceplayermodels_savemodelindex = self.modelindex;
130 self.forceplayermodels_saveskin = self.skin;
131 self.forceplayermodels_savecolormap = self.colormap;
133 if(self.forceplayermodels_savemodel != self.forceplayermodels_isgoodmodel_mdl)
135 self.forceplayermodels_isgoodmodel = fexists(self.forceplayermodels_savemodel);
136 self.forceplayermodels_isgoodmodel_mdl = self.forceplayermodels_savemodel;
137 if(!self.forceplayermodels_isgoodmodel)
138 printf("Warning: missing model %s has been used\n", self.forceplayermodels_savemodel);
141 void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer)
144 // which one is ALWAYS good?
145 if (!forceplayermodels_goodmodel)
149 precache_model(cvar_defstring("_cl_playermodel"));
150 setmodel(e, cvar_defstring("_cl_playermodel"));
151 forceplayermodels_goodmodel = e.model;
152 forceplayermodels_goodmodelindex = e.modelindex;
156 // first, try finding it from the server
157 if(self.forceplayermodels_savemodelindex && self.forceplayermodels_savemodel != "null")
161 if(!isdemo()) // this is mainly cheat protection; not needed for demos
163 // trust server's idea of "own player model"
164 forceplayermodels_modelisgoodmodel = self.forceplayermodels_isgoodmodel;
165 forceplayermodels_model = self.forceplayermodels_savemodel;
166 forceplayermodels_modelindex = self.forceplayermodels_savemodelindex;
167 forceplayermodels_skin = self.forceplayermodels_saveskin;
168 forceplayermodels_attempted = 1;
173 // forcemodel finding
174 if(!forceplayermodels_attempted)
176 forceplayermodels_attempted = 1;
178 // only if this failed, find it out on our own
181 setmodel(e, autocvar__cl_playermodel); // this is harmless, see below
182 forceplayermodels_modelisgoodmodel = fexists(e.model);
183 forceplayermodels_model = e.model;
184 forceplayermodels_modelindex = e.modelindex;
185 forceplayermodels_skin = autocvar__cl_playerskin;
189 if(autocvar_cl_forcemyplayermodel != "" && autocvar_cl_forcemyplayermodel != forceplayermodels_mymodel)
193 setmodel(e, autocvar_cl_forcemyplayermodel); // this is harmless, see below
194 forceplayermodels_myisgoodmodel = fexists(e.model);
195 forceplayermodels_mymodel = e.model;
196 forceplayermodels_mymodelindex = e.modelindex;
203 cm = self.forceplayermodels_savecolormap;
204 cm = (cm >= 1024) ? cm : (stof(getplayerkeyvalue(cm - 1, "colors")) + 1024);
207 isfriend = (cm == 1024 + 17 * myteam);
209 isfriend = islocalplayer;
211 if(autocvar_cl_forcemyplayermodel != "" && forceplayermodels_myisgoodmodel && isfriend)
213 self.model = forceplayermodels_mymodel;
214 self.modelindex = forceplayermodels_mymodelindex;
215 self.skin = autocvar_cl_forcemyplayerskin;
217 else if(autocvar_cl_forceplayermodels && forceplayermodels_modelisgoodmodel)
219 self.model = forceplayermodels_model;
220 self.modelindex = forceplayermodels_modelindex;
221 self.skin = forceplayermodels_skin;
223 else if(self.forceplayermodels_isgoodmodel)
225 self.model = self.forceplayermodels_savemodel;
226 self.modelindex = self.forceplayermodels_savemodelindex;
227 self.skin = self.forceplayermodels_saveskin;
231 self.model = forceplayermodels_goodmodel;
232 self.modelindex = forceplayermodels_goodmodelindex;
233 self.skin = self.forceplayermodels_saveskin;
236 // forceplayercolors too
239 // own team's color is never forced
240 int forcecolor_friend = 0;
241 int forcecolor_enemy = 0;
244 if(autocvar_cl_forcemyplayercolors)
245 forcecolor_friend = 1024 + autocvar_cl_forcemyplayercolors;
246 if(autocvar_cl_forceplayercolors && team_count == 2)
247 forcecolor_enemy = 1024 + autocvar__cl_color;
249 if(forcecolor_enemy && !forcecolor_friend)
251 // only enemy color is forced?
252 // verify it is not equal to the friend color
253 if(forcecolor_enemy == 1024 + 17 * myteam)
254 forcecolor_enemy = 0;
257 if(forcecolor_friend && !forcecolor_enemy)
259 // only friend color is forced?
260 // verify it is not equal to the enemy color
261 for(tm = teams.sort_next; tm; tm = tm.sort_next)
262 // note: we even compare against our own team.
263 // if we rejected because we matched our OWN team color,
264 // this is not bad; we then simply keep our color as is
266 if(forcecolor_friend == 1024 + 17 * tm.team)
267 forcecolor_friend = 0;
270 if(cm == 1024 + 17 * myteam)
272 if(forcecolor_friend)
273 self.colormap = forcecolor_friend;
278 self.colormap = forcecolor_enemy;
283 if(autocvar_cl_forcemyplayercolors && islocalplayer)
284 self.colormap = 1024 + autocvar_cl_forcemyplayercolors;
285 else if(autocvar_cl_forceplayercolors)
286 self.colormap = player_localnum + 1;
289 // GLOWMOD AND DEATH FADING
290 if(self.colormap > 0)
291 self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? self.colormap : stof(getplayerkeyvalue(self.colormap - 1, "colors"))) & 0x0F, true) * 2;
293 self.glowmod = '1 1 1';
295 if(autocvar_cl_deathglow > 0)
297 if(self.csqcmodel_isdead)
299 // Fade out to black now...
300 if(self.old_glowmod == '0 0 0') { self.old_glowmod = self.glowmod; }
303 self.glowmod = self.old_glowmod * bound(0, 1 - (time - self.death_time) / autocvar_cl_deathglow, 1);
304 self.glowmod_x = max(self.glowmod.x, 0.0001);
305 self.glowmod_y = max(self.glowmod.y, 0.0001);
306 self.glowmod_z = max(self.glowmod.z, 0.0001);
308 else if(self.old_glowmod != '0 0 0') { self.old_glowmod = '0 0 0'; }
311 //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (self.csqcmodel_isdead ? "DEAD" : "ALIVE"), self.colormap, vtos(self.glowmod));
314 // FEATURE: fallback frames
315 .int csqcmodel_saveframe;
316 .int csqcmodel_saveframe2;
317 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
318 .int csqcmodel_saveframe3;
319 .int csqcmodel_saveframe4;
321 .int csqcmodel_framecount;
323 #define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1)
324 void CSQCPlayer_FallbackFrame_PreUpdate(void)
326 self.frame = self.csqcmodel_saveframe;
327 self.frame2 = self.csqcmodel_saveframe2;
328 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
329 self.frame3 = self.csqcmodel_saveframe3;
330 self.frame4 = self.csqcmodel_saveframe4;
333 void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew)
335 self.csqcmodel_saveframe = self.frame;
336 self.csqcmodel_saveframe2 = self.frame2;
337 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
338 self.csqcmodel_saveframe3 = self.frame3;
339 self.csqcmodel_saveframe4 = self.frame4;
342 // hack for death animations: set their frametime to zero in case a
346 #define FIX_FRAMETIME(f,ft) do { \
347 if(IS_DEAD_FRAME(self.f) && self.ft != 0 && self.death_time != 0) \
348 self.ft = self.death_time; \
350 FIX_FRAMETIME(frame, frame1time);
351 FIX_FRAMETIME(frame2, frame2time);
352 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
353 FIX_FRAMETIME(frame3, frame3time);
354 FIX_FRAMETIME(frame4, frame4time);
357 self.csqcmodel_isdead = IS_DEAD_FRAME(self.frame);
359 void CSQCPlayer_AnimDecide_PostUpdate(bool isnew)
361 self.csqcmodel_isdead = !!(self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
363 int CSQCPlayer_FallbackFrame(int f)
365 if(frameduration(self.modelindex, f) > 0)
366 return f; // goooooood
367 if(frameduration(self.modelindex, 1) <= 0)
368 return f; // this is a static model. We can't fix it if we wanted to
371 case 23: return 11; // anim_melee -> anim_shoot
372 case 24: return 4; // anim_duckwalkbackwards -> anim_duckwalk
373 case 25: return 4; // anim_duckwalkstrafeleft -> anim_duckwalk
374 case 26: return 4; // anim_duckwalkstraferight -> anim_duckwalk
375 case 27: return 4; // anim_duckwalkforwardright -> anim_duckwalk
376 case 28: return 4; // anim_duckwalkforwardleft -> anim_duckwalk
377 case 29: return 4; // anim_duckwalkbackright -> anim_duckwalk
378 case 30: return 4; // anim_duckwalkbackleft -> anim_duckwalk
380 printf("Frame %d missing in model %s, and we have no fallback - FAIL!\n", f, self.model);
383 void CSQCPlayer_FallbackFrame_Apply(void)
385 self.frame = CSQCPlayer_FallbackFrame(self.frame);
386 self.frame2 = CSQCPlayer_FallbackFrame(self.frame2);
387 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
388 self.frame3 = CSQCPlayer_FallbackFrame(self.frame3);
389 self.frame4 = CSQCPlayer_FallbackFrame(self.frame4);
393 // FEATURE: auto tag_index
395 .int tag_entity_lastmodelindex;
397 void CSQCModel_AutoTagIndex_Apply(void)
399 if(self.tag_entity && wasfreed(self.tag_entity))
400 self.tag_entity = world;
402 if(self.tag_networkentity)
406 if(self.tag_entity.entnum != self.tag_networkentity)
408 self.tag_entity = findfloat(world, entnum, self.tag_networkentity);
412 // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
413 if(self.tag_entity.classname == "csqcmodel")
415 entity oldself = self;
416 self = self.tag_entity;
417 CSQCModel_Hook_PreDraw((self.entnum >= 1 && self.entnum <= maxclients));
421 if(self.tag_entity.modelindex != self.tag_entity_lastmodelindex)
423 self.tag_entity_lastmodelindex = self.tag_entity.modelindex;
430 // the best part is: IT EXISTS
431 if(substring(self.model, 0, 17) == "models/weapons/v_")
433 if(substring(self.tag_entity.model, 0, 17) == "models/weapons/h_")
435 self.tag_index = gettagindex(self.tag_entity, "weapon");
437 self.tag_index = gettagindex(self.tag_entity, "tag_weapon");
440 // we need to prevent this from 'appening
441 self.tag_entity = world;
443 dprint("h_ model lacks weapon attachment, but v_ model is attached to it\n");
446 else if(self.tag_entity.isplayermodel)
448 skeleton_loadinfo(self.tag_entity);
449 self.tag_index = self.tag_entity.bone_weapon;
453 if(substring(self.tag_entity.model, 0, 17) == "models/weapons/v_")
455 self.tag_index = gettagindex(self.tag_entity, "shot");
457 self.tag_index = gettagindex(self.tag_entity, "tag_shot");
462 // damn, see you next frame
469 // FEATURE: EF_NODRAW workalike
470 const int EF_BRIGHTFIELD = 1;
471 const int EF_BRIGHTLIGHT = 4;
472 const int EF_DIMLIGHT = 8;
473 const int EF_DOUBLESIDED = 32768;
474 const int EF_NOSELFSHADOW = 65536;
475 const int EF_DYNAMICMODELLIGHT = 131072;
476 const int EF_RESTARTANIM_BIT = 1048576;
477 const int EF_TELEPORT_BIT = 2097152;
478 const int MF_ROCKET = 1; // leave a trail
479 const int MF_GRENADE = 2; // leave a trail
480 const int MF_GIB = 4; // leave a trail
481 const int MF_ROTATE = 8; // rotate (bonus items)
482 const int MF_TRACER = 16; // green split trail
483 const int MF_ZOMGIB = 32; // small blood trail
484 const int MF_TRACER2 = 64; // orange split trail
485 const int MF_TRACER3 = 128; // purple trail
486 .int csqcmodel_effects;
487 .int csqcmodel_modelflags;
488 void CSQCModel_Effects_PreUpdate(void)
490 self.effects = self.csqcmodel_effects;
491 self.modelflags = self.csqcmodel_modelflags;
493 void Reset_ArcBeam(void);
494 void CSQCModel_Effects_PostUpdate(void)
496 if (self == csqcplayer) {
497 if (self.csqcmodel_teleported) {
501 self.csqcmodel_effects = self.effects;
502 self.csqcmodel_modelflags = self.modelflags;
505 if(self.csqcmodel_teleported)
506 Projectile_ResetTrail(self.origin);
509 void CSQCModel_Effects_Apply(void)
511 int eff = self.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST;
513 self.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
515 self.traileffect = 0;
517 if(eff & EF_BRIGHTFIELD)
518 self.traileffect = particleeffectnum("TR_NEXUIZPLASMA");
519 // ignoring EF_MUZZLEFLASH
520 if(eff & EF_BRIGHTLIGHT)
521 adddynamiclight(self.origin, 400, '3 3 3');
522 if(eff & EF_DIMLIGHT)
523 adddynamiclight(self.origin, 200, '1.5 1.5 1.5');
524 if((eff & EF_NODRAW) || (self.alpha < 0))
526 if(eff & EF_ADDITIVE)
527 self.renderflags |= RF_ADDITIVE;
529 adddynamiclight(self.origin, 200, '0.15 0.15 1.5');
531 adddynamiclight(self.origin, 200, '1.5 0.15 0.15');
532 // ignoring EF_NOGUNBOB
533 if(eff & EF_FULLBRIGHT)
534 self.renderflags |= RF_FULLBRIGHT;
536 pointparticles(particleeffectnum("EF_FLAME"), self.origin, '0 0 0', bound(0, frametime, 0.1));
537 if(eff & EF_STARDUST)
538 pointparticles(particleeffectnum("EF_STARDUST"), self.origin, '0 0 0', bound(0, frametime, 0.1));
539 if(eff & EF_NOSHADOW)
540 self.renderflags |= RF_NOSHADOW;
541 if(eff & EF_NODEPTHTEST)
542 self.renderflags |= RF_DEPTHHACK;
543 // ignoring EF_SELECTABLE
544 if(eff & EF_DOUBLESIDED)
545 self.effects |= EF_DOUBLESIDED;
546 if(eff & EF_NOSELFSHADOW)
547 self.effects |= EF_NOSELFSHADOW;
548 if(eff & EF_DYNAMICMODELLIGHT)
549 self.renderflags |= RF_DYNAMICMODELLIGHT;
550 // ignoring EF_UNUSED18, EF_UNUSED19, EF_RESTARTANIM_BIT, EF_TELEPORT_BIT, EF_LOWPRECISION
551 if(self.csqcmodel_modelflags & MF_ROCKET)
552 self.traileffect = particleeffectnum("TR_ROCKET");
553 if(self.csqcmodel_modelflags & MF_GRENADE)
554 self.traileffect = particleeffectnum("TR_GRENADE");
555 if(self.csqcmodel_modelflags & MF_GIB)
556 self.traileffect = particleeffectnum("TR_BLOOD");
557 if(self.csqcmodel_modelflags & MF_ROTATE)
559 self.renderflags |= RF_USEAXIS;
560 makevectors(self.angles + '0 100 0' * fmod(time, 3.6));
562 if(self.csqcmodel_modelflags & MF_TRACER)
563 self.traileffect = particleeffectnum("TR_WIZSPIKE");
564 if(self.csqcmodel_modelflags & MF_ZOMGIB)
565 self.traileffect = particleeffectnum("TR_SLIGHTBLOOD");
566 if(self.csqcmodel_modelflags & MF_TRACER2)
567 self.traileffect = particleeffectnum("TR_KNIGHTSPIKE");
568 if(self.csqcmodel_modelflags & MF_TRACER3)
569 self.traileffect = particleeffectnum("TR_VORESPIKE");
572 Projectile_DrawTrail(self.origin);
574 Projectile_ResetTrail(self.origin);
576 if(self.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST)
577 self.renderflags |= RF_ADDITIVE;
578 // also special in CSQCPlayer_GlowMod_Apply
580 if(self.csqcmodel_modelflags & MF_ROCKET)
582 if(!self.snd_looping)
584 sound(self, CH_TRIGGER_SINGLE, "misc/jetpack_fly.wav", VOL_BASE, autocvar_g_jetpack_attenuation);
585 self.snd_looping = CH_TRIGGER_SINGLE;
592 sound(self, self.snd_looping, "misc/null.wav", VOL_BASE, autocvar_g_jetpack_attenuation);
593 self.snd_looping = 0;
598 void CSQCPlayer_Precache()
600 precache_sound("misc/jetpack_fly.wav");
604 .int csqcmodel_predraw_run;
606 .int anim_frame1time;
608 .int anim_frame2time;
610 .int anim_saveframe1time;
611 .int anim_saveframe2;
612 .int anim_saveframe2time;
613 .int anim_prev_pmove_flags;
614 void CSQCModel_Hook_PreDraw(bool isplayer)
616 if(self.csqcmodel_predraw_run == framecount)
618 self.csqcmodel_predraw_run = framecount;
620 if(!self.modelindex || self.model == "null")
626 self.drawmask = MASK_NORMAL;
628 if(self.isplayermodel) // this checks if it's a player MODEL!
630 CSQCPlayer_ModelAppearance_Apply(self.entnum == player_localnum + 1);
631 CSQCPlayer_LOD_Apply();
634 skeleton_loadinfo(self);
635 bool doblend = (self.bone_upperbody >= 0);
636 CSQCPlayer_FallbackFrame_Apply();
639 skeleton_from_frames(self, self.csqcmodel_isdead);
643 free_skeleton_from_frames(self);
644 // just in case, clear these (we're animating in frame and frame3)
651 // we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know!
652 skeleton_loadinfo(self);
653 bool doblend = (self.bone_upperbody >= 0);
655 if(self == csqcplayer)
657 if(self.pmove_flags & PMF_ONGROUND)
659 self.anim_prev_pmove_flags = self.pmove_flags;
660 if(self.pmove_flags & PMF_DUCKED)
661 animdecide_setstate(self, self.anim_state | ANIMSTATE_DUCK, false);
662 else if(self.anim_state & ANIMSTATE_DUCK)
663 animdecide_setstate(self, self.anim_state - ANIMSTATE_DUCK, false);
667 tracebox(self.origin + '0 0 1', self.mins, self.maxs, self.origin - '0 0 4', MOVE_NORMAL, self);
668 if(trace_startsolid || trace_fraction < 1)
671 animdecide_load_if_needed(self);
672 animdecide_setimplicitstate(self, onground);
673 animdecide_setframes(self, doblend, anim_frame, anim_frame1time, anim_frame2, anim_frame2time);
675 if(self.anim_saveframe != self.anim_frame || self.anim_saveframe1time != self.anim_frame1time)
676 sf |= CSQCMODEL_PROPERTY_FRAME;
677 if(self.anim_saveframe2 != self.anim_frame2 || self.anim_saveframe2time != self.anim_frame2time)
678 sf |= CSQCMODEL_PROPERTY_FRAME2;
679 self.anim_saveframe = self.anim_frame;
680 self.anim_saveframe1time = self.anim_frame1time;
681 self.anim_saveframe2 = self.anim_frame2;
682 self.anim_saveframe2time = self.anim_frame2time;
683 // Note: we always consider lerpfrac "changed", as it uses fixed values every time anyway.
684 // This ensures that .frame etc. are always written.
685 CSQCModel_InterpolateAnimation_2To4_PreNote(sf | CSQCMODEL_PROPERTY_LERPFRAC);
686 self.lerpfrac = (doblend ? 0.5 : 0);
687 self.frame = self.anim_frame;
688 self.frame1time = self.anim_frame1time;
689 self.frame2 = self.anim_frame2;
690 self.frame2time = self.anim_frame2time;
691 CSQCModel_InterpolateAnimation_2To4_Note(sf | CSQCMODEL_PROPERTY_LERPFRAC, false);
692 CSQCModel_InterpolateAnimation_2To4_Do();
695 skeleton_from_frames(self, self.csqcmodel_isdead);
699 free_skeleton_from_frames(self);
700 // just in case, clear these (we're animating in frame and frame3)
707 CSQCModel_AutoTagIndex_Apply();
709 CSQCModel_Effects_Apply();
712 void CSQCModel_Hook_PreUpdate(bool isnew, bool isplayer, bool islocalplayer)
714 // interpolate v_angle
715 self.iflags |= IFLAG_V_ANGLE_X;
716 // revert to values from server
717 CSQCModel_Effects_PreUpdate();
718 if(self.isplayermodel)
721 CSQCPlayer_FallbackFrame_PreUpdate();
722 CSQCPlayer_ModelAppearance_PreUpdate();
726 void CSQCModel_Hook_PostUpdate(bool isnew, bool isplayer, bool islocalplayer)
728 // is it a player model? (shared state)
729 self.isplayermodel = (substring(self.model, 0, 14) == "models/player/" || substring(self.model, 0, 17) == "models/ok_player/");
731 // save values set by server
732 if(self.isplayermodel)
734 CSQCPlayer_ModelAppearance_PostUpdate();
736 CSQCPlayer_AnimDecide_PostUpdate(isnew);
738 CSQCPlayer_FallbackFrame_PostUpdate(isnew);
740 CSQCModel_Effects_PostUpdate();