]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move client side jump calculation into CheckPlayerJump
authorMario <zacjardine@y7mail.com>
Fri, 12 Dec 2014 05:13:30 +0000 (16:13 +1100)
committerMario <zacjardine@y7mail.com>
Fri, 12 Dec 2014 05:13:30 +0000 (16:13 +1100)
qcsrc/common/physics.qc

index 1e6c0d17140b95dea3c02108c809883287691854..20f1e8c0c3063dc803a093c18b6057c442d4d148 100644 (file)
@@ -562,6 +562,23 @@ void CheckPlayerJump()
        else
                UNSET_JUMP_HELD(self);
 
+#endif
+#ifdef CSQC
+               // jump if on ground with jump button pressed but only if it has been
+               // released at least once since the last jump
+               if (PHYS_INPUT_BUTTON_JUMP(self))
+               {
+                       pm_multijump = FALSE;
+                       PM_multijump_checkjump();
+                       if((IS_ONGROUND(self) || pm_multijump) && (!IS_JUMP_HELD(self) || !PHYS_TRACK_CANJUMP(self)))
+                       {
+                               self.velocity_z += PHYS_JUMPVELOCITY;
+                               UNSET_ONGROUND(self);
+                               SET_JUMP_HELD(self); // canjump = false
+                       }
+               }
+               else
+                       UNSET_JUMP_HELD(self); // canjump = true
 #endif
        if (self.waterlevel == WATERLEVEL_SWIMMING)
                CheckWaterJump();
@@ -1730,23 +1747,6 @@ void PM_Main()
 
        else
        {
-#ifdef CSQC
-               // jump if on ground with jump button pressed but only if it has been
-               // released at least once since the last jump
-               if (PHYS_INPUT_BUTTON_JUMP(self))
-               {
-                       pm_multijump = FALSE;
-                       PM_multijump_checkjump();
-                       if((IS_ONGROUND(self) || pm_multijump) && (!IS_JUMP_HELD(self) || !PHYS_TRACK_CANJUMP(self)))
-                       {
-                               self.velocity_z += PHYS_JUMPVELOCITY;
-                               UNSET_ONGROUND(self);
-                               SET_JUMP_HELD(self); // canjump = false
-                       }
-               }
-               else
-                       UNSET_JUMP_HELD(self); // canjump = true
-#endif
                if (IS_ONGROUND(self))
                        PM_walk(buttons_prev, maxspeed_mod);
                else