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

Method ClipMoveToEntities

client/src/main/java/jake2/client/CL_pred.java:83–145  ·  view source on GitHub ↗
(float[] start, float[] mins, float[] maxs,
            float[] end, trace_t tr)

Source from the content-addressed store, hash-verified

81 * ====================
82 */
83 static void ClipMoveToEntities(float[] start, float[] mins, float[] maxs,
84 float[] end, trace_t tr) {
85 int i, x, zd, zu;
86 trace_t trace;
87 int headnode;
88 float[] angles;
89 entity_state_t ent;
90 int num;
91 cmodel_t cmodel;
92 float[] bmins = new float[3];
93 float[] bmaxs = new float[3];
94
95 for (i = 0; i < ClientGlobals.cl.frame.num_entities; i++) {
96 num = (ClientGlobals.cl.frame.parse_entities + i)
97 & (Defines.MAX_PARSE_ENTITIES - 1);
98 ent = ClientGlobals.cl_parse_entities[num];
99
100 if (ent.solid == 0)
101 continue;
102
103 if (ent.number == ClientGlobals.cl.playernum + 1)
104 continue;
105
106 if (ent.solid == 31) { // special value for bmodel
107 cmodel = ClientGlobals.cl.model_clip[ent.modelindex];
108 if (cmodel == null)
109 continue;
110 headnode = cmodel.headnode;
111 angles = ent.angles;
112 } else { // encoded bbox
113 x = 8 * (ent.solid & 31);
114 zd = 8 * ((ent.solid >>> 5) & 31);
115 zu = 8 * ((ent.solid >>> 10) & 63) - 32;
116
117 bmins[0] = bmins[1] = -x;
118 bmaxs[0] = bmaxs[1] = x;
119 bmins[2] = -zd;
120 bmaxs[2] = zu;
121
122 headnode = ClientGlobals.cm.HeadnodeForBox(bmins, bmaxs);
123 angles = Globals.vec3_origin; // boxes don't rotate
124 }
125
126 if (tr.allsolid)
127 return;
128
129 trace = ClientGlobals.cm.TransformedBoxTrace(start, end, mins, maxs, headnode,
130 Defines.MASK_PLAYERSOLID, ent.origin, angles);
131
132 if (trace.allsolid || trace.startsolid
133 || trace.fraction < tr.fraction) {
134 trace.ent = ent.surrounding_ent;
135 if (tr.startsolid) {
136 tr.set(trace); // rst: solved the Z U P P E L - P R O B L E
137 // M
138 tr.startsolid = true;
139 } else
140 tr.set(trace); // rst: solved the Z U P P E L - P R O B L E

Callers 1

PMTraceMethod · 0.95

Calls 3

HeadnodeForBoxMethod · 0.80
TransformedBoxTraceMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected