Some whitespace, removed the timekick detection for slow-mo clients. There

are way too many legitimate ways to get a too-slow time, unfortunately.
This commit is contained in:
Jeff Teunissen 2000-12-08 06:14:26 +00:00
parent c74861ceb5
commit b62d75a774

View file

@ -289,8 +289,7 @@ void SV_PreSpawn_f (void)
} }
// handle the case of a level changing while a client was connecting // handle the case of a level changing while a client was connecting
if ( atoi(Cmd_Argv(1)) != svs.spawncount ) if (atoi (Cmd_Argv (1)) != svs.spawncount) {
{
Con_Printf ("SV_PreSpawn_f from different level\n"); Con_Printf ("SV_PreSpawn_f from different level\n");
SV_New_f (); SV_New_f ();
return; return;
@ -318,8 +317,8 @@ void SV_PreSpawn_f (void)
host_client->checksum = check; host_client->checksum = check;
} }
//NOTE: This doesn't go through ClientReliableWrite since it's before the user // NOTE: This doesn't go through ClientReliableWrite since it's before the user
//spawns. These functions are written to not overflow // spawns. These functions are written to not overflow
if (host_client->num_backbuf) { if (host_client->num_backbuf) {
Con_Printf("WARNING %s: [SV_PreSpawn] Back buffered (%d0, clearing", host_client->name, host_client->netchan.message.cursize); Con_Printf("WARNING %s: [SV_PreSpawn] Back buffered (%d0, clearing", host_client->name, host_client->netchan.message.cursize);
host_client->num_backbuf = 0; host_client->num_backbuf = 0;
@ -331,13 +330,10 @@ void SV_PreSpawn_f (void)
sv.signon_buffer_size[buf]); sv.signon_buffer_size[buf]);
buf++; buf++;
if (buf == sv.num_signon_buffers) if (buf == sv.num_signon_buffers) { // all done prespawning
{ // all done prespawning
MSG_WriteByte (&host_client->netchan.message, svc_stufftext); MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
MSG_WriteString (&host_client->netchan.message, va("cmd spawn %i 0\n",svs.spawncount) ); MSG_WriteString (&host_client->netchan.message, va("cmd spawn %i 0\n",svs.spawncount) );
} } else { // need to prespawn more
else
{ // need to prespawn more
MSG_WriteByte (&host_client->netchan.message, svc_stufftext); MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
MSG_WriteString (&host_client->netchan.message, MSG_WriteString (&host_client->netchan.message,
va("cmd prespawn %i %i\n", svs.spawncount, buf) ); va("cmd prespawn %i %i\n", svs.spawncount, buf) );
@ -357,45 +353,39 @@ void SV_Spawn_f (void)
eval_t *val; eval_t *val;
int n; int n;
if (host_client->state != cs_connected) if (host_client->state != cs_connected) {
{
Con_Printf ("Spawn not valid -- allready spawned\n"); Con_Printf ("Spawn not valid -- allready spawned\n");
return; return;
} }
// handle the case of a level changing while a client was connecting // handle the case of a level changing while a client was connecting
if ( atoi(Cmd_Argv(1)) != svs.spawncount ) if (atoi (Cmd_Argv (1)) != svs.spawncount) {
{
Con_Printf ("SV_Spawn_f from different level\n"); Con_Printf ("SV_Spawn_f from different level\n");
SV_New_f (); SV_New_f ();
return; return;
} }
n = atoi(Cmd_Argv(2)); n = atoi (Cmd_Argv (2));
// make sure n is valid // make sure n is valid
if ( n < 0 || n > MAX_CLIENTS ) if (n < 0 || n > MAX_CLIENTS) {
{
Con_Printf ("SV_Spawn_f invalid client start\n"); Con_Printf ("SV_Spawn_f invalid client start\n");
SV_New_f (); SV_New_f ();
return; return;
} }
// send all current names, colors, and frag counts
// send all current names, colors, and frag counts
// FIXME: is this a good thing? // FIXME: is this a good thing?
SZ_Clear (&host_client->netchan.message); SZ_Clear (&host_client->netchan.message);
// send current status of all other players // send current status of all other players
// normally this could overflow, but no need to check due to backbuf // normally this could overflow, but no need to check due to backbuf
for (i=n, client = svs.clients + n ; i<MAX_CLIENTS ; i++, client++) for (i=n, client = svs.clients + n ; i<MAX_CLIENTS ; i++, client++)
SV_FullClientUpdateToClient (client, host_client); SV_FullClientUpdateToClient (client, host_client);
// send all current light styles // send all current light styles
for (i=0 ; i<MAX_LIGHTSTYLES ; i++) for (i = 0; i < MAX_LIGHTSTYLES; i++) {
{
ClientReliableWrite_Begin (host_client, svc_lightstyle, ClientReliableWrite_Begin (host_client, svc_lightstyle,
3 + (sv.lightstyles[i] ? strlen(sv.lightstyles[i]) : 1)); 3 + (sv.lightstyles[i] ? strlen(sv.lightstyles[i]) : 1));
ClientReliableWrite_Byte (host_client, (char)i); ClientReliableWrite_Byte (host_client, (char)i);
@ -444,7 +434,6 @@ void SV_Spawn_f (void)
// when that is completed, a begin command will be issued // when that is completed, a begin command will be issued
ClientReliableWrite_Begin (host_client, svc_stufftext, 8); ClientReliableWrite_Begin (host_client, svc_stufftext, 8);
ClientReliableWrite_String (host_client, "skins\n" ); ClientReliableWrite_String (host_client, "skins\n" );
} }
/* /*
@ -490,20 +479,18 @@ void SV_Begin_f (void)
host_client->state = cs_spawned; host_client->state = cs_spawned;
// handle the case of a level changing while a client was connecting // handle the case of a level changing while a client was connecting
if ( atoi(Cmd_Argv(1)) != svs.spawncount ) if (atoi (Cmd_Argv (1)) != svs.spawncount) {
{
Con_Printf ("SV_Begin_f from different level\n"); Con_Printf ("SV_Begin_f from different level\n");
SV_New_f (); SV_New_f ();
return; return;
} }
if (host_client->spectator) if (host_client->spectator) {
{
SV_SpawnSpectator (); SV_SpawnSpectator ();
if (SpectatorConnect) { if (SpectatorConnect) {
// copy spawn parms out of the client_t // copy spawn parms out of the client_t
for (i=0 ; i< NUM_SPAWN_PARMS ; i++) for (i = 0; i < NUM_SPAWN_PARMS; i++)
(&pr_global_struct->parm1)[i] = host_client->spawn_parms[i]; (&pr_global_struct->parm1)[i] = host_client->spawn_parms[i];
// call the spawn function // call the spawn function
@ -511,11 +498,9 @@ void SV_Begin_f (void)
pr_global_struct->self = EDICT_TO_PROG(sv_player); pr_global_struct->self = EDICT_TO_PROG(sv_player);
PR_ExecuteProgram (SpectatorConnect); PR_ExecuteProgram (SpectatorConnect);
} }
} } else {
else
{
// copy spawn parms out of the client_t // copy spawn parms out of the client_t
for (i=0 ; i< NUM_SPAWN_PARMS ; i++) for (i = 0; i < NUM_SPAWN_PARMS; i++)
(&pr_global_struct->parm1)[i] = host_client->spawn_parms[i]; (&pr_global_struct->parm1)[i] = host_client->spawn_parms[i];
// call the spawn function // call the spawn function
@ -530,18 +515,17 @@ void SV_Begin_f (void)
} }
// clear the net statistics, because connecting gives a bogus picture // clear the net statistics, because connecting gives a bogus picture
host_client->last_check = -1;
host_client->netchan.frame_latency = 0; host_client->netchan.frame_latency = 0;
host_client->netchan.frame_rate = 0; host_client->netchan.frame_rate = 0;
host_client->netchan.drop_count = 0; host_client->netchan.drop_count = 0;
host_client->netchan.good_count = 0; host_client->netchan.good_count = 0;
//check he's not cheating // check he's not cheating
pmodel = atoi (Info_ValueForKey (host_client->userinfo, "pmodel"));
emodel = atoi (Info_ValueForKey (host_client->userinfo, "emodel"));
pmodel = atoi(Info_ValueForKey (host_client->userinfo, "pmodel")); if (pmodel != sv.model_player_checksum || emodel != sv.eyes_player_checksum)
emodel = atoi(Info_ValueForKey (host_client->userinfo, "emodel"));
if (pmodel != sv.model_player_checksum ||
emodel != sv.eyes_player_checksum)
SV_BroadcastPrintf (PRINT_HIGH, "%s WARNING: non standard player/eyes model detected\n", host_client->name); SV_BroadcastPrintf (PRINT_HIGH, "%s WARNING: non standard player/eyes model detected\n", host_client->name);
// if we are paused, tell the client // if we are paused, tell the client
@ -1454,22 +1438,18 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
edict_t *ent; edict_t *ent;
int i, n, oldmsec; int i, n, oldmsec;
double tmp_time; double tmp_time;
int tmp_time1, tmp_time2; int tmp_time1;
// To prevent a infinite loop if (!inside) { // prevent infinite loop
if (!inside) {
host_client->msecs += ucmd->msec; host_client->msecs += ucmd->msec;
if ((sv_timekick->int_val) if ((sv_timekick->int_val)
&& (tmp_time = realtime - host_client->last_check) >= sv_timekick_interval->value) { && ((tmp_time = realtime - host_client->last_check) >= sv_timekick_interval->value)) {
tmp_time1 = tmp_time * (1000 + sv_timekick_fuzz->value); tmp_time1 = tmp_time * (1000 + sv_timekick_fuzz->value);
// handle underspeeds too, but with double fuzz applied
tmp_time2 = tmp_time * (1000 - (sv_timekick_fuzz->value * 2));
if ((host_client->last_check != -1) // don't do it if new player if ((host_client->last_check != -1) // don't do it if new player
&& ((host_client->msecs > (int) tmp_time1) && (host_client->msecs > tmp_time1)) {
|| (host_client->msecs < (int) tmp_time2))) {
host_client->msec_cheating++; host_client->msec_cheating++;
SV_BroadcastPrintf (PRINT_HIGH, SV_BroadcastPrintf (PRINT_HIGH,
va ("%s thinks there are %d ms in %d seconds (Strike %d/%d)\n", va ("%s thinks there are %d ms in %d seconds (Strike %d/%d)\n",
@ -1477,11 +1457,10 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
host_client->msec_cheating, sv_timekick->int_val)); host_client->msec_cheating, sv_timekick->int_val));
if (host_client->msec_cheating >= sv_timekick->int_val) { if (host_client->msec_cheating >= sv_timekick->int_val) {
SV_BroadcastPrintf (PRINT_HIGH, va("Strike %d for %s!!\n", SV_BroadcastPrintf (PRINT_HIGH, va ("Strike %d for %s!!\n",
host_client->msec_cheating, host_client->name)); host_client->msec_cheating, host_client->name));
SV_BroadcastPrintf (PRINT_HIGH, "Please see http://www.quakeforge.net/speed_cheat.php for infomation on QuakeForge's time cheat protection, and to explain how some may be cheating without knowing it.\n" SV_BroadcastPrintf (PRINT_HIGH, "Please see http://www.quakeforge.net/speed_cheat.php for infomation on QuakeForge's time cheat protection, and to explain how some may be cheating without knowing it.\n");
); SV_DropClient (host_client);
SV_DropClient(host_client);
} }
} }