Revision | 8be14ead4f32cffaf615e012e6a95e25ce77f419 (tree) |
---|---|
Time | 2021-10-16 13:14:24 |
Author | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
Before performing a backtrace, remember how much we need to thrust the player again upon completing the backtrace successfully.
@@ -379,6 +379,10 @@ | ||
379 | 379 | |
380 | 380 | if (( bPressedAnything ) && ( client->OldData->pMorphedPlayerClass == players[ulIdx].MorphedPlayerClass )) |
381 | 381 | { |
382 | + client->backtraceThrust[0] = players[ulIdx].mo->velx - client->backtraceThrust[0]; | |
383 | + client->backtraceThrust[1] = players[ulIdx].mo->vely - client->backtraceThrust[1]; | |
384 | + client->backtraceThrust[2] = players[ulIdx].mo->velz - client->backtraceThrust[2]; | |
385 | + | |
382 | 386 | CLIENT_PLAYER_DATA_s oldData( &players[ulIdx] ); |
383 | 387 | client->OldData->Restore( &players[ulIdx], false ); |
384 | 388 |
@@ -419,7 +423,15 @@ | ||
419 | 423 | // didn't move too far away into a spot that's blocking them or out of sight. If this check fails, |
420 | 424 | // we have to move the player back to their original position before the backtrace happened. |
421 | 425 | if ( SERVER_ShouldAcceptBacktraceResult( ulIdx, oldData.PositionData ) == false ) |
426 | + { | |
422 | 427 | oldData.Restore( &players[ulIdx], true ); |
428 | + } | |
429 | + else | |
430 | + { | |
431 | + players[ulIdx].mo->velx += client->backtraceThrust[0]; | |
432 | + players[ulIdx].mo->vely += client->backtraceThrust[1]; | |
433 | + players[ulIdx].mo->velz += client->backtraceThrust[2]; | |
434 | + } | |
423 | 435 | } |
424 | 436 | |
425 | 437 | SERVER_ResetClientExtrapolation( ulIdx ); |
@@ -648,6 +648,23 @@ | ||
648 | 648 | // [BB] Tick the unlagged module. |
649 | 649 | UNLAGGED_Tick( ); |
650 | 650 | |
651 | + // [AK] If the skip correction is enabled, also record their velocities before they move. | |
652 | + // This way, we can determine how much the player is thrusted, in case we need to perform a | |
653 | + // backtrace on them, so we can re-add the thrust velocity afterwards. | |
654 | + if ( sv_smoothplayers ) | |
655 | + { | |
656 | + for ( ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ ) | |
657 | + { | |
658 | + if (( SERVER_IsValidClient( ulIdx )) && ( players[ulIdx].mo )) | |
659 | + { | |
660 | + CLIENT_s *client = SERVER_GetClient( ulIdx ); | |
661 | + client->backtraceThrust[0] = players[ulIdx].mo->velx; | |
662 | + client->backtraceThrust[1] = players[ulIdx].mo->vely; | |
663 | + client->backtraceThrust[2] = players[ulIdx].mo->velz; | |
664 | + } | |
665 | + } | |
666 | + } | |
667 | + | |
651 | 668 | G_Ticker (); |
652 | 669 | |
653 | 670 | // However we need to spawn the unlagged debug actors here i.e. after having processed their |
@@ -453,6 +453,10 @@ | ||
453 | 453 | // [AK] Last tic we processed a backtrace on this client. |
454 | 454 | LONG lLastBacktraceTic; |
455 | 455 | |
456 | + // [AK] The player might have already been pushed before we start performing a backtrace on them, so | |
457 | + // we need to know how much thrust we need to add back in case the backtrace succeeds. | |
458 | + fixed_t backtraceThrust[3]; | |
459 | + | |
456 | 460 | // [BB] Variables for the account system |
457 | 461 | FString username; |
458 | 462 | unsigned int clientSessionID; |