MCPcopy Create free account
hub / github.com/demoth/jake2 / PM_CheckJump

Method PM_CheckJump

qcommon/src/main/java/jake2/qcommon/PMove.java:654–696  ·  view source on GitHub ↗

PM_CheckJump.

()

Source from the content-addressed store, hash-verified

652 * PM_CheckJump.
653 */
654 public static void PM_CheckJump() {
655 if ((pm.s.pm_flags & Defines.PMF_TIME_LAND) != 0) {
656 // hasn't been long enough since landing to jump again
657 return;
658 }
659
660 if (pm.cmd.upmove < 10) { // not holding jump
661 pm.s.pm_flags &= ~Defines.PMF_JUMP_HELD;
662 return;
663 }
664
665 // must wait for jump to be released
666 if ((pm.s.pm_flags & Defines.PMF_JUMP_HELD) != 0)
667 return;
668
669 if (pm.s.pm_type == Defines.PM_DEAD)
670 return;
671
672 if (pm.waterlevel >= 2) { // swimming, not jumping
673 pm.groundentity = null;
674
675 if (pml.velocity[2] <= -300)
676 return;
677
678 if (pm.watertype == Defines.CONTENTS_WATER)
679 pml.velocity[2] = 100;
680 else if (pm.watertype == Defines.CONTENTS_SLIME)
681 pml.velocity[2] = 80;
682 else
683 pml.velocity[2] = 50;
684 return;
685 }
686
687 if (pm.groundentity == null)
688 return; // in air, so no effect
689
690 pm.s.pm_flags |= Defines.PMF_JUMP_HELD;
691
692 pm.groundentity = null;
693 pml.velocity[2] += 270;
694 if (pml.velocity[2] < 270)
695 pml.velocity[2] = 270;
696 }
697
698 /**
699 * PM_CheckSpecialMovement.

Callers 1

PmoveMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected