Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
movetypes.qh
Go to the documentation of this file.
1#pragma once
2
3#ifdef SVQC
4// undefined on client, engine cvar
6
7bool use_engine_physics; // debug option for testing legacy engine code
8#endif
9
10// water levels
11const int WATERLEVEL_NONE = 0;
12const int WATERLEVEL_WETFEET = 1;
13const int WATERLEVEL_SWIMMING = 2;
15
16#define IS_ONGROUND(s) boolean((s).flags & FL_ONGROUND)
17#define SET_ONGROUND(s) ((s).flags |= FL_ONGROUND)
18#define UNSET_ONGROUND(s) ((s).flags &= ~FL_ONGROUND)
19#define IS_ONSLICK(s) boolean((s).flags & FL_ONSLICK)
20#define SET_ONSLICK(s) ((s).flags |= FL_ONSLICK)
21#define UNSET_ONSLICK(s) ((s).flags &= ~FL_ONSLICK)
22
23#define GAMEPLAYFIX_DOWNTRACEONGROUND(s) STAT(GAMEPLAYFIX_DOWNTRACEONGROUND)
24#define GAMEPLAYFIX_EASIERWATERJUMP(s) STAT(GAMEPLAYFIX_EASIERWATERJUMP)
25#define GAMEPLAYFIX_STEPDOWN(s) STAT(GAMEPLAYFIX_STEPDOWN)
26#define GAMEPLAYFIX_STEPDOWN_MAXSPEED(s) STAT(GAMEPLAYFIX_STEPDOWN_MAXSPEED)
27#define GAMEPLAYFIX_STEPMULTIPLETIMES(s) STAT(GAMEPLAYFIX_STEPMULTIPLETIMES)
28#define GAMEPLAYFIX_UNSTICKPLAYERS(s) STAT(GAMEPLAYFIX_UNSTICKPLAYERS)
29#define GAMEPLAYFIX_WATERTRANSITION(s) STAT(GAMEPLAYFIX_WATERTRANSITION)
30#define GAMEPLAYFIX_SLIDEMOVEPROJECTILES(s) STAT(GAMEPLAYFIX_SLIDEMOVEPROJECTILES)
31#define GAMEPLAYFIX_GRENADEBOUNCESLOPES(s) STAT(GAMEPLAYFIX_GRENADEBOUNCESLOPES)
32#define GAMEPLAYFIX_NOAIRBORNCORPSE(s) STAT(GAMEPLAYFIX_NOAIRBORNCORPSE)
33#define NOAIRBORNCORPSE_ALLOWSUSPENDED(s) STAT(NOAIRBORNCORPSE_ALLOWSUSPENDED)
34#define UPWARD_VELOCITY_CLEARS_ONGROUND(s) STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND)
35#define GAMEPLAYFIX_DELAYPROJECTILES(s) STAT(GAMEPLAYFIX_DELAYPROJECTILES)
36
37
38#define PHYS_STEPHEIGHT(s) STAT(MOVEVARS_STEPHEIGHT)
39#define PHYS_NOSTEP(s) STAT(NOSTEP)
40#define PHYS_JUMPSTEP(s) STAT(MOVEVARS_JUMPSTEP)
41#define PHYS_WALLFRICTION(s) STAT(MOVEVARS_WALLFRICTION)
42
43#define PHYS_WALLCLIP(s) STAT(MOVEVARS_WALLCLIP)
44
45#ifdef CSQC
48
49 #define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE (boolean(moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE))
50 #define GAMEPLAYFIX_NOGRAVITYONGROUND (boolean(moveflags & MOVEFLAG_NOGRAVITYONGROUND))
51 #define GAMEPLAYFIX_Q2AIRACCELERATE (boolean(moveflags & MOVEFLAG_Q2AIRACCELERATE))
52
53 #define PHYS_GRAVITY(s) STAT(MOVEVARS_GRAVITY, s)
54 // FIXME: 0 doesn't mean zero gravity
55 #define PHYS_ENTGRAVITY(s) STAT(MOVEVARS_ENTGRAVITY, s)
56
57 #define TICRATE ticrate
58
59#elif defined(SVQC)
60
61 #define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE autocvar_sv_gameplayfix_gravityunaffectedbyticrate
62 #define GAMEPLAYFIX_NOGRAVITYONGROUND autocvar_sv_gameplayfix_nogravityonground
63 #define GAMEPLAYFIX_Q2AIRACCELERATE autocvar_sv_gameplayfix_q2airaccelerate
64
65 #define PHYS_GRAVITY(s) autocvar_sv_gravity
66 #define PHYS_ENTGRAVITY(s) ((s).gravity)
67
68 #define TICRATE sys_frametime
69
70#endif
71
72void set_movetype(entity this, int mt);
73
74.float pm_time;
75
77.float move_time;
78//.vector move_origin;
79//.vector move_angles;
80//.vector move_velocity;
81//.vector move_avelocity;
82//.int move_flags;
83//.int move_watertype;
84//.int move_waterlevel;
85.void(float, float)contentstransition;
86//.float move_bounce_factor;
87//.float move_bounce_stopspeed;
88.float move_nomonsters; // -1 for MOVE_NORMAL, otherwise a MOVE_ constant
89
90.entity aiment;
91.vector punchangle;
92
93.entity groundentity; // FIXME add move_groundnetworkentity?
96
97// unsticking
98const int UNSTICK_FINE = 0;
99const int UNSTICK_FIXED = 1;
100const int UNSTICK_STUCK = 2;
101
102// set by _Movetype_FlyMove
104
106void _Movetype_WallFriction(entity this, vector stepnormal);
107int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepnormal, float stepheight);
112void _Movetype_LinkEdict(entity this, float touch_triggers);
113vector _Movetype_ClipVelocity(vector vel, vector norm, float f);
115bool _Movetype_PushEntity(entity this, vector push, bool dolink);
116
117void Movetype_Physics_NoMatchTicrate(entity this, float movedt, bool isclient);
118void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy);
119void Movetype_Physics_MatchServer(entity this, bool sloppy);
121void _Movetype_LinkEdict(entity this, float touch_triggers);
123
125
126const int MAX_CLIP_PLANES = 5;
127
128#ifdef CSQC
129const int MOVETYPE_NONE = 0;
131const int MOVETYPE_ANGLECLIP = 2;
132const int MOVETYPE_WALK = 3;
133const int MOVETYPE_STEP = 4;
134const int MOVETYPE_FLY = 5;
135const int MOVETYPE_TOSS = 6;
136const int MOVETYPE_PUSH = 7;
137const int MOVETYPE_NOCLIP = 8;
139const int MOVETYPE_BOUNCE = 10;
140const int MOVETYPE_BOUNCEMISSILE = 11; // Like bounce but doesn't lose speed on bouncing
141const int MOVETYPE_FOLLOW = 12;
142const int MOVETYPE_PHYSICS = 32;
144
145#elif defined(SVQC)
146const int MOVETYPE_ANGLENOCLIP = 1;
147const int MOVETYPE_ANGLECLIP = 2;
148#endif
149
150const int MOVETYPE_QCPLAYER = 150; // QC-driven player physics, no think functions!
151const int MOVETYPE_QCENTITY = 151; // QC-driven entity physics, some think functions!
152
153const int MOVETYPE_FAKEPUSH = 13;
154
155const int MOVEFLAG_VALID = BIT(23);
159
160#ifdef CSQC
161#define moveflags STAT(MOVEFLAGS)
162#endif
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
vector punchangle
void _Movetype_LinkEdict(entity this, float touch_triggers)
void _Movetype_CheckStuck(entity this)
Definition movetypes.qc:620
const int MOVETYPE_STEP
Definition movetypes.qh:133
const int MOVETYPE_WALK
Definition movetypes.qh:132
void Movetype_Physics_MatchServer(entity this, bool sloppy)
Definition movetypes.qc:817
const int MOVETYPE_NONE
Definition movetypes.qh:129
int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepnormal, float stepheight)
Definition movetypes.qc:120
const int WATERLEVEL_SWIMMING
Definition movetypes.qh:13
const int WATERLEVEL_WETFEET
Definition movetypes.qh:12
void _Movetype_PushEntityTrace(entity this, vector push)
Definition movetypes.qc:650
const int MOVETYPE_QCPLAYER
Definition movetypes.qh:150
const int WATERLEVEL_SUBMERGED
Definition movetypes.qh:14
void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy)
Definition movetypes.qc:835
const int MOVEFLAG_NOGRAVITYONGROUND
Definition movetypes.qh:157
const int MOVETYPE_FOLLOW
Definition movetypes.qh:141
const int UNSTICK_FINE
Definition movetypes.qh:98
const int MAX_CLIP_PLANES
Definition movetypes.qh:126
const int MOVETYPE_FAKEPUSH
Definition movetypes.qh:153
const int WATERLEVEL_NONE
Definition movetypes.qh:11
const int MOVEFLAG_Q2AIRACCELERATE
Definition movetypes.qh:156
float pm_time
Definition movetypes.qh:74
const int MOVETYPE_PUSH
Definition movetypes.qh:136
const int MOVETYPE_FLYMISSILE
Definition movetypes.qh:138
entity groundentity
Definition movetypes.qh:93
float _Movetype_CheckWater(entity ent)
Definition movetypes.qc:334
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
vector _Movetype_ClipVelocity(vector vel, vector norm, float f)
Definition movetypes.qc:639
const int MOVETYPE_FLY_WORLDONLY
Definition movetypes.qh:143
const int MOVETYPE_ANGLENOCLIP
Definition movetypes.qh:130
float bouncefactor
Definition movetypes.qh:47
const int MOVETYPE_ANGLECLIP
Definition movetypes.qh:131
float move_nomonsters
Definition movetypes.qh:88
bool _Movetype_PushEntity(entity this, vector push, bool dolink)
Definition movetypes.qc:668
int _Movetype_UnstickEntity(entity this)
Definition movetypes.qc:593
entity aiment
Definition movetypes.qh:90
void Movetype_Physics_NoMatchTicrate(entity this, float movedt, bool isclient)
Definition movetypes.qc:779
void _Movetype_LinkEdict_TouchAreaGrid(entity this)
Definition movetypes.qc:449
const int UNSTICK_STUCK
Definition movetypes.qh:100
const int MOVETYPE_BOUNCEMISSILE
Definition movetypes.qh:140
void _Movetype_CheckWaterTransition(entity ent)
Definition movetypes.qc:368
float move_time
Definition movetypes.qh:77
vector move_stepnormal
Definition movetypes.qh:103
float move_movetype
Definition movetypes.qh:76
void Movetype_Physics_NoMatchServer(entity this)
Definition movetypes.qc:805
const int MOVETYPE_PHYSICS
Definition movetypes.qh:142
const int MOVETYPE_NOCLIP
Definition movetypes.qh:137
const int MOVEFLAG_VALID
Definition movetypes.qh:155
const int MOVETYPE_QCENTITY
Definition movetypes.qh:151
float move_suspendedinair
Definition movetypes.qh:94
void _Movetype_WallFriction(entity this, vector stepnormal)
Definition movetypes.qc:102
const int MOVETYPE_FLY
Definition movetypes.qh:134
const int UNSTICK_FIXED
Definition movetypes.qh:99
float move_didgravity
Definition movetypes.qh:95
bool _Movetype_NudgeOutOfSolid_PivotIsKnownGood(entity this, vector pivot)
Definition movetypes.qc:19
const int MOVETYPE_TOSS
Definition movetypes.qh:135
bool use_engine_physics
Definition movetypes.qh:7
const int MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE
Definition movetypes.qh:158
bool autocvar_physics_ode
Definition movetypes.qh:5
float bouncestop
Definition movetypes.qh:46
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
vector
Definition self.qh:92