set g_dodging 0 "set to 1 to enable dodging (quick acceleration in a given direction)"
seta cl_dodging_timeout 0.2 "determines how long apart (in seconds) two taps on the same direction key are considered a dodge. use 0 to disable"
+seta cl_dodging 0 "enable dodging, requires sv_dodging_clientselect to be enabled on the server"
set sv_dodging_air_dodging 0
set sv_dodging_wall_dodging 0 "allow dodging off walls"
set sv_dodging_frozen_doubletap 0
set sv_dodging_maxspeed 350 "maximum speed a player can be moving at to use the standard dodging from an (almost) standstill"
set sv_dodging_air_maxspeed 450 "maximum speed a player can be moving at before they dodge again when air dodging is enabled"
+set sv_dodging_clientselect 0 "allow clients to opt-in to dodging movement with the cl_dodging cvar, dodging will be off for clients by default with this enabled"
// ===========
float cvar_cl_dodging_timeout;
REPLICATE(cvar_cl_dodging_timeout, float, "cl_dodging_timeout");
+
+float cvar_cl_dodging;
+REPLICATE(cvar_cl_dodging, float, "cl_dodging");
#define PHYS_DODGING_AIR autocvar_sv_dodging_air_dodging
#define PHYS_DODGING_MAXSPEED autocvar_sv_dodging_maxspeed
#define PHYS_DODGING_AIR_MAXSPEED autocvar_sv_dodging_air_maxspeed
+#define PHYS_DODGING_CLIENTSELECT autocvar_sv_dodging_clientselect
// we ran out of stats slots! TODO: re-enable this when prediction is available for dodging
#if 0
#define PHYS_DODGING_AIR STAT(DODGING_AIR, this)
#define PHYS_DODGING_MAXSPEED STAT(DODGING_MAXSPEED, this)
#define PHYS_DODGING_AIR_MAXSPEED STAT(DODGING_AIR_MAXSPEED, this)
+#define PHYS_DODGING_CLIENTSELECT STAT(DODGING_CLIENTSELECT, this)
#endif
#ifdef CSQC
float cvar_cl_dodging_timeout;
+ bool cvar_cl_dodging;
+ bool autocvar_cl_dodging;
#define PHYS_DODGING_FRAMETIME (1 / (frametime <= 0 ? 60 : frametime))
#define PHYS_DODGING_TIMEOUT(s) STAT(DODGING_TIMEOUT)
#define PHYS_DODGING_PRESSED_KEYS(s) (s).pressedkeys
+ #define PHYS_DODGING_ENABLED(s) autocvar_cl_dodging
#elif defined(SVQC)
.float cvar_cl_dodging_timeout;
+ .bool cvar_cl_dodging;
#define PHYS_DODGING_FRAMETIME sys_frametime
#define PHYS_DODGING_TIMEOUT(s) CS(s).cvar_cl_dodging_timeout
#define PHYS_DODGING_PRESSED_KEYS(s) CS(s).pressedkeys
+ #define PHYS_DODGING_ENABLED(s) CS(s).cvar_cl_dodging
#endif
#ifdef SVQC
if (!this.dodging_action) return;
// when swimming or dead, no dodging allowed..
- if (this.waterlevel >= WATERLEVEL_SWIMMING || IS_DEAD(this))
+ if (this.waterlevel >= WATERLEVEL_SWIMMING || IS_DEAD(this) || (PHYS_DODGING_CLIENTSELECT && !PHYS_DODGING_ENABLED(this)))
{
this.dodging_action = 0;
this.dodging_direction.x = 0;
#ifdef SVQC
REPLICATE(cvar_cl_dodging_timeout, float, "cl_dodging_timeout");
+REPLICATE(cvar_cl_dodging, bool, "cl_dodging");
MUTATOR_HOOKFUNCTION(dodging, GetPressedKeys)
{
bool autocvar_sv_dodging_air_dodging;
float autocvar_sv_dodging_maxspeed;
float autocvar_sv_dodging_air_maxspeed;
+bool autocvar_sv_dodging_clientselect;
#endif
#if 0
REGISTER_STAT(DODGING_AIR, bool, autocvar_sv_dodging_air_dodging)
REGISTER_STAT(DODGING_MAXSPEED, float, autocvar_sv_dodging_maxspeed)
REGISTER_STAT(DODGING_AIR_MAXSPEED, float, autocvar_sv_dodging_air_maxspeed)
+REGISTER_STAT(DODGING_CLIENTSELECT, bool, autocvar_sv_dodging_clientselect)
#endif
/** cvar loopback */
REGISTER_STAT(DODGING_FROZEN, int, autocvar_sv_dodging_frozen)
ATTRIB(Client, autoswitch, bool, this.autoswitch);
ATTRIB(Client, cvar_cl_casings, bool, this.cvar_cl_casings);
ATTRIB(Client, cvar_cl_dodging_timeout, float, this.cvar_cl_dodging_timeout);
+ ATTRIB(Client, cvar_cl_dodging, float, this.cvar_cl_dodging);
ATTRIB(Client, cvar_cl_multijump, bool, this.cvar_cl_multijump);
ATTRIB(Client, cvar_cl_accuracy_data_share, bool, this.cvar_cl_accuracy_data_share);
ATTRIB(Client, cvar_cl_accuracy_data_receive, bool, this.cvar_cl_accuracy_data_receive);