Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
player.qc File Reference
Include dependency graph for player.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define JETPACK_JUMP(s)

Functions

float AdjustAirAccelQW (float accelqw, float factor)
void CheckPlayerJump (entity this)
void CheckWaterJump (entity this)
void CPM_PM_Aircontrol (entity this, float dt, vector wishdir, float wishspeed)
float GeomLerp (float a, float _lerp, float b)
bool IsFlying (entity this)
float IsMoveInDirection (vector mv, float ang)
float Physics_ClientOption (entity this, string option, float defaultval)
void Physics_UpdateStats (entity this)
bool Physics_Valid (string thecvar)
bool PlayerJump (entity this)
void PM_Accelerate (entity this, float dt, vector wishdir, float wishspeed, float wishspeed0, float accel, float accelqw, float stretchfactor, float sidefric, float speedlimit)
void PM_AirAccelerate (entity this, float dt, vector wishdir, float wishspeed)
void PM_check_blocked (entity this)
void PM_check_frozen (entity this)
void PM_check_hitground (entity this)
void PM_check_punch (entity this, float dt)
void PM_check_slick (entity this)
bool PM_check_specialcommand (entity this, int buttons)
void PM_ClientMovement_UpdateStatus (entity this)
void PM_Footsteps (entity this)
void PM_jetpack (entity this, float maxspd_mod, float dt)
 REPLICATE (cvar_cl_jetpack_jump, bool, "cl_jetpack_jump")
 REPLICATE (cvar_cl_movement_track_canjump, bool, "cl_movement_track_canjump")
 REPLICATE (cvar_cl_physics, string, "cl_physics")
void SpecialCommand (entity this)
void SV_PlayerPhysics (entity this)
void sys_phys_update (entity this, float dt)

Variables

float jetpack_stopped
string specialcommand = "xwxwxsxsxaxdxaxdx1x "
float specialcommand_pos

Macro Definition Documentation

◆ JETPACK_JUMP

#define JETPACK_JUMP ( s)
Value:
CS_CVAR(s).cvar_cl_jetpack_jump
#define CS_CVAR(this)
Definition state.qh:51

Definition at line 520 of file player.qc.

Referenced by CheckPlayerJump().

Function Documentation

◆ AdjustAirAccelQW()

float AdjustAirAccelQW ( float accelqw,
float factor )

Definition at line 261 of file player.qc.

262{
263 return copysign(bound(0.000001, 1 - (1 - fabs(accelqw)) * factor, 1), accelqw);
264}
float copysign(float e, float f)
Definition mathlib.qc:225
float bound(float min, float value, float max)
float fabs(float f)

References bound(), copysign(), and fabs().

Referenced by Physics_UpdateStats(), and PM_Accelerate().

◆ CheckPlayerJump()

void CheckPlayerJump ( entity this)

Definition at line 526 of file player.qc.

527{
528#ifdef SVQC
529 bool was_flying = boolean(ITEMS_STAT(this) & IT_USING_JETPACK);
530#endif
531 if (JETPACK_JUMP(this) < 2)
533
535 {
536 bool playerjump = PlayerJump(this); // required
537
538 bool air_jump = !playerjump || M_ARGV(2, bool);
539 bool activate = (JETPACK_JUMP(this) && air_jump && PHYS_INPUT_BUTTON_JUMP(this)) || PHYS_INPUT_BUTTON_JETPACK(this);
540 bool has_fuel = !PHYS_JETPACK_FUEL(this) || PHYS_AMMO_FUEL(this) || (ITEMS_STAT(this) & IT_UNLIMITED_AMMO);
541
542 if (!(ITEMS_STAT(this) & ITEM_Jetpack.m_itemid)) { }
543 else if (this.jetpack_stopped) { }
544 else if (!has_fuel)
545 {
546#ifdef SVQC
547 if (was_flying) // TODO: ran out of fuel message
548 Send_Notification(NOTIF_ONE, this, MSG_INFO, INFO_JETPACK_NOFUEL);
549 else if (activate)
550 Send_Notification(NOTIF_ONE, this, MSG_INFO, INFO_JETPACK_NOFUEL);
551#endif
552 this.jetpack_stopped = true;
554 }
555 else if (activate && !PHYS_FROZEN(this))
557 }
558 else
559 {
560 this.jetpack_stopped = false;
562 }
563
564 if (!PHYS_INPUT_BUTTON_JUMP(this))
565 UNSET_JUMP_HELD(this);
566
568 CheckWaterJump(this);
569}
#define boolean(value)
Definition bool.qh:9
const int IT_USING_JETPACK
Definition item.qh:27
const int IT_UNLIMITED_AMMO
Definition item.qh:23
#define M_ARGV(x, type)
Definition events.qh:17
float jetpack_stopped
Definition player.qc:525
bool PlayerJump(entity this)
Definition player.qc:378
void CheckWaterJump(entity this)
Definition player.qc:492
#define JETPACK_JUMP(s)
Definition player.qc:520
#define PHYS_JETPACK_FUEL(s)
Definition player.qh:125
#define PHYS_INPUT_BUTTON_JUMP(s)
Definition player.qh:151
#define PHYS_INPUT_BUTTON_JETPACK(s)
Definition player.qh:162
float waterlevel
Definition player.qh:226
#define ITEMS_STAT(s)
Definition player.qh:214
#define PHYS_FROZEN(s)
Definition player.qh:118
#define UNSET_JUMP_HELD(s)
Definition player.qh:205
#define PHYS_AMMO_FUEL(s)
Definition player.qh:110
const int WATERLEVEL_SWIMMING
Definition movetypes.qh:13
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
Definition all.qc:1573

References boolean, CheckWaterJump(), entity(), IT_UNLIMITED_AMMO, IT_USING_JETPACK, ITEMS_STAT, JETPACK_JUMP, jetpack_stopped, M_ARGV, PHYS_AMMO_FUEL, PHYS_FROZEN, PHYS_INPUT_BUTTON_JETPACK, PHYS_INPUT_BUTTON_JUMP, PHYS_JETPACK_FUEL, PlayerJump(), Send_Notification(), UNSET_JUMP_HELD, waterlevel, and WATERLEVEL_SWIMMING.

Referenced by sys_phys_update().

◆ CheckWaterJump()

void CheckWaterJump ( entity this)

Definition at line 492 of file player.qc.

493{
494// check for a jump-out-of-water
495 makevectors(this.v_angle);
496 vector start = this.origin;
497 start_z += 8;
498 v_forward_z = 0;
500 vector end = start + v_forward*24;
501 traceline (start, end, true, this);
502 if (trace_fraction < 1)
503 { // solid at waist
504 start_z = start_z + this.maxs_z - 8;
505 end = start + v_forward*24;
506 this.movedir = trace_plane_normal * -50;
507 traceline(start, end, true, this);
508 if (trace_fraction == 1)
509 { // open at eye level
510 this.velocity_z = 225;
511 this.flags |= FL_WATERJUMP;
512 this.teleport_time = time + 2; // safety net
513 SET_JUMP_HELD(this);
514 }
515 }
516}
vector v_angle
Definition player.qh:237
float teleport_time
Definition player.qh:216
#define SET_JUMP_HELD(s)
Definition player.qh:204
const int FL_WATERJUMP
Definition constants.qh:80
float flags
float time
vector v_forward
vector origin
float trace_fraction
vector trace_plane_normal
vector movedir
Definition viewloc.qh:18
vector normalize(vector v)
#define makevectors
Definition post.qh:21
vector
Definition self.qh:92

References entity(), FL_WATERJUMP, flags, makevectors, movedir, normalize(), origin, SET_JUMP_HELD, teleport_time, time, trace_fraction, trace_plane_normal, v_angle, v_forward, and vector.

Referenced by CheckPlayerJump().

◆ CPM_PM_Aircontrol()

void CPM_PM_Aircontrol ( entity this,
float dt,
vector wishdir,
float wishspeed )

Definition at line 225 of file player.qc.

226{
227 float movity = IsMoveInDirection(PHYS_CS(this).movement, 0);
228 if(PHYS_AIRCONTROL_FLAGS(this) & BIT(0)) // backwards
229 movity += IsMoveInDirection(PHYS_CS(this).movement, 180);
230 if(PHYS_AIRCONTROL_FLAGS(this) & BIT(1)) // sidewards
231 {
232 movity += IsMoveInDirection(PHYS_CS(this).movement, 90);
233 movity += IsMoveInDirection(PHYS_CS(this).movement, -90);
234 }
235
236 float k = 2 * movity - 1;
237 if (k <= 0)
238 return;
239 if (!(PHYS_AIRCONTROL_FLAGS(this) & BIT(2))) // crouching has an impact
240 k *= bound(0, wishspeed / PHYS_MAXAIRSPEED(this), 1);
241
242 const float zspeed = this.velocity_z;
243 this.velocity_z = 0;
244 float xyspeed = vlen(this.velocity);
245 this.velocity = normalize(this.velocity);
246
247 float dot = this.velocity * wishdir;
248
249 if (dot > 0) // we can't change direction while slowing down
250 {
251 k *= (dot ** PHYS_AIRCONTROL_POWER(this)) * dt;
252 xyspeed = max(0, xyspeed - PHYS_AIRCONTROL_PENALTY(this) * sqrt(max(0, 1 - dot*dot)) * k);
253 k *= 32 * fabs(PHYS_AIRCONTROL(this));
254 this.velocity = normalize(this.velocity * xyspeed + wishdir * k);
255 }
256
257 this.velocity = this.velocity * xyspeed;
258 this.velocity_z = zspeed;
259}
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
float IsMoveInDirection(vector mv, float ang)
Definition player.qc:145
vector movement
Definition player.qh:229
#define PHYS_CS(s)
Definition player.qh:258
#define PHYS_AIRCONTROL_PENALTY(s)
Definition player.qh:102
#define PHYS_MAXAIRSPEED(s)
Definition player.qh:134
#define PHYS_AIRCONTROL_FLAGS(s)
Definition player.qh:101
#define PHYS_AIRCONTROL_POWER(s)
Definition player.qh:103
#define PHYS_AIRCONTROL(s)
Definition player.qh:100
vector velocity
float vlen(vector v)
float sqrt(float f)
float max(float f,...)

References BIT, bound(), entity(), fabs(), IsMoveInDirection(), max(), movement, normalize(), PHYS_AIRCONTROL, PHYS_AIRCONTROL_FLAGS, PHYS_AIRCONTROL_PENALTY, PHYS_AIRCONTROL_POWER, PHYS_CS, PHYS_MAXAIRSPEED, sqrt(), vector, velocity, and vlen().

Referenced by sys_phys_simulate().

◆ GeomLerp()

float GeomLerp ( float a,
float _lerp,
float b )

Definition at line 154 of file player.qc.

155{
156 return a == 0 ? (_lerp < 1 ? 0 : b)
157 : b == 0 ? (_lerp > 0 ? 0 : a)
158 : a * (fabs(b / a) ** _lerp);
159}

References fabs().

Referenced by HUD_StrafeHUD(), StrafeHUD_DetermineHudAngle(), and sys_phys_simulate().

◆ IsFlying()

bool IsFlying ( entity this)

Definition at line 836 of file player.qc.

837{
838 if(IS_ONGROUND(this))
839 return false;
841 return false;
842 tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 24', MOVE_NORMAL, this);
843 //traceline(this.origin, this.origin - '0 0 48', MOVE_NORMAL, this);
844 if(trace_fraction < 1)
845 return false;
846 return true;
847}
const float MOVE_NORMAL
vector mins
vector maxs
#define IS_ONGROUND(s)
Definition movetypes.qh:16

References entity(), IS_ONGROUND, maxs, mins, MOVE_NORMAL, origin, trace_fraction, waterlevel, and WATERLEVEL_SWIMMING.

Referenced by Damage(), MUTATOR_HOOKABLE(), sys_phys_update(), W_Devastator_Explode(), W_Electro_Explode(), W_MineLayer_Explode(), W_Mortar_Grenade_Explode(), W_Mortar_Grenade_Explode2(), W_OverkillNex_Attack(), W_RocketMinsta_Laser_Explode(), W_Vaporizer_Attack(), and W_Vortex_Attack().

◆ IsMoveInDirection()

float IsMoveInDirection ( vector mv,
float ang )

Definition at line 145 of file player.qc.

146{
147 if (mv_x == 0 && mv_y == 0)
148 return 0; // avoid division by zero
149 ang -= RAD2DEG * atan2(mv_y, mv_x);
150 ang = remainder(ang, 360) / 45;
151 return ang > 1 ? 0 : ang < -1 ? 0 : 1 - fabs(ang);
152}
float RAD2DEG
float remainder(float e, float f)
Definition mathlib.qc:212
vector vector ang
Definition self.qh:92

References ang, fabs(), RAD2DEG, remainder(), and vector.

Referenced by CPM_PM_Aircontrol(), and sys_phys_simulate().

◆ Physics_ClientOption()

float Physics_ClientOption ( entity this,
string option,
float defaultval )

Definition at line 23 of file player.qc.

24{
26 return defaultval;
27
28 if(IS_REAL_CLIENT(this) && Physics_Valid(CS_CVAR(this).cvar_cl_physics))
29 {
30 string s = strcat("g_physics_", CS_CVAR(this).cvar_cl_physics, "_", option);
31 if(cvar_type(s) & CVAR_TYPEFLAG_EXISTS)
32 return cvar(s);
33 }
35 {
36 // NOTE: not using Physics_Valid here, so the default can be forced to something normally unavailable
37 string s = strcat("g_physics_", autocvar_g_physics_clientselect_default, "_", option);
38 if(cvar_type(s) & CVAR_TYPEFLAG_EXISTS)
39 return cvar(s);
40 }
41 return defaultval;
42}
bool Physics_Valid(string thecvar)
Definition player.qc:18
bool autocvar_g_physics_clientselect
Definition player.qh:42
string autocvar_g_physics_clientselect_default
Definition player.qh:40
float CVAR_TYPEFLAG_EXISTS
float cvar(string name)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define IS_REAL_CLIENT(v)
Definition utils.qh:17

References autocvar_g_physics_clientselect, autocvar_g_physics_clientselect_default, CS_CVAR, cvar(), CVAR_TYPEFLAG_EXISTS, entity(), IS_REAL_CLIENT, Physics_Valid(), and strcat().

Referenced by Physics_UpdateStats().

◆ Physics_UpdateStats()

void Physics_UpdateStats ( entity this)

Definition at line 44 of file player.qc.

45{
46 // update this first, as it's used on all stats (wouldn't want to update them all manually from a mutator hook now, would we?)
47 STAT(MOVEVARS_HIGHSPEED, this) = autocvar_g_movement_highspeed;
48
49 MUTATOR_CALLHOOK(PlayerPhysics_UpdateStats, this);
50 float maxspd_mod = PHYS_HIGHSPEED(this) * ((this.swampslug.active == ACTIVE_ACTIVE) ? this.swampslug.swamp_slowdown : 1);
51 STAT(MOVEVARS_MAXSPEED, this) = Physics_ClientOption(this, "maxspeed", autocvar_sv_maxspeed) * maxspd_mod; // also slow walking
53 {
54 STAT(MOVEVARS_AIRACCEL_QW, this) = Physics_ClientOption(this, "airaccel_qw", autocvar_sv_airaccel_qw);
55 STAT(MOVEVARS_AIRSTRAFEACCEL_QW, this) = Physics_ClientOption(this, "airstrafeaccel_qw", autocvar_sv_airstrafeaccel_qw);
56 STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, this) = Physics_ClientOption(this, "airspeedlimit_nonqw", autocvar_sv_airspeedlimit_nonqw);
57 }
58 else
59 {
60 STAT(MOVEVARS_AIRACCEL_QW, this) = AdjustAirAccelQW(Physics_ClientOption(this, "airaccel_qw", autocvar_sv_airaccel_qw), maxspd_mod);
61 STAT(MOVEVARS_AIRSTRAFEACCEL_QW, this) = (Physics_ClientOption(this, "airstrafeaccel_qw", autocvar_sv_airstrafeaccel_qw))
62 ? AdjustAirAccelQW(Physics_ClientOption(this, "airstrafeaccel_qw", autocvar_sv_airstrafeaccel_qw), maxspd_mod)
63 : 0;
64 STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, this) = Physics_ClientOption(this, "airspeedlimit_nonqw", autocvar_sv_airspeedlimit_nonqw) * maxspd_mod;
65 }
66
68 {
69 /* Q3 uses the following:
70 * MIN '-15 -15 -24'
71 * MAX '15 15 32'
72 * VIEW_OFS '0 0 26'
73 * CROUCH_MIN '-15 -15 -24'
74 * CROUCH_MAX '15 15 16'
75 * CROUCH_VIEW_OFS '0 0 12'
76 * but Xonotic player models have a different z offset to suit origin at 24/69.
77 * At q3compat hitbox dimensions and model scale the equivalent offset is origin at 20/56.
78 * See also: model .scale in PutPlayerInServer().
79 */
81 STAT(PL_MIN, this) = q3hb ? '-15 -15 -20' : autocvar_sv_player_mins;
82 STAT(PL_MAX, this) = q3hb ? '15 15 36' : autocvar_sv_player_maxs;
83 STAT(PL_VIEW_OFS, this) = q3hb ? '0 0 30' : autocvar_sv_player_viewoffset;
84 STAT(PL_CROUCH_MIN, this) = q3hb ? '-15 -15 -20' : autocvar_sv_player_crouch_mins;
85 STAT(PL_CROUCH_MAX, this) = q3hb ? '15 15 20' : autocvar_sv_player_crouch_maxs;
86 STAT(PL_CROUCH_VIEW_OFS, this) = q3hb ? '0 0 16' : autocvar_sv_player_crouch_viewoffset;
87 }
88 else
89 {
90 /* Quake and Q2 use a wider bbox matching the Q1BSP 32x32x56 cliphull:
91 * MIN '-16 -16 -24'
92 * MAX '16 16 32'
93 * VIEW_OFS '0 0 22'
94 * Quake doesn't support crouching, Q2 has a very low crouch:
95 * CROUCH_MIN '-16 -16 -24'
96 * CROUCH_MAX '16 16 4'
97 * CROUCH_VIEW_OFS '0 0 -2'
98 * We probably want a higher VIEW_OFS and Xonotic models don't crouch low enough for Q2 settings
99 * so these are the same heights as for Q3 above.
100 */
101 STAT(PL_MIN, this) = '-16 -16 -20';
102 STAT(PL_MAX, this) = '16 16 36';
103 STAT(PL_VIEW_OFS, this) = '0 0 30';
104 STAT(PL_CROUCH_MIN, this) = '-16 -16 -20';
105 // Q1BSP has no cliphull to support crouching so disable it there, see PM_ClientMovement_UpdateStatus().
106 STAT(PL_CROUCH_MAX, this) = autocvar_sv_mapformat_is_quake2 ? '16 16 20' : STAT(PL_MAX, this);
107 STAT(PL_CROUCH_VIEW_OFS, this) = autocvar_sv_mapformat_is_quake2 ? '0 0 16' : STAT(PL_VIEW_OFS, this);
108 }
109
110 // old stats
111 // fix some new settings
112 STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, this) = Physics_ClientOption(this, "airaccel_qw_stretchfactor", autocvar_sv_airaccel_qw_stretchfactor);
113 STAT(MOVEVARS_MAXAIRSTRAFESPEED, this) = Physics_ClientOption(this, "maxairstrafespeed", autocvar_sv_maxairstrafespeed);
115 STAT(MOVEVARS_MAXAIRSPEED, this) = Physics_ClientOption(this, "maxairspeed", autocvar_sv_maxairspeed) * maxspd_mod;
116 else
117 STAT(MOVEVARS_MAXAIRSPEED, this) = Physics_ClientOption(this, "maxairspeed", autocvar_sv_maxairspeed);
118
119 STAT(MOVEVARS_AIRSTRAFEACCELERATE, this) = Physics_ClientOption(this, "airstrafeaccelerate", autocvar_sv_airstrafeaccelerate);
120 STAT(MOVEVARS_WARSOWBUNNY_TURNACCEL, this) = Physics_ClientOption(this, "warsowbunny_turnaccel", autocvar_sv_warsowbunny_turnaccel);
121 STAT(MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, this) = Physics_ClientOption(this, "airaccel_sideways_friction", autocvar_sv_airaccel_sideways_friction);
122 STAT(MOVEVARS_AIRCONTROL, this) = Physics_ClientOption(this, "aircontrol", autocvar_sv_aircontrol);
123 STAT(MOVEVARS_AIRCONTROL_FLAGS, this) = Physics_ClientOption(this, "aircontrol_flags", autocvar_sv_aircontrol_flags);
124 STAT(MOVEVARS_AIRCONTROL_POWER, this) = Physics_ClientOption(this, "aircontrol_power", autocvar_sv_aircontrol_power);
125 STAT(MOVEVARS_AIRCONTROL_PENALTY, this) = Physics_ClientOption(this, "aircontrol_penalty", autocvar_sv_aircontrol_penalty);
126 STAT(MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, this) = Physics_ClientOption(this, "warsowbunny_airforwardaccel", autocvar_sv_warsowbunny_airforwardaccel);
127 STAT(MOVEVARS_WARSOWBUNNY_TOPSPEED, this) = Physics_ClientOption(this, "warsowbunny_topspeed", autocvar_sv_warsowbunny_topspeed);
128 STAT(MOVEVARS_WARSOWBUNNY_ACCEL, this) = Physics_ClientOption(this, "warsowbunny_accel", autocvar_sv_warsowbunny_accel);
129 STAT(MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, this) = Physics_ClientOption(this, "warsowbunny_backtosideratio", autocvar_sv_warsowbunny_backtosideratio);
130 STAT(MOVEVARS_FRICTION, this) = Physics_ClientOption(this, "friction", autocvar_sv_friction);
131 STAT(MOVEVARS_ACCELERATE, this) = Physics_ClientOption(this, "accelerate", autocvar_sv_accelerate);
132 STAT(MOVEVARS_STOPSPEED, this) = Physics_ClientOption(this, "stopspeed", autocvar_sv_stopspeed);
133 STAT(MOVEVARS_AIRACCELERATE, this) = Physics_ClientOption(this, "airaccelerate", autocvar_sv_airaccelerate);
134 STAT(MOVEVARS_AIRSTOPACCELERATE, this) = Physics_ClientOption(this, "airstopaccelerate", autocvar_sv_airstopaccelerate);
135 STAT(MOVEVARS_AIRSTOPACCELERATE_FULL, this) = Physics_ClientOption(this, "airstopaccelerate_full", autocvar_sv_airstopaccelerate_full);
136 STAT(MOVEVARS_SLICKACCELERATE, this) = Physics_ClientOption(this, "slickaccelerate", autocvar_sv_slickaccelerate);
137 STAT(MOVEVARS_JUMPVELOCITY, this) = Physics_ClientOption(this, "jumpvelocity", autocvar_sv_jumpvelocity);
138 STAT(MOVEVARS_JUMPVELOCITY_CROUCH, this) = Physics_ClientOption(this, "jumpvelocity_crouch", autocvar_sv_jumpvelocity_crouch);
139 STAT(MOVEVARS_TRACK_CANJUMP, this) = Physics_ClientOption(this, "track_canjump", autocvar_sv_track_canjump);
140
141 MUTATOR_CALLHOOK(PlayerPhysics_PostUpdateStats, this, maxspd_mod);
142}
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
float Physics_ClientOption(entity this, string option, float defaultval)
Definition player.qc:23
float AdjustAirAccelQW(float accelqw, float factor)
Definition player.qc:261
vector autocvar_sv_player_crouch_viewoffset
Definition player.qh:351
float autocvar_sv_airstrafeaccel_qw
Definition player.qh:16
float autocvar_sv_warsowbunny_airforwardaccel
Definition player.qh:27
vector autocvar_sv_player_viewoffset
Definition player.qh:348
float autocvar_sv_jumpvelocity
Definition player.qh:50
vector autocvar_sv_player_crouch_mins
Definition player.qh:350
vector autocvar_sv_player_maxs
Definition player.qh:346
float autocvar_sv_warsowbunny_turnaccel
Definition player.qh:21
float autocvar_sv_friction
Definition player.qh:31
float autocvar_sv_airaccelerate
Definition player.qh:34
float autocvar_sv_accelerate
Definition player.qh:32
float autocvar_sv_maxspeed
Definition player.qh:53
float autocvar_sv_warsowbunny_accel
Definition player.qh:29
float autocvar_sv_airaccel_qw_stretchfactor
Definition player.qh:18
float autocvar_sv_airstopaccelerate
Definition player.qh:36
float autocvar_sv_aircontrol_penalty
Definition player.qh:26
float autocvar_sv_warsowbunny_topspeed
Definition player.qh:28
float autocvar_sv_airspeedlimit_nonqw
Definition player.qh:17
vector autocvar_sv_player_crouch_maxs
Definition player.qh:349
float autocvar_sv_maxairstrafespeed
Definition player.qh:19
bool autocvar_sv_airstopaccelerate_full
Definition player.qh:37
int autocvar_sv_aircontrol_flags
Definition player.qh:24
float autocvar_sv_aircontrol_power
Definition player.qh:25
float autocvar_sv_slickaccelerate
Definition player.qh:35
float autocvar_sv_warsowbunny_backtosideratio
Definition player.qh:30
float autocvar_sv_airstrafeaccelerate
Definition player.qh:20
vector autocvar_sv_player_mins
Definition player.qh:347
#define PHYS_HIGHSPEED(s)
Definition player.qh:120
float autocvar_sv_track_canjump
Definition player.qh:38
float autocvar_sv_airaccel_qw
Definition player.qh:15
float autocvar_sv_maxairspeed
Definition player.qh:52
float autocvar_g_movement_highspeed
Definition player.qh:44
float autocvar_sv_airaccel_sideways_friction
Definition player.qh:22
float autocvar_sv_jumpvelocity_crouch
Definition player.qh:51
bool autocvar_g_movement_highspeed_q3_compat
Definition player.qh:45
float autocvar_sv_aircontrol
Definition player.qh:23
float autocvar_sv_stopspeed
Definition player.qh:33
const int ACTIVE_ACTIVE
Definition defs.qh:37
#define STAT(...)
Definition stats.qh:82
q3compat
Definition quake3.qc:59
bool autocvar_sv_q3compat_changehitbox
Definition quake3.qh:7
entity swampslug
Definition swamp.qh:7
bool autocvar_sv_mapformat_is_quake3
Definition world.qh:32
bool autocvar_sv_mapformat_is_quake2
Definition world.qh:33

References ACTIVE_ACTIVE, AdjustAirAccelQW(), autocvar_g_movement_highspeed, autocvar_g_movement_highspeed_q3_compat, autocvar_sv_accelerate, autocvar_sv_airaccel_qw, autocvar_sv_airaccel_qw_stretchfactor, autocvar_sv_airaccel_sideways_friction, autocvar_sv_airaccelerate, autocvar_sv_aircontrol, autocvar_sv_aircontrol_flags, autocvar_sv_aircontrol_penalty, autocvar_sv_aircontrol_power, autocvar_sv_airspeedlimit_nonqw, autocvar_sv_airstopaccelerate, autocvar_sv_airstopaccelerate_full, autocvar_sv_airstrafeaccel_qw, autocvar_sv_airstrafeaccelerate, autocvar_sv_friction, autocvar_sv_jumpvelocity, autocvar_sv_jumpvelocity_crouch, autocvar_sv_mapformat_is_quake2, autocvar_sv_mapformat_is_quake3, autocvar_sv_maxairspeed, autocvar_sv_maxairstrafespeed, autocvar_sv_maxspeed, autocvar_sv_player_crouch_maxs, autocvar_sv_player_crouch_mins, autocvar_sv_player_crouch_viewoffset, autocvar_sv_player_maxs, autocvar_sv_player_mins, autocvar_sv_player_viewoffset, autocvar_sv_q3compat_changehitbox, autocvar_sv_slickaccelerate, autocvar_sv_stopspeed, autocvar_sv_track_canjump, autocvar_sv_warsowbunny_accel, autocvar_sv_warsowbunny_airforwardaccel, autocvar_sv_warsowbunny_backtosideratio, autocvar_sv_warsowbunny_topspeed, autocvar_sv_warsowbunny_turnaccel, entity(), MUTATOR_CALLHOOK, PHYS_HIGHSPEED, Physics_ClientOption(), q3compat, STAT, and swampslug.

Referenced by ClientConnect(), and sys_phys_fix().

◆ Physics_Valid()

bool Physics_Valid ( string thecvar)

Definition at line 18 of file player.qc.

19{
20 return thecvar != "" && thecvar && thecvar != "default" && strhasword(autocvar_g_physics_clientselect_options, thecvar);
21}
string autocvar_g_physics_clientselect_options
Definition player.qh:39
#define strhasword(s, w)
Definition string.qh:370

References autocvar_g_physics_clientselect_options, and strhasword.

Referenced by ClientCommand_physics(), and Physics_ClientOption().

◆ PlayerJump()

bool PlayerJump ( entity this)

Definition at line 378 of file player.qc.

379{
380 if (PHYS_FROZEN(this))
381 return true; // no jumping in freezetag when frozen
382
384 return true; // no jumping while typing
385
386#ifdef SVQC
387 if (this.player_blocked)
388 return true; // no jumping while blocked
389#endif
390
391 bool doublejump = false;
392 float mjumpheight = ((PHYS_JUMPVELOCITY_CROUCH(this) && IS_DUCKED(this)) ? PHYS_JUMPVELOCITY_CROUCH(this) : PHYS_JUMPVELOCITY(this));
393 bool track_jump = PHYS_CL_TRACK_CANJUMP(this);
394
395 if (MUTATOR_CALLHOOK(PlayerJump, this, mjumpheight, doublejump))
396 return true;
397
398 mjumpheight = M_ARGV(1, float);
399 doublejump = M_ARGV(2, bool);
400
402 {
403 if(this.viewloc)
404 {
405 doublejump = true;
406 mjumpheight *= 0.7;
407 track_jump = true;
408 }
409 else
410 {
411 this.velocity_z = PHYS_MAXSPEED(this) * 0.7;
412 return true;
413 }
414 }
415
416 if (!doublejump)
417 if (!IS_ONGROUND(this))
418 return IS_JUMP_HELD(this);
419
420 if(PHYS_TRACK_CANJUMP(this))
421 track_jump = true;
422
423 if (track_jump)
424 if (IS_JUMP_HELD(this))
425 return true;
426
427 // sv_jumpspeedcap_min/sv_jumpspeedcap_max act as baseline
428 // velocity bounds. Final velocity is bound between (jumpheight *
429 // min + jumpheight) and (jumpheight * max + jumpheight);
430
431 if(PHYS_JUMPSPEEDCAP_MIN != "")
432 {
433 float minjumpspeed = mjumpheight * stof(PHYS_JUMPSPEEDCAP_MIN);
434
435 if (this.velocity_z < minjumpspeed)
436 mjumpheight += minjumpspeed - this.velocity_z;
437 }
438
439 if(PHYS_JUMPSPEEDCAP_MAX != "")
440 {
441 // don't do jump speedcaps on ramps to preserve old xonotic ramjump style
442 tracebox(this.origin + '0 0 0.01', this.mins, this.maxs, this.origin - '0 0 0.01', MOVE_NORMAL, this);
443
444 if (!(trace_fraction < 1 && trace_plane_normal_z < 0.98 && PHYS_JUMPSPEEDCAP_DISABLE_ONRAMPS(this)))
445 {
446 float maxjumpspeed = mjumpheight * stof(PHYS_JUMPSPEEDCAP_MAX);
447
448 if (this.velocity_z > maxjumpspeed)
449 mjumpheight -= this.velocity_z - maxjumpspeed;
450 }
451 }
452
453 if (!WAS_ONGROUND(this) && !WAS_ONSLICK(this))
454 {
455#ifdef SVQC
457 LOG_TRACE("landing velocity: ", vtos(this.velocity), " (abs: ", ftos(vlen(this.velocity)), ")");
458#endif
459 if(this.lastground < time - 0.3)
460 {
461 float f = (1 - PHYS_FRICTION_ONLAND(this));
462 f = bound(0, f, 1);
463 this.velocity_x *= f;
464 this.velocity_y *= f;
465 }
466#ifdef SVQC
467 if(this.jumppadcount > 1)
468 LOG_TRACE(ftos(this.jumppadcount), "x jumppad combo");
469 this.jumppadcount = 0;
470#endif
471 }
472
473 this.velocity_z += mjumpheight;
474
475 UNSET_ONGROUND(this);
476 UNSET_ONSLICK(this);
477 SET_JUMP_HELD(this);
478
479#ifdef CSQC
481#endif
482
483#ifdef SVQC
485
487 PlayerSound(this, playersound_jump, CH_PLAYER, VOL_BASE, VOICETYPE_PLAYERSOUND);
488#endif
489 return true;
490}
void animdecide_setaction(entity e, float action, float restart)
const int ANIMACTION_JUMP
#define PHYS_CL_TRACK_CANJUMP(s)
Definition player.qh:285
bool autocvar_g_jump_grunt
Definition player.qh:41
#define PHYS_INPUT_BUTTON_CHAT(s)
Definition player.qh:159
#define PHYS_JUMPVELOCITY(s)
Definition player.qh:131
#define PHYS_JUMPSPEEDCAP_MIN
Definition player.qh:282
#define WAS_ONGROUND(s)
Definition player.qh:207
#define WAS_ONSLICK(s)
Definition player.qh:208
#define PHYS_TRACK_CANJUMP(s)
Definition player.qh:140
#define PHYS_JUMPVELOCITY_CROUCH(s)
Definition player.qh:132
#define IS_JUMP_HELD(s)
Definition player.qh:203
#define PHYS_JUMPSPEEDCAP_MAX
Definition player.qh:283
bool autocvar_speedmeter
Definition player.qh:46
#define IS_DUCKED(s)
Definition player.qh:210
float lastground
Definition player.qh:64
#define PHYS_INPUT_BUTTON_MINIGAME(s)
Definition player.qh:164
#define PHYS_MAXSPEED(s)
Definition player.qh:136
#define PHYS_FRICTION_ONLAND(s)
Definition player.qh:115
#define PHYS_JUMPSPEEDCAP_DISABLE_ONRAMPS(s)
Definition player.qh:130
float jumpheight_min
Definition extra.qh:4
float jumpheight_max
Definition extra.qh:4
#define PlayerSound(this, def, chan, vol, voicetype)
const int VOICETYPE_PLAYERSOUND
float jumppadcount
Definition jumppads.qh:28
#define LOG_TRACE(...)
Definition log.qh:76
entity viewloc
Definition viewloc.qh:13
float stof(string val,...)
string vtos(vector v)
string ftos(float f)
#define UNSET_ONSLICK(s)
Definition movetypes.qh:21
#define UNSET_ONGROUND(s)
Definition movetypes.qh:18
entity this
Definition self.qh:72
bool player_blocked
Definition client.qh:332
const float VOL_BASE
Definition sound.qh:36
const int CH_PLAYER
Definition sound.qh:20

References ANIMACTION_JUMP, animdecide_setaction(), autocvar_g_jump_grunt, autocvar_speedmeter, bound(), CH_PLAYER, entity(), ftos(), IS_DUCKED, IS_JUMP_HELD, IS_ONGROUND, jumpheight_max, jumpheight_min, jumppadcount, lastground, LOG_TRACE, M_ARGV, maxs, mins, MOVE_NORMAL, MUTATOR_CALLHOOK, origin, PHYS_CL_TRACK_CANJUMP, PHYS_FRICTION_ONLAND, PHYS_FROZEN, PHYS_INPUT_BUTTON_CHAT, PHYS_INPUT_BUTTON_MINIGAME, PHYS_JUMPSPEEDCAP_DISABLE_ONRAMPS, PHYS_JUMPSPEEDCAP_MAX, PHYS_JUMPSPEEDCAP_MIN, PHYS_JUMPVELOCITY, PHYS_JUMPVELOCITY_CROUCH, PHYS_MAXSPEED, PHYS_TRACK_CANJUMP, player_blocked, PlayerJump(), PlayerSound, SET_JUMP_HELD, stof(), time, trace_fraction, UNSET_ONGROUND, UNSET_ONSLICK, velocity, viewloc, vlen(), VOICETYPE_PLAYERSOUND, VOL_BASE, vtos(), WAS_ONGROUND, WAS_ONSLICK, waterlevel, and WATERLEVEL_SWIMMING.

Referenced by CheckPlayerJump(), MUTATOR_HOOKABLE(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), and PlayerJump().

◆ PM_Accelerate()

void PM_Accelerate ( entity this,
float dt,
vector wishdir,
float wishspeed,
float wishspeed0,
float accel,
float accelqw,
float stretchfactor,
float sidefric,
float speedlimit )

Definition at line 271 of file player.qc.

272{
273 float speedclamp = stretchfactor > 0 ? stretchfactor
274 : accelqw < 0 ? 1 // full clamping, no stretch
275 : -1; // no clamping
276
277 accelqw = fabs(accelqw);
278
280 wishspeed0 = wishspeed; // don't need to emulate this Q1 bug
281
282 float vel_straight = this.velocity * wishdir;
283 float vel_z = this.velocity_z;
284 vector vel_xy = vec2(this.velocity);
285 vector vel_perpend = vel_xy - vel_straight * wishdir;
286
287 float step = accel * dt * wishspeed0;
288
289 float vel_xy_current = vlen(vel_xy);
290 if (speedlimit)
291 accelqw = AdjustAirAccelQW(accelqw, (speedlimit - bound(wishspeed, vel_xy_current, speedlimit)) / max(1, speedlimit - wishspeed));
292 float vel_xy_forward = vel_xy_current + bound(0, wishspeed - vel_xy_current, step) * accelqw + step * (1 - accelqw);
293 float vel_xy_backward = vel_xy_current - bound(0, wishspeed + vel_xy_current, step) * accelqw - step * (1 - accelqw);
294 vel_xy_backward = max(0, vel_xy_backward); // not that it REALLY occurs that this would cause wrong behaviour afterwards
295 vel_straight = vel_straight + bound(0, wishspeed - vel_straight, step) * accelqw + step * (1 - accelqw);
296
297 if (sidefric < 0 && (vel_perpend*vel_perpend))
298 // negative: only apply so much sideways friction to stay below the speed you could get by "braking"
299 {
300 float f = max(0, 1 + dt * wishspeed * sidefric);
301 float themin = (vel_xy_backward * vel_xy_backward - vel_straight * vel_straight) / (vel_perpend * vel_perpend);
302 // assume: themin > 1
303 // vel_xy_backward*vel_xy_backward - vel_straight*vel_straight > vel_perpend*vel_perpend
304 // vel_xy_backward*vel_xy_backward > vel_straight*vel_straight + vel_perpend*vel_perpend
305 // vel_xy_backward*vel_xy_backward > vel_xy * vel_xy
306 // obviously, this cannot be
307 if (themin <= 0)
308 vel_perpend *= f;
309 else
310 {
311 themin = sqrt(themin);
312 vel_perpend *= max(themin, f);
313 }
314 }
315 else
316 vel_perpend *= max(0, 1 - dt * wishspeed * sidefric);
317
318 vel_xy = vel_straight * wishdir + vel_perpend;
319
320 if (speedclamp >= 0)
321 {
322 float vel_xy_preclamp;
323 vel_xy_preclamp = vlen(vel_xy);
324 if (vel_xy_preclamp > 0) // prevent division by zero
325 {
326 vel_xy_current += (vel_xy_forward - vel_xy_current) * speedclamp;
327 if (vel_xy_current < vel_xy_preclamp)
328 vel_xy *= (vel_xy_current / vel_xy_preclamp);
329 }
330 }
331
332 this.velocity = vel_xy + vel_z * '0 0 1';
333}
#define GAMEPLAYFIX_Q2AIRACCELERATE
Definition movetypes.qh:51
#define vec2(...)
Definition vector.qh:90

References AdjustAirAccelQW(), bound(), entity(), fabs(), GAMEPLAYFIX_Q2AIRACCELERATE, max(), sqrt(), vec2, vector, velocity, and vlen().

Referenced by sys_phys_simulate().

◆ PM_AirAccelerate()

void PM_AirAccelerate ( entity this,
float dt,
vector wishdir,
float wishspeed )

Definition at line 335 of file player.qc.

336{
337 if (wishspeed == 0)
338 return;
339
340 vector curvel = this.velocity;
341 curvel_z = 0;
342 float curspeed = vlen(curvel);
343
344 if (wishspeed > curspeed * 1.01)
345 wishspeed = min(wishspeed, curspeed + PHYS_WARSOWBUNNY_AIRFORWARDACCEL(this) * PHYS_MAXSPEED(this) * dt);
346 else
347 {
348 float f = max(0, (PHYS_WARSOWBUNNY_TOPSPEED(this) - curspeed) / (PHYS_WARSOWBUNNY_TOPSPEED(this) - PHYS_MAXSPEED(this)));
349 wishspeed = max(curspeed, PHYS_MAXSPEED(this)) + PHYS_WARSOWBUNNY_ACCEL(this) * f * PHYS_MAXSPEED(this) * dt;
350 }
351 vector wishvel = wishdir * wishspeed;
352 vector acceldir = wishvel - curvel;
353 float addspeed = vlen(acceldir);
354 acceldir = normalize(acceldir);
355
356 float accelspeed = min(addspeed, PHYS_WARSOWBUNNY_TURNACCEL(this) * PHYS_MAXSPEED(this) * dt);
357
359 {
360 vector curdir = normalize(curvel);
361 float dot = acceldir * curdir;
362 if (dot < 0)
363 acceldir -= (1 - PHYS_WARSOWBUNNY_BACKTOSIDERATIO(this)) * dot * curdir;
364 }
365
366 this.velocity += accelspeed * acceldir;
367}
#define PHYS_WARSOWBUNNY_ACCEL(s)
Definition player.qh:142
#define PHYS_WARSOWBUNNY_TOPSPEED(s)
Definition player.qh:145
#define PHYS_WARSOWBUNNY_AIRFORWARDACCEL(s)
Definition player.qh:143
#define PHYS_WARSOWBUNNY_BACKTOSIDERATIO(s)
Definition player.qh:144
#define PHYS_WARSOWBUNNY_TURNACCEL(s)
Definition player.qh:146
float min(float f,...)

References entity(), max(), min(), normalize(), PHYS_MAXSPEED, PHYS_WARSOWBUNNY_ACCEL, PHYS_WARSOWBUNNY_AIRFORWARDACCEL, PHYS_WARSOWBUNNY_BACKTOSIDERATIO, PHYS_WARSOWBUNNY_TOPSPEED, PHYS_WARSOWBUNNY_TURNACCEL, vector, velocity, and vlen().

Referenced by sys_phys_simulate().

◆ PM_check_blocked()

void PM_check_blocked ( entity this)

Definition at line 715 of file player.qc.

716{
718 PHYS_CS(this).movement = '0 0 0';
719#ifdef SVQC
720 if (!this.player_blocked)
721 return;
722 PHYS_CS(this).movement = '0 0 0';
724#endif
725}
float disableclientprediction

References disableclientprediction, entity(), PHYS_CS, PHYS_INPUT_BUTTON_CHAT, PHYS_INPUT_BUTTON_MINIGAME, and player_blocked.

Referenced by sys_phys_update().

◆ PM_check_frozen()

void PM_check_frozen ( entity this)

Definition at line 641 of file player.qc.

642{
643 if (!PHYS_FROZEN(this))
644 return;
645 if (PHYS_DODGING_FROZEN(this) && IS_CLIENT(this))
646 {
647 // bind movement to a very slow speed so dodging can use .movement for directional calculations
648 PHYS_CS(this).movement_x = bound(-2, PHYS_CS(this).movement.x, 2);
649 PHYS_CS(this).movement_y = bound(-2, PHYS_CS(this).movement.y, 2);
650 PHYS_CS(this).movement_z = bound(-2, PHYS_CS(this).movement.z, 2);
651 }
652 else
653 PHYS_CS(this).movement = '0 0 0';
654}
#define IS_CLIENT(s)
Definition player.qh:242
#define PHYS_DODGING_FROZEN(s)
Definition player.qh:112

References bound(), entity(), IS_CLIENT, movement, PHYS_CS, PHYS_DODGING_FROZEN, and PHYS_FROZEN.

Referenced by sys_phys_update().

◆ PM_check_hitground()

void PM_check_hitground ( entity this)

Definition at line 656 of file player.qc.

657{
658#ifdef SVQC
659 if (!this.wasFlying) return;
660 this.wasFlying = false;
661 if (this.waterlevel >= WATERLEVEL_SWIMMING) return;
662 if (this.ladder_entity) return;
663 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
664 {
665 .entity weaponentity = weaponentities[slot];
666 if(this.(weaponentity).hook)
667 return;
668 }
669 this.nextstep = time + 0.3 + random() * 0.1;
671 tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 1', MOVE_NOMONSTERS, this);
674 ? GS_FALL_METAL
675 : GS_FALL;
676 float vol = ((IS_DUCKED(this)) ? VOL_MUFFLED : VOL_BASE);
678#endif
679}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
entity hook
Definition player.qh:239
bool wasFlying
Definition player.qh:65
const float MOVE_NOMONSTERS
float Q3SURFACEFLAG_METALSTEPS
float trace_dphitq3surfaceflags
float Q3SURFACEFLAG_NOSTEPS
#define GlobalSound(this, def, chan, vol, voicetype)
entity ladder_entity
Definition ladder.qh:11
float random(void)
const float VOL_MUFFLED
Definition sound.qh:38
const int MAX_WEAPONSLOTS
Definition weapon.qh:16
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17

References CH_PLAYER, entity(), GlobalSound, hook, IS_DUCKED, ladder_entity, MAX_WEAPONSLOTS, maxs, mins, MOVE_NOMONSTERS, origin, Q3SURFACEFLAG_METALSTEPS, Q3SURFACEFLAG_NOSTEPS, random(), time, trace_dphitq3surfaceflags, VOICETYPE_PLAYERSOUND, VOL_BASE, VOL_MUFFLED, wasFlying, waterlevel, WATERLEVEL_SWIMMING, and weaponentities.

Referenced by sys_phys_update().

◆ PM_check_punch()

void PM_check_punch ( entity this,
float dt )

Definition at line 617 of file player.qc.

618{
619#ifdef SVQC
620 if (this.punchangle != '0 0 0')
621 {
622 float f = vlen(this.punchangle) - 10 * dt;
623 if (f > 0)
624 this.punchangle = normalize(this.punchangle) * f;
625 else
626 this.punchangle = '0 0 0';
627 }
628
629 if (this.punchvector != '0 0 0')
630 {
631 float f = vlen(this.punchvector) - 30 * dt;
632 if (f > 0)
633 this.punchvector = normalize(this.punchvector) * f;
634 else
635 this.punchvector = '0 0 0';
636 }
637#endif
638}
vector punchangle
vector punchvector

References entity(), normalize(), punchangle, punchvector, and vlen().

Referenced by sys_phys_monitor().

◆ PM_check_slick()

void PM_check_slick ( entity this)

Definition at line 702 of file player.qc.

703{
704 if(!IS_ONGROUND(this))
705 return;
706
708 tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 1', MOVE_NOMONSTERS, this);
710 SET_ONSLICK(this);
711 else
712 UNSET_ONSLICK(this);
713}
float Q3SURFACEFLAG_SLICK
#define SET_ONSLICK(s)
Definition movetypes.qh:20

References entity(), IS_ONGROUND, maxs, mins, MOVE_NOMONSTERS, origin, Q3SURFACEFLAG_SLICK, SET_ONSLICK, trace_dphitq3surfaceflags, and UNSET_ONSLICK.

Referenced by sys_phys_update().

◆ PM_check_specialcommand()

bool PM_check_specialcommand ( entity this,
int buttons )

Definition at line 584 of file player.qc.

585{
586#ifdef SVQC
587 string c;
588 switch (buttons)
589 {
590 // buttons mapped in PHYS_INPUT_BUTTON_MASK
591 case 0: c = "x"; break;
592 case BIT(0): c = "1"; break;
593 case BIT(2): c = " "; break;
594 case BIT(7): c = "s"; break;
595 case BIT(8): c = "w"; break;
596 case BIT(9): c = "a"; break;
597 case BIT(10): c = "d"; break;
598 default: c = "?";
599 }
600
601 if (c == substring(specialcommand, CS(this).specialcommand_pos, 1))
602 {
603 CS(this).specialcommand_pos += 1;
605 {
606 CS(this).specialcommand_pos = 0;
607 SpecialCommand(this);
608 return true;
609 }
610 }
611 else if (CS(this).specialcommand_pos && (c != substring(specialcommand, CS(this).specialcommand_pos - 1, 1)))
612 CS(this).specialcommand_pos = 0;
613#endif
614 return false;
615}
float specialcommand_pos
Definition player.qc:573
void SpecialCommand(entity this)
Definition player.qc:574
string specialcommand
Definition player.qc:572
#define strlen
string substring(string s, float start, float length)
ClientState CS(Client this)
Definition state.qh:47

References BIT, CS(), entity(), SpecialCommand(), specialcommand, specialcommand_pos, strlen, and substring().

Referenced by sys_phys_override().

◆ PM_ClientMovement_UpdateStatus()

void PM_ClientMovement_UpdateStatus ( entity this)

Definition at line 161 of file player.qc.

162{
163 if(!IS_PLAYER(this))
164 return;
165
166 bool have_hook = false;
167 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
168 {
169 #if defined(CSQC)
170 entity wepent = viewmodels[slot];
171 #elif defined(SVQC)
172 .entity weaponentity = weaponentities[slot];
173 entity wepent = this.(weaponentity);
174 #endif
175 if(wepent.hook && !wasfreed(wepent.hook))
176 {
177 have_hook = true;
178 break;
179 }
180 }
181
182 bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
183 if(this.viewloc && !(this.viewloc.spawnflags & VIEWLOC_FREEMOVE) && PHYS_CS(this).movement.x < 0)
184 do_crouch = true;
185 if (have_hook)
186 do_crouch = false;
187// else if (this.waterlevel >= WATERLEVEL_SWIMMING)
188// do_crouch = false;
189 else if (PHYS_INVEHICLE(this))
190 do_crouch = false;
191 else if (PHYS_FROZEN(this) || IS_DEAD(this))
192 do_crouch = false;
193
194 MUTATOR_CALLHOOK(PlayerCanCrouch, this, do_crouch);
195 do_crouch = M_ARGV(1, bool);
196
197 // Disable crouching on Q1BSP because it lacks a suitable cliphull (HLBSP added one).
198 if (STAT(PL_CROUCH_MAX, this).z == STAT(PL_MAX, this).z)
199 do_crouch = false;
200
201 if (do_crouch)
202 {
203 if (!IS_DUCKED(this))
204 {
205 SET_DUCKED(this);
206 this.view_ofs = STAT(PL_CROUCH_VIEW_OFS, this);
207 setsize(this, STAT(PL_CROUCH_MIN, this), STAT(PL_CROUCH_MAX, this));
208 // setanim(this, this.anim_duck, false, true, true); // this anim is BROKEN anyway
209 }
210 }
211 else if (IS_DUCKED(this))
212 {
213 tracebox(this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), this.origin, MOVE_NORMAL, this);
214 if (!trace_startsolid)
215 {
216 UNSET_DUCKED(this);
217 this.view_ofs = STAT(PL_VIEW_OFS, this);
218 setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
219 }
220 }
221
222 _Movetype_CheckWater(this); // needs to be run on the client, might as well use the latest on the server too!
223}
#define PHYS_INPUT_BUTTON_CROUCH(s)
Definition player.qh:154
#define IS_DEAD(s)
Definition player.qh:245
#define UNSET_DUCKED(s)
Definition player.qh:212
#define PHYS_INVEHICLE(s)
Definition player.qh:280
#define IS_PLAYER(s)
Definition player.qh:243
#define SET_DUCKED(s)
Definition player.qh:211
float trace_startsolid
const int VIEWLOC_FREEMOVE
Definition viewloc.qh:6
bool _Movetype_CheckWater(entity this)
Definition movetypes.qc:334
vector view_ofs
Definition progsdefs.qc:151
entity viewmodels[MAX_WEAPONSLOTS]
Definition view.qh:108

References _Movetype_CheckWater(), entity(), IS_DEAD, IS_DUCKED, IS_PLAYER, M_ARGV, MAX_WEAPONSLOTS, MOVE_NORMAL, movement, MUTATOR_CALLHOOK, origin, PHYS_CS, PHYS_FROZEN, PHYS_INPUT_BUTTON_CROUCH, PHYS_INVEHICLE, SET_DUCKED, STAT, trace_startsolid, UNSET_DUCKED, view_ofs, viewloc, VIEWLOC_FREEMOVE, viewmodels, and weaponentities.

Referenced by sys_phys_fix().

◆ PM_Footsteps()

void PM_Footsteps ( entity this)

Definition at line 681 of file player.qc.

682{
683#ifdef SVQC
684 if (!autocvar_g_footsteps) return;
685 if (IS_DUCKED(this)) return;
686 if (time >= this.lastground + 0.2) return;
687 if (vdist(this.velocity, <=, autocvar_sv_maxspeed * 0.6)) return;
688 if ((time > this.nextstep) || (time < (this.nextstep - 10.0)))
689 {
690 this.nextstep = time + 0.3 + random() * 0.1;
692 tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 1', MOVE_NOMONSTERS, this);
695 ? GS_STEP_METAL
696 : GS_STEP;
698 }
699#endif
700}
bool autocvar_g_footsteps
Definition player.qh:54
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8

References autocvar_g_footsteps, autocvar_sv_maxspeed, CH_PLAYER, entity(), GlobalSound, IS_DUCKED, lastground, maxs, mins, MOVE_NOMONSTERS, origin, Q3SURFACEFLAG_METALSTEPS, Q3SURFACEFLAG_NOSTEPS, random(), time, trace_dphitq3surfaceflags, vdist, velocity, VOICETYPE_PLAYERSOUND, and VOL_BASE.

Referenced by sys_phys_update().

◆ PM_jetpack()

void PM_jetpack ( entity this,
float maxspd_mod,
float dt )

Definition at line 727 of file player.qc.

728{
729 //makevectors(this.v_angle.y * '0 1 0');
730 makevectors(this.v_angle);
731 vector wishvel = v_forward * PHYS_CS(this).movement_x
732 + v_right * PHYS_CS(this).movement_y;
733 // add remaining speed as Z component
734 float maxairspd = PHYS_MAXAIRSPEED(this) * max(1, maxspd_mod);
735 // fix speedhacks :P
736 wishvel = normalize(wishvel) * min(1, vlen(wishvel) / maxairspd);
737 // add the unused velocity as up component
738 wishvel_z = 0;
739
740 // if (PHYS_INPUT_BUTTON_JUMP(this))
741 wishvel_z = sqrt(max(0, 1 - wishvel * wishvel));
742
743 // it is now normalized, so...
744 float a_side = PHYS_JETPACK_ACCEL_SIDE(this);
745 float a_up = PHYS_JETPACK_ACCEL_UP(this);
746 float a_add = PHYS_JETPACK_ANTIGRAVITY(this) * PHYS_GRAVITY(this);
747
749
750 wishvel_x *= a_side;
751 wishvel_y *= a_side;
752 wishvel_z *= a_up;
753 wishvel_z += a_add;
754
755 if(PHYS_JETPACK_REVERSE_THRUST(this) && PHYS_INPUT_BUTTON_CROUCH(this)) { wishvel_z *= -1; }
756
757 float best = 0;
759 // finding the maximum over all vectors of above form
760 // with wishvel having an absolute value of 1
762 // we're finding the maximum over
763 // f(a_side, a_up, a_add, z) := a_side * (1 - z^2) + (a_add + a_up * z)^2;
764 // for z in the range from -1 to 1
766 // maximum is EITHER attained at the single extreme point:
767 float a_diff = a_side * a_side - a_up * a_up;
768 float f;
769 if (a_diff != 0)
770 {
771 f = a_add * a_up / a_diff; // this is the zero of diff(f(a_side, a_up, a_add, z), z)
772 if (f > -1 && f < 1) // can it be attained?
773 {
774 best = (a_diff + a_add * a_add) * (a_diff + a_up * a_up) / a_diff;
775 //print("middle\n");
776 }
777 }
778 // OR attained at z = 1:
779 f = (a_up + a_add) * (a_up + a_add);
780 if (f > best)
781 {
782 best = f;
783 //print("top\n");
784 }
785 // OR attained at z = -1:
786 f = (a_up - a_add) * (a_up - a_add);
787 if (f > best)
788 {
789 best = f;
790 //print("bottom\n");
791 }
792 best = sqrt(best);
794
795 //print("best possible acceleration: ", ftos(best), "\n");
796
797 float fxy, fz;
798 fxy = bound(0, 1 - (this.velocity * normalize(wishvel_x * '1 0 0' + wishvel_y * '0 1 0')) / PHYS_JETPACK_MAXSPEED_SIDE(this), 1);
799 if (wishvel_z - PHYS_GRAVITY(this) > 0)
800 fz = bound(0, 1 - this.velocity_z / PHYS_JETPACK_MAXSPEED_UP(this), 1);
801 else
802 fz = bound(0, 1 + this.velocity_z / PHYS_JETPACK_MAXSPEED_UP(this), 1);
803
804 float fvel;
805 fvel = vlen(wishvel);
806 wishvel_x *= fxy;
807 wishvel_y *= fxy;
808 wishvel_z = (wishvel_z - PHYS_GRAVITY(this)) * fz + PHYS_GRAVITY(this);
809
810 fvel = min(1, vlen(wishvel) / best);
811 if (PHYS_JETPACK_FUEL(this) && !(ITEMS_STAT(this) & IT_UNLIMITED_AMMO))
812 f = min(1, PHYS_AMMO_FUEL(this) / (PHYS_JETPACK_FUEL(this) * dt * fvel));
813 else
814 f = 1;
815
816 //print("this acceleration: ", ftos(vlen(wishvel) * f), "\n");
817
818 if (f > 0 && wishvel != '0 0 0')
819 {
820 this.velocity = this.velocity + wishvel * f * dt;
821 UNSET_ONGROUND(this);
822
823#ifdef SVQC
824 if (!(ITEMS_STAT(this) & IT_UNLIMITED_AMMO))
825 TakeResource(this, RES_FUEL, PHYS_JETPACK_FUEL(this) * dt * fvel * f);
826
828
829 // jetpack also inhibits health regeneration, but only for 1 second
831#endif
832 }
833}
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
#define PHYS_JETPACK_MAXSPEED_UP(s)
Definition player.qh:127
#define PHYS_JETPACK_REVERSE_THRUST(s)
Definition player.qh:128
#define PHYS_JETPACK_ACCEL_SIDE(s)
Definition player.qh:122
#define PHYS_JETPACK_ACCEL_UP(s)
Definition player.qh:123
#define PHYS_JETPACK_ANTIGRAVITY(s)
Definition player.qh:124
#define PHYS_JETPACK_MAXSPEED_SIDE(s)
Definition player.qh:126
vector v_right
best
Definition all.qh:82
#define PHYS_GRAVITY(s)
Definition movetypes.qh:53
float pauseregen_finished
Definition client.qh:337
float autocvar_g_balance_pause_fuel_regen

References autocvar_g_balance_pause_fuel_regen, best, bound(), entity(), IT_UNLIMITED_AMMO, IT_USING_JETPACK, ITEMS_STAT, makevectors, max(), min(), normalize(), pauseregen_finished, PHYS_AMMO_FUEL, PHYS_CS, PHYS_GRAVITY, PHYS_INPUT_BUTTON_CROUCH, PHYS_JETPACK_ACCEL_SIDE, PHYS_JETPACK_ACCEL_UP, PHYS_JETPACK_ANTIGRAVITY, PHYS_JETPACK_FUEL, PHYS_JETPACK_MAXSPEED_SIDE, PHYS_JETPACK_MAXSPEED_UP, PHYS_JETPACK_REVERSE_THRUST, PHYS_MAXAIRSPEED, sqrt(), TakeResource(), time, UNSET_ONGROUND, v_angle, v_forward, v_right, vector, velocity, and vlen().

Referenced by sys_phys_update().

◆ REPLICATE() [1/3]

REPLICATE ( cvar_cl_jetpack_jump ,
bool ,
"cl_jetpack_jump"  )

◆ REPLICATE() [2/3]

REPLICATE ( cvar_cl_movement_track_canjump ,
bool ,
"cl_movement_track_canjump"  )

◆ REPLICATE() [3/3]

REPLICATE ( cvar_cl_physics ,
string ,
"cl_physics"  )

◆ SpecialCommand()

void SpecialCommand ( entity this)

Definition at line 574 of file player.qc.

575{
576 if(autocvar_sv_cheats || this.maycheat)
577 {
578 if (!CheatImpulse(this, CHIMPULSE_GIVE_ALL.impulse))
579 LOG_INFO("A hollow voice says \"Plugh\".");
580 }
581}
bool maycheat
Definition cheats.qc:44
float CheatImpulse(entity this, int imp)
Definition cheats.qc:138
int autocvar_sv_cheats
Definition cheats.qh:5
#define LOG_INFO(...)
Definition log.qh:65

References autocvar_sv_cheats, CheatImpulse(), entity(), LOG_INFO, and maycheat.

Referenced by PM_check_specialcommand().

◆ SV_PlayerPhysics()

void SV_PlayerPhysics ( entity this)

Definition at line 852 of file player.qc.

856{
857#ifdef SVQC
858 // needs to be called before physics are run!
859 if(IS_REAL_CLIENT(this))
860 PM_UpdateButtons(this, CS(this));
861#elif defined(CSQC)
862 if(this.last_pushed && !WarpZoneLib_ExactTrigger_Touch(this.last_pushed, this, false))
863 this.last_pushed = NULL;
864#endif
865
867
868#ifdef SVQC
869 CS(this).pm_frametime = frametime;
870#elif defined(CSQC)
871 if((ITEMS_STAT(this) & IT_USING_JETPACK) && !IS_DEAD(this) && !intermission)
873 else
875#endif
876}
void sys_phys_update(entity this, float dt)
Definition physics.qc:10
#define PHYS_INPUT_TIMELENGTH
Definition player.qh:254
float frametime
float intermission
const int MF_ROCKET
int csqcmodel_modelflags
entity last_pushed
Definition jumppads.qh:25
bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher, bool touchfunc)
Definition common.qc:815
#define NULL
Definition post.qh:14
void PM_UpdateButtons(entity this, entity store)
Definition client.qc:3058

References CS(), csqcmodel_modelflags, entity(), frametime, intermission, IS_DEAD, IS_REAL_CLIENT, IT_USING_JETPACK, ITEMS_STAT, last_pushed, MF_ROCKET, NULL, PHYS_INPUT_TIMELENGTH, PM_UpdateButtons(), sys_phys_update(), and WarpZoneLib_ExactTrigger_Touch().

◆ sys_phys_update()

void sys_phys_update ( entity this,
float dt )

Definition at line 10 of file physics.qc.

11{
12 if (!IS_CLIENT(this))
13 {
15 return;
16 }
17
18 sys_phys_fix(this, dt);
19 if (sys_phys_override(this, dt))
20 return;
21
22 sys_phys_monitor(this, dt);
23
24 PHYS_CS(this).movement_old = PHYS_CS(this).movement;
25 PHYS_CS(this).v_angle_old = this.v_angle;
26 PHYS_CS(this).buttons_old = PHYS_INPUT_BUTTON_MASK(this);
27
28 sys_phys_ai(this);
29
31
32 if (IS_SVQC)
33 {
34 if (this.move_movetype == MOVETYPE_NONE)
35 return;
36 // when we get here, disableclientprediction cannot be 2
37 if(this.move_movetype == MOVETYPE_FOLLOW) // not compatible with prediction
39 else if(this.move_qcphysics)
41 else
43 }
44
46
47 PM_check_frozen(this);
48
49 PM_check_blocked(this);
50
51 float maxspeed_mod = 1;
52
53 // conveyors: first fix velocity
54 if (this.conveyor.active)
55 this.velocity -= this.conveyor.movedir;
56 MUTATOR_CALLHOOK(PlayerPhysics, this, dt);
57
58 if (!IS_PLAYER(this))
59 {
61 maxspeed_mod = STAT(SPECTATORSPEED, this);
62 }
63 sys_phys_fixspeed(this, maxspeed_mod);
64
65 if (IS_DEAD(this))
66 {
67 // handle water here
68 vector midpoint = ((this.absmin + this.absmax) * 0.5);
69 int cont = pointcontents(midpoint);
70 if (cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
71 {
72 this.velocity = this.velocity * 0.5;
73
74 // do we want this?
75 // if(pointcontents(midpoint + '0 0 2') == CONTENT_WATER)
76 // { this.velocity_z = 70; }
77 }
79 return;
80 }
81
82 PM_check_slick(this);
83
84 if (IS_SVQC && !PHYS_FIXANGLE(this))
85 this.angles = eY * this.v_angle.y;
86 if (IS_PLAYER(this))
87 {
88 if (IS_ONGROUND(this))
89 {
91 PM_Footsteps(this);
92 }
93 else if (IsFlying(this))
94 this.wasFlying = true;
95 CheckPlayerJump(this);
96 }
97
98 if (this.flags & FL_WATERJUMP)
99 {
100 this.velocity_x = this.movedir.x;
101 this.velocity_y = this.movedir.y;
102 if (time > this.teleport_time || this.waterlevel == WATERLEVEL_NONE)
103 {
104 this.flags &= ~FL_WATERJUMP;
105 this.teleport_time = 0;
106 }
107 }
108 else if (MUTATOR_CALLHOOK(PM_Physics, this, maxspeed_mod, dt))
109 { /* handled */ }
110 else if (this.move_movetype == MOVETYPE_NOCLIP
111 || this.move_movetype == MOVETYPE_FLY
113 || MUTATOR_CALLHOOK(IsFlying, this))
114 {
115 this.com_phys_friction = PHYS_FRICTION(this);
116 this.com_phys_vel_max = PHYS_MAXSPEED(this) * maxspeed_mod;
117 this.com_phys_acc_rate = PHYS_ACCELERATE(this) * maxspeed_mod;
118 this.com_phys_friction_air = true;
119 sys_phys_simulate(this, dt);
120 this.com_phys_friction_air = false;
121 }
122 else if (this.waterlevel >= WATERLEVEL_SWIMMING)
123 {
124 this.com_phys_vel_max = PHYS_MAXSPEED(this) * maxspeed_mod;
125 this.com_phys_acc_rate = PHYS_ACCELERATE(this) * maxspeed_mod;
126 this.com_phys_water = true;
127 sys_phys_simulate(this, dt);
128 this.com_phys_water = false;
129 this.jumppadcount = 0;
130 }
131 else if (this.ladder_entity)
132 {
133 this.com_phys_friction = PHYS_FRICTION(this);
134 this.com_phys_vel_max = PHYS_MAXSPEED(this) * maxspeed_mod;
135 this.com_phys_acc_rate = PHYS_ACCELERATE(this) * maxspeed_mod;
136 this.com_phys_gravity = -PHYS_GRAVITY(this) * dt;
137 if (PHYS_ENTGRAVITY(this))
138 this.com_phys_gravity *= PHYS_ENTGRAVITY(this);
139 this.com_phys_ladder = true;
140 this.com_phys_friction_air = true;
141 sys_phys_simulate(this, dt);
142 this.com_phys_friction_air = false;
143 this.com_phys_ladder = false;
144 this.com_phys_gravity = 0;
145 }
146 else if (ITEMS_STAT(this) & IT_USING_JETPACK)
147 PM_jetpack(this, maxspeed_mod, dt);
148 else if (IS_ONGROUND(this) && (!IS_ONSLICK(this) || !PHYS_SLICK_APPLYGRAVITY(this)))
149 {
150 if (!WAS_ONGROUND(this))
151 {
152 emit(phys_land, this);
153 if (this.lastground < time - 0.3)
154 this.velocity *= (1 - PHYS_FRICTION_ONLAND(this));
155 }
156 this.com_phys_vel_max = PHYS_MAXSPEED(this) * maxspeed_mod;
157 this.com_phys_gravity = -PHYS_GRAVITY(this) * dt;
158 if (PHYS_ENTGRAVITY(this))
159 this.com_phys_gravity *= PHYS_ENTGRAVITY(this);
160 this.com_phys_ground = true;
161 this.com_phys_vel_2d = true;
162 sys_phys_simulate(this, dt);
163 this.com_phys_vel_2d = false;
164 this.com_phys_ground = false;
165 this.com_phys_gravity = 0;
166 }
167 else
168 {
169 this.com_phys_acc_rate_air = PHYS_AIRACCELERATE(this) * min(maxspeed_mod, 1);
170 this.com_phys_acc_rate_air_stop = PHYS_AIRSTOPACCELERATE(this) * maxspeed_mod;
171 this.com_phys_acc_rate_air_strafe = PHYS_AIRSTRAFEACCELERATE(this) * maxspeed_mod;
172 this.com_phys_vel_max_air_strafe = PHYS_MAXAIRSTRAFESPEED(this) * maxspeed_mod;
173 this.com_phys_vel_max_air = PHYS_MAXAIRSPEED(this) * maxspeed_mod;
174 this.com_phys_vel_max = PHYS_MAXAIRSPEED(this) * min(maxspeed_mod, 1);
175 this.com_phys_air = true;
176 this.com_phys_vel_2d = true;
177 sys_phys_simulate(this, dt);
178 this.com_phys_vel_2d = false;
179 this.com_phys_air = false;
180 }
181
183}
bool sys_phys_override(entity this, float dt)
Definition cl_physics.qc:13
void sys_phys_monitor(entity this, float dt)
Definition cl_physics.qc:19
void sys_phys_ai(entity this)
Definition cl_physics.qc:21
void sys_phys_spectator_control(entity this)
Definition cl_physics.qc:25
void sys_phys_pregame_hold(entity this)
Definition cl_physics.qc:23
void sys_phys_fixspeed(entity this, float maxspeed_mod)
Definition cl_physics.qc:27
void sys_phys_fix(entity this, float dt)
Definition cl_physics.qc:3
void PM_check_hitground(entity this)
Definition player.qc:656
void PM_jetpack(entity this, float maxspd_mod, float dt)
Definition player.qc:727
void PM_check_blocked(entity this)
Definition player.qc:715
void PM_check_frozen(entity this)
Definition player.qc:641
void CheckPlayerJump(entity this)
Definition player.qc:526
void PM_check_slick(entity this)
Definition player.qc:702
bool IsFlying(entity this)
Definition player.qc:836
void PM_Footsteps(entity this)
Definition player.qc:681
#define PHYS_MAXAIRSTRAFESPEED(s)
Definition player.qh:135
#define PHYS_AIRACCELERATE(s)
Definition player.qh:95
#define PHYS_FRICTION(s)
Definition player.qh:114
#define PHYS_AIRSTRAFEACCELERATE(s)
Definition player.qh:107
#define PHYS_FIXANGLE(s)
Definition player.qh:220
#define PHYS_ACCELERATE(s)
Definition player.qh:94
#define PHYS_AIRSTOPACCELERATE(s)
Definition player.qh:105
entity conveyor
Definition player.qh:57
#define PHYS_SLICK_APPLYGRAVITY(s)
Definition player.qh:148
#define PHYS_INPUT_BUTTON_MASK(s)
Definition player.qh:189
const float CONTENT_WATER
vector absmax
vector absmin
const float CONTENT_LAVA
const float CONTENT_SLIME
float com_phys_acc_rate_air_strafe
Definition physics.qh:12
float com_phys_acc_rate_air
Definition physics.qh:11
float com_phys_gravity
Definition physics.qh:16
float com_phys_acc_rate
Definition physics.qh:10
float com_phys_vel_max
Definition physics.qh:7
bool com_phys_vel_2d
Definition physics.qh:22
bool com_phys_air
Definition physics.qh:20
bool com_phys_water
Definition physics.qh:23
bool move_qcphysics
Definition physics.qh:25
bool com_phys_ladder
Definition physics.qh:21
float com_phys_friction
Definition physics.qh:14
float com_phys_vel_max_air
Definition physics.qh:8
bool com_phys_ground
Definition physics.qh:19
float com_phys_vel_max_air_strafe
Definition physics.qh:9
float com_phys_acc_rate_air_stop
Definition physics.qh:13
bool com_phys_friction_air
Definition physics.qh:24
void sys_phys_simulate(entity this, float dt)
for players
Definition physics.qc:198
void sys_phys_simulate_simple(entity this, float dt)
for other entities
Definition physics.qc:480
void sys_phys_postupdate(entity this)
Definition physics.qc:185
ent angles
Definition ent_cs.qc:121
#define IS_SVQC
Definition _all.inc:12
#define emit(T,...)
Definition lib.qh:17
const int MOVETYPE_NONE
Definition movetypes.qh:129
const int MOVETYPE_FOLLOW
Definition movetypes.qh:141
const int WATERLEVEL_NONE
Definition movetypes.qh:11
#define IS_ONSLICK(s)
Definition movetypes.qh:19
const int MOVETYPE_FLY_WORLDONLY
Definition movetypes.qh:143
float move_movetype
Definition movetypes.qh:76
const int MOVETYPE_NOCLIP
Definition movetypes.qh:137
const int MOVETYPE_FLY
Definition movetypes.qh:134
#define PHYS_ENTGRAVITY(s)
Definition movetypes.qh:55
const vector eY
Definition vector.qh:45
void viewloc_PlayerPhysics(entity this)
Definition viewloc.qc:13

References absmax, absmin, angles, CheckPlayerJump(), com_phys_acc_rate, com_phys_acc_rate_air, com_phys_acc_rate_air_stop, com_phys_acc_rate_air_strafe, com_phys_air, com_phys_friction, com_phys_friction_air, com_phys_gravity, com_phys_ground, com_phys_ladder, com_phys_vel_2d, com_phys_vel_max, com_phys_vel_max_air, com_phys_vel_max_air_strafe, com_phys_water, CONTENT_LAVA, CONTENT_SLIME, CONTENT_WATER, conveyor, disableclientprediction, emit, entity(), eY, FL_WATERJUMP, flags, IS_CLIENT, IS_DEAD, IS_ONGROUND, IS_ONSLICK, IS_PLAYER, IS_SVQC, IsFlying(), IT_USING_JETPACK, ITEMS_STAT, jumppadcount, ladder_entity, lastground, min(), move_movetype, move_qcphysics, movedir, MOVETYPE_FLY, MOVETYPE_FLY_WORLDONLY, MOVETYPE_FOLLOW, MOVETYPE_NOCLIP, MOVETYPE_NONE, MUTATOR_CALLHOOK, PHYS_ACCELERATE, PHYS_AIRACCELERATE, PHYS_AIRSTOPACCELERATE, PHYS_AIRSTRAFEACCELERATE, PHYS_CS, PHYS_ENTGRAVITY, PHYS_FIXANGLE, PHYS_FRICTION, PHYS_FRICTION_ONLAND, PHYS_GRAVITY, PHYS_INPUT_BUTTON_MASK, PHYS_MAXAIRSPEED, PHYS_MAXAIRSTRAFESPEED, PHYS_MAXSPEED, PHYS_SLICK_APPLYGRAVITY, PM_check_blocked(), PM_check_frozen(), PM_check_hitground(), PM_check_slick(), PM_Footsteps(), PM_jetpack(), STAT, sys_phys_ai(), sys_phys_fix(), sys_phys_fixspeed(), sys_phys_monitor(), sys_phys_override(), sys_phys_postupdate(), sys_phys_pregame_hold(), sys_phys_simulate(), sys_phys_simulate_simple(), sys_phys_spectator_control(), teleport_time, time, v_angle, vector, velocity, viewloc_PlayerPhysics(), WAS_ONGROUND, wasFlying, waterlevel, WATERLEVEL_NONE, and WATERLEVEL_SWIMMING.

Referenced by SV_PlayerPhysics().

Variable Documentation

◆ jetpack_stopped

float jetpack_stopped

Definition at line 525 of file player.qc.

Referenced by CheckPlayerJump().

◆ specialcommand

string specialcommand = "xwxwxsxsxaxdxaxdx1x "

Definition at line 572 of file player.qc.

Referenced by PM_check_specialcommand().

◆ specialcommand_pos

float specialcommand_pos

Definition at line 573 of file player.qc.

Referenced by PM_check_specialcommand().