]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/client/csqc_builtins.qc
Merge remote-tracking branch 'origin/master' into terencehill/menu_focus_stuff
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / csqc_builtins.qc
1 void (vector ang)                                                       makevectors = #1;
2 void(entity e, vector o) setorigin      = #2;
3 void (entity e, string m)                                               setmodel = #3;
4 void(entity e, vector min, vector max) setsize = #4;
5
6 void ()                                                                 break = #6;
7 float ()                                                                random = #7;
8 void (entity e, float chan, string samp, float vol, float atten)        sound = #8;
9 vector (vector v)                                                       normalize = #9;
10 void (string e)                                                         error = #10;
11 void (string e)                                                         objerror = #11;
12 float (vector v)                                                        vlen = #12;
13 float (vector v)                                                        vectoyaw = #13;
14 entity ()                                                               spawn = #14;
15 void (entity e)                                                         remove = #15;
16
17 void (vector v1, vector v2, float nomonsters, entity forent)            traceline = #16;
18
19 entity (entity start, .string fld, string match)                        find = #18;
20 string (string s)                                                       precache_sound = #19;
21 string (string s)                                                       precache_model = #20;
22
23 void (string s, ...)                                            dprint = #25;
24 string (float f)                                                        ftos = #26;
25 string (vector v)                                                       vtos = #27;
26 void ()                                                                 coredump = #28;
27 void ()                                                                 traceon = #29;
28 void ()                                                                 traceoff = #30;
29 void (entity e)                                                         eprint = #31;
30
31 float (float v)                                                         rint = #36;
32 float (float v)                                                         floor = #37;
33 float (float v)                                                         ceil = #38;
34
35 float (vector v)                                                        pointcontents = #41;
36 float (float f)                                                         fabs = #43;
37
38 float (string s)                                                        cvar = #45;
39 void (string s, ...)                                                    localcmd = #46;
40 entity (entity e)                                                       nextent = #47;
41
42 vector (vector v)                                                       vectoangles = #51;
43 vector (vector v, vector w)                                                     vectoangles2 = #51;
44
45 void (string var, string val)                                           cvar_set = #72;
46
47
48 float()                                                                 ReadByte = #360;
49 float()                                                                 ReadChar = #361;
50 float()                                                                 ReadShort = #362;
51 float()                                                                 ReadLong = #363;
52 float()                                                                 ReadCoord = #364;
53 float()                                                                 ReadAngle = #365;
54 string()                                                                ReadString = #366;      //warning: this returns a temporary!
55
56 float(string s)                                                         stof = #81;
57
58
59 void (vector v1, vector min, vector max, vector v2, float nomonsters, entity forent)    tracebox = #90;
60 float (string name, string value, ...)                                  registercvar = #93;
61
62 entity (entity start, .entity fld, entity match)                        findentity = #98;
63 entity (entity start, .float fld, float match)                          findfloat = #98;
64
65 float (string s)                                                        checkextension = #99;
66
67 float (string filename, float mode)                                     fopen = #110;
68 void (float fhandle)                                                    fclose = #111;
69 string (float fhandle)                                                  fgets = #112;
70 void (float fhandle, string s)                                          fputs = #113;
71 float (string s)                                                        strlen = #114;
72 string (...)                                                            strcat = #115;
73 string (string s, float start, float length)                            substring = #116;
74 vector (string s)                                                       stov = #117;
75 string (string s)                                                       strzone = #118;
76 void (string s)                                                         strunzone = #119;
77
78 void ()                                                                 R_ClearScene = #300;
79 void (float mask)                                                       R_AddEntities = #301;
80 void (entity e)                                                         R_AddEntity = #302;
81 float (float property, ...)                                             R_SetView = #303;
82 vector (float property, ...)                                            R_SetView3fv = #303;
83 void ()                                                                 R_RenderScene = #304;
84 void (vector org, float radius, vector rgb)                             R_AddDynamicLight = #305;
85 void ()                                                                 R_CalcRefDef = #306;
86
87 vector (vector v)                                                       cs_unproject = #310;
88 vector (vector v)                                                       cs_project = #311;
89
90 void    drawline(float width, vector pos1, vector pos2, vector rgb, float alpha, float flags) = #315;
91 float   iscachedpic(string name)        = #316;
92 string  precache_pic(string name, ...)  = #317;
93 vector  draw_getimagesize(string pic) = #318;
94 void    freepic(string name)            = #319;
95 float   drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #320;
96 float   drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #321;
97 float   drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #322;
98 float   drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #323;
99 void    drawsetcliparea(float x, float y, float width, float height) = #324;
100 void    drawresetcliparea(void) = #325;
101 float   drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag) = #326;
102 float   stringwidth(string text, float handleColors, vector fontSize) = #327;
103 float   drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #328;
104
105
106 float (float statnum)                                                   getstatf = #330;
107 float (float statnum)                                                   getstati = #331;
108 string (float statnum)                                                  getstats = #332;
109
110 void (entity e, float i)                                                setmodelindex = #333;
111 string (float i)                                                        modelnameforindex = #334;
112
113 float(string efname)                                                    particleeffectnum = #335;
114 void(entity ent, float effectnum, vector start, vector end, ...)        trailparticles = #336;
115 void (float efnum, vector org, vector vel, float countmultiplier, ...)  pointparticles = #337;
116
117 void (string s, ...)                                                    cprint = #338;
118 void (string s, ...)                                                    print = #339;
119
120 void (float scale)                                                      setsensitivityscale = #346;
121
122
123 float (float framenum)                                                  getinputstate = #345;
124 void (entity e)                                                                 runstandardplayerphysics = #347;
125
126 string (float playernum, string key)                                    getplayerkeyvalue = #348;
127 void (string cmdname)                                                   registercmd = #352;
128 void(float usecursor)                                                   setcursormode = #343;
129 vector ()                                                               getmousepos = #344;
130
131 string (string s)                                                       uncolorstring = #170;
132
133 void (vector org, vector forward, vector right, vector up)              setlistener = #351;
134
135 float (vector start, vector end, float ignore, float csqcents)          selecttraceline = #355;
136 float ()                                                                isdemo = #349;
137 float ()                                                                isserver = #350;
138
139 void (float f)                                                          setwantsmousemove = #343;
140 string (float key)                                                      getkeybind = #342;
141 //string (float f)                                                      chr = #78;
142 string (float f)                                                        chr = #78;
143 float(string str, float ofs)                                            str2chr = #222;
144 string(float c, ...)                                                    chr2str = #223;
145
146 vector (vector org)                                                     getlight = #92;
147
148 entity (.string fld, string match)                                      findchain = #402;
149 entity (.float fld, float match)                                        findchainflags = #450;
150 entity (.entity fld, entity match)                                      findchainentity = #403;
151 entity (.float fld, float match)                                        findchainfloat = #403;
152 entity (entity start, .float fld, float match)                          findflags = #449;
153
154 float (string pattern, float caseinsensitive, float quiet)              search_begin = #444;
155 void (float handle)                                                     search_end = #445;
156 float (float handle)                                                    search_getsize = #446;
157 string (float handle, float num)                                        search_getfilename = #447;
158
159
160 #define SPA_POSITION 0
161 #define SPA_S_AXIS 1
162 #define SPA_T_AXIS 2
163 #define SPA_R_AXIS 3
164 #define SPA_TEXCOORDS0 4
165 #define SPA_LIGHTMAP0_TEXCOORDS 5
166 #define SPA_LIGHTMAP_COLOR 6
167 float (entity e, float s)                                               getsurfacenumpoints = #434;
168 vector (entity e, float s, float n)                                     getsurfacepoint = #435;
169 vector (entity e, float s)                                              getsurfacenormal = #436;
170 string (entity e, float s)                                              getsurfacetexture = #437;
171 float (entity e, vector p)                                              getsurfacenearpoint = #438;
172 vector (entity e, float s, vector p)                                    getsurfaceclippedpoint = #439;
173 vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
174 float(entity e, float s) getsurfacenumtriangles = #628;
175 vector(entity e, float s, float n) getsurfacetriangle = #629;
176
177
178 float (float a, float b, ...) min = #94;
179 float (float a, float b, float c) min3 = #94;
180 float (float a, float b, float c, float d) min4 = #94;
181 float (float a, float b, float c, float d, float e) min5 = #94;
182 float (float a, float b, float c, float d, float e, float f) min6 = #94;
183 float (float a, float b, float c, float d, float e, float f, float g) min7 = #94;
184 float (float a, float b, float c, float d, float e, float f, float g, float h) min8 = #94;
185 float (float a, float b, ...) max = #95;
186 float (float a, float b, float c) max3 = #95;
187 float (float a, float b, float c, float d) max4 = #95;
188 float (float a, float b, float c, float d, float e) max5 = #95;
189 float (float a, float b, float c, float d, float e, float f) max6 = #95;
190 float (float a, float b, float c, float d, float e, float f, float g) max7 = #95;
191 float (float a, float b, float c, float d, float e, float f, float g, float h) max8 = #95;
192 float (float minimum, float val, float maximum) bound = #96;
193
194 vector () randomvec = #91;
195
196 float (float val)               sin = #60;
197 float (float val)               cos = #61;
198 float (float val)               sqrt = #62;
199 float (float a, float b)        pow = #97;
200
201 void (vector org, string modelname, float startframe, float endframe, float framerate) effect = #404;
202
203 void (vector org, vector velocity, float howmany) te_blood = #405;
204 void (vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406;
205 void (vector org, float radius, float lifetime, vector color) te_customflash = #417;
206 void(vector org, vector color) te_explosionrgb = #407;
207 void(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter) te_particlecube = #408;
208 void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain = #409;
209 void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410;
210 void(vector org) te_plasmaburn = #433;
211 void(vector org) te_gunshotquad = #412;
212 void(vector org) te_spikequad = #413;
213 void(vector org) te_superspikequad = #414;
214 void(vector org) te_explosionquad = #415;
215 void(vector org) te_smallflash = #416;
216 void(vector org, vector vel, float howmany) te_spark = #411;
217
218 void(vector org) te_gunshot = #418;
219 void(vector org) te_spike = #419;
220 void(vector org) te_superspike = #420;
221 void(vector org) te_explosion = #421;
222 void(vector org) te_tarexplosion = #422;
223 void(vector org) te_wizspike = #423;
224 void(vector org) te_knightspike = #424;
225 void(vector org) te_lavasplash = #425;
226 void(vector org) te_teleport = #426;
227 void(vector org, float color, float colorlength) te_explosion2 = #427;
228 void(entity own, vector start, vector end) te_lightning1 = #428;
229 void(entity own, vector start, vector end) te_lightning2 = #429;
230 void(entity own, vector start, vector end) te_lightning3 = #430;
231 void(entity own, vector start, vector end) te_beam = #431;
232
233 float (entity ent, string tagname)      gettagindex = #451;
234 vector (entity ent, float tagindex)     gettaginfo = #452;
235
236 float (string s)        tokenize = #441;
237 string (float argnum)   argv = #442;
238
239 string (string s) cvar_string = #448;
240 string (string s) cvar_defstring = #482;
241
242 float ()                                                buf_create = #460;
243 void (float bufhandle)                                  buf_del = #461;
244 float (float bufhandle)                                 buf_getsize = #462;
245 void (float bufhandle_from, float bufhandle_to)         buf_copy = #463;
246 void (float bufhandle, float sortpower, float backward) buf_sort = #464;
247 string (float bufhandle, string glue)                   buf_implode = #465;
248 string (float bufhandle, float string_index)            bufstr_get = #466;
249 void (float bufhandle, float string_index, string str)  bufstr_set = #467;
250 float (float bufhandle, string str, float order)        bufstr_add = #468;
251 void (float bufhandle, float string_index)              bufstr_free = #469;
252
253 float () onground = #355;
254
255 void(string texturename, ...) R_BeginPolygon = #306;
256 void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex = #307;
257 void() R_EndPolygon = #308;
258
259 float(string s, float num) charindex = #356;
260
261 // Darkplaces Additional Functions
262 string(string s) strdecolorize = #477;
263 string(string s) strtolower = #480; // returns the passed in string in pure lowercase form
264 string(string s) strtoupper = #481; // returns the passed in string in pure uppercase form
265 float(string s) strlennocol = #476;
266
267 void(vector origin, string sample, float volume, float attenuation) pointsound = #483;
268
269 // added by blub
270
271 string(string key)                                      serverkey = #354;
272 float(string s1, string s2)                             strcasecmp = #229;
273 float(string s1, string s2, float len)                  strncasecmp = #230;
274 float(string str, string sub, float startoffs)          strstrofs = #221;
275 //float(string str, string sub)                         strstrofs = #221;
276 entity(float num)                                       edict_num = #459;
277 string(void)                                            ReadPicture = #501;
278 string(string filename)                                 whichpack = #503;
279 float(entity ent)                                       num_for_edict = #512;
280 float(string s, string separator1, ...) tokenizebyseparator = #479;
281 string(string in) uri_unescape = #511;
282 float(float caseinsensitive, string s, ...) crc16 = #494;
283 string(string info, string key) infoget = #227;
284 string(string info, string key, string value, ...) infoadd = #226;
285 string(string in) uri_escape = #510;
286
287 float stringtokeynum(string keyname) = #341;
288 string  keynumtostring(float keynum) = #520;
289 string  findkeysforcommand(string command) = #521;
290
291 string(float ccase, float calpha, float cnum, string s, ...) strconv = #224;
292 float(entity ent) wasfreed = #353;
293
294 entity(vector org, float rad) findradius = #22;
295
296 string(float uselocaltime, string format, ...) strftime = #478;
297 float(float timer) gettime = #519;
298 #define GETTIME_REALTIME 1
299 #define GETTIME_CDTRACK 4
300
301 float(string s) tokenize_console = #514;
302 float(float i) argv_start_index = #515;
303 float(float i) argv_end_index = #516;
304
305 float(float s) asin = #471; // returns angle in radians for a given sin() value, the result is in the range -PI*0.5 to PI*0.5
306 float(float c) acos = #472; // returns angle in radians for a given cos() value, the result is in the range 0 to PI
307 float(float t) atan = #473; // returns angle in radians for a given tan() value, the result is in the range -PI*0.5 to PI*0.5
308 float(float c, float s) atan2 = #474; // returns angle in radians for a given cos() and sin() value pair, the result is in the range -PI to PI (this is identical to vectoyaw except it returns radians rather than degrees)
309 float(float a) tan = #475; // returns tangent value (which is simply sin(a)/cos(a)) for the given angle in radians, the result is in the range -infinity to +infinity
310 float DEG2RAD = 0.0174532925199432957692369076848861271344287188854172545609719144;
311 float RAD2DEG = 57.2957795130823208767981548141051703324054724665643215491602438612;
312 float PI      = 3.1415926535897932384626433832795028841971693993751058209749445923;
313 float log(float f) = #532;
314
315 void(entity e, entity ignore) tracetoss = #64;
316
317 float(entity e, float ch) getsoundtime = #533; // (DP_SND_GETSOUNDTIME)
318
319 #define PARTICLES_USEALPHA 1
320 float particles_alphamin, particles_alphamax;
321 #define PARTICLES_USECOLOR 2
322 vector particles_colormin, particles_colormax;
323 void(float effectindex, entity own, vector org_from, vector org_to, vector dir_from, vector dir_to, float countmultiplier, float flags) boxparticles = #502;
324 string(string format, ...) sprintf = #627;
325
326 float(string name) cvar_type = #495;
327 float CVAR_TYPEFLAG_EXISTS = 1;
328 float CVAR_TYPEFLAG_SAVED = 2;
329 float CVAR_TYPEFLAG_PRIVATE = 4;
330 float CVAR_TYPEFLAG_ENGINE = 8;
331 float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
332 float CVAR_TYPEFLAG_READONLY = 32;
333
334 void (entity e, float chan, string samp, float vol, float atten, float pitchshift, float flags) sound7 = #8;
335
336 float trace_dphitcontents;
337 float trace_networkentity;
338
339 string(string search, string replace, string subject) strreplace = #484;
340
341 //DP_QC_DIGEST
342 //idea: motorsep, Spike
343 //DarkPlaces implementation: divVerent
344 //builtin definitions:
345 string(string digest, string data, ...) digest_hex = #639;
346 //description:
347 //returns a given hex digest of given data
348 //the returned digest is always encoded in hexadecimal
349 //only the "MD4" digest is always supported!
350 //if the given digest is not supported, string_null is returned
351 //the digest string is matched case sensitively, use "MD4", not "md4"!
352
353 //DP_CSQC_MINFPS_QUALITY
354 //idea: divVerent
355 //darkplaces implementation: divVerent
356 //constant definitions:
357 const float VF_MINFPS_QUALITY   = 213;
358 //use getproperty(VF_MINFPS_QUALITY); to do CSQC based LOD based on cl_minfps
359 //1 should lead to an unmodified view