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

Method SV_PushEntity

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

Does not change the entities velocity at all

(SubgameEntity ent, float[] push, GameExportsImpl gameExports)

Source from the content-addressed store, hash-verified

245 * Does not change the entities velocity at all
246 */
247 private static trace_t SV_PushEntity(SubgameEntity ent, float[] push, GameExportsImpl gameExports) {
248 trace_t trace;
249 float[] start = { 0, 0, 0 };
250 float[] end = { 0, 0, 0 };
251 int mask;
252
253 Math3D.VectorCopy(ent.s.origin, start);
254 Math3D.VectorAdd(start, push, end);
255
256 // FIXME: test this
257 // a goto statement was replaced.
258 boolean retry = false;
259
260 do {
261 if (ent.clipmask != 0)
262 mask = ent.clipmask;
263 else
264 mask = Defines.MASK_SOLID;
265
266 trace = gameExports.gameImports
267 .trace(start, ent.mins, ent.maxs, end, ent, mask);
268
269 Math3D.VectorCopy(trace.endpos, ent.s.origin);
270 gameExports.gameImports.linkentity(ent);
271
272 retry = false;
273 if (trace.fraction != 1.0) {
274 SV_Impact(ent, trace, gameExports);
275
276 // if the pushed entity went away and the pusher is still there
277 if (!trace.ent.inuse && ent.inuse) {
278 // move the pusher back and try again
279 Math3D.VectorCopy(start, ent.s.origin);
280 gameExports.gameImports.linkentity(ent);
281 //goto retry;
282 retry = true;
283 }
284 }
285 } while (retry);
286
287 if (ent.inuse)
288 GameBase.G_TouchTriggers(ent, gameExports);
289
290 return trace;
291 }
292
293 /**
294 * Objects need to be moved back on a failed push, otherwise riders would

Callers 1

SV_Physics_TossMethod · 0.95

Calls 6

VectorCopyMethod · 0.95
VectorAddMethod · 0.95
SV_ImpactMethod · 0.95
G_TouchTriggersMethod · 0.95
traceMethod · 0.65
linkentityMethod · 0.65

Tested by

no test coverage detected