cvar_t sv_deltacompress = {0, "sv_deltacompress", "1"};
cvar_t sv_idealpitchscale = {0, "sv_idealpitchscale","0.8"};
cvar_t sv_maxspeed = {CVAR_NOTIFY, "sv_maxspeed", "320"};
+cvar_t sv_maxairspeed = {0, "sv_maxairspeed", "30"};
cvar_t sv_accelerate = {0, "sv_accelerate", "10"};
static usercmd_t cmd;
float addspeed, wishspd, accelspeed, currentspeed;
wishspd = VectorNormalizeLength (wishveloc);
- if (wishspd > 30)
- wishspd = 30;
+ if (wishspd > sv_maxairspeed.value)
+ wishspd = sv_maxairspeed.value;
currentspeed = DotProduct (host_client->edict->fields.server->velocity, wishveloc);
addspeed = wishspd - currentspeed;
if (addspeed <= 0)
SV_ReadClientMove
===================
*/
-extern void SV_Physics_Entity (prvm_edict_t *ent, qboolean runmove);
+void SV_ApplyClientMove (void);
void SV_ReadClientMove (void)
{
int i;
if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
// read impulse
- i = MSG_ReadByte ();
- if (i)
- move->impulse = i;
+ move->impulse = MSG_ReadByte ();
if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
// PRYDON_CLIENTCURSOR
memset(move, 0, sizeof(*move));
else
{
+ // apply the latest accepted move to the entity fields
+ SV_ApplyClientMove();
host_client->movesequence = move->sequence;
if (host_client->movesequence)
{
if (frametime > 0.1)
frametime = 0.1;
prog->globals.server->frametime = frametime;
- SV_Physics_Entity(host_client->edict, true);
+ SV_Physics_ClientEntity(host_client->edict);
prog->globals.server->frametime = oldframetime;
}
}
void SV_ApplyClientMove (void)
{
+#ifdef NUM_PING_TIMES
int i;
- prvm_eval_t *val;
float total;
+#endif
+ prvm_eval_t *val;
usercmd_t *move = &host_client->cmd;
// calculate average ping time
+ host_client->ping = move->receivetime - move->time;
+#ifdef NUM_PING_TIMES
host_client->ping_times[host_client->num_pings % NUM_PING_TIMES] = move->receivetime - move->time;
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
// set the edict fields
host_client->edict->fields.server->button0 = move->buttons & 1;
host_client->edict->fields.server->button2 = (move->buttons & 2)>>1;
- host_client->edict->fields.server->impulse = move->impulse;
+ if (move->impulse)
+ host_client->edict->fields.server->impulse = move->impulse;
VectorCopy(move->viewangles, host_client->edict->fields.server->v_angle);
if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button3))) val->_float = ((move->buttons >> 2) & 1);
if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button4))) val->_float = ((move->buttons >> 3) & 1);
if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button6))) val->_float = ((move->buttons >> 5) & 1);
if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button7))) val->_float = ((move->buttons >> 6) & 1);
if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button8))) val->_float = ((move->buttons >> 7) & 1);
+ if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button9))) val->_float = ((move->buttons >> 11) & 1);
+ if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button10))) val->_float = ((move->buttons >> 12) & 1);
+ if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button11))) val->_float = ((move->buttons >> 13) & 1);
+ if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button12))) val->_float = ((move->buttons >> 14) & 1);
+ if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button13))) val->_float = ((move->buttons >> 15) & 1);
+ if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button14))) val->_float = ((move->buttons >> 16) & 1);
+ if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button15))) val->_float = ((move->buttons >> 17) & 1);
+ if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_button16))) val->_float = ((move->buttons >> 18) & 1);
if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_buttonuse))) val->_float = ((move->buttons >> 8) & 1);
if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_buttonchat))) val->_float = ((move->buttons >> 9) & 1);
if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_cursor_active))) val->_float = ((move->buttons >> 10) & 1);