Turns to the movement direction, and walks the current distance if facing it.
(SubgameEntity ent, float yaw, float dist, GameExportsImpl gameExports)
| 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 |
no test coverage detected