]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
factor out player jump checking into a CheckPlayerJump() function
authorRudolf Polzer <divverent@xonotic.org>
Sun, 11 Sep 2011 13:40:31 +0000 (15:40 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Sun, 11 Sep 2011 13:40:31 +0000 (15:40 +0200)
qcsrc/server/cl_physics.qc

index 7d14fbdae9868261727ba21db69d3ceb278794d6..1ffccefd21723d0779e9ed0e466b392c43496f87 100644 (file)
@@ -180,7 +180,6 @@ void PlayerJump (void)
        self.restart_jump = -1; // restart jump anim next time
        // value -1 is used to not use the teleport bit (workaround for tiny hitch when re-jumping)
 }
-
 void CheckWaterJump()
 {
        local vector start, end;
@@ -209,6 +208,25 @@ void CheckWaterJump()
                }
        }
 };
+void CheckPlayerJump()
+{
+       if(self.flags & FL_ONGROUND)
+       {
+               if (autocvar_g_multijump > 0)
+                       self.multijump_count = 0;
+               else
+                       self.multijump_count = -2; // the cvar value for infinite jumps is -1, so this needs to be smaller
+       }
+
+       if (self.BUTTON_JUMP)
+               PlayerJump ();
+       else
+               self.flags |= FL_JUMPRELEASED;
+
+       if (self.waterlevel == WATERLEVEL_SWIMMING)
+               CheckWaterJump ();
+       self.prevjumpbutton = self.BUTTON_JUMP;
+}
 
 float racecar_angle(float forward, float down)
 {
@@ -938,24 +956,7 @@ void SV_PlayerPhysics()
                self.wasFlying = 1;
 
        if(self.classname == "player")
-       {
-               if(self.flags & FL_ONGROUND)
-               {
-                       if (autocvar_g_multijump > 0)
-                               self.multijump_count = 0;
-                       else
-                               self.multijump_count = -2; // the cvar value for infinite jumps is -1, so this needs to be smaller
-               }
-
-               if (self.BUTTON_JUMP)
-                       PlayerJump ();
-               else
-                       self.flags |= FL_JUMPRELEASED;
-
-               if (self.waterlevel == WATERLEVEL_SWIMMING)
-                       CheckWaterJump ();
-               self.prevjumpbutton = self.BUTTON_JUMP;
-       }
+               CheckPlayerJump();
 
        if (self.flags & FL_WATERJUMP )
        {