• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-c誰得cocoaqtpythonrubywindowsphpgameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwitterdombtronvb.nettestarduinodirectxpreviewerゲームエンジン

This is a fork of Zandronum Beta for TSPG.


Commit MetaInfo

Revisioned48c3edd00033e44cd2a7d2e136b1c60e5f4548 (tree)
Time2021-11-19 21:39:38
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Keep track of any specials the player executed during extrapolation so that if they execute the exact same special during a backtrace, the server can simply cancel the execution.

Change Summary

Incremental Difference

diff -r e4b0ce5c2498 -r ed48c3edd000 src/p_lnspec.cpp
--- a/src/p_lnspec.cpp Thu Nov 18 20:44:25 2021 -0500
+++ b/src/p_lnspec.cpp Fri Nov 19 07:39:38 2021 -0500
@@ -3925,6 +3925,37 @@
39253925 {
39263926 if (num >= 0 && num <= 255)
39273927 {
3928+ // [AK] If we're the server and the activator is a player, check if they're being extrapolated
3929+ // or backtraced right now. We want to keep track of any specials this player has executed while
3930+ // being extrapolated so that if they're backtraced and execute the exact same special again, we
3931+ // can simply cancel the execution.
3932+ if (( NETWORK_GetState( ) == NETSTATE_SERVER ) && ( activator ) && ( activator->player ))
3933+ {
3934+ CLIENT_s *pClient = SERVER_GetClient( activator->player - players );
3935+ CLIENT_SAVED_SPECIAL_s savedSpecial;
3936+
3937+ if ( SERVER_IsBacktracingPlayer( activator->player - players ))
3938+ {
3939+ for ( unsigned int i = 0; i < pClient->ExtrapolatedSpecials.Size( ); i++ )
3940+ {
3941+ savedSpecial = pClient->ExtrapolatedSpecials[i];
3942+
3943+ // [AK] If this is the same special, don't execute it again!
3944+ if (( num == savedSpecial.num ) && ( line == savedSpecial.line ) && ( backSide == savedSpecial.backSide ))
3945+ return 0;
3946+ }
3947+ }
3948+ else if ( SERVER_IsExtrapolatingPlayer( activator->player - players ))
3949+ {
3950+ savedSpecial.num = num;
3951+ savedSpecial.line = line;
3952+ savedSpecial.backSide = backSide;
3953+
3954+ // [AK] Save the info about this special for later.
3955+ pClient->ExtrapolatedSpecials.Push( savedSpecial );
3956+ }
3957+ }
3958+
39283959 return LineSpecials[num](line, activator, backSide, arg1, arg2, arg3, arg4, arg5);
39293960 }
39303961 return 0;
diff -r e4b0ce5c2498 -r ed48c3edd000 src/sv_main.cpp
--- a/src/sv_main.cpp Thu Nov 18 20:44:25 2021 -0500
+++ b/src/sv_main.cpp Fri Nov 19 07:39:38 2021 -0500
@@ -5618,6 +5618,7 @@
56185618 }
56195619
56205620 g_aClients[ulClient].ulExtrapolatedTics = 0;
5621+ g_aClients[ulClient].ExtrapolatedSpecials.Clear( );
56215622 g_aClients[ulClient].bIsBacktracing = false;
56225623 }
56235624
diff -r e4b0ce5c2498 -r ed48c3edd000 src/sv_main.h
--- a/src/sv_main.h Thu Nov 18 20:44:25 2021 -0500
+++ b/src/sv_main.h Fri Nov 19 07:39:38 2021 -0500
@@ -230,6 +230,14 @@
230230 };
231231
232232 //*****************************************************************************
233+struct CLIENT_SAVED_SPECIAL_s
234+{
235+ int num;
236+ line_t *line;
237+ bool backSide;
238+};
239+
240+//*****************************************************************************
233241 struct CLIENT_PLAYER_DATA_s
234242 {
235243 ULONG ulSavedGametic;
@@ -476,6 +484,9 @@
476484 // Each backup command received per tic delays the client's ping by ~29 ms.
477485 ULONG ulExtraDelay;
478486
487+ // [AK] A list of specials this player executed while being extrapolated.
488+ TArray<CLIENT_SAVED_SPECIAL_s> ExtrapolatedSpecials;
489+
479490 // [AK] The player might have already been pushed before we start performing a backtrace on them, so
480491 // we need to know how much thrust we need to add back in case the backtrace succeeds.
481492 fixed_t backtraceThrust[3];