Fix implicit state on cloned players.
Fix non-csqcplayers (just because I can, this code will get disabled anyway)
{
// we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know!
float doblend = FALSE;
- float flg = 0;
+ float onground = 0;
if(self == csqcplayer)
{
if(self.pmove_flags & PMF_ONGROUND)
- flg |= FL_ONGROUND;
+ onground = 1;
self.anim_prev_pmove_flags = self.pmove_flags;
if(self.pmove_flags & PMF_DUCKED)
animdecide_setstate(self, self.anim_state | ANIMSTATE_DUCK, FALSE);
{
traceline(self.origin + '0 0 1' * self.maxs_z, self.origin + '0 0 1' * (self.mins_z - 4), MOVE_NOMONSTERS, self);
if(trace_startsolid || trace_fraction < 1)
- flg |= FL_ONGROUND;
+ onground = 1;
}
animdecide_init(self); // FIXME only do this on model change
- animdecide_setframes(self, flg, doblend, anim_frame, anim_frame1time, anim_frame2, anim_frame2time);
+ animdecide_setimplicitstate(self, onground);
+ animdecide_setframes(self, doblend, anim_frame, anim_frame1time, anim_frame2, anim_frame2time);
float sf = 0;
if(self.anim_saveframe != self.anim_frame || self.anim_saveframe1time != self.anim_frame1time)
sf |= CSQCMODEL_PROPERTY_FRAME;
-// implicit anim state
-.float anim_implicit_state;
-.float anim_implicit_time;
-
-// actions
-.float anim_lower_implicit_action;
-.float anim_lower_implicit_time;
-.float anim_upper_implicit_action;
-.float anim_upper_implicit_time;
-
// player animation data for this model
// each vector is as follows:
// _x = startframe
// can't get here
}
-void animdecide_setimplicitstate(entity e, float flg)
+void animdecide_setimplicitstate(entity e, float onground)
{
float s;
s = 0;
if(v_y < -fabs(v_x) * 0.5)
s |= ANIMIMPLICITSTATE_LEFT;
}
- if(!(flg & FL_ONGROUND))
+ if(!onground)
s |= ANIMIMPLICITSTATE_INAIR;
// detect some kinds of otherwise misdetected jumps (ground to air transition)
e.anim_implicit_time = time;
}
}
-void animdecide_setframes(entity e, float flg, float support_blending, .float fld_frame, .float fld_frame1time, .float fld_frame2, .float fld_frame2time)
+void animdecide_setframes(entity e, float support_blending, .float fld_frame, .float fld_frame1time, .float fld_frame2, .float fld_frame2time)
{
- animdecide_setimplicitstate(e, flg);
// _x: frame
// _y: start time
// _z: priority
// client side frame inferring
void animdecide_init(entity e);
-// flags to pass here
-float FL_ONGROUND = 512;
-void animdecide_setframes(entity e, float flg, float support_blending, .float fld_frame, .float fld_frame1time, .float fld_frame2, .float fld_frame2time);
+void animdecide_setimplicitstate(entity e, float onground);
+void animdecide_setframes(entity e, float support_blending, .float fld_frame, .float fld_frame1time, .float fld_frame2, .float fld_frame2time);
// please network this one
.float anim_state;
.float anim_upper_action;
.float anim_upper_time;
+// when copying entities, copy these too
+.float anim_implicit_state;
+.float anim_implicit_time;
+.float anim_lower_implicit_action;
+.float anim_lower_implicit_time;
+.float anim_upper_implicit_action;
+.float anim_upper_implicit_time;
+
// explicit anim states (networked)
void animdecide_setstate(entity e, float newstate, float restart);
#define ANIMSTATE_DEAD1 1 // base frames: die1
return v;
}
+#ifndef MENUQC
vector animfixfps(entity e, vector a, vector b)
{
// multi-frame anim: keep as-is
}
return a;
}
+#endif
vector vec3(float x, float y, float z);
+#ifndef MENUQC
vector animfixfps(entity e, vector a, vector b);
+#endif
self.anim_lower_time = oldself.anim_lower_time;
self.anim_upper_action = oldself.anim_upper_action;
self.anim_upper_time = oldself.anim_upper_time;
+ self.anim_implicit_state = oldself.anim_implicit_state;
+ self.anim_implicit_time = oldself.anim_implicit_time;
+ self.anim_lower_implicit_action = oldself.anim_lower_implicit_action;
+ self.anim_lower_implicit_time = oldself.anim_lower_implicit_time;
+ self.anim_upper_implicit_action = oldself.anim_upper_implicit_action;
+ self.anim_upper_implicit_time = oldself.anim_upper_implicit_time;
self.dphitcontentsmask = oldself.dphitcontentsmask;
self.death_time = oldself.death_time;
self.pain_finished = oldself.pain_finished;
self.nextthink = time;
self.think = CopyBody_Think;
// "bake" the current animation frame for clones (they don't get clientside animation)
- animdecide_setframes(self, self.flags, FALSE, frame, frame1time, frame2, frame2time);
+ animdecide_setframes(self, FALSE, frame, frame1time, frame2, frame2time);
self = oldself;
}
if(self.crouch)
animbits |= ANIMSTATE_DUCK;
animdecide_setstate(self, animbits, FALSE);
+ animdecide_setimplicitstate(self, (self.flags & FL_ONGROUND));
+
+#ifndef NO_LEGACY_NETWORKING
+ if(!self.iscsqcmodel)
+ animdecide_setframes(self, FALSE, frame, frame1time, frame2, frame2time);
+#endif
if (self.weaponentity)
{