-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmath.cs2
More file actions
121 lines (71 loc) · 3.04 KB
/
math.cs2
File metadata and controls
121 lines (71 loc) · 3.04 KB
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
[command,add](int $x1, int $x2)(int)
[command,sub](int $x1, int $x2)(int)
[command,multiply](int $x1, int $x2)(int)
[command,divide](int $x1, int $x2)(int)
[command,random](int $x1)(int)
[command,randominc](int $x1)(int)
[command,interpolate](int $output_min, int $output_max, int $input_min, int $input_max, int $input)(int)
[command,addpercent](int $x1, int $x2)(int)
[command,setbit](int $x1, int $x2)(int)
[command,clearbit](int $x1, int $x2)(int)
[command,testbit](int $x1, int $x2)(int)
[command,modulo](int $x1, int $x2)(int)
[command,pow](int $x1, int $x2)(int)
[command,invpow](int $x1, int $x2)(int)
[command,and](int $x1, int $x2)(int)
[command,or](int $x1, int $x2)(int)
[command,min](int $x1, int $x2)(int)
[command,max](int $x1, int $x2)(int)
/**
* Scales an input value by a fractional multiplier.
*
* Computes `(numerator / denominator) * input`, useful for applying percentages,
* ratios, or proportional scaling to values.
*
* The [numerator] and [denominator] define the scaling fraction, which is applied
* to the [input] value. The result is calculated as `(numerator * input) / denominator`.
*
* ```
* // Scale to 5/7 of the original value
* scale(5, 7, 512) // Returns 365
*
* // Apply 64.64% scaling
* scale(6464, 10000, cc_getmodelzoom)
*
* // Convert from one range to another (e.g., 334 in range 0-4 to range 0-7)
* scale(7, 4, 334) // Returns 584
* ```
*/
[command,scale](int $numerator, int $denominator, int $input)(int)
[command,bitcount](int $num)(int)
[command,togglebit](int $value, int $bit)(int)
[command,setbit_range](int $value, int $startbit, int $endbit)(int)
[command,clearbit_range](int $value, int $startbit, int $endbit)(int)
[command,getbit_range](int $value, int $startbit, int $endbit)(int)
[command,setbit_range_toint](int $value, int $startbit, int $endbit, int $new_value)(int)
[command,sin_deg](int $x1)(int)
[command,cos_deg](int $x1)(int)
[command,atan2_deg](int $x1, int $x2)(int)
[command,abs](int $x1)(int)
[command,parseint](string $x1)(int)
[command,long_add](long $x1, long $x2)(long)
[command,long_sub](long $x1, long $x2)(long)
[command,long_multiply](long $x1, long $x2)(long)
[command,long_divide](long $x1, long $x2)(long)
[command,long_min](long $x1, long $x2)(long)
[command,long_max](long $x1, long $x2)(long)
[command,long_scale](long $x1, long $x2, long $x3)(long)
[command,int_to_long](int $x1)(long)
[command,long_setbit](long $x1, int $x2)(long)
[command,long_clearbit](long $x1, int $x2)(long)
[command,long_testbit](long $x1, int $x2)(int)
[command,long_bitcount](long $x1)(int)
[command,long_togglebit](long $x1, int $x2)(long)
[command,long_setbit_range](long $x1, int $x2, int $x3)(long)
[command,long_clearbit_range](long $x1, int $x2, int $x3)(long)
[command,long_getbit_range](long $x1, int $x2, int $x3)(long)
[command,long_modulo](long $x1, long $x2)(long)
[command,long_and](long $x1, long $x2)(long)
[command,long_or](long $x1, long $x2)(long)
[command,long_not](long $x1)(long)
[command,long_setbit_range_tolong](long $x1, int $x2, int $x3, long $x4)(long)