Commit MetaInfo

Revision8be14ead4f32cffaf615e012e6a95e25ce77f419 (tree)
Time2021-10-16 13:14:24
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Before performing a backtrace, remember how much we need to thrust the player again upon completing the backtrace successfully.

Change Summary

Incremental Difference

diff -r 6b77c2ab84bd -r 8be14ead4f32 src/p_tick.cpp
--- a/src/p_tick.cpp Sat Oct 16 00:09:50 2021 -0400
+++ b/src/p_tick.cpp Sat Oct 16 00:14:24 2021 -0400
@@ -379,6 +379,10 @@
379379
380380 if (( bPressedAnything ) && ( client->OldData->pMorphedPlayerClass == players[ulIdx].MorphedPlayerClass ))
381381 {
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+
382386 CLIENT_PLAYER_DATA_s oldData( &players[ulIdx] );
383387 client->OldData->Restore( &players[ulIdx], false );
384388
@@ -419,7 +423,15 @@
419423 // didn't move too far away into a spot that's blocking them or out of sight. If this check fails,
420424 // we have to move the player back to their original position before the backtrace happened.
421425 if ( SERVER_ShouldAcceptBacktraceResult( ulIdx, oldData.PositionData ) == false )
426+ {
422427 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+ }
423435 }
424436
425437 SERVER_ResetClientExtrapolation( ulIdx );
diff -r 6b77c2ab84bd -r 8be14ead4f32 src/sv_main.cpp
--- a/src/sv_main.cpp Sat Oct 16 00:09:50 2021 -0400
+++ b/src/sv_main.cpp Sat Oct 16 00:14:24 2021 -0400
@@ -648,6 +648,23 @@
648648 // [BB] Tick the unlagged module.
649649 UNLAGGED_Tick( );
650650
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+
651668 G_Ticker ();
652669
653670 // However we need to spawn the unlagged debug actors here i.e. after having processed their
diff -r 6b77c2ab84bd -r 8be14ead4f32 src/sv_main.h
--- a/src/sv_main.h Sat Oct 16 00:09:50 2021 -0400
+++ b/src/sv_main.h Sat Oct 16 00:14:24 2021 -0400
@@ -453,6 +453,10 @@
453453 // [AK] Last tic we processed a backtrace on this client.
454454 LONG lLastBacktraceTic;
455455
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+
456460 // [BB] Variables for the account system
457461 FString username;
458462 unsigned int clientSessionID;
Show on old repository browser