4 #include "player_skeleton.qh"
6 #include "weapons/projectile.qh"
8 #include "../common/animdecide.qh"
9 #include "../common/csqcmodel_settings.qh"
10 #include "../common/effects/effects.qh"
11 #include "../common/teams.qh"
12 #include "../common/triggers/trigger/viewloc.qh"
14 #include "mutators/events.qh"
16 #include "../csqcmodellib/cl_model.qh"
17 #include "../csqcmodellib/cl_player.qh"
18 #include "../csqcmodellib/interpolate.qh"
24 void CSQCModel_Hook_PreDraw(bool isplayer);
32 void CSQCPlayer_LOD_Apply(void)
35 if(self.lodmodelindex0 != self.modelindex)
37 string modelname = self.model;
40 vector mi = self.mins;
41 vector ma = self.maxs;
44 self.lodmodelindex0 = self.modelindex;
45 self.lodmodelindex1 = self.modelindex;
46 self.lodmodelindex2 = self.modelindex;
48 // FIXME: this only supports 3-letter extensions
49 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod1", substring(modelname, -4, 4));
55 self.lodmodelindex1 = self.modelindex;
58 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod2", substring(modelname, -4, 4));
64 self.lodmodelindex2 = self.modelindex;
67 _setmodel(self, modelname); // make everything normal again
68 setsize(self, mi, ma);
72 if(autocvar_cl_playerdetailreduction <= 0)
74 if(autocvar_cl_playerdetailreduction <= -2)
75 self.modelindex = self.lodmodelindex2;
76 else if(autocvar_cl_playerdetailreduction <= -1)
77 self.modelindex = self.lodmodelindex1;
79 self.modelindex = self.lodmodelindex0;
83 float distance = vlen(self.origin - view_origin);
84 float f = (distance * current_viewzoom + 100.0) * autocvar_cl_playerdetailreduction;
85 f *= 1.0 / bound(0.01, view_quality, 1);
86 if(f > autocvar_cl_loddistance2)
87 self.modelindex = self.lodmodelindex2;
88 else if(f > autocvar_cl_loddistance1)
89 self.modelindex = self.lodmodelindex1;
91 self.modelindex = self.lodmodelindex0;
95 // FEATURE: forcemodel and model color selection (MUST be called BEFORE LOD!)
96 string forceplayermodels_model;
97 bool forceplayermodels_modelisgoodmodel;
98 int forceplayermodels_modelindex;
99 int forceplayermodels_skin;
101 string forceplayermodels_mymodel;
102 bool forceplayermodels_myisgoodmodel;
103 int forceplayermodels_mymodelindex;
105 bool forceplayermodels_attempted;
107 .string forceplayermodels_savemodel;
108 .int forceplayermodels_savemodelindex;
109 .int forceplayermodels_saveskin;
110 .int forceplayermodels_savecolormap;
112 .string forceplayermodels_isgoodmodel_mdl;
113 .bool forceplayermodels_isgoodmodel;
115 string forceplayermodels_goodmodel;
116 int forceplayermodels_goodmodelindex;
121 void CSQCPlayer_ModelAppearance_PreUpdate(void)
123 self.model = self.forceplayermodels_savemodel;
124 self.modelindex = self.forceplayermodels_savemodelindex;
125 self.skin = self.forceplayermodels_saveskin;
126 self.colormap = self.forceplayermodels_savecolormap;
128 void CSQCPlayer_ModelAppearance_PostUpdate(void)
130 self.forceplayermodels_savemodel = self.model;
131 self.forceplayermodels_savemodelindex = self.modelindex;
132 self.forceplayermodels_saveskin = self.skin;
133 self.forceplayermodels_savecolormap = self.colormap;
135 if(self.forceplayermodels_savemodel != self.forceplayermodels_isgoodmodel_mdl)
137 self.forceplayermodels_isgoodmodel = fexists(self.forceplayermodels_savemodel);
138 self.forceplayermodels_isgoodmodel_mdl = self.forceplayermodels_savemodel;
139 if(!self.forceplayermodels_isgoodmodel)
140 LOG_INFOF("Warning: missing model %s has been used\n", self.forceplayermodels_savemodel);
143 void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer)
146 // which one is ALWAYS good?
147 if (!forceplayermodels_goodmodel)
151 precache_model(cvar_defstring("_cl_playermodel"));
152 _setmodel(e, cvar_defstring("_cl_playermodel"));
153 forceplayermodels_goodmodel = e.model;
154 forceplayermodels_goodmodelindex = e.modelindex;
158 // first, try finding it from the server
159 if(self.forceplayermodels_savemodelindex && self.forceplayermodels_savemodel != "null")
163 if(!isdemo()) // this is mainly cheat protection; not needed for demos
165 // trust server's idea of "own player model"
166 forceplayermodels_modelisgoodmodel = self.forceplayermodels_isgoodmodel;
167 forceplayermodels_model = self.forceplayermodels_savemodel;
168 forceplayermodels_modelindex = self.forceplayermodels_savemodelindex;
169 forceplayermodels_skin = self.forceplayermodels_saveskin;
170 forceplayermodels_attempted = 1;
175 // forcemodel finding
176 if(!forceplayermodels_attempted)
178 forceplayermodels_attempted = 1;
180 // only if this failed, find it out on our own
183 _setmodel(e, autocvar__cl_playermodel); // this is harmless, see below
184 forceplayermodels_modelisgoodmodel = fexists(e.model);
185 forceplayermodels_model = e.model;
186 forceplayermodels_modelindex = e.modelindex;
187 forceplayermodels_skin = autocvar__cl_playerskin;
191 if(autocvar_cl_forcemyplayermodel != "" && autocvar_cl_forcemyplayermodel != forceplayermodels_mymodel)
195 _setmodel(e, autocvar_cl_forcemyplayermodel); // this is harmless, see below
196 forceplayermodels_myisgoodmodel = fexists(e.model);
197 forceplayermodels_mymodel = e.model;
198 forceplayermodels_mymodelindex = e.modelindex;
205 cm = self.forceplayermodels_savecolormap;
206 cm = (cm >= 1024) ? cm : (stof(getplayerkeyvalue(cm - 1, "colors")) + 1024);
209 isfriend = (cm == 1024 + 17 * myteam);
211 isfriend = islocalplayer;
213 if(autocvar_cl_forcemyplayermodel != "" && forceplayermodels_myisgoodmodel && isfriend)
215 self.model = forceplayermodels_mymodel;
216 self.modelindex = forceplayermodels_mymodelindex;
217 self.skin = autocvar_cl_forcemyplayerskin;
219 else if(autocvar_cl_forceplayermodels && forceplayermodels_modelisgoodmodel)
221 self.model = forceplayermodels_model;
222 self.modelindex = forceplayermodels_modelindex;
223 self.skin = forceplayermodels_skin;
225 else if(self.forceplayermodels_isgoodmodel)
227 self.model = self.forceplayermodels_savemodel;
228 self.modelindex = self.forceplayermodels_savemodelindex;
229 self.skin = self.forceplayermodels_saveskin;
233 self.model = forceplayermodels_goodmodel;
234 self.modelindex = forceplayermodels_goodmodelindex;
235 self.skin = self.forceplayermodels_saveskin;
238 // forceplayercolors too
241 // own team's color is never forced
242 int forcecolor_friend = 0;
243 int forcecolor_enemy = 0;
246 if(autocvar_cl_forcemyplayercolors)
247 forcecolor_friend = 1024 + autocvar_cl_forcemyplayercolors;
248 if(autocvar_cl_forceplayercolors && team_count == 2)
249 forcecolor_enemy = 1024 + autocvar__cl_color;
251 if(forcecolor_enemy && !forcecolor_friend)
253 // only enemy color is forced?
254 // verify it is not equal to the friend color
255 if(forcecolor_enemy == 1024 + 17 * myteam)
256 forcecolor_enemy = 0;
259 if(forcecolor_friend && !forcecolor_enemy)
261 // only friend color is forced?
262 // verify it is not equal to the enemy color
263 for(tm = teams.sort_next; tm; tm = tm.sort_next)
264 // note: we even compare against our own team.
265 // if we rejected because we matched our OWN team color,
266 // this is not bad; we then simply keep our color as is
268 if(forcecolor_friend == 1024 + 17 * tm.team)
269 forcecolor_friend = 0;
272 if(cm == 1024 + 17 * myteam)
274 if(forcecolor_friend)
275 self.colormap = forcecolor_friend;
280 self.colormap = forcecolor_enemy;
285 if(autocvar_cl_forcemyplayercolors && islocalplayer)
286 self.colormap = 1024 + autocvar_cl_forcemyplayercolors;
287 else if(autocvar_cl_forceplayercolors)
288 self.colormap = player_localnum + 1;
291 // GLOWMOD AND DEATH FADING
292 if(self.colormap > 0)
293 self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? self.colormap : stof(getplayerkeyvalue(self.colormap - 1, "colors"))) & 0x0F, true) * 2;
295 self.glowmod = '1 1 1';
297 if(autocvar_cl_deathglow > 0)
299 if(self.csqcmodel_isdead)
301 // Fade out to black now...
302 if(self.old_glowmod == '0 0 0') { self.old_glowmod = self.glowmod; }
305 self.glowmod = self.old_glowmod * bound(0, 1 - (time - self.death_time) / autocvar_cl_deathglow, 1);
306 self.glowmod_x = max(self.glowmod.x, 0.0001);
307 self.glowmod_y = max(self.glowmod.y, 0.0001);
308 self.glowmod_z = max(self.glowmod.z, 0.0001);
310 else if(self.old_glowmod != '0 0 0') { self.old_glowmod = '0 0 0'; }
313 //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (self.csqcmodel_isdead ? "DEAD" : "ALIVE"), self.colormap, vtos(self.glowmod));
316 // FEATURE: fallback frames
317 .int csqcmodel_saveframe;
318 .int csqcmodel_saveframe2;
319 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
320 .int csqcmodel_saveframe3;
321 .int csqcmodel_saveframe4;
323 .int csqcmodel_framecount;
325 #define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1)
326 void CSQCPlayer_FallbackFrame_PreUpdate(void)
328 self.frame = self.csqcmodel_saveframe;
329 self.frame2 = self.csqcmodel_saveframe2;
330 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
331 self.frame3 = self.csqcmodel_saveframe3;
332 self.frame4 = self.csqcmodel_saveframe4;
335 void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew)
337 self.csqcmodel_saveframe = self.frame;
338 self.csqcmodel_saveframe2 = self.frame2;
339 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
340 self.csqcmodel_saveframe3 = self.frame3;
341 self.csqcmodel_saveframe4 = self.frame4;
344 // hack for death animations: set their frametime to zero in case a
348 #define FIX_FRAMETIME(f,ft) do { \
349 if(IS_DEAD_FRAME(self.f) && self.ft != 0 && self.death_time != 0) \
350 self.ft = self.death_time; \
352 FIX_FRAMETIME(frame, frame1time);
353 FIX_FRAMETIME(frame2, frame2time);
354 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
355 FIX_FRAMETIME(frame3, frame3time);
356 FIX_FRAMETIME(frame4, frame4time);
359 self.csqcmodel_isdead = IS_DEAD_FRAME(self.frame);
361 void CSQCPlayer_AnimDecide_PostUpdate(bool isnew)
363 self.csqcmodel_isdead = !!(self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
365 int CSQCPlayer_FallbackFrame(int f)
367 if(frameduration(self.modelindex, f) > 0)
368 return f; // goooooood
369 if(frameduration(self.modelindex, 1) <= 0)
370 return f; // this is a static model. We can't fix it if we wanted to
373 case 23: return 11; // anim_melee -> anim_shoot
374 case 24: return 4; // anim_duckwalkbackwards -> anim_duckwalk
375 case 25: return 4; // anim_duckwalkstrafeleft -> anim_duckwalk
376 case 26: return 4; // anim_duckwalkstraferight -> anim_duckwalk
377 case 27: return 4; // anim_duckwalkforwardright -> anim_duckwalk
378 case 28: return 4; // anim_duckwalkforwardleft -> anim_duckwalk
379 case 29: return 4; // anim_duckwalkbackright -> anim_duckwalk
380 case 30: return 4; // anim_duckwalkbackleft -> anim_duckwalk
382 LOG_INFOF("Frame %d missing in model %s, and we have no fallback - FAIL!\n", f, self.model);
385 void CSQCPlayer_FallbackFrame_Apply(void)
387 self.frame = CSQCPlayer_FallbackFrame(self.frame);
388 self.frame2 = CSQCPlayer_FallbackFrame(self.frame2);
389 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
390 self.frame3 = CSQCPlayer_FallbackFrame(self.frame3);
391 self.frame4 = CSQCPlayer_FallbackFrame(self.frame4);
395 // FEATURE: auto tag_index
397 .int tag_entity_lastmodelindex;
399 void CSQCModel_AutoTagIndex_Apply(void)
401 if(self.tag_entity && wasfreed(self.tag_entity))
402 self.tag_entity = world;
406 MUTATOR_CALLHOOK(TagIndex_Update, self);
408 if(self.tag_networkentity)
412 if(self.tag_entity.entnum != self.tag_networkentity)
414 self.tag_entity = findfloat(world, entnum, self.tag_networkentity);
418 // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
419 if(self.tag_entity.classname == "csqcmodel")
421 WITH(entity, self, self.tag_entity, CSQCModel_Hook_PreDraw((self.entnum >= 1 && self.entnum <= maxclients)));
424 if(self.tag_entity.modelindex != self.tag_entity_lastmodelindex)
426 self.tag_entity_lastmodelindex = self.tag_entity.modelindex;
433 // the best part is: IT EXISTS
434 if(substring(self.model, 0, 14) == "models/weapons")
436 if(substring(self.tag_entity.model, 0, 14) == "models/weapons")
438 self.tag_index = gettagindex(self.tag_entity, "weapon");
440 self.tag_index = gettagindex(self.tag_entity, "tag_weapon");
443 // we need to prevent this from 'appening
444 self.tag_entity = world;
446 LOG_TRACE("h_ model lacks weapon attachment, but v_ model is attached to it\n");
449 else if(self.tag_entity.isplayermodel)
451 skeleton_loadinfo(self.tag_entity);
452 self.tag_index = self.tag_entity.bone_weapon;
456 if(substring(self.tag_entity.model, 0, 14) == "models/weapons")
458 self.tag_index = gettagindex(self.tag_entity, "shot");
460 self.tag_index = gettagindex(self.tag_entity, "tag_shot");
463 MUTATOR_CALLHOOK(TagIndex_Apply, self);
467 // damn, see you next frame
474 // FEATURE: EF_NODRAW workalike
475 const int EF_BRIGHTFIELD = 1;
476 const int EF_BRIGHTLIGHT = 4;
477 const int EF_DIMLIGHT = 8;
478 const int EF_DOUBLESIDED = 32768;
479 const int EF_NOSELFSHADOW = 65536;
480 const int EF_DYNAMICMODELLIGHT = 131072;
481 const int EF_RESTARTANIM_BIT = 1048576;
482 const int EF_TELEPORT_BIT = 2097152;
483 const int MF_ROCKET = 1; // leave a trail
484 const int MF_GRENADE = 2; // leave a trail
485 const int MF_GIB = 4; // leave a trail
486 const int MF_ROTATE = 8; // rotate (bonus items)
487 const int MF_TRACER = 16; // green split trail
488 const int MF_ZOMGIB = 32; // small blood trail
489 const int MF_TRACER2 = 64; // orange split trail
490 const int MF_TRACER3 = 128; // purple trail
491 .int csqcmodel_effects;
492 .int csqcmodel_modelflags;
493 .int csqcmodel_traileffect;
494 void CSQCModel_Effects_PreUpdate(void)
496 self.effects = self.csqcmodel_effects;
497 self.modelflags = self.csqcmodel_modelflags;
498 self.traileffect = self.csqcmodel_traileffect;
500 void Reset_ArcBeam(void);
501 void CSQCModel_Effects_PostUpdate(void)
503 if (self == csqcplayer) {
504 if (self.csqcmodel_teleported) {
508 self.csqcmodel_effects = self.effects;
509 self.csqcmodel_modelflags = self.modelflags;
510 self.csqcmodel_traileffect = self.traileffect;
513 if(self.csqcmodel_teleported)
514 Projectile_ResetTrail(self, self.origin);
517 void CSQCModel_Effects_Apply(void)
519 int eff = self.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST;
520 int tref = self.csqcmodel_traileffect;
522 self.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
524 self.traileffect = 0;
526 if(eff & EF_BRIGHTFIELD)
527 tref = EFFECT_TR_NEXUIZPLASMA.m_id;
528 // ignoring EF_MUZZLEFLASH
529 if(eff & EF_BRIGHTLIGHT)
530 adddynamiclight(self.origin, 400, '3 3 3');
531 if(eff & EF_DIMLIGHT)
532 adddynamiclight(self.origin, 200, '1.5 1.5 1.5');
533 if((eff & EF_NODRAW) || (self.alpha < 0))
535 if(eff & EF_ADDITIVE)
536 self.renderflags |= RF_ADDITIVE;
538 adddynamiclight(self.origin, 200, '0.15 0.15 1.5');
540 adddynamiclight(self.origin, 200, '1.5 0.15 0.15');
541 // ignoring EF_NOGUNBOB
542 if(eff & EF_FULLBRIGHT)
543 self.renderflags |= RF_FULLBRIGHT;
545 pointparticles(particleeffectnum(EFFECT_EF_FLAME), self.origin, '0 0 0', bound(0, frametime, 0.1));
546 if(eff & EF_STARDUST)
547 pointparticles(particleeffectnum(EFFECT_EF_STARDUST), self.origin, '0 0 0', bound(0, frametime, 0.1));
548 if(eff & EF_NOSHADOW)
549 self.renderflags |= RF_NOSHADOW;
550 if(eff & EF_NODEPTHTEST)
551 self.renderflags |= RF_DEPTHHACK;
552 // ignoring EF_SELECTABLE
553 if(eff & EF_DOUBLESIDED)
554 self.effects |= EF_DOUBLESIDED;
555 if(eff & EF_NOSELFSHADOW)
556 self.effects |= EF_NOSELFSHADOW;
557 if(eff & EF_DYNAMICMODELLIGHT)
558 self.renderflags |= RF_DYNAMICMODELLIGHT;
559 // ignoring EF_UNUSED18, EF_UNUSED19, EF_RESTARTANIM_BIT, EF_TELEPORT_BIT, EF_LOWPRECISION
560 if(self.csqcmodel_modelflags & MF_ROCKET)
561 tref = EFFECT_TR_ROCKET.m_id;
562 if(self.csqcmodel_modelflags & MF_GRENADE)
563 tref = EFFECT_TR_GRENADE.m_id;
564 if(self.csqcmodel_modelflags & MF_GIB)
565 tref = EFFECT_TR_BLOOD.m_id;
566 if(self.csqcmodel_modelflags & MF_ROTATE)
568 self.renderflags |= RF_USEAXIS;
569 makevectors(self.angles + '0 100 0' * fmod(time, 3.6));
571 if(self.csqcmodel_modelflags & MF_TRACER)
572 tref = EFFECT_TR_WIZSPIKE.m_id;
573 if(self.csqcmodel_modelflags & MF_ZOMGIB)
574 tref = EFFECT_TR_SLIGHTBLOOD.m_id;
575 if(self.csqcmodel_modelflags & MF_TRACER2)
576 tref = EFFECT_TR_KNIGHTSPIKE.m_id;
577 if(self.csqcmodel_modelflags & MF_TRACER3)
578 tref = EFFECT_TR_VORESPIKE.m_id;
580 self.traileffect = tref;
583 Projectile_DrawTrail(self, self.origin);
585 Projectile_ResetTrail(self, self.origin);
587 if(self.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST)
588 self.renderflags |= RF_ADDITIVE;
589 // also special in CSQCPlayer_GlowMod_Apply
591 if(self.csqcmodel_modelflags & MF_ROCKET)
593 if(!self.snd_looping)
595 sound(self, CH_TRIGGER_SINGLE, SND_JETPACK_FLY, VOL_BASE, autocvar_g_jetpack_attenuation);
596 self.snd_looping = CH_TRIGGER_SINGLE;
603 sound(self, self.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation);
604 self.snd_looping = 0;
610 .int csqcmodel_predraw_run;
612 .int anim_frame1time;
614 .int anim_frame2time;
616 .int anim_saveframe1time;
617 .int anim_saveframe2;
618 .int anim_saveframe2time;
619 .int anim_prev_pmove_flags;
620 void CSQCModel_Hook_PreDraw(bool isplayer)
622 if(self.csqcmodel_predraw_run == framecount)
624 self.csqcmodel_predraw_run = framecount;
626 if(!self.modelindex || self.model == "null")
632 self.drawmask = MASK_NORMAL;
634 if(self.isplayermodel) // this checks if it's a player MODEL!
636 CSQCPlayer_ModelAppearance_Apply(self.entnum == player_localnum + 1);
637 CSQCPlayer_LOD_Apply();
641 skeleton_loadinfo(self);
642 bool doblend = (self.bone_upperbody >= 0);
643 CSQCPlayer_FallbackFrame_Apply();
646 skeleton_from_frames(self, self.csqcmodel_isdead);
650 free_skeleton_from_frames(self);
651 // just in case, clear these (we're animating in frame and frame3)
658 // we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know!
659 skeleton_loadinfo(self);
660 bool doblend = (self.bone_upperbody >= 0);
662 if(self == csqcplayer)
664 if(self.flags & FL_ONGROUND)
666 self.anim_prev_pmove_flags = self.flags;
667 if(self.flags & FL_DUCKED)
668 animdecide_setstate(self, self.anim_state | ANIMSTATE_DUCK, false);
669 else if(self.anim_state & ANIMSTATE_DUCK)
670 animdecide_setstate(self, self.anim_state - ANIMSTATE_DUCK, false);
674 tracebox(self.origin + '0 0 1', self.mins, self.maxs, self.origin - '0 0 4', MOVE_NORMAL, self);
675 if(trace_startsolid || trace_fraction < 1)
678 animdecide_load_if_needed(self);
679 animdecide_setimplicitstate(self, onground);
680 animdecide_setframes(self, doblend, anim_frame, anim_frame1time, anim_frame2, anim_frame2time);
682 if(self.anim_saveframe != self.anim_frame || self.anim_saveframe1time != self.anim_frame1time)
683 sf |= CSQCMODEL_PROPERTY_FRAME;
684 if(self.anim_saveframe2 != self.anim_frame2 || self.anim_saveframe2time != self.anim_frame2time)
685 sf |= CSQCMODEL_PROPERTY_FRAME2;
686 self.anim_saveframe = self.anim_frame;
687 self.anim_saveframe1time = self.anim_frame1time;
688 self.anim_saveframe2 = self.anim_frame2;
689 self.anim_saveframe2time = self.anim_frame2time;
690 // Note: we always consider lerpfrac "changed", as it uses fixed values every time anyway.
691 // This ensures that .frame etc. are always written.
692 CSQCModel_InterpolateAnimation_2To4_PreNote(sf | CSQCMODEL_PROPERTY_LERPFRAC);
693 self.lerpfrac = (doblend ? 0.5 : 0);
694 self.frame = self.anim_frame;
695 self.frame1time = self.anim_frame1time;
696 self.frame2 = self.anim_frame2;
697 self.frame2time = self.anim_frame2time;
698 CSQCModel_InterpolateAnimation_2To4_Note(sf | CSQCMODEL_PROPERTY_LERPFRAC, false);
699 CSQCModel_InterpolateAnimation_2To4_Do();
702 skeleton_from_frames(self, self.csqcmodel_isdead);
706 free_skeleton_from_frames(self);
707 // just in case, clear these (we're animating in frame and frame3)
714 CSQCModel_AutoTagIndex_Apply();
716 CSQCModel_Effects_Apply();
719 void CSQCModel_Hook_PreUpdate(bool isnew, bool isplayer, bool islocalplayer)
721 // interpolate v_angle
722 self.iflags |= IFLAG_V_ANGLE_X;
723 // revert to values from server
724 CSQCModel_Effects_PreUpdate();
725 if(self.isplayermodel)
728 CSQCPlayer_FallbackFrame_PreUpdate();
729 CSQCPlayer_ModelAppearance_PreUpdate();
733 void CSQCModel_Hook_PostUpdate(bool isnew, bool isplayer, bool islocalplayer)
735 // is it a player model? (shared state)
736 self.isplayermodel = (substring(self.model, 0, 14) == "models/player/" || substring(self.model, 0, 17) == "models/ok_player/" || (substring(self.model, 0, 16) == "models/monsters/" && (self.entnum >= 1 && self.entnum <= maxclients)));
738 // save values set by server
739 if(self.isplayermodel)
741 CSQCPlayer_ModelAppearance_PostUpdate();
743 CSQCPlayer_AnimDecide_PostUpdate(isnew);
745 CSQCPlayer_FallbackFrame_PostUpdate(isnew);
747 CSQCModel_Effects_PostUpdate();