edict_t *sv_player;
-extern cvar_t sv_friction;
cvar_t sv_edgefriction = {"edgefriction", "2"};
-extern cvar_t sv_stopspeed;
+cvar_t sv_predict = {"sv_predict", "1"};
+cvar_t sv_deltacompress = {"sv_deltacompress", "1"};
static vec3_t forward, right, up;
// apply friction
control = speed < sv_stopspeed.value ? sv_stopspeed.value : speed;
- newspeed = speed - host_frametime*control*friction;
+ newspeed = speed - sv.frametime*control*friction;
if (newspeed < 0)
newspeed = 0;
VectorSubtract (wishvel, velocity, pushvec);
addspeed = VectorNormalize (pushvec);
- accelspeed = sv_accelerate.value*host_frametime*addspeed;
+ accelspeed = sv_accelerate.value*sv.frametime*addspeed;
if (accelspeed > addspeed)
accelspeed = addspeed;
addspeed = wishspeed - currentspeed;
if (addspeed <= 0)
return;
- accelspeed = sv_accelerate.value*host_frametime*wishspeed;
+ accelspeed = sv_accelerate.value*sv.frametime*wishspeed;
if (accelspeed > addspeed)
accelspeed = addspeed;
addspeed = wishspd - currentspeed;
if (addspeed <= 0)
return;
-// accelspeed = sv_accelerate.value * host_frametime;
- accelspeed = sv_accelerate.value*wishspeed * host_frametime;
+// accelspeed = sv_accelerate.value * sv.frametime;
+ accelspeed = sv_accelerate.value*wishspeed * sv.frametime;
if (accelspeed > addspeed)
accelspeed = addspeed;
void DropPunchAngle (void)
{
float len;
+ eval_t *val;
len = VectorNormalizeLength (sv_player->v.punchangle);
- len -= 10*host_frametime;
+ len -= 10*sv.frametime;
if (len < 0)
len = 0;
VectorScale (sv_player->v.punchangle, len, sv_player->v.punchangle);
+
+ if ((val = GETEDICTFIELDVALUE(sv_player, eval_punchvector)))
+ {
+ len = VectorNormalizeLength (val->vector);
+
+ len -= 20*sv.frametime;
+ if (len < 0)
+ len = 0;
+ VectorScale (val->vector, len, val->vector);
+ }
}
/*
speed = Length (velocity);
if (speed)
{
- newspeed = speed - host_frametime * speed * sv_friction.value;
+ newspeed = speed - sv.frametime * speed * sv_friction.value;
if (newspeed < 0)
newspeed = 0;
VectorScale (velocity, newspeed/speed, velocity);
return;
VectorNormalize (wishvel);
- accelspeed = sv_accelerate.value * wishspeed * host_frametime;
+ accelspeed = sv_accelerate.value * wishspeed * sv.frametime;
if (accelspeed > addspeed)
accelspeed = addspeed;
//
// walk
//
- if ( (sv_player->v.waterlevel >= 2)
- && (sv_player->v.movetype != MOVETYPE_NOCLIP) )
+ if ( (sv_player->v.waterlevel >= 2) && (sv_player->v.movetype != MOVETYPE_NOCLIP) )
{
SV_WaterMove ();
return;
for (i=0, total = 0;i < NUM_PING_TIMES;i++)
total += host_client->ping_times[i];
host_client->ping = total / NUM_PING_TIMES; // can be used for prediction
- if (!sv.paused && (svs.maxclients > 1 || key_dest == key_game) ) // if paused for any reason, don't predict
- host_client->latency = host_client->ping + sv_frametime; // push ahead by ticrate
+ host_client->latency = 0;
+ if (sv_predict.value && (svs.maxclients > 1) && (!sv.paused)) // if paused or a local game, don't predict
+ host_client->latency = host_client->ping;
if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_ping)))
val->_float = host_client->ping * 1000.0;
int ret;
int cmd;
char *s;
-
+
do
{
nextmsg:
}
if (!ret)
return true;
-
+
MSG_BeginReading ();
-
+
while (1)
{
if (!host_client->active)
Con_DPrintf("%s tried to %s\n", host_client->name, s);
*/
break;
-
+
case clc_disconnect:
// Sys_Printf ("SV_ReadClientMessage: client disconnected\n");
return false;
-
+
case clc_move:
SV_ReadClientMove (&host_client->cmd);
break;
}
}
} while (ret == 1);
-
+
return true;
}
SV_RunClients
==================
*/
-extern dfunction_t *SV_PlayerPhysicsQC;
void SV_RunClients (void)
{
int i;
{
pr_global_struct->time = sv.time;
pr_global_struct->self = EDICT_TO_PROG(sv_player);
- PR_ExecuteProgram ((func_t)(SV_PlayerPhysicsQC - pr_functions));
+ PR_ExecuteProgram ((func_t)(SV_PlayerPhysicsQC - pr_functions), "");
}
else
SV_ClientThink ();