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

Method SV_StepDirection

game/src/main/java/jake2/game/SV.java:948–974  ·  view source on GitHub ↗

Turns to the movement direction, and walks the current distance if facing it.

(SubgameEntity ent, float yaw, float dist, GameExportsImpl gameExports)

Source from the content-addressed store, hash-verified

946 * it.
947 */
948 static boolean SV_StepDirection(SubgameEntity ent, float yaw, float dist, GameExportsImpl gameExports) {
949 float[] move = { 0, 0, 0 };
950 float[] oldorigin = { 0, 0, 0 };
951
952 ent.ideal_yaw = yaw;
953 M.rotateToIdealYaw(ent);
954
955 yaw = (float) (yaw * Math.PI * 2 / 360);
956 move[0] = (float) Math.cos(yaw) * dist;
957 move[1] = (float) Math.sin(yaw) * dist;
958 move[2] = 0;
959
960 Math3D.VectorCopy(ent.s.origin, oldorigin);
961 if (SV_movestep(ent, move, false, gameExports)) {
962 float delta = ent.s.angles[Defines.YAW] - ent.ideal_yaw;
963 if (delta > 45 && delta < 315) {
964 // not turned far enough, so don't take the step
965 Math3D.VectorCopy(oldorigin, ent.s.origin);
966 }
967 gameExports.gameImports.linkentity(ent);
968 GameBase.G_TouchTriggers(ent, gameExports);
969 return true;
970 }
971 gameExports.gameImports.linkentity(ent);
972 GameBase.G_TouchTriggers(ent, gameExports);
973 return false;
974 }
975
976 /**
977 * SV_FixCheckBottom

Callers 2

SV_NewChaseDirMethod · 0.95
M_MoveToGoalMethod · 0.95

Calls 5

rotateToIdealYawMethod · 0.95
VectorCopyMethod · 0.95
SV_movestepMethod · 0.95
G_TouchTriggersMethod · 0.95
linkentityMethod · 0.65

Tested by

no test coverage detected