X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Fdodging%2Fsv_dodging.qc;h=3651e9aa07286d42db46bc13b430cb869f74cf83;hp=0378ed7ed3f6960404ea262a219c908a3fed6628;hb=3c08700f00a014d84ffe1bb64305ca5da7594cea;hpb=e685cdc62ec2aaf6c08d7ec7d0ce6a87d5b4d78c diff --git a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc index 0378ed7ed..3651e9aa0 100644 --- a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc @@ -18,6 +18,7 @@ #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 @@ -37,16 +38,24 @@ #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 @@ -56,8 +65,6 @@ bool autocvar_sv_dodging_sound; #include #include -.float cvar_cl_dodging_timeout; - REGISTER_MUTATOR(dodging, cvar("g_dodging")) { // this just turns on the cvar. @@ -180,7 +187,8 @@ bool PM_dodging_checkpressedkeys(entity this) if ((time - this.last_dodging_time) < PHYS_DODGING_DELAY) return false; - MAKE_VECTORS_NEW(this.angles, forward, right, up); + vector forward, right, up; + MAKE_VECTORS(this.angles, forward, right, up); bool can_dodge = (is_close_to_ground(this, PHYS_DODGING_HEIGHT_THRESHOLD, up) && (PHYS_DODGING_MAXSPEED == 0 || vdist(this.velocity, <, PHYS_DODGING_MAXSPEED))); bool can_wall_dodge = (PHYS_DODGING_WALL && is_close_to_wall(this, PHYS_DODGING_DISTANCE_THRESHOLD, forward, right)); @@ -213,7 +221,7 @@ void PM_dodging(entity this) 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; @@ -221,7 +229,7 @@ void PM_dodging(entity this) return; } - NEW_VECS(forward, right, up); + vector forward, right, up; if(PHYS_DODGING_AIR) MAKE_VECTORS(this.v_angle, forward, right, up); else @@ -298,6 +306,7 @@ MUTATOR_HOOKFUNCTION(dodging, PlayerPhysics) #ifdef SVQC REPLICATE(cvar_cl_dodging_timeout, float, "cl_dodging_timeout"); +REPLICATE(cvar_cl_dodging, bool, "cl_dodging"); MUTATOR_HOOKFUNCTION(dodging, GetPressedKeys) {