vec_t cursor_fraction;
int cursor_entitynumber;
- double time; // time the move is executed for (cl_movement: clienttime, non-cl_movement: receivetime)
- double receivetime; // time the move was received at
- double clienttime; // time to which server state the move corresponds to
+ double time; // time the move is executed for (non-cl_movement is executed at receivetime)
+ float receivetime; // time the move was received at (used for ping)
int msec; // for predicted moves
int buttons;
int impulse;
int sendflags[NUM_CSQCENTITIES_PER_FRAME];
} csqcentityframedb_t;
-// if defined this does ping smoothing, otherwise it does not
-//#define NUM_PING_TIMES 16
-
#define NUM_SPAWN_PARMS 16
typedef struct client_s
/// PRVM_EDICT_NUM(clientnum+1)
prvm_edict_t *edict;
-#ifdef NUM_PING_TIMES
- float ping_times[NUM_PING_TIMES];
- /// ping_times[num_pings%NUM_PING_TIMES]
- int num_pings;
-#endif
/// LadyHavoc: can be used for prediction or whatever...
float ping;
client->movesequence = 0;
client->movement_highestsequence_seen = 0;
memset(&client->movement_count, 0, sizeof(client->movement_count));
-#ifdef NUM_PING_TIMES
- for (i = 0;i < NUM_PING_TIMES;i++)
- client->ping_times[i] = 0;
- client->num_pings = 0;
-#endif
client->ping = 0;
// allow the client some time to send his keepalives, even if map loading took ages
{
int i;
- // never timeout loopback connections
for (i = (host_isclient.integer ? 1 : 0), host_client = &svs.clients[i]; i < svs.maxclients; i++, host_client++)
{
if (host_client->netconnection && host.realtime > host_client->netconnection->timeout)
// read ping time
if (sv.protocol != PROTOCOL_QUAKE && sv.protocol != PROTOCOL_QUAKEDP && sv.protocol != PROTOCOL_NEHAHRAMOVIE && sv.protocol != PROTOCOL_NEHAHRABJP && sv.protocol != PROTOCOL_NEHAHRABJP2 && sv.protocol != PROTOCOL_NEHAHRABJP3 && sv.protocol != PROTOCOL_DARKPLACES1 && sv.protocol != PROTOCOL_DARKPLACES2 && sv.protocol != PROTOCOL_DARKPLACES3 && sv.protocol != PROTOCOL_DARKPLACES4 && sv.protocol != PROTOCOL_DARKPLACES5 && sv.protocol != PROTOCOL_DARKPLACES6)
move->sequence = MSG_ReadLong(&sv_message);
- move->time = move->clienttime = MSG_ReadFloat(&sv_message);
+ move->time = MSG_ReadFloat(&sv_message);
if (sv_message.badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
move->receivetime = (float)sv.time;
#endif
// limit reported time to current time
// (incase the client is trying to cheat)
- move->time = min(move->time, move->receivetime + sv.frametime);
+ move->time = min(move->time, sv.time + sv.frametime);
// read current angles
for (i = 0;i < 3;i++)
double moveframetime;
double oldframetime;
double oldframetime2;
-#ifdef NUM_PING_TIMES
- double total;
-#endif
+
if (sv_numreadmoves < 1)
return;
// only start accepting input once the player is spawned
// with this approach, and if they don't send input for a while they
// start moving anyway, so the longest 'lagaport' possible is
// determined by the sv_clmovement_inputtimeout cvar)
- if (moveframetime <= 0)
- continue;
oldframetime = PRVM_serverglobalfloat(frametime);
oldframetime2 = sv.frametime;
// update ping time for qc to see while executing this move
host_client->movesequence = 0;
// make sure that normal physics takes over immediately
host_client->clmovement_inputtimeout = 0;
+ // update ping time
+ host_client->ping = host_client->cmd.receivetime - sv_readmoves[sv_numreadmoves-1].time;
}
-
- // calculate average ping time
- host_client->ping = host_client->cmd.receivetime - host_client->cmd.clienttime;
-#ifdef NUM_PING_TIMES
- host_client->ping_times[host_client->num_pings % NUM_PING_TIMES] = host_client->cmd.receivetime - host_client->cmd.clienttime;
- host_client->num_pings++;
- for (i=0, total = 0;i < NUM_PING_TIMES;i++)
- total += host_client->ping_times[i];
- host_client->ping = total / NUM_PING_TIMES;
-#endif
}
void SV_ApplyClientMove (void)