5 #define PHYS_DODGING g_dodging 6 #define PHYS_DODGING_DELAY autocvar_sv_dodging_delay 7 #define PHYS_DODGING_DISTANCE_THRESHOLD autocvar_sv_dodging_wall_distance_threshold 8 #define PHYS_DODGING_FROZEN_DOUBLETAP autocvar_sv_dodging_frozen_doubletap 9 #define PHYS_DODGING_HEIGHT_THRESHOLD autocvar_sv_dodging_height_threshold 10 #define PHYS_DODGING_HORIZ_SPEED_MIN autocvar_sv_dodging_horiz_speed_min 11 #define PHYS_DODGING_HORIZ_SPEED_MAX autocvar_sv_dodging_horiz_speed_max 12 #define PHYS_DODGING_HORIZ_FORCE_SLOWEST autocvar_sv_dodging_horiz_force_slowest 13 #define PHYS_DODGING_HORIZ_FORCE_FASTEST autocvar_sv_dodging_horiz_force_fastest 14 #define PHYS_DODGING_HORIZ_FORCE_FROZEN autocvar_sv_dodging_horiz_force_frozen 15 #define PHYS_DODGING_RAMP_TIME autocvar_sv_dodging_ramp_time 16 #define PHYS_DODGING_UP_SPEED autocvar_sv_dodging_up_speed 17 #define PHYS_DODGING_WALL autocvar_sv_dodging_wall_dodging 18 #define PHYS_DODGING_AIR autocvar_sv_dodging_air_dodging 19 #define PHYS_DODGING_MAXSPEED autocvar_sv_dodging_maxspeed 20 #define PHYS_DODGING_AIR_MAXSPEED autocvar_sv_dodging_air_maxspeed 21 #define PHYS_DODGING_CLIENTSELECT autocvar_sv_dodging_clientselect 25 #define PHYS_DODGING STAT(DODGING, this) 26 #define PHYS_DODGING_DELAY STAT(DODGING_DELAY, this) 27 #define PHYS_DODGING_DISTANCE_THRESHOLD STAT(DODGING_DISTANCE_THRESHOLD, this) 28 #define PHYS_DODGING_FROZEN_DOUBLETAP STAT(DODGING_FROZEN_DOUBLETAP, this) 29 #define PHYS_DODGING_HEIGHT_THRESHOLD STAT(DODGING_HEIGHT_THRESHOLD, this) 30 #define PHYS_DODGING_HORIZ_SPEED_MIN STAT(DODGING_HORIZ_SPEED_MIN, this) 31 #define PHYS_DODGING_HORIZ_SPEED_MAX STAT(DODGING_HORIZ_SPEED_MAX, this) 32 #define PHYS_DODGING_HORIZ_FORCE_SLOWEST STAT(DODGING_HORIZ_FORCE_SLOWEST, this) 33 #define PHYS_DODGING_HORIZ_FORCE_FASTEST STAT(DODGING_HORIZ_FORCE_FASTEST, this) 34 #define PHYS_DODGING_HORIZ_FORCE_FROZEN STAT(DODGING_HORIZ_FORCE_FROZEN, this) 35 #define PHYS_DODGING_RAMP_TIME STAT(DODGING_RAMP_TIME, this) 36 #define PHYS_DODGING_UP_SPEED STAT(DODGING_UP_SPEED, this) 37 #define PHYS_DODGING_WALL STAT(DODGING_WALL, this) 38 #define PHYS_DODGING_AIR STAT(DODGING_AIR, this) 39 #define PHYS_DODGING_MAXSPEED STAT(DODGING_MAXSPEED, this) 40 #define PHYS_DODGING_AIR_MAXSPEED STAT(DODGING_AIR_MAXSPEED, this) 41 #define PHYS_DODGING_CLIENTSELECT STAT(DODGING_CLIENTSELECT, this) 45 bool autocvar_cl_dodging;
46 #define PHYS_DODGING_FRAMETIME (1 / (frametime <= 0 ? 60 : frametime)) 47 #define PHYS_DODGING_TIMEOUT(s) STAT(DODGING_TIMEOUT) 48 #define PHYS_DODGING_PRESSED_KEYS(s) (s).pressedkeys 49 #define PHYS_DODGING_ENABLED(s) autocvar_cl_dodging 51 #define PHYS_DODGING_FRAMETIME sys_frametime 52 #define PHYS_DODGING_TIMEOUT(s) CS_CVAR(s).cvar_cl_dodging_timeout 53 #define PHYS_DODGING_PRESSED_KEYS(s) CS(s).pressedkeys 54 #define PHYS_DODGING_ENABLED(s) CS_CVAR(s).cvar_cl_dodging 57 REPLICATE(cvar_cl_dodging_timeout,
float,
"cl_dodging_timeout");
58 REPLICATE(cvar_cl_dodging,
bool,
"cl_dodging");
62 bool autocvar_sv_dodging_sound;
72 g_dodging =
cvar(
"g_dodging");
117 tracebox(this.origin, this.mins, this.maxs, this.origin + threshold * dir, true, this); \ 118 if (trace_fraction < 1 && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) \ 145 float horiz_vel =
vlen(
vec2(player.velocity));
156 float tap_direction_x = 0;
157 float tap_direction_y = 0;
158 bool dodge_detected =
false;
159 vector mymovement = PHYS_CS(
this).movement;
161 #define X(COND,BTN,RESULT) \ 162 if (mymovement_##COND) { \ 164 if(!(PHYS_DODGING_PRESSED_KEYS(this) & KEY_##BTN) || frozen_no_doubletap) { \ 165 tap_direction_##RESULT; \ 166 if ((time - this.last_##BTN##_KEY_time) < PHYS_DODGING_TIMEOUT(this) || frozen_no_doubletap) { \ 167 dodge_detected = true; \ 168 } else if(PHYS_INPUT_BUTTON_DODGE(this)) { \ 169 dodge_detected = true; \ 171 this.last_##BTN##_KEY_time = time; \ 174 X(x < 0, BACKWARD, x--);
175 X(x > 0, FORWARD, x++);
177 X(y > 0, RIGHT, y++);
180 if (!dodge_detected)
return false;
189 vector forward, right, up;
190 MAKE_VECTORS(this.
angles, forward, right, up);
195 if (!can_dodge && !can_wall_dodge && !can_air_dodge)
return false;
232 vector forward, right, up;
234 MAKE_VECTORS(this.
v_angle, forward, right, up);
236 MAKE_VECTORS(this.
angles, forward, right, up);
259 if (autocvar_sv_dodging_sound)
278 void PM_dodging_GetPressedKeys(
entity this)
302 PM_dodging_GetPressedKeys(player);
309 void dodging_ResetPlayer(
entity this)
325 dodging_ResetPlayer(player);
331 dodging_ResetPlayer(player);
#define PHYS_INPUT_BUTTON_ATCK2(s)
#define PHYS_INPUT_BUTTON_JUMP(s)
#define PHYS_DODGING_HEIGHT_THRESHOLD
float determine_force(entity player)
#define REGISTER_MUTATOR(id, dependence)
const int VOICETYPE_PLAYERSOUND
#define PHYS_DODGING_HORIZ_FORCE_FROZEN
#define PHYS_DODGING_AIR_MAXSPEED
const int ANIMACTION_JUMP
#define PHYS_DODGING_DISTANCE_THRESHOLD
bool is_close_to_wall(entity this, float threshold, vector forward, vector right)
#define PHYS_DODGING_FROZEN_DOUBLETAP
#define PHYS_DODGING_FROZEN(s)
#define PHYS_DODGING_MAXSPEED
#define PHYS_DODGING_CLIENTSELECT
#define UNSET_ONGROUND(s)
void PM_dodging(entity this)
#define MUTATOR_ONROLLBACK_OR_REMOVE
float dodging_force_total
ERASEABLE float map_bound_ranges(float value, float src_min, float src_max, float dest_min, float dest_max)
Same as map_ranges except that values outside the source range are clamped to min or max...
#define PHYS_DODGING_RAMP_TIME
REPLICATE(cvar_cl_dodging_timeout, float, "cl_dodging_timeout")
float last_RIGHT_KEY_time
float dodging_single_action
void GetPressedKeys(entity this)
float last_BACKWARD_KEY_time
void animdecide_setaction(entity e, float action, float restart)
float dodging_force_remaining
#define PHYS_INPUT_BUTTON_ATCK(s)
#define BITSET(var, mask, flag)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define PHYS_DODGING_HORIZ_FORCE_FASTEST
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
const int WATERLEVEL_SWIMMING
#define PHYS_DODGING_HORIZ_FORCE_SLOWEST
#define PHYS_DODGING_UP_SPEED
bool is_close_to_ground(entity this, float threshold, vector up)
float last_FORWARD_KEY_time
#define PHYS_DODGING_WALL
#define PHYS_DODGING_DELAY
#define PHYS_DODGING_HORIZ_SPEED_MIN
#define PHYS_DODGING_HORIZ_SPEED_MAX
MUTATOR_HOOKFUNCTION(dodging, PlayerPhysics)
bool PM_dodging_checkpressedkeys(entity this)