]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/dpdefs/doc.md
Remove .move_* fields and MOVETYPE_PUSH logic (doesn't work)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / dpdefs / doc.md
1 # CSQC
2
3 ```
4
5 // input:
6 //   self
7 .void() predraw;
8
9 // input:
10 //   time
11 //   self
12 .void() think;
13
14 // 0 = keydown, key, character (EXT_CSQC)
15 // 1 = keyup, key, character (EXT_CSQC)
16 // 2 = mousemove relative, x, y (EXT_CSQC)
17 // 3 = mousemove absolute, x, y (DP_CSQC)
18 bool CSQC_InputEvent(int eventtype, int x, int y);
19
20 void CSQC_UpdateView(int width, int height);
21 // catch commands registered with registercommand
22 bool CSQC_ConsoleCommand(string cmd);
23 bool CSQC_Parse_TempEntity();
24 bool CSQC_Parse_StuffCmd(string msg);
25 bool CSQC_Parse_Print(string msg);
26 bool CSQC_Parse_CenterPrint(string msg);
27 bool CSQC_Event_Sound(int ent, int channel, string sample, float volume, float attenuation, vector pos, float speed, int flags);
28
29 entity CSQC_Ent_Spawn(int entnum);
30 void CSQC_Ent_Update(bool isnew);
31 void CSQC_Ent_Remove();
32
33 void CSQC_Init();
34 void CSQC_Shutdown();
35
36 // input:
37 //   time
38 //   self
39 //   v_forward: forward
40 //   v_right: right
41 //   v_up: up
42 // output:
43 //   origin
44 //   v_forward: forward
45 //   v_right: right
46 //   v_up: up
47 //   trace_endpos: visorigin
48 .vector camera_transform(vector pos, vector ang);
49
50 // control start position of sound()
51 // calculated as ofs = time - sound_starttime
52 float sound_starttime;
53
54 ```
55
56 # SVQC
57
58 ```
59
60 .entity clientcamera;
61
62 // input:
63 //   time
64 //   self
65 void ClientDisconnect();
66
67 // input:
68 //   time
69 void SV_Shutdown();
70
71 // input:
72 //   time
73 void SV_PausedTic(float elapsed);
74
75 // input:
76 //   time
77 //   self
78 void SV_ChangeTeam(int color);
79
80 // input:
81 //   time
82 //   self
83 void ClientKill();
84
85 // input:
86 //   time
87 //   self
88 void RestoreGame();
89
90 // Called when a client connects to the server
91 // input:
92 //   time
93 //   self
94 //   parm1..n
95 void ClientConnect();
96
97 // Called when a client spawns in the server
98 // input:
99 //   time
100 //   self
101 //   parm1..n
102 void PutClientInServer();
103
104 // return false to remove
105 .bool SendEntity(entity to, int sf);
106
107 // input:
108 //   time
109 //   self
110 void SV_OnEntityPreSpawnFunction();
111
112 // input:
113 //   time
114 //   self
115 void SV_OnEntityNoSpawnFunction();
116
117 // input:
118 //   time
119 //   self
120 void SV_OnEntityPostSpawnFunction();
121
122 // input:
123 //   time
124 // output:
125 //   parm1..n
126 void SetNewParms();
127
128 // Runs every frame
129 // input:
130 //
131 .bool customizeentityforclient();
132
133 // input:
134 //   time
135 //   self
136 // output:
137 //   parm1..n
138 void SetChangeParms();
139
140 // input:
141 //   time
142 //   self
143 //   other
144 //   trace_allsolid
145 //   trace_startsolid
146 //   trace_fraction
147 //   trace_inwater
148 //   trace_inopen
149 //   trace_endpos: self.origin
150 //   trace_plane_normal
151 //   trace_plane_dist
152 //   trace_ent: other
153 //   trace_dpstartcontents
154 //   trace_dphitcontents
155 //   trace_dphitq3surfaceflags
156 //   trace_dphittexturename
157 .void touch();
158
159 // when .watertype changes:
160 .void contentstransition(int prev, int current);
161
162 // input:
163 //   time
164 //   self
165 //   other
166 .void blocked();
167
168 // input:
169 //   time
170 //   self
171 .void movetypesteplandevent(vector vel);
172
173 // input:
174 //   time
175 //   self
176 void PlayerPreThink();
177
178 // input:
179 //   time
180 //   self
181 void PlayerPostThink();
182
183 // input:
184 //   time
185 //   frametime
186 void StartFrame();
187
188 // input:
189 //   time
190 void EndFrame();
191
192 // input:
193 //   time
194 //   self
195 void SV_PlayerPhysics();
196
197 // input:
198 //   time
199 //   self
200 void SV_ParseClientCommand(string cmd);
201
202 ```
203
204 # MENUQC
205
206 ```
207
208 void m_keydown(int key, int ascii);
209
210 void m_keyup(int key, int ascii);
211
212 void m_draw(int width, int height);
213
214 void m_toggle(int mode);
215
216 int m_gethostcachecategory(int entry);
217
218 void m_shutdown();
219
220 void m_init();
221
222 ```
223
224 # All
225
226 ```
227
228 void URI_Get_Callback(int id, int status, string data);
229
230 void GameCommand(string cmd);
231
232 ```
233
234 # Misc
235
236 ## Trace
237
238 ### tracebox
239
240     void tracebox(vector v1, vector min, vector max, vector v2, int tryents, entity ignoreentity);
241
242 attempt to move an object from v1 to v2 of given size
243
244 tryents:
245  * MOVE_NORMAL (0)
246  * MOVE_NOMONSTERS (1): ignore monsters
247  * MOVE_MISSILE (2): +15 to every extent
248  * MOVE_WORLDONLY (3): ignore everything except bsp
249  * MOVE_HITMODEL (4): hit model, not bbox
250
251 ### traceline
252
253     void traceline(vector v1, vector v2, int tryents, entity ignoreentity);
254
255 degenerate case of tracebox when min and max are equal
256
257 ### result globals
258
259     bool trace_allsolid;
260
261 trace never left solid
262
263     bool trace_startsolid;
264
265 trace started inside solid
266
267     float trace_fraction;
268
269 distance before collision: 0..1, 1 if no collision
270
271     vector trace_endpos;
272
273 v1 + (v2 - v1) * trace_fraction
274
275     vector trace_plane_normal;
276
277 normalized plane normal, '0 0 0' if no collision.
278 May be present if edges touch without clipping, use `trace_fraction < 1` as a determinant instead
279
280     float trace_plane_dist;
281
282
283
284     entity trace_ent;
285
286 entity hit, if any
287
288     bool trace_inopen;
289
290
291
292     bool trace_inwater;
293
294
295
296     int trace_dpstartcontents;
297
298 DPCONTENTS_ value at start position of trace
299
300     int trace_dphitcontents;
301
302 DPCONTENTS_ value of impacted surface (not contents at impact point, just contents of the surface that was hit)
303
304     int trace_dphitq3surfaceflags;
305
306 Q3SURFACEFLAG_ value of impacted surface
307
308     string trace_dphittexturename;
309
310 texture name of impacted surface
311
312     int trace_networkentity;
313
314