================== SV_UserMove The message usually contains all the movement commands that were in the last three packets, so that the information in dropped packets can be recovered. On very fast clients, there may be multiple usercmd packed into each of the backup packets. ================== */
| 1389 | ================== |
| 1390 | */ |
| 1391 | static void SV_UserMove( client_t *cl, msg_t *msg, qboolean delta ) { |
| 1392 | int i, key; |
| 1393 | int cmdCount; |
| 1394 | usercmd_t nullcmd; |
| 1395 | usercmd_t cmds[MAX_PACKET_USERCMDS]; |
| 1396 | usercmd_t *cmd, *oldcmd; |
| 1397 | |
| 1398 | if ( delta ) { |
| 1399 | cl->deltaMessage = cl->messageAcknowledge; |
| 1400 | } else { |
| 1401 | cl->deltaMessage = -1; |
| 1402 | } |
| 1403 | |
| 1404 | cmdCount = MSG_ReadByte( msg ); |
| 1405 | |
| 1406 | if ( cmdCount < 1 ) { |
| 1407 | Com_Printf( "cmdCount < 1\n" ); |
| 1408 | return; |
| 1409 | } |
| 1410 | |
| 1411 | if ( cmdCount > MAX_PACKET_USERCMDS ) { |
| 1412 | Com_Printf( "cmdCount > MAX_PACKET_USERCMDS\n" ); |
| 1413 | return; |
| 1414 | } |
| 1415 | |
| 1416 | // use the checksum feed in the key |
| 1417 | key = sv.checksumFeed; |
| 1418 | // also use the message acknowledge |
| 1419 | key ^= cl->messageAcknowledge; |
| 1420 | // also use the last acknowledged server command in the key |
| 1421 | key ^= Com_HashKey(cl->reliableCommands[ cl->reliableAcknowledge & (MAX_RELIABLE_COMMANDS-1) ], 32); |
| 1422 | |
| 1423 | Com_Memset( &nullcmd, 0, sizeof(nullcmd) ); |
| 1424 | oldcmd = &nullcmd; |
| 1425 | for ( i = 0 ; i < cmdCount ; i++ ) { |
| 1426 | cmd = &cmds[i]; |
| 1427 | MSG_ReadDeltaUsercmdKey( msg, key, oldcmd, cmd ); |
| 1428 | if ( sv_legacyFixes->integer ) { |
| 1429 | // block "charge jump" and other nonsense |
| 1430 | if ( cmd->forcesel == FP_LEVITATION || cmd->forcesel >= NUM_FORCE_POWERS ) { |
| 1431 | cmd->forcesel = 0xFFu; |
| 1432 | } |
| 1433 | |
| 1434 | // affects speed calculation |
| 1435 | cmd->angles[ROLL] = 0; |
| 1436 | } |
| 1437 | oldcmd = cmd; |
| 1438 | } |
| 1439 | |
| 1440 | // save time for ping calculation |
| 1441 | cl->frames[ cl->messageAcknowledge & PACKET_MASK ].messageAcked = svs.time; |
| 1442 | |
| 1443 | // TTimo |
| 1444 | // catch the no-cp-yet situation before SV_ClientEnterWorld |
| 1445 | // if CS_ACTIVE, then it's time to trigger a new gamestate emission |
| 1446 | // if not, then we are getting remaining parasite usermove commands, which we should ignore |
| 1447 | if (sv_pure->integer != 0 && cl->pureAuthentic == 0 && !cl->gotCP) { |
| 1448 | if (cl->state == CS_ACTIVE) |
no test coverage detected