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

Method PM_CheckDuck

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

Sets mins, maxs, and pm.viewheight.

()

Source from the content-addressed store, hash-verified

830 * Sets mins, maxs, and pm.viewheight.
831 */
832 public static void PM_CheckDuck() {
833 trace_t trace;
834
835 pm.mins[0] = -16;
836 pm.mins[1] = -16;
837
838 pm.maxs[0] = 16;
839 pm.maxs[1] = 16;
840
841 if (pm.s.pm_type == Defines.PM_GIB) {
842 pm.mins[2] = 0;
843 pm.maxs[2] = 16;
844 pm.viewheight = 8;
845 return;
846 }
847
848 pm.mins[2] = -24;
849
850 if (pm.s.pm_type == Defines.PM_DEAD) {
851 pm.s.pm_flags |= Defines.PMF_DUCKED;
852 } else if (pm.cmd.upmove < 0 && (pm.s.pm_flags & Defines.PMF_ON_GROUND) != 0) { // duck
853 pm.s.pm_flags |= Defines.PMF_DUCKED;
854 } else { // stand up if possible
855 if ((pm.s.pm_flags & Defines.PMF_DUCKED) != 0) {
856 // try to stand up
857 pm.maxs[2] = 32;
858 trace = pm.trace.trace(pml.origin, pm.mins, pm.maxs, pml.origin);
859 if (!trace.allsolid)
860 pm.s.pm_flags &= ~Defines.PMF_DUCKED;
861 }
862 }
863
864 if ((pm.s.pm_flags & Defines.PMF_DUCKED) != 0) {
865 pm.maxs[2] = 4;
866 pm.viewheight = -2;
867 } else {
868 pm.maxs[2] = 32;
869 pm.viewheight = 22;
870 }
871 }
872
873 /**
874 * Dead bodies have extra friction.

Callers 1

PmoveMethod · 0.95

Calls 1

traceMethod · 0.65

Tested by

no test coverage detected