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

Method PredictMovement

client/src/main/java/jake2/client/CL_pred.java:207–286  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

205 * Sets cl.predicted_origin and cl.predicted_angles =================
206 */
207 static void PredictMovement() {
208
209 if (ClientGlobals.cls.state != Defines.ca_active)
210 return;
211
212 if (ClientGlobals.cl_paused.value != 0.0f)
213 return;
214
215 if (ClientGlobals.cl_predict.value == 0.0f
216 || (ClientGlobals.cl.frame.playerstate.pmove.pm_flags & Defines.PMF_NO_PREDICTION) != 0) {
217 // just set angles
218 for (int i = 0; i < 3; i++) {
219 ClientGlobals.cl.predicted_angles[i] = ClientGlobals.cl.viewangles[i]
220 + Math3D
221 .SHORT2ANGLE(ClientGlobals.cl.frame.playerstate.pmove.delta_angles[i]);
222 }
223 return;
224 }
225
226 int ack = ClientGlobals.cls.netchan.incoming_acknowledged;
227 int current = ClientGlobals.cls.netchan.outgoing_sequence;
228
229 // if we are too far out of date, just freeze
230 if (current - ack >= Defines.CMD_BACKUP) {
231 if (ClientGlobals.cl_showmiss.value != 0.0f)
232 Com.Printf("exceeded CMD_BACKUP\n");
233 return;
234 }
235
236 // copy current state to pmove
237 //memset (pm, 0, sizeof(pm));
238 pmove_t pm = new pmove_t();
239
240 pm.trace = new pmove_t.TraceAdapter() {
241 public trace_t trace(float[] start, float[] mins, float[] maxs,
242 float[] end) {
243 return PMTrace(start, mins, maxs, end);
244 }
245 };
246 pm.pointcontents = CL_pred::PMpointcontents;
247
248 PMove.pm_airaccelerate = Lib.atof(ClientGlobals.cl.configstrings[Defines.CS_AIRACCEL]);
249
250 // bugfix (rst) yeah !!!!!!!! found the solution to the B E W E G U N G
251 // S P R O B L E M.
252 pm.s.set(ClientGlobals.cl.frame.playerstate.pmove);
253
254 // SCR_DebugGraph (current - ack - 1, 0);
255 int frame = 0;
256
257 // run frames
258 usercmd_t cmd;
259 while (++ack < current) {
260 frame = ack & (Defines.CMD_BACKUP - 1);
261 cmd = ClientGlobals.cl.cmds[frame];
262
263 pm.cmd.set(cmd);
264

Callers 1

FrameMethod · 0.95

Calls 6

SHORT2ANGLEMethod · 0.95
PrintfMethod · 0.95
atofMethod · 0.95
PmoveMethod · 0.95
VectorCopyMethod · 0.95
setMethod · 0.45

Tested by

no test coverage detected