1 #include "csqcmodel_hooks.qh"
2 #include "autocvars.qh"
3 #include "csqcmodel_hooks.qh"
4 #include "miscfunctions.qh"
5 #include <client/mutators/_mod.qh>
6 #include "player_skeleton.qh"
7 #include "weapons/projectile.qh"
8 #include <common/animdecide.qh>
9 #include <common/ent_cs.qh>
10 #include <common/physics/movetypes/movetypes.qh>
11 #include <common/viewloc.qh>
12 #include <common/effects/all.qh>
13 #include <common/effects/all.inc>
14 #include <lib/csqcmodel/cl_model.qh>
15 #include <lib/csqcmodel/cl_player.qh>
16 #include <lib/csqcmodel/interpolate.qh>
25 void CSQCPlayer_LOD_Apply(entity this)
28 if(this.lodmodelindex0 != this.modelindex)
30 string modelname = this.model;
33 vector mi = this.mins;
34 vector ma = this.maxs;
37 this.lodmodelindex0 = this.modelindex;
38 this.lodmodelindex1 = this.modelindex;
39 this.lodmodelindex2 = this.modelindex;
41 // FIXME: this only supports 3-letter extensions
42 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod1", substring(modelname, -4, 4));
48 this.lodmodelindex1 = this.modelindex;
51 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod2", substring(modelname, -4, 4));
57 this.lodmodelindex2 = this.modelindex;
60 _setmodel(this, modelname); // make everything normal again
61 setsize(this, mi, ma);
65 if(autocvar_cl_playerdetailreduction <= 0)
67 if(autocvar_cl_playerdetailreduction <= -2)
68 this.modelindex = this.lodmodelindex2;
69 else if(autocvar_cl_playerdetailreduction <= -1)
70 this.modelindex = this.lodmodelindex1;
72 this.modelindex = this.lodmodelindex0;
76 float distance = vlen(this.origin - view_origin);
77 float f = (distance * current_viewzoom + 100.0) * autocvar_cl_playerdetailreduction;
78 f *= 1.0 / bound(0.01, view_quality, 1);
79 if(f > autocvar_cl_loddistance2)
80 this.modelindex = this.lodmodelindex2;
81 else if(f > autocvar_cl_loddistance1)
82 this.modelindex = this.lodmodelindex1;
84 this.modelindex = this.lodmodelindex0;
88 // FEATURE: forcemodel and model color selection (MUST be called BEFORE LOD!)
89 string forceplayermodels_model;
90 bool forceplayermodels_modelisgoodmodel;
91 int forceplayermodels_modelindex;
92 int forceplayermodels_skin;
94 string forceplayermodels_mymodel;
95 bool forceplayermodels_myisgoodmodel;
96 int forceplayermodels_mymodelindex;
98 bool forceplayermodels_attempted;
100 .string forceplayermodels_savemodel;
101 .int forceplayermodels_savemodelindex;
102 .int forceplayermodels_saveskin;
103 .int forceplayermodels_savecolormap;
105 .string forceplayermodels_isgoodmodel_mdl;
106 .bool forceplayermodels_isgoodmodel;
108 string forceplayermodels_goodmodel;
109 int forceplayermodels_goodmodelindex;
114 void CSQCPlayer_ModelAppearance_PreUpdate(entity this)
116 this.model = this.forceplayermodels_savemodel;
117 this.modelindex = this.forceplayermodels_savemodelindex;
118 this.skin = this.forceplayermodels_saveskin;
119 this.colormap = this.forceplayermodels_savecolormap;
121 void CSQCPlayer_ModelAppearance_PostUpdate(entity this)
123 this.forceplayermodels_savemodel = this.model;
124 this.forceplayermodels_savemodelindex = this.modelindex;
125 this.forceplayermodels_saveskin = this.skin;
126 this.forceplayermodels_savecolormap = this.colormap;
128 if(this.forceplayermodels_savemodel != this.forceplayermodels_isgoodmodel_mdl)
130 this.forceplayermodels_isgoodmodel = fexists(this.forceplayermodels_savemodel);
131 this.forceplayermodels_isgoodmodel_mdl = this.forceplayermodels_savemodel;
132 if(!this.forceplayermodels_isgoodmodel)
133 LOG_INFOF("Warning: missing model %s has been used", this.forceplayermodels_savemodel);
136 void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
138 if(MUTATOR_CALLHOOK(ForcePlayermodels_Skip, this, islocalplayer))
139 goto skipforcemodels;
142 // which one is ALWAYS good?
143 if (!forceplayermodels_goodmodel)
146 precache_model(cvar_defstring("_cl_playermodel"));
147 _setmodel(e, cvar_defstring("_cl_playermodel"));
148 forceplayermodels_goodmodel = e.model;
149 forceplayermodels_goodmodelindex = e.modelindex;
153 // first, try finding it from the server
154 if(this.forceplayermodels_savemodelindex && this.forceplayermodels_savemodel != "null")
158 if(!isdemo()) // this is mainly cheat protection; not needed for demos
160 // trust server's idea of "own player model"
161 forceplayermodels_modelisgoodmodel = this.forceplayermodels_isgoodmodel;
162 forceplayermodels_model = this.forceplayermodels_savemodel;
163 forceplayermodels_modelindex = this.forceplayermodels_savemodelindex;
164 forceplayermodels_skin = this.forceplayermodels_saveskin;
165 forceplayermodels_attempted = 1;
170 // forcemodel finding
171 if(!forceplayermodels_attempted)
173 forceplayermodels_attempted = 1;
175 // only if this failed, find it out on our own
177 precache_model(autocvar__cl_playermodel);
178 _setmodel(e, autocvar__cl_playermodel); // this is harmless, see below
179 forceplayermodels_modelisgoodmodel = fexists(e.model);
180 forceplayermodels_model = e.model;
181 forceplayermodels_modelindex = e.modelindex;
182 forceplayermodels_skin = autocvar__cl_playerskin;
186 if(autocvar_cl_forcemyplayermodel != "" && autocvar_cl_forcemyplayermodel != forceplayermodels_mymodel)
189 _setmodel(e, autocvar_cl_forcemyplayermodel); // this is harmless, see below
190 forceplayermodels_myisgoodmodel = fexists(e.model);
191 forceplayermodels_mymodel = e.model;
192 forceplayermodels_mymodelindex = e.modelindex;
199 cm = this.forceplayermodels_savecolormap;
200 cm = (cm >= 1024) ? cm : (entcs_GetClientColors(cm - 1) + 1024);
203 isfriend = (cm == 1024 + 17 * myteam);
205 isfriend = islocalplayer;
207 if(autocvar_cl_forcemyplayermodel != "" && forceplayermodels_myisgoodmodel && isfriend)
209 this.model = forceplayermodels_mymodel;
210 this.modelindex = forceplayermodels_mymodelindex;
211 this.skin = autocvar_cl_forcemyplayerskin;
213 else if(autocvar_cl_forceplayermodels && forceplayermodels_modelisgoodmodel)
215 this.model = forceplayermodels_model;
216 this.modelindex = forceplayermodels_modelindex;
217 this.skin = forceplayermodels_skin;
219 else if(this.forceplayermodels_isgoodmodel)
221 this.model = this.forceplayermodels_savemodel;
222 this.modelindex = this.forceplayermodels_savemodelindex;
223 this.skin = this.forceplayermodels_saveskin;
227 this.model = forceplayermodels_goodmodel;
228 this.modelindex = forceplayermodels_goodmodelindex;
229 this.skin = this.forceplayermodels_saveskin;
232 // forceplayercolors too
235 // own team's color is never forced
236 int forcecolor_friend = 0;
237 int forcecolor_enemy = 0;
240 if(autocvar_cl_forcemyplayercolors)
241 forcecolor_friend = 1024 + autocvar_cl_forcemyplayercolors;
242 if(autocvar_cl_forceplayercolors == 2 && team_count == 2)
243 forcecolor_enemy = 1024 + autocvar__cl_color;
245 if(forcecolor_enemy && !forcecolor_friend)
247 // only enemy color is forced?
248 // verify it is not equal to the friend color
249 if(forcecolor_enemy == 1024 + 17 * myteam)
250 forcecolor_enemy = 0;
253 if(forcecolor_friend && !forcecolor_enemy)
255 // only friend color is forced?
256 // verify it is not equal to the enemy color
257 for(tm = teams.sort_next; tm; tm = tm.sort_next)
258 // note: we even compare against our own team.
259 // if we rejected because we matched our OWN team color,
260 // this is not bad; we then simply keep our color as is
262 if(forcecolor_friend == 1024 + 17 * tm.team)
263 forcecolor_friend = 0;
266 if(cm == 1024 + 17 * myteam)
268 if(forcecolor_friend)
269 this.colormap = forcecolor_friend;
274 this.colormap = forcecolor_enemy;
279 if(autocvar_cl_forcemyplayercolors && islocalplayer)
280 this.colormap = 1024 + autocvar_cl_forcemyplayercolors;
281 else if(autocvar_cl_forceplayercolors)
282 this.colormap = player_localnum + 1;
285 LABEL(skipforcemodels)
287 // GLOWMOD AND DEATH FADING
288 if(this.colormap > 0)
289 this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : entcs_GetClientColors(this.colormap - 1)) & 0x0F, true) * 2;
291 this.glowmod = '1 1 1';
293 if(autocvar_cl_deathglow > 0)
295 if(this.csqcmodel_isdead)
297 // Fade out to black now...
298 if(this.old_glowmod == '0 0 0') { this.old_glowmod = this.glowmod; }
301 this.glowmod = this.old_glowmod * bound(0, 1 - (time - this.death_time) / autocvar_cl_deathglow, 1);
302 this.glowmod_x = max(this.glowmod.x, 0.0001);
303 this.glowmod_y = max(this.glowmod.y, 0.0001);
304 this.glowmod_z = max(this.glowmod.z, 0.0001);
306 else if(this.old_glowmod != '0 0 0') { this.old_glowmod = '0 0 0'; }
309 //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (this.csqcmodel_isdead ? "DEAD" : "ALIVE"), this.colormap, vtos(this.glowmod));
312 // FEATURE: fallback frames
313 .int csqcmodel_saveframe;
314 .int csqcmodel_saveframe2;
315 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
316 .int csqcmodel_saveframe3;
317 .int csqcmodel_saveframe4;
319 .int csqcmodel_framecount;
321 #define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1)
322 void CSQCPlayer_FallbackFrame_PreUpdate(entity this)
324 this.frame = this.csqcmodel_saveframe;
325 this.frame2 = this.csqcmodel_saveframe2;
326 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
327 this.frame3 = this.csqcmodel_saveframe3;
328 this.frame4 = this.csqcmodel_saveframe4;
331 void CSQCPlayer_FallbackFrame_PostUpdate(entity this, bool isnew)
333 this.csqcmodel_saveframe = this.frame;
334 this.csqcmodel_saveframe2 = this.frame2;
335 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
336 this.csqcmodel_saveframe3 = this.frame3;
337 this.csqcmodel_saveframe4 = this.frame4;
340 // hack for death animations: set their frametime to zero in case a
344 #define FIX_FRAMETIME(f,ft) MACRO_BEGIN { \
345 if(IS_DEAD_FRAME(this.f) && this.ft != 0 && this.death_time != 0) \
346 this.ft = this.death_time; \
348 FIX_FRAMETIME(frame, frame1time);
349 FIX_FRAMETIME(frame2, frame2time);
350 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
351 FIX_FRAMETIME(frame3, frame3time);
352 FIX_FRAMETIME(frame4, frame4time);
355 this.csqcmodel_isdead = IS_DEAD_FRAME(this.frame);
357 void CSQCPlayer_AnimDecide_PostUpdate(entity this, bool isnew)
359 this.csqcmodel_isdead = boolean(this.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
361 int CSQCPlayer_FallbackFrame(entity this, int f)
364 if(frameduration(this.modelindex, f) > 0)
365 return f; // goooooood
366 if(frameduration(this.modelindex, 1) <= 0)
367 return f; // this is a static model. We can't fix it if we wanted to
370 case 23: return 11; // anim_melee -> anim_shoot
371 case 24: return 4; // anim_duckwalkbackwards -> anim_duckwalk
372 case 25: return 4; // anim_duckwalkstrafeleft -> anim_duckwalk
373 case 26: return 4; // anim_duckwalkstraferight -> anim_duckwalk
374 case 27: return 4; // anim_duckwalkforwardright -> anim_duckwalk
375 case 28: return 4; // anim_duckwalkforwardleft -> anim_duckwalk
376 case 29: return 4; // anim_duckwalkbackright -> anim_duckwalk
377 case 30: return 4; // anim_duckwalkbackleft -> anim_duckwalk
379 LOG_DEBUGF("Frame %d missing in model %s, and we have no fallback - FAIL!", f, this.model);
382 void CSQCPlayer_FallbackFrame_Apply(entity this)
384 this.frame = CSQCPlayer_FallbackFrame(this, this.frame);
385 this.frame2 = CSQCPlayer_FallbackFrame(this, this.frame2);
386 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
387 this.frame3 = CSQCPlayer_FallbackFrame(this, this.frame3);
388 this.frame4 = CSQCPlayer_FallbackFrame(this, this.frame4);
392 // FEATURE: auto tag_index
394 .int tag_entity_lastmodelindex;
396 void CSQCModel_AutoTagIndex_Apply(entity this)
398 if(this.tag_entity && wasfreed(this.tag_entity))
399 this.tag_entity = NULL;
401 MUTATOR_CALLHOOK(TagIndex_Update, this);
403 if(this.tag_networkentity)
407 if(this.tag_entity.entnum != this.tag_networkentity)
409 this.tag_entity = findfloat(NULL, entnum, this.tag_networkentity);
413 // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
414 if(this.tag_entity.classname == "csqcmodel")
416 CSQCModel_Hook_PreDraw(this.tag_entity, (this.tag_entity.isplayermodel & ISPLAYER_CLIENT));
419 if(this.tag_entity.modelindex != this.tag_entity_lastmodelindex)
421 this.tag_entity_lastmodelindex = this.tag_entity.modelindex;
428 // the best part is: IT EXISTS
429 if(substring(this.model, 0, 14) == "models/weapons")
431 if(substring(this.tag_entity.model, 0, 14) == "models/weapons")
433 this.tag_index = gettagindex(this.tag_entity, "weapon");
435 this.tag_index = gettagindex(this.tag_entity, "tag_weapon");
438 // we need to prevent this from 'appening
439 this.tag_entity = NULL;
441 LOG_TRACE("h_ model lacks weapon attachment, but v_ model is attached to it");
444 else if(this.tag_entity.isplayermodel)
446 skeleton_loadinfo(this.tag_entity);
447 this.tag_index = this.tag_entity.bone_weapon;
451 if(substring(this.tag_entity.model, 0, 14) == "models/weapons")
453 this.tag_index = gettagindex(this.tag_entity, "shot");
455 this.tag_index = gettagindex(this.tag_entity, "tag_shot");
458 MUTATOR_CALLHOOK(TagIndex_Apply, this);
462 // damn, see you next frame
469 void CSQCModel_Effects_PreUpdate(entity this)
471 this.effects = this.csqcmodel_effects;
472 this.modelflags = this.csqcmodel_modelflags;
473 this.traileffect = this.csqcmodel_traileffect;
475 void Reset_ArcBeam();
476 void CSQCModel_Effects_PostUpdate(entity this)
478 if (this == csqcplayer) {
479 if (this.csqcmodel_teleported) {
483 this.csqcmodel_effects = this.effects;
484 this.csqcmodel_modelflags = this.modelflags;
485 this.csqcmodel_traileffect = this.traileffect;
488 if(this.csqcmodel_teleported)
489 Projectile_ResetTrail(this, this.origin);
492 void CSQCModel_Effects_Apply(entity this)
494 int eff = this.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST;
495 int tref = this.csqcmodel_traileffect;
497 this.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
499 this.traileffect = 0;
501 if(eff & EF_BRIGHTFIELD)
502 tref = EFFECT_TR_NEXUIZPLASMA.m_id;
503 // ignoring EF_MUZZLEFLASH
504 if(eff & EF_BRIGHTLIGHT)
505 adddynamiclight(this.origin, 400, '3 3 3');
506 if(eff & EF_DIMLIGHT)
507 adddynamiclight(this.origin, 200, '1.5 1.5 1.5');
508 if((eff & EF_NODRAW) || (this.alpha < 0))
510 if(eff & EF_ADDITIVE)
511 this.renderflags |= RF_ADDITIVE;
513 adddynamiclight(this.origin, 200, '0.15 0.15 1.5');
515 adddynamiclight(this.origin, 200, '1.5 0.15 0.15');
516 // ignoring EF_NOGUNBOB
517 if(eff & EF_FULLBRIGHT)
518 this.renderflags |= RF_FULLBRIGHT;
520 pointparticles(EFFECT_EF_FLAME, this.origin, '0 0 0', bound(0, frametime, 0.1));
521 if(eff & EF_STARDUST)
522 pointparticles(EFFECT_EF_STARDUST, this.origin, '0 0 0', bound(0, frametime, 0.1));
523 if(eff & EF_NOSHADOW)
524 this.renderflags |= RF_NOSHADOW;
525 if(eff & EF_NODEPTHTEST)
526 this.renderflags |= RF_DEPTHHACK;
527 // ignoring EF_SELECTABLE
528 if(eff & EF_DOUBLESIDED)
529 this.effects |= EF_DOUBLESIDED;
530 if(eff & EF_NOSELFSHADOW)
531 this.effects |= EF_NOSELFSHADOW;
532 if(eff & EF_DYNAMICMODELLIGHT)
533 this.renderflags |= RF_DYNAMICMODELLIGHT;
534 // ignoring EF_UNUSED18, EF_UNUSED19, EF_RESTARTANIM_BIT, EF_TELEPORT_BIT, EF_LOWPRECISION
535 if(this.csqcmodel_modelflags & MF_ROCKET)
536 tref = EFFECT_TR_ROCKET.m_id;
537 if(this.csqcmodel_modelflags & MF_GRENADE)
538 tref = EFFECT_TR_GRENADE.m_id;
539 if(this.csqcmodel_modelflags & MF_GIB)
540 tref = EFFECT_TR_BLOOD.m_id;
541 if(this.csqcmodel_modelflags & MF_ROTATE)
543 this.renderflags |= RF_USEAXIS;
544 MAKEVECTORS(makevectors, this.angles + '0 100 0' * fmod(time, 3.6), v_forward, v_right, v_up);
546 if(this.csqcmodel_modelflags & MF_TRACER)
547 tref = EFFECT_TR_WIZSPIKE.m_id;
548 if(this.csqcmodel_modelflags & MF_ZOMGIB)
549 tref = EFFECT_TR_SLIGHTBLOOD.m_id;
550 if(this.csqcmodel_modelflags & MF_TRACER2)
551 tref = EFFECT_TR_KNIGHTSPIKE.m_id;
552 if(this.csqcmodel_modelflags & MF_TRACER3)
553 tref = EFFECT_TR_VORESPIKE.m_id;
555 this.traileffect = tref;
558 Projectile_DrawTrail(this, this.origin);
560 Projectile_ResetTrail(this, this.origin);
562 if(this.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST)
563 this.renderflags |= RF_ADDITIVE;
564 // also special in CSQCPlayer_GlowMod_Apply
566 if(this.csqcmodel_modelflags & MF_ROCKET)
568 if(!this.snd_looping)
570 sound(this, CH_TRIGGER_SINGLE, SND_JETPACK_FLY, VOL_BASE, autocvar_cl_jetpack_attenuation);
571 this.snd_looping = CH_TRIGGER_SINGLE;
578 sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_cl_jetpack_attenuation);
579 this.snd_looping = 0;
585 .int csqcmodel_predraw_run;
587 .int anim_frame1time;
589 .int anim_frame2time;
591 .int anim_saveframe1time;
592 .int anim_saveframe2;
593 .int anim_saveframe2time;
594 .int anim_prev_pmove_flags;
595 void CSQCModel_Hook_PreDraw(entity this, bool isplayer)
597 if(this.csqcmodel_predraw_run == framecount)
599 this.csqcmodel_predraw_run = framecount;
601 if(!this.modelindex || this.model == "null" || this.alpha < 0)
607 this.drawmask = MASK_NORMAL;
609 if(this.isplayermodel && this.drawmask) // this checks if it's a player MODEL!
611 CSQCPlayer_ModelAppearance_Apply(this, (this.isplayermodel & ISPLAYER_LOCAL));
612 CSQCPlayer_LOD_Apply(this);
616 skeleton_loadinfo(this);
617 bool doblend = (this.bone_upperbody >= 0);
618 CSQCPlayer_FallbackFrame_Apply(this);
621 skeleton_from_frames(this, this.csqcmodel_isdead);
625 free_skeleton_from_frames(this);
626 // just in case, clear these (we're animating in frame and frame3)
633 // we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know!
634 skeleton_loadinfo(this);
635 bool doblend = (this.bone_upperbody >= 0);
637 if(this == csqcplayer)
639 if(IS_ONGROUND(this))
641 this.anim_prev_pmove_flags = this.flags;
642 if(this.flags & FL_DUCKED)
643 animdecide_setstate(this, this.anim_state | ANIMSTATE_DUCK, false);
644 else if(this.anim_state & ANIMSTATE_DUCK)
645 animdecide_setstate(this, this.anim_state - ANIMSTATE_DUCK, false);
649 tracebox(this.origin + '0 0 1', this.mins, this.maxs, this.origin - '0 0 4', MOVE_NORMAL, this);
650 if(trace_startsolid || trace_fraction < 1)
653 animdecide_load_if_needed(this);
654 animdecide_setimplicitstate(this, onground);
655 animdecide_setframes(this, doblend, anim_frame, anim_frame1time, anim_frame2, anim_frame2time);
657 if(this.anim_saveframe != this.anim_frame || this.anim_saveframe1time != this.anim_frame1time)
658 sf |= CSQCMODEL_PROPERTY_FRAME;
659 if(this.anim_saveframe2 != this.anim_frame2 || this.anim_saveframe2time != this.anim_frame2time)
660 sf |= CSQCMODEL_PROPERTY_FRAME2;
661 this.anim_saveframe = this.anim_frame;
662 this.anim_saveframe1time = this.anim_frame1time;
663 this.anim_saveframe2 = this.anim_frame2;
664 this.anim_saveframe2time = this.anim_frame2time;
665 // Note: we always consider lerpfrac "changed", as it uses fixed values every time anyway.
666 // This ensures that .frame etc. are always written.
667 CSQCModel_InterpolateAnimation_2To4_PreNote(this, sf | CSQCMODEL_PROPERTY_LERPFRAC);
668 this.lerpfrac = (doblend ? 0.5 : 0);
669 this.frame = this.anim_frame;
670 this.frame1time = this.anim_frame1time;
671 this.frame2 = this.anim_frame2;
672 this.frame2time = this.anim_frame2time;
673 CSQCModel_InterpolateAnimation_2To4_Note(this, sf | CSQCMODEL_PROPERTY_LERPFRAC, false);
674 CSQCModel_InterpolateAnimation_2To4_Do(this);
677 skeleton_from_frames(this, this.csqcmodel_isdead);
681 free_skeleton_from_frames(this);
682 // just in case, clear these (we're animating in frame and frame3)
689 CSQCModel_AutoTagIndex_Apply(this);
691 CSQCModel_Effects_Apply(this);
694 void CSQCModel_Hook_PreUpdate(entity this, bool isnew, bool isplayer, bool islocalplayer)
696 // interpolate v_angle
697 this.iflags |= IFLAG_V_ANGLE_X;
698 // revert to values from server
699 CSQCModel_Effects_PreUpdate(this);
700 if(this.isplayermodel)
703 CSQCPlayer_FallbackFrame_PreUpdate(this);
704 CSQCPlayer_ModelAppearance_PreUpdate(this);
708 void CSQCModel_Hook_PostUpdate(entity this, bool isnew, bool isplayer, bool islocalplayer)
710 // is it a player model? (shared state)
711 bool is_playermodel = (substring(this.model, 0, 14) == "models/player/" || substring(this.model, 0, 17) == "models/ok_player/" ||
712 (substring(this.model, 0, 16) == "models/monsters/" && (this.isplayermodel & BIT(1))));
713 this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_MODEL, is_playermodel);
715 // save values set by server
716 if(this.isplayermodel)
718 CSQCPlayer_ModelAppearance_PostUpdate(this);
720 CSQCPlayer_AnimDecide_PostUpdate(this, isnew);
722 CSQCPlayer_FallbackFrame_PostUpdate(this, isnew);
724 CSQCModel_Effects_PostUpdate(this);