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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
--- Miscellaneous functions : math, console, graphics, translation and etc.

--- Prints the given text to the console
-- @cstyle void ConsolePrint(string text).
-- @param text string; the text to print.

function ConsolePrint(text)
end

--- Shows the given text in the the development environment (does not appear in the console log)
-- @cstyle void OutputDebugString(string text).
-- @param text string; the text to print.

function OutputDebugString(text)
end

--- Asynchronous random, mainly for use in async scripts.
-- @cstyle int AsyncRand().
-- @cstyle int AsyncRand(int max).
-- @cstyle int AsyncRand(int min, int max).
-- @cstyle int AsyncRand(array arr).
-- @return int/value rand; any random, random in the interval[0, max - 1], random in the interval [min, max], OR a random element from arr.

function AsyncRand(...)
end

--- Asynchronous random, mainly for use in async scripts.
-- @cstyle int BraidRandom(int seed).
-- @cstyle int BraidRandom(int seed, int max).
-- @cstyle int BraidRandom(int seed, int min, int max).
-- @cstyle int BraidRandom(int seed, array arr).
-- @return int/value rand; any random, random in the interval[0, max - 1], random in the interval [min, max], OR a random element from arr.
-- @return int seed; a new seed.

function BraidRandom(seed, ...)
end

--- Returns the result from the xxhash algorithm performed over its arguments
-- @cstyle int xxhash(type arg1, ...).
-- @param arg<i> can be any simple type or a userdata
-- @return int

function xxhash(arg1, arg2, arg3, ...)
end

--- Same as xxhash but accepts all parameter types. Tables, functions and threads are converted to memory addresses. Thus results will be different between game sessions.
-- @return int

function xxhash_session(arg1, arg2, arg3, ...)
end

--- Returns the absolute value of the given number.
-- @cstyle int abs(int nValue).
-- @param nValue int; the number for which to calculate the absolute value.
-- @return int; the absolute value of nValue.

function abs(nValue)
end

--- Returns the square root of the given number.
-- @cstyle int sqrt(int nValue).
-- @param nValue int; the number for which to calculate the square root.
-- @return int; the square root of nValue rounded to nearest integer smaller then the real square root.

function sqrt(nValue)
end

-- Translates a value from a linear set to a value in an exponential set with a matching start and end points, and a given exponent for t
-- @cstyle int LinearToExponential(uint value, uint exponent, uint min, uint max).
-- @param value uint; (min <= value <= max) The exponential value to be tranformed.
-- @param exponent uint; (exponent > 0) The exponent of t in the interpolation formula.
-- @param min uint; (min < max) The minimum value of both sets (start).
-- @param max uint; (max > min) The maximum value of both sets (end).
-- @return uint;

function LinearToExponential(value, exponent, min, max)
end

-- Reverses the translation done by LinearToExponential().
-- @cstyle int ExponentialToLinear(uint value, uint exponent, uint min, uint max).
-- @param value uint; (min <= value <= max) The exponential value to be tranformed.
-- @param exponent uint; (exponent > 0) The exponent of t in the interpolation formula.
-- @param min uint; (min < max) The minimum value of both sets (start).
-- @param max uint; (max > min) The maximum value of both sets (end).
-- @return uint;

function ExponentialToLinear(value, exponent, min, max)
end

--- Returns angle given normalized from -180*60 to 180*60.
-- @cstyle int AngleNormalize(int angle).
-- @param angle int; angle to normalize in minutes.
-- @return int.

function AngleNormalize(angle)
end

--- Returns the arcsine of the value given divided by 4096.
-- @cstyle int sin(int nValue).
-- @param nValue int; the value is between -4096 and 4096, and represents the interval -1..1.
-- @return int; Returns the arcsine in minutes. Safe to use in synched code, does not use floats.

function asin(nValue)
end

--- Returns the sine of the given angle.
-- @cstyle int sin(int nAngle).
-- @param nAngle the angle in minutes for which to calculate the sine.
-- @return int; Returns the sine of angle multiplied by 4096. Safe to use in synched code, does not use floats.

function sin(nAngle)
end

--- Returns the cosine of the given angle.
-- @cstyle int cos(int nAngle).
-- @param nAngle int; the angle in minutes for which to calculate the cosine.
-- @return int; Returns the cosine of angle multiplied by 4096. Safe to use in synched code, does not use floats.

function cos(nAngle)
end

--- Returns the angle corresponding to the given tangent
-- @cstyle int atan(int y, int x).
-- @param y int; can be the y coordinate, the tangent value scaled by 4096 or a point.
-- @param x int; the x coordinate, optional
-- @return int; Returns the angle multiplied by 4096. Safe to use in synched code, does not use floats.

function atan(mul, div)
end

--- Rounds a number according to the provided granularity.
-- @cstyle int round(int number, int granularity).
-- @param number int; the number to round.
-- @param number granularity; the granularity to use.
-- @return int; The rounded number.

function round(number, granularity)
end

--- Tests if a ray intersects a sphere.
-- @cstyle bool TestRaySphere(point rayOrg, point rayDir, point sphereCenter, int sphereRadius).
-- @param rayOrg point; origin of the ray.
-- @param rayDir point; direction of the ray.
-- @param sphereCenter point; center of the sphere.
-- @param sphereRadius int; radius of the sphere.
-- @return bool; true if the ray intersects the sphere, false otherwise.

function TestRaySphere(rayOrg, rayDir, sphereCenter, sphereRadius)
end

--- Checks and returns the result if a ray intersects an axis aligned bounding box.
-- @cstyle bool RayIntersectsSphere(point rayOrg, point rayDir, box b).
-- @param rayOrg point; origin of the ray.
-- @param rayDir point; destination(not direction) of the ray.
-- @param b box.
-- @return point/nil; Returns the intersection point if the ray intersects the box, nil otherwise.

function RayIntersectsAABB(rayOrg, rayDest, b)
end

--- Checks and returns the result if a segment intersects an axis aligned bounding box.
-- @cstyle bool, point SegmentIntersectsAABB(point pt1, point pt2, box b).
-- @param pt1 point; first vertex of the segment.
-- @param pt2 point; second vertex of the segment.
-- @param b box.
-- @return bool, point; Returns true, intersection if the ray intersects the box, false otherwise.

function SegmentIntersectsAABB(pt1, pt2, b)
end

--- Checks and returns the result if a ray intersects a sphere.
-- @cstyle bool RayIntersectsSphere(point rayOrg, point rayDir, point sphereCenter, int sphereRadius).
-- @param rayOrg point; origin of the ray.
-- @param rayDir point; direction of the ray.
-- @param sphereCenter point; center of the sphere.
-- @param sphereRadius int; radius of the sphere.
-- @return bool, point; Returns true, intersection if the ray intersects the sphere, false otherwise.

function RayIntersectsSphere(rayOrg, rayDir, sphereCenter, sphereRadius)
end

--- Checks and returns the result if a segment intersects a sphere.
-- @cstyle bool, point SegmentIntersectsSphere(point pt1, point pt2, point sphereCenter, int sphereRadius).
-- @param pt1 point; first vertex of the segment.
-- @param pt2 point; second vertex of the segment.
-- @param sphereCenter point; center of the sphere.
-- @param sphereRadius int; radius of the sphere.
-- @return bool, point; Returns true, intersection if the ray intersects the sphere, false otherwise.

function SegmentIntersectsSphere(pt1, pt2, sphereCenter, sphereRadius)
end

--- Tests if a sphere intersects another sphere.
-- @cstyle bool SphereTestSphere(point ptCenter1, int nRadius1, point ptCenter2, int nRadius2).
-- @param ptCenter1 point; center of the first sphere.
-- @param nRadius1 int; radius of the first sphere.
-- @param ptCenter2 point; center of the second sphere.
-- @param nRadius2 int; radius of the second sphere.
-- @return bool; true if the spheres intersect, false otherwise.

function SphereTestSphere(ptCenter11, nRadius1, ptCenter2, nRadius2)
end

--- Tests if a axis aligned bounding box intersects sphere.
-- @cstyle bool SphereTestSphere(box b, point ptCenter1, int nRadius1).
-- @param b box.
-- @param ptCenter1 point; center of the sphere.
-- @param nRadius1 int; radius of the sphere.
-- @return bool; true if the sphere intersect the box, false otherwise.

function AABBTestSphere(b, ptCenter1, nRadius1)
end

--- Tests if a axis aligned bounding box intersects another axis aligned bounding box.
-- @cstyle bool AABBTestAABB(box b1, box b2).
-- @param box b1.
-- @param box b2.
-- @return bool; true if the boxes intersect, false otherwise.

function AABBTestAABB(b, ptCenter1, nRadius1)
end

--- Performs a Hermite spline interpolation from position p1 with tangent m1 to position p2 and tangent m2.
-- @cstyle point/int HermiteSpline(point/int p1, point/int m1, point/int p2, point/int m2, int t, int scale = 65536).
-- @param p1 point/int; start control point.
-- @param m1 point/int; tangent at the start control point.
-- @param p2 point/int; end control point.
-- @param m2 point/int; tangent at the end control point.
-- @param t int; weighting factor between [0,scale].
-- @param scale int; factor scale, 65536 by default.
-- @return point/int; the interpolated point between control points according to t.

function HermiteSpline(p1, m1, p2, m2, t, scale)
end

--- Performs a Catmull-Rom spline interpolation using the 4 control points.
-- @cstyle point CatmullRomSpline(point p1, point p2, point p3, point p4, int t, int scale = 65536).
-- @param point p1; start control point.
-- @param point p2; second control point.
-- @param point p3; third control point.
-- @param point p4; fourth control point.
-- @param int t; weighting factor between [0,scale].
-- @param scale int; factor scale, 65536 by default.
-- @return point; the interpolated point between control points according to t.

function CatmullRomSpline(p1, p2, p3, p4, t, scale)
end

--- Returns bitwise AND of its arguments.
-- @cstyle int band(int n1, int n2, ...).
-- @param n1 int;
-- @return int; bitwise AND of the arguments.

function band(n1, n2, ...)
end

--- Returns bitwise OR of its arguments.
-- @cstyle int bor(int n1, int n2, ...).
-- @param n1 int;
-- @return int; bitwise OR of the arguments.

function bor(n1, n2, ...)
end

--- Returns bitwise XOR of its arguments.
-- @cstyle int bxor(int n1, int n2, ...).
-- @param n1 int;
-- @return int; bitwise XOR of the arguments.

function bxor(n1, n2, ...)
end

--- Returns bitwise NOT of its argument.
-- @cstyle int bnot(int n).
-- @param n int;
-- @return int; bitwise NOT of the argument.

function bnot(n)
end

--- Returns (flags & ~mask) | (value & mask).
-- @cstyle int maskset(int flags, int mask, int value).
-- @param flags int;
-- @param mask int;
-- @param value int;
-- @return int;

function maskset(flags, mask, value)
end

--- Logical left or right shift (not arithmetic). For right shift use negative count.
-- @cstyle unsigned int shift(unsigned int value, int count).
-- @param value unsigned int;
-- @param count int;
-- @return unsigned int; Returns (count > 0 ? (value << count) : (value >> -count)).

function shift(value, shift)
end

--- Returns whether any bits present in mask are present in flags. (bitwise and)
-- @cstyle bool IsFlagSet(int flags, int mask).
-- @param flags int;
-- @param mask int; the bits(s) to be tested.
-- @return bool; true if any of the bit(s) are set in the flags.
-- @see SetFlag.

function IsFlagSet(flags, mask)
end

--- Returns the less of the integers.
-- @cstyle int Min(int i1, int i2).
-- @param i1 int; the first number.
-- @param i2 int; the second number.
-- @return int; the smaller of i1 and i2.

function Min(i1, i2)
end

--- Returns the greater of the integers.
-- @cstyle int Max(int i1, int i2).
-- @param i1 int; the first number.
-- @param i2 int; the second number.
-- @return int; the bigger from i1 and i2.

function Max(i1, i2)
end

--- Returns the min & max of all provided parameters
function MinMax(i1, i2, ...)
end

--- Get the red, green and blue components from a RGB color variable.
-- @cstyle int, int, int GetRGB(int argb).
-- @param argb int; a RGB color variable.
-- @return int, int, int; red, green, blue triple of the RGB component.

function GetRGB(argb)
end

--- Get the red, green, blue and alpha components from a RGBA color variable.
-- @cstyle int, int, int, int GetRGBA(int argb).
-- @param argb a RGBA color variable.
-- @return int, int, int, int; red, green, blue, aplha four of the RGBA component.

function GetRGBA(argb)
end

--- Set the red component of a RGB color variable.
-- @cstyle int SetR(int argb, int r).
-- @param argb int; RGB color variable for which to set the red component.
-- @param r int; value of the red component.
-- @return int; RGB color variable with the new red component.

function SetR(argb, r)
end

--- Set the green component of a RGB color variable.
-- @cstyle int SetG(int argb, int g).
-- @param argb int; RGB color variable for which to set the green component.
-- @param g int; value of the green component.
-- @return int; RGB color variable with the new green component.

function SetG(argb, g)
end

--- Set the blue component of a RGB color variable.
-- @cstyle int SetB(int argb, int b).
-- @param argb int; RGB color variable for which to set the blue component.
-- @param b int; value of the blue component.
-- @return int; RGB color variable with the new blue component.

function SetB(argb, b)
end

--- Set the alpha component of a RGBA color variable.
-- @cstyle int SetA(int argb, int a).
-- @param argb int; RGBA color variable for which to set the alpha component.
-- @param a int; value of the alpha component.
-- @return int; RGBA color variable with the new alpha component.

function SetA(argb, b)
end

--- Combines r, g and b color channels into a single number used wherever an int rgb parameter is needed.
-- @cstyle int RGB(int r, int g, int b).
-- @param r int; intensity of the red component.
-- @param g int; intensity of the green component.
-- @param b int; intensity of the blue component.
-- @return int; RGB color variable with the corresponding components set.

function RGB(r, g, b)
end

--- Combines r, g, b and a color channels into a single number used wherever an int rgba parameter is needed.
-- @cstyle int RGBA(int r, int g, int b, int a).
-- @param r int; intensity of the red component.
-- @param g int; intensity of the green component.
-- @param b int; intensity of the blue component.
-- @param a int; intensity of the alpha component.
-- @return int; RGBA color variable with the corresponding components set.

function RGBA(r, g, b, a)
end

--- Interpolates linearly rgb0 to rgb1 as p goes from 0 to q.
-- @cstyle int InterpolateRGB(int rgb0, int rgb1, int p, int q).
-- @param rgb0 int; the starting RGB color variable.
-- @param rgb1 int; the final RGB color variable.
-- @param p int; the numerator.
-- @param q int; the divisor.
-- @return int; RGB color variable which is rgb0 + (p / q) * (rgb1 - rgb0).

function InterpolateRGB(rgb0, rgb1, p, q)
end

--- Compose a random opaque color with the given luminosity and maximum saturation level.
-- @cstyle int RandColor(int hue_seed = AsyncRand(), int lum_seed = AsyncRand())
-- @param hue_seed int. The random seed for hue (random number by default)
-- @param lum_seed int. The random seed for luminosity (random number by default)
-- @return int; RGB color.

function RandColor(hue_seed, lum_seed)
end

--- Get the color distance between two colors.
-- @cstyle int ColorDiff(int col1, int col2)
-- @return int; color dist.

function ColorDist(col1, col2)
end

--- Gets the current language used in the 
-- @cstyle string GetLanguage().
-- @return sting; the language currently used by the 

function GetLanguage()
end

--- Returns the current system tick count.
-- @cstyle int GetClock().
-- @return int.

function GetClock()
end

--- Returns v * m / d calculated with 64 bit integers. Truncates the result similar to plain division. Works on a point or a box as well.
-- @cstyle int/point MulDivTrunc(int/point/box v, int m, int d).
-- @param v int/point/box.
-- @param m int.
-- @param d int.
-- @return int.

function MulDivTrunc(v, m, d)
end

--- Returns v * m / d ROUNDED to the nearest integer, calculated with 64 bit integers as the C function MulDiv. Works on a point or a box as well.
-- @cstyle int/point MulDivRound(int/point/box v, int m, int d).
-- @param v int/point/box.
-- @param m int.
-- @param d int.
-- @return int.

function MulDivRound(v, m, d)
end

--- Returns m / d ROUNDED to the nearest integer
-- @cstyle int DivRound(int m, int d).
-- @param m int.
-- @param d int.
-- @return int.

function DivRound(m, d)
end

-- @cstyle bool IsPowerOf2(int v).
function IsPowerOf2(v)
end

--- Checks if the file creation date is older than specified days.
-- @cstyle bool FileAgeOlderThanDays(string filename, int days).
-- @param filename; string with the file to be checked.
-- @param days; specifies the period in days to check.
-- @return bool; false if the file was created before given days, true otherwise or if error occured during checking.

function FileAgeOlderThanDays(filename, days)
end

--- Check presence of internet connection.
-- @cstyle bool IsThereInternetConnection().
-- @return bool; true if internet connection exists, false otherwise.

function IsThereInternetConnection()
end

--- Ends antialiased and/or motion blurred screenshot
-- @cstyle void EndAAMotionBlurScreenshot(string filename, int samples)
-- @param filename; the target filename to save the screenshot
-- @param samples; the total number of samples added for this screenshot
function EndAAMotionBlurScreenshot(filename, samples)
end

--- Check the class of an object
-- @cstyle bool IsKindOf(table object, string class).
-- @return bool;
function IsKindOf(object, class)
end

--- Returns the first object from a given class in a list
-- @cstyle object FindFirstIsKindOf(table objects, string class).
-- @return object;
function FindFirstIsKindOf(objects, class)
end

function ConvertToOSPath(game_path)
end

function PlaneFromPoints(pt1, pt2, pt3, local_space)
end

--- Returns a value computed after following a list of instructions
-- @cstyle any compute(any initial_value, any instruction, ...).
-- @param initial_value; the initial value to start from. Returned if no instruction is given.
-- @param instruction; depending on the type of instruction:
--   type string, number, boolean: return compute(value[instruction], ...)
--   type table: return compute(instruction[value], ...)
--   type function: return instruction(value, ...)
--   any other type: return value
-- @return any;
function compute(value, instruction, ...)
--[[
	if type(instruction) == "string" or type(instruction) == "number" or type(instruction) == "boolean" then
		if type(value) == "table" then
			return compute(value[instruction], ...)
		end
		return
	elseif type(instruction) == "function" then
		return instruction(value, ...)
	elseif type(instruction) == "table" then
		return compute(instruction[value], ...)
	end
	return value
]]
end

--- Pseudo-random permutation generator based on prime number addition. Can generate only a small set of all permutations.
-- Usage: for _, n in permute(size, seed) do ... end
-- The value of n is in the range (1 .. size) in a random permutation (each value will be returned exacly once) order.
-- The value of _ is for internal use.
-- @cstyle void permute(int size, int/string/nil seed).
-- @param size - permutes the integers in the range (1 .. size)
-- @param int seed - initial seed, which defines the permutation order
-- @param string seed - InteractionRand(nil, seed) is used to get the seed
-- @param nil seed - AsyncRand() is used to get the seed
function permute(size, seed)
end