1 #include "mutators/events.qh"
2 #include "player_skeleton.qh"
3 #include "weapons/projectile.qh"
4 #include <common/animdecide.qh>
5 #include <common/physics/movetypes/movetypes.qh>
6 #include <common/viewloc.qh>
7 #include <lib/csqcmodel/cl_model.qh>
8 #include <lib/csqcmodel/cl_player.qh>
9 #include <lib/csqcmodel/interpolate.qh>
14 void CSQCModel_Hook_PreDraw(entity this, bool isplayer);
22 void CSQCPlayer_LOD_Apply(entity this)
25 if(this.lodmodelindex0 != this.modelindex)
27 string modelname = this.model;
30 vector mi = this.mins;
31 vector ma = this.maxs;
34 this.lodmodelindex0 = this.modelindex;
35 this.lodmodelindex1 = this.modelindex;
36 this.lodmodelindex2 = this.modelindex;
38 // FIXME: this only supports 3-letter extensions
39 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod1", substring(modelname, -4, 4));
45 this.lodmodelindex1 = this.modelindex;
48 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod2", substring(modelname, -4, 4));
54 this.lodmodelindex2 = this.modelindex;
57 _setmodel(this, modelname); // make everything normal again
58 setsize(this, mi, ma);
62 if(autocvar_cl_playerdetailreduction <= 0)
64 if(autocvar_cl_playerdetailreduction <= -2)
65 this.modelindex = this.lodmodelindex2;
66 else if(autocvar_cl_playerdetailreduction <= -1)
67 this.modelindex = this.lodmodelindex1;
69 this.modelindex = this.lodmodelindex0;
73 float distance = vlen(this.origin - view_origin);
74 float f = (distance * current_viewzoom + 100.0) * autocvar_cl_playerdetailreduction;
75 f *= 1.0 / bound(0.01, view_quality, 1);
76 if(f > autocvar_cl_loddistance2)
77 this.modelindex = this.lodmodelindex2;
78 else if(f > autocvar_cl_loddistance1)
79 this.modelindex = this.lodmodelindex1;
81 this.modelindex = this.lodmodelindex0;
85 // FEATURE: forcemodel and model color selection (MUST be called BEFORE LOD!)
86 string forceplayermodels_model;
87 bool forceplayermodels_modelisgoodmodel;
88 int forceplayermodels_modelindex;
89 int forceplayermodels_skin;
91 string forceplayermodels_mymodel;
92 bool forceplayermodels_myisgoodmodel;
93 int forceplayermodels_mymodelindex;
95 bool forceplayermodels_attempted;
97 .string forceplayermodels_savemodel;
98 .int forceplayermodels_savemodelindex;
99 .int forceplayermodels_saveskin;
100 .int forceplayermodels_savecolormap;
102 .string forceplayermodels_isgoodmodel_mdl;
103 .bool forceplayermodels_isgoodmodel;
105 string forceplayermodels_goodmodel;
106 int forceplayermodels_goodmodelindex;
111 void CSQCPlayer_ModelAppearance_PreUpdate(entity this)
113 this.model = this.forceplayermodels_savemodel;
114 this.modelindex = this.forceplayermodels_savemodelindex;
115 this.skin = this.forceplayermodels_saveskin;
116 this.colormap = this.forceplayermodels_savecolormap;
118 void CSQCPlayer_ModelAppearance_PostUpdate(entity this)
120 this.forceplayermodels_savemodel = this.model;
121 this.forceplayermodels_savemodelindex = this.modelindex;
122 this.forceplayermodels_saveskin = this.skin;
123 this.forceplayermodels_savecolormap = this.colormap;
125 if(this.forceplayermodels_savemodel != this.forceplayermodels_isgoodmodel_mdl)
127 this.forceplayermodels_isgoodmodel = fexists(this.forceplayermodels_savemodel);
128 this.forceplayermodels_isgoodmodel_mdl = this.forceplayermodels_savemodel;
129 if(!this.forceplayermodels_isgoodmodel)
130 LOG_INFOF("Warning: missing model %s has been used\n", this.forceplayermodels_savemodel);
133 void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
136 // which one is ALWAYS good?
137 if (!forceplayermodels_goodmodel)
140 precache_model(cvar_defstring("_cl_playermodel"));
141 _setmodel(e, cvar_defstring("_cl_playermodel"));
142 forceplayermodels_goodmodel = e.model;
143 forceplayermodels_goodmodelindex = e.modelindex;
147 // first, try finding it from the server
148 if(this.forceplayermodels_savemodelindex && this.forceplayermodels_savemodel != "null")
152 if(!isdemo()) // this is mainly cheat protection; not needed for demos
154 // trust server's idea of "own player model"
155 forceplayermodels_modelisgoodmodel = this.forceplayermodels_isgoodmodel;
156 forceplayermodels_model = this.forceplayermodels_savemodel;
157 forceplayermodels_modelindex = this.forceplayermodels_savemodelindex;
158 forceplayermodels_skin = this.forceplayermodels_saveskin;
159 forceplayermodels_attempted = 1;
164 // forcemodel finding
165 if(!forceplayermodels_attempted)
167 forceplayermodels_attempted = 1;
169 // only if this failed, find it out on our own
171 precache_model(autocvar__cl_playermodel);
172 _setmodel(e, autocvar__cl_playermodel); // this is harmless, see below
173 forceplayermodels_modelisgoodmodel = fexists(e.model);
174 forceplayermodels_model = e.model;
175 forceplayermodels_modelindex = e.modelindex;
176 forceplayermodels_skin = autocvar__cl_playerskin;
180 if(autocvar_cl_forcemyplayermodel != "" && autocvar_cl_forcemyplayermodel != forceplayermodels_mymodel)
183 _setmodel(e, autocvar_cl_forcemyplayermodel); // this is harmless, see below
184 forceplayermodels_myisgoodmodel = fexists(e.model);
185 forceplayermodels_mymodel = e.model;
186 forceplayermodels_mymodelindex = e.modelindex;
193 cm = this.forceplayermodels_savecolormap;
194 cm = (cm >= 1024) ? cm : (stof(getplayerkeyvalue(cm - 1, "colors")) + 1024);
197 isfriend = (cm == 1024 + 17 * myteam);
199 isfriend = islocalplayer;
201 if(autocvar_cl_forcemyplayermodel != "" && forceplayermodels_myisgoodmodel && isfriend)
203 this.model = forceplayermodels_mymodel;
204 this.modelindex = forceplayermodels_mymodelindex;
205 this.skin = autocvar_cl_forcemyplayerskin;
207 else if(autocvar_cl_forceplayermodels && forceplayermodels_modelisgoodmodel)
209 this.model = forceplayermodels_model;
210 this.modelindex = forceplayermodels_modelindex;
211 this.skin = forceplayermodels_skin;
213 else if(this.forceplayermodels_isgoodmodel)
215 this.model = this.forceplayermodels_savemodel;
216 this.modelindex = this.forceplayermodels_savemodelindex;
217 this.skin = this.forceplayermodels_saveskin;
221 this.model = forceplayermodels_goodmodel;
222 this.modelindex = forceplayermodels_goodmodelindex;
223 this.skin = this.forceplayermodels_saveskin;
226 // forceplayercolors too
229 // own team's color is never forced
230 int forcecolor_friend = 0;
231 int forcecolor_enemy = 0;
234 if(autocvar_cl_forcemyplayercolors)
235 forcecolor_friend = 1024 + autocvar_cl_forcemyplayercolors;
236 if(autocvar_cl_forceplayercolors == 2 && team_count == 2)
237 forcecolor_enemy = 1024 + autocvar__cl_color;
239 if(forcecolor_enemy && !forcecolor_friend)
241 // only enemy color is forced?
242 // verify it is not equal to the friend color
243 if(forcecolor_enemy == 1024 + 17 * myteam)
244 forcecolor_enemy = 0;
247 if(forcecolor_friend && !forcecolor_enemy)
249 // only friend color is forced?
250 // verify it is not equal to the enemy color
251 for(tm = teams.sort_next; tm; tm = tm.sort_next)
252 // note: we even compare against our own team.
253 // if we rejected because we matched our OWN team color,
254 // this is not bad; we then simply keep our color as is
256 if(forcecolor_friend == 1024 + 17 * tm.team)
257 forcecolor_friend = 0;
260 if(cm == 1024 + 17 * myteam)
262 if(forcecolor_friend)
263 this.colormap = forcecolor_friend;
268 this.colormap = forcecolor_enemy;
273 if(autocvar_cl_forcemyplayercolors && islocalplayer)
274 this.colormap = 1024 + autocvar_cl_forcemyplayercolors;
275 else if(autocvar_cl_forceplayercolors)
276 this.colormap = player_localnum + 1;
279 // GLOWMOD AND DEATH FADING
280 if(this.colormap > 0)
281 this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : stof(getplayerkeyvalue(this.colormap - 1, "colors"))) & 0x0F, true) * 2;
283 this.glowmod = '1 1 1';
285 if(autocvar_cl_deathglow > 0)
287 if(this.csqcmodel_isdead)
289 // Fade out to black now...
290 if(this.old_glowmod == '0 0 0') { this.old_glowmod = this.glowmod; }
293 this.glowmod = this.old_glowmod * bound(0, 1 - (time - this.death_time) / autocvar_cl_deathglow, 1);
294 this.glowmod_x = max(this.glowmod.x, 0.0001);
295 this.glowmod_y = max(this.glowmod.y, 0.0001);
296 this.glowmod_z = max(this.glowmod.z, 0.0001);
298 else if(this.old_glowmod != '0 0 0') { this.old_glowmod = '0 0 0'; }
301 //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (this.csqcmodel_isdead ? "DEAD" : "ALIVE"), this.colormap, vtos(this.glowmod));
304 // FEATURE: fallback frames
305 .int csqcmodel_saveframe;
306 .int csqcmodel_saveframe2;
307 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
308 .int csqcmodel_saveframe3;
309 .int csqcmodel_saveframe4;
311 .int csqcmodel_framecount;
313 #define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1)
314 void CSQCPlayer_FallbackFrame_PreUpdate(entity this)
316 this.frame = this.csqcmodel_saveframe;
317 this.frame2 = this.csqcmodel_saveframe2;
318 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
319 this.frame3 = this.csqcmodel_saveframe3;
320 this.frame4 = this.csqcmodel_saveframe4;
323 void CSQCPlayer_FallbackFrame_PostUpdate(entity this, bool isnew)
325 this.csqcmodel_saveframe = this.frame;
326 this.csqcmodel_saveframe2 = this.frame2;
327 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
328 this.csqcmodel_saveframe3 = this.frame3;
329 this.csqcmodel_saveframe4 = this.frame4;
332 // hack for death animations: set their frametime to zero in case a
336 #define FIX_FRAMETIME(f,ft) MACRO_BEGIN { \
337 if(IS_DEAD_FRAME(this.f) && this.ft != 0 && this.death_time != 0) \
338 this.ft = this.death_time; \
340 FIX_FRAMETIME(frame, frame1time);
341 FIX_FRAMETIME(frame2, frame2time);
342 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
343 FIX_FRAMETIME(frame3, frame3time);
344 FIX_FRAMETIME(frame4, frame4time);
347 this.csqcmodel_isdead = IS_DEAD_FRAME(this.frame);
349 void CSQCPlayer_AnimDecide_PostUpdate(entity this, bool isnew)
351 this.csqcmodel_isdead = boolean(this.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
353 int CSQCPlayer_FallbackFrame(entity this, int f)
355 if(frameduration(this.modelindex, f) > 0)
356 return f; // goooooood
357 if(frameduration(this.modelindex, 1) <= 0)
358 return f; // this is a static model. We can't fix it if we wanted to
361 case 23: return 11; // anim_melee -> anim_shoot
362 case 24: return 4; // anim_duckwalkbackwards -> anim_duckwalk
363 case 25: return 4; // anim_duckwalkstrafeleft -> anim_duckwalk
364 case 26: return 4; // anim_duckwalkstraferight -> anim_duckwalk
365 case 27: return 4; // anim_duckwalkforwardright -> anim_duckwalk
366 case 28: return 4; // anim_duckwalkforwardleft -> anim_duckwalk
367 case 29: return 4; // anim_duckwalkbackright -> anim_duckwalk
368 case 30: return 4; // anim_duckwalkbackleft -> anim_duckwalk
370 LOG_DEBUGF("Frame %d missing in model %s, and we have no fallback - FAIL!\n", f, this.model);
373 void CSQCPlayer_FallbackFrame_Apply(entity this)
375 this.frame = CSQCPlayer_FallbackFrame(this, this.frame);
376 this.frame2 = CSQCPlayer_FallbackFrame(this, this.frame2);
377 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
378 this.frame3 = CSQCPlayer_FallbackFrame(this, this.frame3);
379 this.frame4 = CSQCPlayer_FallbackFrame(this, this.frame4);
383 // FEATURE: auto tag_index
385 .int tag_entity_lastmodelindex;
387 void CSQCModel_AutoTagIndex_Apply(entity this)
389 if(this.tag_entity && wasfreed(this.tag_entity))
390 this.tag_entity = world;
392 viewloc_SetTags(this);
394 MUTATOR_CALLHOOK(TagIndex_Update, this);
396 if(this.tag_networkentity)
400 if(this.tag_entity.entnum != this.tag_networkentity)
402 this.tag_entity = findfloat(world, entnum, this.tag_networkentity);
406 // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
407 if(this.tag_entity.classname == "csqcmodel")
409 CSQCModel_Hook_PreDraw(this.tag_entity, (this.tag_entity.entnum >= 1 && this.tag_entity.entnum <= maxclients));
412 if(this.tag_entity.modelindex != this.tag_entity_lastmodelindex)
414 this.tag_entity_lastmodelindex = this.tag_entity.modelindex;
421 // the best part is: IT EXISTS
422 if(substring(this.model, 0, 14) == "models/weapons")
424 if(substring(this.tag_entity.model, 0, 14) == "models/weapons")
426 this.tag_index = gettagindex(this.tag_entity, "weapon");
428 this.tag_index = gettagindex(this.tag_entity, "tag_weapon");
431 // we need to prevent this from 'appening
432 this.tag_entity = world;
434 LOG_TRACE("h_ model lacks weapon attachment, but v_ model is attached to it\n");
437 else if(this.tag_entity.isplayermodel)
439 skeleton_loadinfo(this.tag_entity);
440 this.tag_index = this.tag_entity.bone_weapon;
444 if(substring(this.tag_entity.model, 0, 14) == "models/weapons")
446 this.tag_index = gettagindex(this.tag_entity, "shot");
448 this.tag_index = gettagindex(this.tag_entity, "tag_shot");
451 MUTATOR_CALLHOOK(TagIndex_Apply, this);
455 // damn, see you next frame
462 // FEATURE: EF_NODRAW workalike
463 const int EF_BRIGHTFIELD = BIT(0);
464 const int EF_BRIGHTLIGHT = BIT(2);
465 const int EF_DIMLIGHT = BIT(3);
466 const int EF_DOUBLESIDED = BIT(15);
467 const int EF_NOSELFSHADOW = BIT(16);
468 const int EF_DYNAMICMODELLIGHT = BIT(17);
469 const int EF_RESTARTANIM_BIT = BIT(20);
470 const int EF_TELEPORT_BIT = BIT(21);
471 const int MF_ROCKET = BIT(0); // leave a trail
472 const int MF_GRENADE = BIT(1); // leave a trail
473 const int MF_GIB = BIT(2); // leave a trail
474 const int MF_ROTATE = BIT(3); // rotate (bonus items)
475 const int MF_TRACER = BIT(4); // green split trail
476 const int MF_ZOMGIB = BIT(5); // small blood trail
477 const int MF_TRACER2 = BIT(6); // orange split trail
478 const int MF_TRACER3 = BIT(7); // purple trail
479 .int csqcmodel_effects;
480 .int csqcmodel_modelflags;
481 .int csqcmodel_traileffect;
482 void CSQCModel_Effects_PreUpdate(entity this)
484 this.effects = this.csqcmodel_effects;
485 this.modelflags = this.csqcmodel_modelflags;
486 this.traileffect = this.csqcmodel_traileffect;
488 void Reset_ArcBeam();
489 void CSQCModel_Effects_PostUpdate(entity this)
491 if (this == csqcplayer) {
492 if (this.csqcmodel_teleported) {
496 this.csqcmodel_effects = this.effects;
497 this.csqcmodel_modelflags = this.modelflags;
498 this.csqcmodel_traileffect = this.traileffect;
501 if(this.csqcmodel_teleported)
502 Projectile_ResetTrail(this, this.origin);
505 void CSQCModel_Effects_Apply(entity this)
507 int eff = this.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST;
508 int tref = this.csqcmodel_traileffect;
510 this.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
512 this.traileffect = 0;
514 if(eff & EF_BRIGHTFIELD)
515 tref = EFFECT_TR_NEXUIZPLASMA.m_id;
516 // ignoring EF_MUZZLEFLASH
517 if(eff & EF_BRIGHTLIGHT)
518 adddynamiclight(this.origin, 400, '3 3 3');
519 if(eff & EF_DIMLIGHT)
520 adddynamiclight(this.origin, 200, '1.5 1.5 1.5');
521 if((eff & EF_NODRAW) || (this.alpha < 0))
523 if(eff & EF_ADDITIVE)
524 this.renderflags |= RF_ADDITIVE;
526 adddynamiclight(this.origin, 200, '0.15 0.15 1.5');
528 adddynamiclight(this.origin, 200, '1.5 0.15 0.15');
529 // ignoring EF_NOGUNBOB
530 if(eff & EF_FULLBRIGHT)
531 this.renderflags |= RF_FULLBRIGHT;
533 pointparticles(EFFECT_EF_FLAME, this.origin, '0 0 0', bound(0, frametime, 0.1));
534 if(eff & EF_STARDUST)
535 pointparticles(EFFECT_EF_STARDUST, this.origin, '0 0 0', bound(0, frametime, 0.1));
536 if(eff & EF_NOSHADOW)
537 this.renderflags |= RF_NOSHADOW;
538 if(eff & EF_NODEPTHTEST)
539 this.renderflags |= RF_DEPTHHACK;
540 // ignoring EF_SELECTABLE
541 if(eff & EF_DOUBLESIDED)
542 this.effects |= EF_DOUBLESIDED;
543 if(eff & EF_NOSELFSHADOW)
544 this.effects |= EF_NOSELFSHADOW;
545 if(eff & EF_DYNAMICMODELLIGHT)
546 this.renderflags |= RF_DYNAMICMODELLIGHT;
547 // ignoring EF_UNUSED18, EF_UNUSED19, EF_RESTARTANIM_BIT, EF_TELEPORT_BIT, EF_LOWPRECISION
548 if(this.csqcmodel_modelflags & MF_ROCKET)
549 tref = EFFECT_TR_ROCKET.m_id;
550 if(this.csqcmodel_modelflags & MF_GRENADE)
551 tref = EFFECT_TR_GRENADE.m_id;
552 if(this.csqcmodel_modelflags & MF_GIB)
553 tref = EFFECT_TR_BLOOD.m_id;
554 if(this.csqcmodel_modelflags & MF_ROTATE)
556 this.renderflags |= RF_USEAXIS;
557 makevectors(this.angles + '0 100 0' * fmod(time, 3.6));
559 if(this.csqcmodel_modelflags & MF_TRACER)
560 tref = EFFECT_TR_WIZSPIKE.m_id;
561 if(this.csqcmodel_modelflags & MF_ZOMGIB)
562 tref = EFFECT_TR_SLIGHTBLOOD.m_id;
563 if(this.csqcmodel_modelflags & MF_TRACER2)
564 tref = EFFECT_TR_KNIGHTSPIKE.m_id;
565 if(this.csqcmodel_modelflags & MF_TRACER3)
566 tref = EFFECT_TR_VORESPIKE.m_id;
568 this.traileffect = tref;
571 Projectile_DrawTrail(this, this.origin);
573 Projectile_ResetTrail(this, this.origin);
575 if(this.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST)
576 this.renderflags |= RF_ADDITIVE;
577 // also special in CSQCPlayer_GlowMod_Apply
579 if(this.csqcmodel_modelflags & MF_ROCKET)
581 if(!this.snd_looping)
583 sound(this, CH_TRIGGER_SINGLE, SND_JETPACK_FLY, VOL_BASE, autocvar_g_jetpack_attenuation);
584 this.snd_looping = CH_TRIGGER_SINGLE;
591 sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation);
592 this.snd_looping = 0;
598 .int csqcmodel_predraw_run;
600 .int anim_frame1time;
602 .int anim_frame2time;
604 .int anim_saveframe1time;
605 .int anim_saveframe2;
606 .int anim_saveframe2time;
607 .int anim_prev_pmove_flags;
608 void CSQCModel_Hook_PreDraw(entity this, bool isplayer)
610 if(this.csqcmodel_predraw_run == framecount)
612 this.csqcmodel_predraw_run = framecount;
614 if(!this.modelindex || this.model == "null")
620 this.drawmask = MASK_NORMAL;
622 if(this.isplayermodel) // this checks if it's a player MODEL!
624 CSQCPlayer_ModelAppearance_Apply(this, this.entnum == player_localnum + 1);
625 CSQCPlayer_LOD_Apply(this);
629 skeleton_loadinfo(this);
630 bool doblend = (this.bone_upperbody >= 0);
631 CSQCPlayer_FallbackFrame_Apply(this);
634 skeleton_from_frames(this, this.csqcmodel_isdead);
638 free_skeleton_from_frames(this);
639 // just in case, clear these (we're animating in frame and frame3)
646 // we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know!
647 skeleton_loadinfo(this);
648 bool doblend = (this.bone_upperbody >= 0);
650 if(this == csqcplayer)
652 if(IS_ONGROUND(this))
654 this.anim_prev_pmove_flags = this.flags;
655 if(this.flags & FL_DUCKED)
656 animdecide_setstate(this, this.anim_state | ANIMSTATE_DUCK, false);
657 else if(this.anim_state & ANIMSTATE_DUCK)
658 animdecide_setstate(this, this.anim_state - ANIMSTATE_DUCK, false);
662 tracebox(this.origin + '0 0 1', this.mins, this.maxs, this.origin - '0 0 4', MOVE_NORMAL, this);
663 if(trace_startsolid || trace_fraction < 1)
666 animdecide_load_if_needed(this);
667 animdecide_setimplicitstate(this, onground);
668 animdecide_setframes(this, doblend, anim_frame, anim_frame1time, anim_frame2, anim_frame2time);
670 if(this.anim_saveframe != this.anim_frame || this.anim_saveframe1time != this.anim_frame1time)
671 sf |= CSQCMODEL_PROPERTY_FRAME;
672 if(this.anim_saveframe2 != this.anim_frame2 || this.anim_saveframe2time != this.anim_frame2time)
673 sf |= CSQCMODEL_PROPERTY_FRAME2;
674 this.anim_saveframe = this.anim_frame;
675 this.anim_saveframe1time = this.anim_frame1time;
676 this.anim_saveframe2 = this.anim_frame2;
677 this.anim_saveframe2time = this.anim_frame2time;
678 // Note: we always consider lerpfrac "changed", as it uses fixed values every time anyway.
679 // This ensures that .frame etc. are always written.
680 CSQCModel_InterpolateAnimation_2To4_PreNote(this, sf | CSQCMODEL_PROPERTY_LERPFRAC);
681 this.lerpfrac = (doblend ? 0.5 : 0);
682 this.frame = this.anim_frame;
683 this.frame1time = this.anim_frame1time;
684 this.frame2 = this.anim_frame2;
685 this.frame2time = this.anim_frame2time;
686 CSQCModel_InterpolateAnimation_2To4_Note(this, sf | CSQCMODEL_PROPERTY_LERPFRAC, false);
687 CSQCModel_InterpolateAnimation_2To4_Do(this);
690 skeleton_from_frames(this, this.csqcmodel_isdead);
694 free_skeleton_from_frames(this);
695 // just in case, clear these (we're animating in frame and frame3)
702 CSQCModel_AutoTagIndex_Apply(this);
704 CSQCModel_Effects_Apply(this);
707 void CSQCModel_Hook_PreUpdate(entity this, bool isnew, bool isplayer, bool islocalplayer)
709 // interpolate v_angle
710 this.iflags |= IFLAG_V_ANGLE_X;
711 // revert to values from server
712 CSQCModel_Effects_PreUpdate(this);
713 if(this.isplayermodel)
716 CSQCPlayer_FallbackFrame_PreUpdate(this);
717 CSQCPlayer_ModelAppearance_PreUpdate(this);
721 void CSQCModel_Hook_PostUpdate(entity this, bool isnew, bool isplayer, bool islocalplayer)
723 // is it a player model? (shared state)
724 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)));
726 // save values set by server
727 if(this.isplayermodel)
729 CSQCPlayer_ModelAppearance_PostUpdate(this);
731 CSQCPlayer_AnimDecide_PostUpdate(this, isnew);
733 CSQCPlayer_FallbackFrame_PostUpdate(this, isnew);
735 CSQCModel_Effects_PostUpdate(this);