Xonotic
movetypes.qh
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef SVQC
4 // undefined on client, engine cvar
5 bool autocvar_physics_ode;
6 
7 int autocvar_sv_qcphysics = 1; // TODO this is for testing - remove when qcphysics work
8 #endif
9 
10 // water levels
11 const int WATERLEVEL_NONE = 0;
12 const int WATERLEVEL_WETFEET = 1;
13 const int WATERLEVEL_SWIMMING = 2;
14 const int WATERLEVEL_SUBMERGED = 3;
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
46 .float bouncestop;
47 .float bouncefactor;
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 
72 void 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
98 const int UNSTICK_FINE = 0;
99 const int UNSTICK_FIXED = 1;
100 const int UNSTICK_STUCK = 2;
101 
102 // set by _Movetype_FlyMove
104 
106 void _Movetype_WallFriction(entity this, vector stepnormal);
107 int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepnormal, float stepheight);
110 void _Movetype_CheckStuck(entity this);
111 float _Movetype_CheckWater(entity ent);
113 void _Movetype_LinkEdict(entity this, float touch_triggers);
114 vector _Movetype_ClipVelocity(vector vel, vector norm, float f);
115 void _Movetype_PushEntityTrace(entity this, vector push);
116 bool _Movetype_PushEntity(entity this, vector push, float failonstartsolid, bool dolink);
117 
118 void Movetype_Physics_NoMatchTicrate(entity this, float movedt, bool isclient);
119 void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy);
120 void Movetype_Physics_MatchServer(entity this, bool sloppy);
122 void _Movetype_LinkEdict(entity this, float touch_triggers);
124 
126 
127 const int MAX_CLIP_PLANES = 5;
128 
129 #ifdef CSQC
130 const int MOVETYPE_NONE = 0;
131 const int MOVETYPE_ANGLENOCLIP = 1;
132 const int MOVETYPE_ANGLECLIP = 2;
133 const int MOVETYPE_WALK = 3;
134 const int MOVETYPE_STEP = 4;
135 const int MOVETYPE_FLY = 5;
136 const int MOVETYPE_TOSS = 6;
137 const int MOVETYPE_PUSH = 7;
138 const int MOVETYPE_NOCLIP = 8;
139 const int MOVETYPE_FLYMISSILE = 9;
140 const int MOVETYPE_BOUNCE = 10;
141 const int MOVETYPE_BOUNCEMISSILE = 11; // Like bounce but doesn't lose speed on bouncing
142 const int MOVETYPE_FOLLOW = 12;
143 const int MOVETYPE_PHYSICS = 32;
144 const int MOVETYPE_FLY_WORLDONLY = 33;
145 
146 #elif defined(SVQC)
147 const int MOVETYPE_ANGLENOCLIP = 1;
148 const int MOVETYPE_ANGLECLIP = 2;
149 #endif
150 
151 const int MOVETYPE_QCPLAYER = 150; // QC-driven player physics, no think functions!
152 const int MOVETYPE_QCENTITY = 151; // QC-driven entity physics, some think functions!
153 
154 const int MOVETYPE_FAKEPUSH = 13;
155 
156 const int MOVEFLAG_VALID = BIT(23);
160 
161 #ifdef CSQC
162 #define moveflags STAT(MOVEFLAGS)
163 #endif
void Movetype_Physics_MatchServer(entity this, bool sloppy)
Definition: movetypes.qc:851
void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy)
Definition: movetypes.qc:869
float MOVETYPE_NONE
Definition: progsdefs.qc:246
float MOVETYPE_WALK
Definition: progsdefs.qc:249
const int WATERLEVEL_SUBMERGED
Definition: movetypes.qh:14
const float MOVETYPE_PHYSICS
const int MAX_CLIP_PLANES
Definition: movetypes.qh:127
float MOVETYPE_STEP
Definition: progsdefs.qc:250
float MOVETYPE_TOSS
Definition: progsdefs.qc:252
void _Movetype_CheckStuck(entity this)
Definition: movetypes.qc:649
const int MOVEFLAG_NOGRAVITYONGROUND
Definition: movetypes.qh:158
entity() spawn
vector move_stepnormal
Definition: movetypes.qh:103
const int MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE
Definition: movetypes.qh:159
float MOVETYPE_BOUNCEMISSILE
Definition: progsdefs.qc:257
int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepnormal, float stepheight)
Definition: movetypes.qc:124
void Movetype_Physics_NoMatchTicrate(entity this, float movedt, bool isclient)
Definition: movetypes.qc:813
float bouncestop
float MOVETYPE_BOUNCE
Definition: progsdefs.qc:256
float move_suspendedinair
Definition: movetypes.qh:94
const int MOVETYPE_FAKEPUSH
Definition: movetypes.qh:154
float move_movetype
Definition: movetypes.qh:76
const int MOVEFLAG_Q2AIRACCELERATE
Definition: movetypes.qh:157
const int WATERLEVEL_NONE
Definition: movetypes.qh:11
bool _Movetype_NudgeOutOfSolid_PivotIsKnownGood(entity this, vector pivot)
Definition: movetypes.qc:23
float pm_time
Definition: movetypes.qh:74
entity groundentity
Definition: movetypes.qh:93
const int UNSTICK_STUCK
Definition: movetypes.qh:100
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition: bits.qh:8
float bouncefactor
void _Movetype_CheckVelocity(entity this)
Definition: movetypes.qc:339
void _Movetype_CheckWaterTransition(entity ent)
Definition: movetypes.qc:379
void _Movetype_LinkEdict(entity this, float touch_triggers)
const int MOVETYPE_QCENTITY
Definition: movetypes.qh:152
float move_nomonsters
Definition: movetypes.qh:88
float MOVETYPE_PUSH
Definition: progsdefs.qc:253
float MOVETYPE_FLY_WORLDONLY
void _Movetype_PushEntityTrace(entity this, vector push)
Definition: movetypes.qc:679
void Movetype_Physics_NoMatchServer(entity this)
Definition: movetypes.qc:839
const int WATERLEVEL_WETFEET
Definition: movetypes.qh:12
float move_didgravity
Definition: movetypes.qh:95
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float MOVETYPE_FLYMISSILE
Definition: progsdefs.qc:255
float MOVETYPE_NOCLIP
Definition: progsdefs.qc:254
vector _Movetype_ClipVelocity(vector vel, vector norm, float f)
Definition: movetypes.qc:668
int _Movetype_UnstickEntity(entity this)
Definition: movetypes.qc:622
vector punchangle
Definition: movetypes.qh:91
float move_time
Definition: movetypes.qh:77
float MOVETYPE_FOLLOW
void _Movetype_WallFriction(entity this, vector stepnormal)
Definition: movetypes.qc:106
const int MOVEFLAG_VALID
Definition: movetypes.qh:156
void _Movetype_LinkEdict_TouchAreaGrid(entity this)
Definition: movetypes.qc:453
const int UNSTICK_FINE
Definition: movetypes.qh:98
const int WATERLEVEL_SWIMMING
Definition: movetypes.qh:13
bool _Movetype_PushEntity(entity this, vector push, float failonstartsolid, bool dolink)
entity aiment
Definition: movetypes.qh:90
const int MOVETYPE_QCPLAYER
Definition: movetypes.qh:151
const int UNSTICK_FIXED
Definition: movetypes.qh:99
void set_movetype(entity this, int mt)
float MOVETYPE_FLY
Definition: progsdefs.qc:251
float _Movetype_CheckWater(entity ent)
Definition: movetypes.qc:345