MCPcopy Create free account
hub / github.com/ZDoom/Raze / ReadTicCmd

Function ReadTicCmd

source/core/d_protocol.cpp:326–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324
325extern short consistency[MAXPLAYERS][BACKUPTICS];
326void ReadTicCmd (uint8_t **stream, int player, int tic)
327{
328 int type;
329 uint8_t *start;
330 ticcmd_t *tcmd;
331
332 int ticmod = tic % BACKUPTICS;
333
334 tcmd = &netcmds[player][ticmod];
335 tcmd->consistency = ReadWord (stream);
336
337 start = *stream;
338
339 while ((type = ReadByte (stream)) != DEM_USERCMD && type != DEM_EMPTYUSERCMD)
340 Net_SkipCommand (type, stream);
341
342 NetSpecs[player][ticmod].SetData (start, int(*stream - start - 1));
343
344 if (type == DEM_USERCMD)
345 {
346 UnpackUserCmd (&tcmd->ucmd,
347 tic ? &netcmds[player][(tic-1)%BACKUPTICS].ucmd : NULL, stream);
348 }
349 else
350 {
351 if (tic)
352 {
353 memcpy (&tcmd->ucmd, &netcmds[player][(tic-1)%BACKUPTICS].ucmd, sizeof(tcmd->ucmd));
354 }
355 else
356 {
357 memset (&tcmd->ucmd, 0, sizeof(tcmd->ucmd));
358 }
359 }
360#if 0
361 if (player==consoleplayer&&tic>BACKUPTICS)
362 assert(consistancy[player][ticmod] == tcmd->consistancy);
363#endif
364}
365
366void RunNetSpecs (int player, int buf)
367{

Callers 1

GetPacketsFunction · 0.85

Calls 5

ReadWordFunction · 0.85
Net_SkipCommandFunction · 0.85
UnpackUserCmdFunction · 0.85
ReadByteFunction · 0.70
SetDataMethod · 0.45

Tested by

no test coverage detected