@@ -754,30 +754,6 @@ void SV_ForceFullClientsUpdate(void)
754
754
755
755
void SV_RunCmd (usercmd_t *ucmd, int random_seed)
756
756
{
757
- #ifdef REHLDS_FIXES
758
- auto gameClient = g_GameClients[host_client - g_psvs.clients ];
759
- float playerFrameTime = (1 .0f / sys_ticrate.value );
760
- float flTimeAllowedForProcessing = gameClient->ConsumeMovementTimeForUserCmdProcessing ( playerFrameTime );
761
- bool isBot = host_client->fakeclient ;
762
- if ( !isBot && ( flTimeAllowedForProcessing < playerFrameTime ) )
763
- {
764
- // Make sure that the activity in command is erased because player cheated or dropped too many packets
765
- double dblWarningFrequencyThrottle = sv_maxusrcmdprocessticks_warning.value ;
766
- if ( dblWarningFrequencyThrottle >= 0.0 )
767
- {
768
- static double s_dblLastWarningTime = 0.0 ;
769
- double dblTimeNow = Sys_FloatTime ();
770
- if ( !s_dblLastWarningTime || ( dblTimeNow - s_dblLastWarningTime >= dblWarningFrequencyThrottle ) )
771
- {
772
- s_dblLastWarningTime = dblTimeNow;
773
- Con_Printf ( " sv_maxusrcmdprocessticks_warning at server tick %u: Ignored client %s usrcmd (%.6f < %.6f)!\n " ,
774
- /* System::GetTick() */ 1337 , host_client->name , flTimeAllowedForProcessing, playerFrameTime );
775
- }
776
- }
777
- return ; // Don't process this command
778
- }
779
- #endif // REHLDS_FIXES
780
-
781
757
usercmd_t cmd = *ucmd;
782
758
int i;
783
759
edict_t *ent;
@@ -814,6 +790,54 @@ void SV_RunCmd(usercmd_t *ucmd, int random_seed)
814
790
}
815
791
#endif
816
792
793
+ #ifdef REHLDS_FIXES
794
+ #define TICK_INTERVAL (1 .0f / sys_ticrate.value)
795
+
796
+ CGameClient* gameClient = g_GameClients[host_client - g_psvs.clients ];
797
+ bool bRunNullCmd = false ;
798
+ if (int numUsrCmdProcessTicksMax = (int )sv_maxusrcmdprocessticks.value )
799
+ {
800
+ // Grant the client some time buffer to execute user commands
801
+ gameClient->m_flMovementTimeForUserCmdProcessingRemaining += TICK_INTERVAL;
802
+
803
+ // but never accumulate more than N ticks
804
+ if (gameClient->GetRemainingMovementTimeForUserCmdProcessing () > numUsrCmdProcessTicksMax * TICK_INTERVAL)
805
+ {
806
+ gameClient->m_flMovementTimeForUserCmdProcessingRemaining = numUsrCmdProcessTicksMax * TICK_INTERVAL;
807
+ bRunNullCmd = true ;
808
+ }
809
+ }
810
+ /* else
811
+ {
812
+ // Otherwise we don't care to track time
813
+ m_flMovementTimeForUserCmdProcessingRemaining = FLT_MAX;
814
+ }
815
+ */
816
+
817
+ float playerFrameTime = TICK_INTERVAL;
818
+ float flTimeAllowedForProcessing = gameClient->ConsumeMovementTimeForUserCmdProcessing (playerFrameTime);
819
+ bool isBot = host_client->fakeclient ;
820
+
821
+ if (!isBot && (flTimeAllowedForProcessing < playerFrameTime))
822
+ {
823
+ // Make sure that the activity in command is erased because player cheated or dropped too many packets
824
+ double dblWarningFrequencyThrottle = sv_maxusrcmdprocessticks_warning.value ;
825
+ if (dblWarningFrequencyThrottle >= 0.0 )
826
+ {
827
+ static double s_dblLastWarningTime = 0.0 ;
828
+ double dblTimeNow = Sys_FloatTime ();
829
+ if (!s_dblLastWarningTime || (dblTimeNow - s_dblLastWarningTime >= dblWarningFrequencyThrottle))
830
+ {
831
+ s_dblLastWarningTime = dblTimeNow;
832
+ Con_Printf (" sv_maxusrcmdprocessticks_warning at server tick %u: Ignored client %s usrcmd (%.6f < %.6f)!\n " ,
833
+ /* System::GetTick() */ 123 , host_client->name , flTimeAllowedForProcessing, playerFrameTime);
834
+ }
835
+ }
836
+
837
+ return ; // Don't process this command
838
+ }
839
+ #endif // REHLDS_FIXES
840
+
817
841
gEntityInterface .pfnCmdStart (sv_player, ucmd, random_seed);
818
842
frametime = float (ucmd->msec * 0.001 );
819
843
host_client->svtimebase = frametime + host_client->svtimebase ;
0 commit comments