CL_ClientMovement_Move(s);
}
+void CL_ClientMovement_Physics_CPM_PM_Aircontrol(cl_clientmovement_state_t *s, vec3_t wishdir, vec_t wishspeed)
+{
+ vec_t zspeed, speed, dot, k;
+
+ if(s->cmd.forwardmove == 0 || s->cmd.sidemove != 0)
+ return;
+
+ zspeed = s->velocity[2];
+ s->velocity[2] = 0;
+ speed = VectorNormalizeLength(s->velocity);
+
+ dot = DotProduct(s->velocity, wishdir);
+ k = 32;
+ k *= cl.movevars_aircontrol*dot*dot*s->cmd.frametime;
+
+ if(dot > 0) { // we can't change direction while slowing down
+ VectorMAM(speed, s->velocity, k, wishdir, s->velocity);
+ VectorNormalize(s->velocity);
+ }
+
+ VectorScale(s->velocity, speed, s->velocity);
+ s->velocity[2] = zspeed;
+}
+
void CL_ClientMovement_Physics_Walk(cl_clientmovement_state_t *s)
{
vec_t friction;
vec_t vel_straight;
vec_t vel_z;
vec3_t vel_perpend;
+ float wishspeed2, accel;
// apply air speed limit
wishspeed = min(wishspeed, cl.movevars_maxairspeed);
+ accel = cl.movevars_airaccelerate;
+
+ // CPM: air control
+ wishspeed2 = wishspeed;
+ if(cl.movevars_airstopaccelerate != 0)
+ if(DotProduct(s->velocity, wishdir) < 0)
+ accel = cl.movevars_airstopaccelerate;
+ if(s->cmd.forwardmove == 0 && s->cmd.sidemove != 0)
+ {
+ if(cl.movevars_maxairstrafespeed)
+ if(wishspeed > cl.movevars_maxairstrafespeed)
+ wishspeed = cl.movevars_maxairstrafespeed;
+ if(cl.movevars_airstrafeaccelerate)
+ accel = cl.movevars_airstrafeaccelerate;
+ }
+ // !CPM
/*
addspeed = wishspeed - DotProduct(s->velocity, wishdir);
f = wishspeed - vel_straight;
if(f > 0)
- vel_straight += min(f, cl.movevars_airaccelerate * s->cmd.frametime * wishspeed) * cl.movevars_airaccel_qw;
+ vel_straight += min(f, accel * s->cmd.frametime * wishspeed) * cl.movevars_airaccel_qw;
if(wishspeed > 0)
- vel_straight += min(wishspeed, cl.movevars_airaccelerate * s->cmd.frametime * wishspeed) * (1 - cl.movevars_airaccel_qw);
+ vel_straight += min(wishspeed, accel * s->cmd.frametime * wishspeed) * (1 - cl.movevars_airaccel_qw);
VectorM(1 - (s->cmd.frametime * (wishspeed / cl.movevars_maxairspeed) * cl.movevars_airaccel_sideways_friction), vel_perpend, vel_perpend);
VectorMA(vel_perpend, vel_straight, wishdir, s->velocity);
s->velocity[2] += vel_z;
+
+ if(cl.movevars_aircontrol)
+ CL_ClientMovement_Physics_CPM_PM_Aircontrol(s, wishdir, wishspeed2);
}
s->velocity[2] -= cl.movevars_gravity * cl.movevars_entgravity * s->cmd.frametime;
CL_ClientMovement_Move(s);
cl.movevars_friction = cl.statsf[STAT_MOVEVARS_FRICTION];
cl.movevars_wallfriction = cl.statsf[STAT_MOVEVARS_WALLFRICTION];
cl.movevars_waterfriction = cl.statsf[STAT_MOVEVARS_WATERFRICTION];
+ cl.movevars_airstopaccelerate = cl.statsf[STAT_MOVEVARS_AIRSTOPACCELERATE];
+ cl.movevars_airstrafeaccelerate = cl.statsf[STAT_MOVEVARS_AIRSTRAFEACCELERATE];
+ cl.movevars_maxairstrafespeed = cl.statsf[STAT_MOVEVARS_MAXAIRSTRAFESPEED];
+ cl.movevars_aircontrol = cl.statsf[STAT_MOVEVARS_AIRCONTROL];
}
else
{
cl.movevars_stepheight = cl_movement_stepheight.value;
cl.movevars_airaccel_qw = cl_movement_airaccel_qw.value;
cl.movevars_airaccel_sideways_friction = cl_movement_airaccel_sideways_friction.value;
+ cl.movevars_airstopaccelerate = 0;
+ cl.movevars_airstrafeaccelerate = 0;
+ cl.movevars_maxairstrafespeed = 0;
+ cl.movevars_aircontrol = 0;
}
}
float movevars_stepheight;
float movevars_airaccel_qw;
float movevars_airaccel_sideways_friction;
+ float movevars_airstopaccelerate;
+ float movevars_airstrafeaccelerate;
+ float movevars_maxairstrafespeed;
+ float movevars_aircontrol;
// models used by qw protocol
int qw_modelindex_spike;
//#define STAT_TIME 17 // FTE
//#define STAT_VIEW2 20 // FTE
#define STAT_VIEWZOOM 21 // DP
+#define STAT_MOVEVARS_AIRSTOPACCELERATE 231 // DP
+#define STAT_MOVEVARS_AIRSTRAFEACCELERATE 232 // DP
+#define STAT_MOVEVARS_MAXAIRSTRAFESPEED 233 // DP
+#define STAT_MOVEVARS_AIRCONTROL 234 // DP
#define STAT_FRAGLIMIT 235 // DP
#define STAT_TIMELIMIT 236 // DP
#define STAT_MOVEVARS_WALLFRICTION 237 // DP
extern cvar_t sv_airaccel_qw;
extern cvar_t sv_airaccel_sideways_friction;
extern cvar_t sv_airaccelerate;
+extern cvar_t sv_airstopaccelerate;
+extern cvar_t sv_airstrafeaccelerate;
+extern cvar_t sv_maxairstrafespeed;
+extern cvar_t sv_aircontrol;
extern cvar_t sv_allowdownloads;
extern cvar_t sv_allowdownloads_archive;
extern cvar_t sv_allowdownloads_config;
cvar_t sv_airaccel_qw = {0, "sv_airaccel_qw", "1", "ratio of QW-style air control as opposed to simple acceleration"};
cvar_t sv_airaccel_sideways_friction = {0, "sv_airaccel_sideways_friction", "", "anti-sideways movement stabilization (reduces speed gain when zigzagging)"};
cvar_t sv_airaccelerate = {0, "sv_airaccelerate", "-1", "rate at which a player accelerates to sv_maxairspeed while in the air, if less than 0 the sv_accelerate variable is used instead"};
+cvar_t sv_airstopaccelerate = {0, "sv_airstopaccelerate", "0", "when set, replacement for sv_airaccelerate when moving backwards"};
+cvar_t sv_airstrafeaccelerate = {0, "sv_airstrafeaccelerate", "0", "when set, replacement for sv_airaccelerate when just strafing"};
+cvar_t sv_maxairstrafespeed = {0, "sv_maxairstrafespeed", "0", "when set, replacement for sv_maxairspeed when just strafing"};
+cvar_t sv_aircontrol = {0, "sv_aircontrol", "0", "CPMA-style air control"};
cvar_t sv_allowdownloads = {0, "sv_allowdownloads", "1", "whether to allow clients to download files from the server (does not affect http downloads)"};
cvar_t sv_allowdownloads_archive = {0, "sv_allowdownloads_archive", "0", "whether to allow downloads of archives (pak/pk3)"};
cvar_t sv_allowdownloads_config = {0, "sv_allowdownloads_config", "0", "whether to allow downloads of config files (cfg)"};
Cvar_RegisterVariable (&sv_airaccel_qw);
Cvar_RegisterVariable (&sv_airaccel_sideways_friction);
Cvar_RegisterVariable (&sv_airaccelerate);
+ Cvar_RegisterVariable (&sv_airstopaccelerate);
+ Cvar_RegisterVariable (&sv_airstrafeaccelerate);
+ Cvar_RegisterVariable (&sv_maxairstrafespeed);
+ Cvar_RegisterVariable (&sv_aircontrol);
Cvar_RegisterVariable (&sv_allowdownloads);
Cvar_RegisterVariable (&sv_allowdownloads_archive);
Cvar_RegisterVariable (&sv_allowdownloads_config);
statsf[STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION] = sv_airaccel_sideways_friction.value;
statsf[STAT_MOVEVARS_FRICTION] = sv_friction.value;
statsf[STAT_MOVEVARS_WATERFRICTION] = sv_waterfriction.value >= 0 ? sv_waterfriction.value : sv_friction.value;
+ statsf[STAT_MOVEVARS_AIRSTOPACCELERATE] = sv_airstopaccelerate.value;
+ statsf[STAT_MOVEVARS_AIRSTRAFEACCELERATE] = sv_airstrafeaccelerate.value;
+ statsf[STAT_MOVEVARS_MAXAIRSTRAFESPEED] = sv_maxairstrafespeed.value;
+ statsf[STAT_MOVEVARS_AIRCONTROL] = sv_aircontrol.value;
statsf[STAT_FRAGLIMIT] = fraglimit.value;
statsf[STAT_TIMELIMIT] = timelimit.value;