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

Method PM_InitialSnapPosition

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

Snaps the origin of the player move to 0.125 grid.

()

Source from the content-addressed store, hash-verified

951 * Snaps the origin of the player move to 0.125 grid.
952 */
953 public static void PM_InitialSnapPosition() {
954 int x, y, z;
955 short base[] = { 0, 0, 0 };
956
957 Math3D.VectorCopy(pm.s.origin, base);
958
959 for (z = 0; z < 3; z++) {
960 pm.s.origin[2] = (short) (base[2] + offset[z]);
961 for (y = 0; y < 3; y++) {
962 pm.s.origin[1] = (short) (base[1] + offset[y]);
963 for (x = 0; x < 3; x++) {
964 pm.s.origin[0] = (short) (base[0] + offset[x]);
965 if (PM_GoodPosition()) {
966 pml.origin[0] = pm.s.origin[0] * 0.125f;
967 pml.origin[1] = pm.s.origin[1] * 0.125f;
968 pml.origin[2] = pm.s.origin[2] * 0.125f;
969 Math3D.VectorCopy(pm.s.origin,
970 pml.previous_origin);
971 return;
972 }
973 }
974 }
975 }
976
977 Com.DPrintf("Bad InitialSnapPosition\n");
978 }
979
980 /**
981 * PM_ClampAngles.

Callers 1

PmoveMethod · 0.95

Calls 3

VectorCopyMethod · 0.95
PM_GoodPositionMethod · 0.95
DPrintfMethod · 0.95

Tested by

no test coverage detected