PM_CheckSpecialMovement.
()
| 699 | * PM_CheckSpecialMovement. |
| 700 | */ |
| 701 | public static void PM_CheckSpecialMovement() { |
| 702 | float[] spot = { 0, 0, 0 }; |
| 703 | int cont; |
| 704 | float[] flatforward = { 0, 0, 0 }; |
| 705 | trace_t trace; |
| 706 | |
| 707 | if (pm.s.pm_time != 0) |
| 708 | return; |
| 709 | |
| 710 | pml.ladder = false; |
| 711 | |
| 712 | // check for ladder |
| 713 | flatforward[0] = pml.forward[0]; |
| 714 | flatforward[1] = pml.forward[1]; |
| 715 | flatforward[2] = 0; |
| 716 | Math3D.VectorNormalize(flatforward); |
| 717 | |
| 718 | Math3D.VectorMA(pml.origin, 1, flatforward, spot); |
| 719 | trace = pm.trace.trace(pml.origin, pm.mins, |
| 720 | pm.maxs, spot); |
| 721 | if ((trace.fraction < 1) |
| 722 | && (trace.contents & Defines.CONTENTS_LADDER) != 0) |
| 723 | pml.ladder = true; |
| 724 | |
| 725 | // check for water jump |
| 726 | if (pm.waterlevel != 2) |
| 727 | return; |
| 728 | |
| 729 | Math3D.VectorMA(pml.origin, 30, flatforward, spot); |
| 730 | spot[2] += 4; |
| 731 | cont = pm.pointcontents.pointcontents(spot); |
| 732 | if (0 == (cont & Defines.CONTENTS_SOLID)) |
| 733 | return; |
| 734 | |
| 735 | spot[2] += 16; |
| 736 | cont = pm.pointcontents.pointcontents(spot); |
| 737 | if (cont != 0) |
| 738 | return; |
| 739 | // jump out of water |
| 740 | Math3D.VectorScale(flatforward, 50, pml.velocity); |
| 741 | pml.velocity[2] = 350; |
| 742 | |
| 743 | pm.s.pm_flags |= Defines.PMF_TIME_WATERJUMP; |
| 744 | pm.s.pm_time = -1; // was 255 |
| 745 | } |
| 746 | |
| 747 | /** |
| 748 | * PM_FlyMove. |
no test coverage detected