@@ -754,6 +754,27 @@ void SV_ForceFullClientsUpdate(void)
754
754
755
755
void SV_RunCmd (usercmd_t *ucmd, int random_seed)
756
756
{
757
+ const float playerFrameTime = (1 .0f / sys_ticrate.value );
758
+ const float flTimeAllowedForProcessing = host_client->ConsumeMovementTimeForUserCmdProcessing ( playerFrameTime );
759
+ bool isBot = host_client->fakeclient ;
760
+ if ( !isBot && ( flTimeAllowedForProcessing < playerFrameTime ) )
761
+ {
762
+ // Make sure that the activity in command is erased because player cheated or dropped too many packets
763
+ double dblWarningFrequencyThrottle = sv_maxusrcmdprocessticks_warning.value ;
764
+ if ( dblWarningFrequencyThrottle >= 0.0 )
765
+ {
766
+ static double s_dblLastWarningTime = 0.0 ;
767
+ double dblTimeNow = Sys_FloatTime ();
768
+ if ( !s_dblLastWarningTime || ( dblTimeNow - s_dblLastWarningTime >= dblWarningFrequencyThrottle ) )
769
+ {
770
+ s_dblLastWarningTime = dblTimeNow;
771
+ Con_Printf ( " sv_maxusrcmdprocessticks_warning at server tick %u: Ignored client %s usrcmd (%.6f < %.6f)!\n " ,
772
+ m_system->GetTick (), host_client->name , flTimeAllowedForProcessing, playerFrameTime );
773
+ }
774
+ }
775
+ return ; // Don't process this command
776
+ }
777
+
757
778
usercmd_t cmd = *ucmd;
758
779
int i;
759
780
edict_t *ent;
@@ -1042,63 +1063,6 @@ void SV_RunCmd(usercmd_t *ucmd, int random_seed)
1042
1063
1043
1064
if (!host_client->fakeclient )
1044
1065
SV_RestoreMove (host_client);
1045
-
1046
- // If we have to restore the view angle then do so right now
1047
-
1048
- // TODO: Implement: in `player.h` & `player.cpp`
1049
- /*
1050
- QAngle m_qangLockViewangles;
1051
- int m_iLockViewanglesTickNumber;
1052
-
1053
- int GetLockViewanglesTickNumber() const { return m_iLockViewanglesTickNumber; }
1054
- QAngle GetLockViewanglesData() const { return m_qangLockViewangles; }
1055
-
1056
- ////////////
1057
- void CCSPlayer::NoteWeaponFired()
1058
- {
1059
- Assert( m_pCurrentCommand );
1060
- if( m_pCurrentCommand )
1061
- {
1062
- m_iLastWeaponFireUsercmd = m_pCurrentCommand->command_number;
1063
- }
1064
-
1065
- // Remember the tickcount when the weapon was fired and lock viewangles here!
1066
- if ( m_iLockViewanglesTickNumber != gpGlobals->tickcount )
1067
- {
1068
- m_iLockViewanglesTickNumber = gpGlobals->tickcount;
1069
- m_qangLockViewangles = pl.v_angle;
1070
- }
1071
- }
1072
- */
1073
-
1074
- /* *
1075
- Implement in CCSPlayer::FireBullet:
1076
-
1077
- // Let the player remember the usercmd he fired a weapon on. Assists in making decisions about lag compensation.
1078
- if ( pPlayer )
1079
- pPlayer->NoteWeaponFired();
1080
-
1081
-
1082
- if ( bBulletHitPlayer && !bShotHitTeammate )
1083
- { // Guarantee that the bullet that hit an enemy trumps the player viewangles
1084
- // that are locked in for the duration of the server simulation ticks
1085
- m_iLockViewanglesTickNumber = gpGlobals->tickcount;
1086
- m_qangLockViewangles = pl.v_angle;
1087
- }
1088
- */
1089
-
1090
- /*
1091
- Implement in SV_RunCmd():
1092
-
1093
- // player->IsBot() == sv_player->fakeclient
1094
- // tickcount == m_System->GetTick()
1095
-
1096
- if ( !player->IsBot() &&
1097
- ( gpGlobals->tickcount - player->GetLockViewanglesTickNumber() < sv_maxusrcmdprocessticks_holdaim.value ) )
1098
- {
1099
- player->pl.v_angle = player->GetLockViewanglesData();
1100
- }
1101
- */
1102
1066
}
1103
1067
1104
1068
int SV_ValidateClientCommand (char *pszCommand)
0 commit comments