(SubgameEntity ent, float time, int mask, GameExportsImpl gameExports)
| 112 | } |
| 113 | |
| 114 | private static int SV_FlyMove(SubgameEntity ent, float time, int mask, GameExportsImpl gameExports) { |
| 115 | edict_t hit; |
| 116 | int bumpcount, numbumps; |
| 117 | float[] dir = { 0.0f, 0.0f, 0.0f }; |
| 118 | float d; |
| 119 | int numplanes; |
| 120 | float[][] planes = new float[PMove.MAX_CLIP_PLANES][3]; |
| 121 | float[] primal_velocity = { 0.0f, 0.0f, 0.0f }; |
| 122 | float[] original_velocity = { 0.0f, 0.0f, 0.0f }; |
| 123 | float[] new_velocity = { 0.0f, 0.0f, 0.0f }; |
| 124 | int i, j; |
| 125 | trace_t trace; |
| 126 | float[] end = { 0.0f, 0.0f, 0.0f }; |
| 127 | float time_left; |
| 128 | int blocked; |
| 129 | |
| 130 | numbumps = 4; |
| 131 | |
| 132 | blocked = 0; |
| 133 | Math3D.VectorCopy(ent.velocity, original_velocity); |
| 134 | Math3D.VectorCopy(ent.velocity, primal_velocity); |
| 135 | numplanes = 0; |
| 136 | |
| 137 | time_left = time; |
| 138 | |
| 139 | ent.groundentity = null; |
| 140 | for (bumpcount = 0; bumpcount < numbumps; bumpcount++) { |
| 141 | for (i = 0; i < 3; i++) |
| 142 | end[i] = ent.s.origin[i] + time_left * ent.velocity[i]; |
| 143 | |
| 144 | trace = gameExports.gameImports.trace(ent.s.origin, ent.mins, ent.maxs, end, |
| 145 | ent, mask); |
| 146 | |
| 147 | if (trace.allsolid) { // entity is trapped in another solid |
| 148 | Math3D.VectorCopy(Globals.vec3_origin, ent.velocity); |
| 149 | return 3; |
| 150 | } |
| 151 | |
| 152 | if (trace.fraction > 0) { // actually covered some distance |
| 153 | Math3D.VectorCopy(trace.endpos, ent.s.origin); |
| 154 | Math3D.VectorCopy(ent.velocity, original_velocity); |
| 155 | numplanes = 0; |
| 156 | } |
| 157 | |
| 158 | if (trace.fraction == 1) |
| 159 | break; // moved the entire distance |
| 160 | |
| 161 | hit = trace.ent; |
| 162 | |
| 163 | if (trace.plane.normal[2] > 0.7) { |
| 164 | blocked |= 1; // floor |
| 165 | if (hit.solid == Defines.SOLID_BSP) { |
| 166 | ent.groundentity = hit; |
| 167 | ent.groundentity_linkcount = hit.linkcount; |
| 168 | } |
| 169 | } |
| 170 | if (trace.plane.normal[2] == 0.0f) { |
| 171 | blocked |= 2; // step |
no test coverage detected