X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Fdodging%2Fsv_dodging.qc;h=a844ab08c8fbcffb91f63ba34727e7e3814e4b32;hb=9006af604d68b00234718665c013b0031bf44758;hp=93feb5d94626d2d4a5451cc97fba881e02ad7e5b;hpb=f28bafd2da379d00bd179459e73a77620552a66f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc index 93feb5d94..a844ab08c 100644 --- a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc @@ -104,19 +104,20 @@ REGISTER_MUTATOR(dodging, true); .int pressedkeys; #endif -// returns 1 if the player is close to a wall +// returns true if the player is close to a wall bool check_close_to_wall(entity this, float threshold) { if (PHYS_DODGING_WALL == 0) { return false; } -#define X(OFFSET) \ - tracebox(this.origin, this.mins, this.maxs, this.origin + OFFSET, true, this); \ - if(trace_fraction < 1 && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY) && vdist(this.origin - trace_endpos, <, threshold)) \ +#define X(dir) \ + tracebox(this.origin, this.mins, this.maxs, this.origin + threshold * dir, true, this); \ + if (trace_fraction < 1 && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) \ return true; - X(1000*v_right); - X(-1000*v_right); - X(1000*v_forward); - X(-1000*v_forward); + + X(v_right); + X(-v_right); + X(v_forward); + X(-v_forward); #undef X return false;