]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix crouch bug, add comment
authorFruitieX <fruitiex@gmail.com>
Thu, 9 Jun 2011 12:04:49 +0000 (15:04 +0300)
committerFruitieX <fruitiex@gmail.com>
Thu, 9 Jun 2011 12:04:49 +0000 (15:04 +0300)
qcsrc/server/cl_player.qc

index 382645810b47fec2719cfc1b8f74e56dbb973fd7..c52a222ce9c7b296d95a6d7ac0213187ca3c1806 100644 (file)
@@ -261,12 +261,9 @@ void player_anim (void)
        {
                if (!(self.flags & FL_ONGROUND) || self.BUTTON_JUMP)
                {
-                       if((self.animstate_startframe == self.anim_jump_x && time - self.animstate_starttime >= 21/25) || (self.animstate_startframe == self.anim_duckjump_x && time - self.animstate_starttime >= 21/25))
-                               setanim(self, self.anim_fly, TRUE, FALSE, FALSE);
-
-                       if(self.animstate_startframe != self.anim_fly_x) // no tracing if we're in the fly anim
+                       if (self.crouch)
                        {
-                               if (self.crouch && self.animstate_startframe != self.anim_duckjump_x) // don't perform another trace if already playing the crouch jump anim
+                               if (self.animstate_startframe != self.anim_duckjump_x) // don't perform another trace if already playing the crouch jump anim
                                {
                                        traceline(self.origin + '0 0 1' * PL_CROUCH_MIN_z, self.origin + '0 0 1' * (PL_CROUCH_MIN_z - autocvar_sv_player_jumpanim_minfall), TRUE, self);
                                        if(!trace_startsolid && trace_fraction == 1 || self.animstate_startframe == self.anim_idle_x) // don't get stuck on idle animation in midair
@@ -275,13 +272,23 @@ void player_anim (void)
                                                self.restart_jump = FALSE;
                                        }
                                }
-                               else if (self.animstate_startframe != self.anim_jump_x) // don't perform another trace if already playing the jump anim
+                       }
+                       else
+                       {
+                               // 21/25 is the magic number here for how long the jump animation takes to play once (numframes/framerate)
+                               if((self.animstate_startframe == self.anim_jump_x && time - self.animstate_starttime >= 21/25))
+                                       setanim(self, self.anim_fly, TRUE, FALSE, FALSE);
+
+                               if(self.animstate_startframe != self.anim_fly_x) // no tracing if we're in the fly anim
                                {
-                                       traceline(self.origin + '0 0 1' * PL_MIN_z, self.origin + '0 0 1' * (PL_MIN_z - autocvar_sv_player_jumpanim_minfall), TRUE, self);
-                                       if(!trace_startsolid && trace_fraction == 1 || self.animstate_startframe == self.anim_idle_x) // don't get stuck on idle animation in midair
+                                       if (self.animstate_startframe != self.anim_jump_x) // don't perform another trace if already playing the jump anim
                                        {
-                                               setanim(self, self.anim_jump, FALSE, TRUE, self.restart_jump);
-                                               self.restart_jump = FALSE;
+                                               traceline(self.origin + '0 0 1' * PL_MIN_z, self.origin + '0 0 1' * (PL_MIN_z - autocvar_sv_player_jumpanim_minfall), TRUE, self);
+                                               if(!trace_startsolid && trace_fraction == 1 || self.animstate_startframe == self.anim_idle_x) // don't get stuck on idle animation in midair
+                                               {
+                                                       setanim(self, self.anim_jump, FALSE, TRUE, self.restart_jump);
+                                                       self.restart_jump = FALSE;
+                                               }
                                        }
                                }
                        }