]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/divVerent/csad' into divVerent/csad
authorRudolf Polzer <divverent@xonotic.org>
Tue, 4 Dec 2012 16:38:35 +0000 (17:38 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 4 Dec 2012 16:38:35 +0000 (17:38 +0100)
Conflicts:
qcsrc/client/csqcmodel_hooks.qc

qcsrc/client/csqcmodel_hooks.qc
qcsrc/common/animdecide.qc
qcsrc/common/animdecide.qh
qcsrc/common/util.qc
qcsrc/common/util.qh
qcsrc/server/cl_player.qc
qcsrc/server/cl_weaponsystem.qc

index bbe5618d9ba35ef332e017bd0aa1fc49958a0202..7a642e3bde8f3064b36cb3bb5a574187a2a40fd5 100644 (file)
@@ -589,11 +589,11 @@ void CSQCModel_Hook_PreDraw(float isplayer)
                {
                        // we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know!
                        float doblend = autocvar__animblend;
-                       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);
@@ -604,10 +604,11 @@ void CSQCModel_Hook_PreDraw(float isplayer)
                        {
                                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);
                        print(sprintf("frames: %d %d\n", self.anim_frame, self.anim_frame2));
                        float sf = 0;
                        if(self.anim_saveframe != self.anim_frame || self.anim_saveframe1time != self.anim_frame1time)
index a7d2b3278340de60e8eb1ad82baf6633c8339eb7..bb2429bb38e6bfd2e6cdf177723d08c3ff76653f 100644 (file)
@@ -1,13 +1,3 @@
-// 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
@@ -74,10 +64,13 @@ void animdecide_init(entity e)
        e.anim_duckwalkforwardleft = animfixfps(e, '28 1 1', '4 1 1');
        e.anim_duckwalkbackright = animfixfps(e, '29 1 1', '4 1 1');
        e.anim_duckwalkbackleft  = animfixfps(e, '30 1 1', '4 1 1');
+
+       // these anims ought to stay until stopped explicitly by weaponsystem
+       e.aim_shoot_z = 0.001;
+       e.aim_melee_z = 0.001;
 }
 
 #define ANIMPRIO_IDLE 0
-#define ANIMPRIO_STATIC 1
 #define ANIMPRIO_ACTIVE 2
 #define ANIMPRIO_DEAD 3
 
@@ -179,7 +172,7 @@ vector animdecide_getloweranim(entity e)
                        case ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_LEFT:
                                return vec3(e.anim_duckwalkbackleft_x, t, ANIMPRIO_ACTIVE);
                        default:
-                               return vec3(e.anim_duckidle_x, t, ANIMPRIO_STATIC);
+                               return vec3(e.anim_duckidle_x, t, ANIMPRIO_ACTIVE);
                }
        }
        else
@@ -211,7 +204,7 @@ vector animdecide_getloweranim(entity e)
        // can't get here
 }
 
-void animdecide_setimplicitstate(entity e, float flg)
+void animdecide_setimplicitstate(entity e, float onground)
 {
        float s;
        s = 0;
@@ -242,7 +235,7 @@ void animdecide_setimplicitstate(entity e, float flg)
                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)
@@ -259,9 +252,8 @@ void animdecide_setimplicitstate(entity e, float flg)
                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
index 071646f96bd6a11de6ea6a2e91ff301b7cbc135f..105dac7c47f2460a8710a54c87032a5b469eb1dd 100644 (file)
@@ -1,9 +1,8 @@
 // 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;
@@ -13,6 +12,14 @@ void animdecide_setframes(entity e, float flg, float support_blending, .float fl
 .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
index 7b08c2c5cf6eaf14fc7c02d10d8d655672e4d786..98eecb3c61cdb6af600f2ec9999098a15f6be999 100644 (file)
@@ -2473,6 +2473,7 @@ vector vec3(float x, float y, float z)
        return v;
 }
 
+#ifndef MENUQC
 vector animfixfps(entity e, vector a, vector b)
 {
        // multi-frame anim: keep as-is
@@ -2490,3 +2491,4 @@ vector animfixfps(entity e, vector a, vector b)
        }
        return a;
 }
+#endif
index a5b1d985c41e139e48ddb43ad43f5a90f05b292a..b8c5502a846e6466af246144b42a04a475103c34 100644 (file)
@@ -364,4 +364,6 @@ void FindConnectedComponent(entity e, .entity fld, findNextEntityNearFunction_t
 
 vector vec3(float x, float y, float z);
 
+#ifndef MENUQC
 vector animfixfps(entity e, vector a, vector b);
+#endif
index c771a1e8b501eb65e0b322353bd2382b4a26efe3..876608745dce17b1dea69d02373d6feca26b14a2 100644 (file)
@@ -167,6 +167,12 @@ void CopyBody(float keepvelocity)
        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;
@@ -207,7 +213,7 @@ void CopyBody(float keepvelocity)
        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;
 }
@@ -244,6 +250,12 @@ void player_anim (void)
        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)
        {
index e2e547a2354b0301ac24f83ae11c281d2a033534..690d9b5511d6d8291e80f44269f17be4efa6561e 100644 (file)
@@ -1046,16 +1046,18 @@ void weapon_thinkf(float fr, float t, void() func)
        self.weapon_think = func;
        //dprint("next ", ftos(self.weapon_nextthink), "\n");
 
-       // The shoot animation looks TERRIBLE without animation blending! Yay for moonwalking while shooting!
-       //anim = self.anim_shoot;
-       if (t)
-       if (!self.crouch) // shoot anim stands up, this looks bad
+       if((fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2) && t)
        {
                if(self.weapon == WEP_SHOTGUN && self.BUTTON_ATCK2)
                        animdecide_setaction(self, ANIMACTION_MELEE, restartanim);
                else
                        animdecide_setaction(self, ANIMACTION_SHOOT, restartanim);
        }
+       else
+       {
+               if(self.anim_upper_action == ANIMACTION_SHOOT || self.anim_upper_action == ANIMACTION_MELEE)
+                       self.anim_upper_action = 0;
+       }
 }
 
 void weapon_boblayer1(float spd, vector org)