-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.cfg
More file actions
315 lines (254 loc) · 29.6 KB
/
util.cfg
File metadata and controls
315 lines (254 loc) · 29.6 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
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
svar_set __tmp_len 0
sar_function tmp_alloc "svar_set __tmp_$__tmp_len $'$__tmp$'; svar_add __tmp_len 1"
sar_function tmp_free "svar_sub __tmp_len 1; sar_expand sar_expand svar_set __tmp $'$$$$__tmp_$$__tmp_len$'"
sar_function withtemp "tmp_alloc; $1 $+2; tmp_free"
sar_function recho sar_echo FFFFFF $+1
sar_function veval script SendToConsole($+1)
sar_function meval script printl($+1)
// If cond "$1" is true, do $2, otherwise do $3
sar_function __choose conds "$1" "$2" "$3"
svar_set __i32_max 2147483647
svar_set __i32_min -2147483648
svar_set __zero 0
svar_set __empty ""
sar_function __tmp_cvar_save cond !?__tmp_i_cvar_$1=1 "svar_set __tmp_i_cvar_$1 1; svar_from_cvar __tmp_cvar_$1 $1; __tmp_cvar_save_exit $1"
sar_function __tmp_cvar_restore cond ?__tmp_i_cvar_$1=1 "svar_set __tmp_i_cvar_$1 0; sar_expand $1 $$'$$__tmp_cvar_$1$$'"
sar_function __tmp_cvar_save_exit cond !?__tmp_x_cvar_$1=1 "svar_set __tmp_x_cvar_$1 1; sar_on_exit __tmp_cvar_restore $1"
sar_alias __tmp_toast_save "__tmp_cvar_save sar_toast_x; __tmp_cvar_save sar_toast_y; __tmp_cvar_save sar_toast_align; __tmp_cvar_save sar_toast_anchor; __tmp_cvar_save sar_toast_disable; __tmp_cvar_save sar_toast_width; __tmp_cvar_save sar_toast_background; __tmp_cvar_save sar_toast_compact; __tmp_cvar_save sar_toast_font"
sar_alias __tmp_toast_restore "__tmp_cvar_restore sar_toast_x; __tmp_cvar_restore sar_toast_y; __tmp_cvar_restore sar_toast_align; __tmp_cvar_restore sar_toast_anchor; __tmp_cvar_restore sar_toast_disable; __tmp_cvar_restore sar_toast_width; __tmp_cvar_restore sar_toast_background; __tmp_cvar_restore sar_toast_compact; __tmp_cvar_restore sar_toast_font"
// Svar capture without clogging console
// Dependencies: __tmp_cvar_save, __tmp_cvar_restore
sar_function svar_capture_quiet "__tmp_cvar_save sar_con_filter; __tmp_cvar_save sar_con_filter_default; sar_con_filter 1; sar_con_filter_default 0; svar_capture $'$1$' $+2; __tmp_cvar_restore sar_con_filter; __tmp_cvar_restore sar_con_filter_default"
// Set an svar to the 2nd argument interpreting the svar's value
sar_function __svar_cap_arg2 "sar_expand __svar_cap_arg2_h $'$1$' $$$1"
sar_function __svar_cap_arg2_h "svar_set $1 $3"
// Get game width and height
// Return variables: width, height
sar_alias __get_screen_size "__tmp_toast_save; sar_toast_setpos top left; svar_from_cvar __tmp sar_toast_y; sar_toast_setpos bottom right; svar_from_cvar height sar_toast_y; svar_add height __tmp; svar_from_cvar width sar_toast_x; svar_add width __tmp; svar_from_cvar __tmp sar_toast_width; svar_add width __tmp; __tmp_toast_restore"
__get_screen_size
sar_function tempcheat "svar_from_cvar __sv_cheats sv_cheats; sv_cheats 1; $1 $+2; sar_expand sv_cheats $$__sv_cheats"
sar_function cheats_only "svar_from_cvar __sv_cheats sv_cheats; svar_fadd __sv_cheats 0; cond ?__sv_cheats=1 $1; cond !?__sv_cheats=1 $'echo $2 requires sv_cheats.$'"
sar_alias or __set_if_empty
// Returns 1 if $1 < $2, otherwise 0
// Updated from RainbowPhoenixx's version
// Return variable: less_than_ret
sar_function less_than "svar_set __tmp_less_than $'$1$'; svar_fsub __tmp_less_than $'$2$'; svar_fmul __tmp_less_than 0; conds ?__tmp_less_than=0 $'svar_set less_than_ret 0$' $'svar_set less_than_ret 1$'"
// sar_function greater_than "less_than $'$2$' $'$1$'; sar_expand svar_set greater_than_ret $$less_than_ret"
// Returns 1 if $1 < 0, otherwise 0
// Updated from RainbowPhoenixx's version
// Return variable: neg_ret
sar_function neg "svar_set __tmp_neg $'$1$'; svar_fmul __tmp_neg 0; conds ?__tmp_neg=0 $'svar_set neg_ret 0$' $'svar_set neg_ret 1$'"
// Length of string
// Return variable: length_of_ret
// Dependencies: svar_capture_quiet
svar_set __length_of_compare "Substring index out of bounds of variable"
sar_function length_of "svar_set __tmp_length_of $+1; svar_set length_of_ret 0; __length_of"
sar_function __length_of "svar_capture_quiet __tmp_length_of_2 svar_substr __tmp_length_of 1; cond !?__tmp_length_of_2=?__length_of_compare $'svar_add length_of_ret 1; __length_of$'"
// Index of substring in string
// Return variable: index_of_ret
// Dependencies: length_of, less_than
sar_function index_of "svar_set __tmp_index_of $'$1$'; svar_set __tmp_index_of_2 $'$2$'; length_of $'$2$'; svar_set index_of_ret 0; __index_of; length_of $'$1$'; sar_expand less_than $$index_of_ret $$length_of_ret; cond ?less_than_ret=0 svar_set index_of_ret -1"
sar_function __index_of "svar_set __tmp_index_of_3 $'$__tmp_index_of$'; svar_substr __tmp_index_of_3 0 $length_of_ret; __index_of_h"
sar_function __index_of_h cond "!?__tmp_index_of_2=?__tmp_index_of_3" cond "!?__tmp_index_of_3=?__empty" "svar_add index_of_ret 1; svar_substr __tmp_index_of 1; __index_of"
// Replace a string with another in a string
// Return variable: replace_ret
// Dependencies: length_of, index_of
sar_function replace "svar_set replace_ret $'$1$'; svar_set __tmp_replace_2 $'$2$'; svar_set __tmp_replace_3 $'$3$'; sar_expand index_of $'$$__tmp_replace_3$' $'$$__tmp_replace_2$'; cond ?index_of_ret=-1&!?replace_ret=?__empty&!?__tmp_replace_2=?__empty __replace_h1"
sar_function __replace_h1 "length_of $'$replace_ret$'; sar_expand svar_set __tmp_replace_5 $$length_of_ret; length_of $'$__tmp_replace_2$'; sar_expand svar_set __tmp_replace_4 $$length_of_ret; index_of $'$replace_ret$' $'$__tmp_replace_2$'; __replace_h2"
sar_function __replace_h2 cond !?index_of_ret=-1 "__replace_h3; sar_expand index_of $$'$$replace_ret$$' $$'$$__tmp_replace_2$$'; __replace_h2"
sar_function __replace_h3 "sar_expand svar_set __tmp_replace $$'$$replace_ret$$'; sar_expand svar_substr replace_ret 0 $$index_of_ret; svar_add index_of_ret __tmp_replace_4; __replace_h4"
sar_function __replace_h4 "conds ?index_of_ret=?__tmp_replace_5 $'sar_expand svar_set __tmp_replace $$'$$'$' $'sar_expand svar_substr __tmp_replace $$index_of_ret$'; sar_expand svar_set replace_ret $$'$$replace_ret$$__tmp_replace_3$$__tmp_replace$$'"
// Get current session tick
// Updated from mlugg's version
// Return variable: gettick_ret
// Dependencies: svar_capture_quiet
sar_alias gettick "svar_capture_quiet gettick_ret sar_session; sar_expand __gettick $gettick_ret"
sar_function __gettick "svar_set gettick_ret $4"
// orthoview <x> <y> <z> [zoom] [direction|ang <pitch> <yaw>]
sar_function orthoview "svar_set __orthopos $'$1 $2 $3$'; svar_set __orthozoom $'$4$'; svar_set __orthodir $'$5$'; svar_set __orthopitch $'$6$'; svar_set __orthoyaw $'$7$'; conds $'(%$#=3|%$#=4|%$#=5|%$#=7)&(#sv_cheats=1|#sv_cheats=1.000000)$' __orthoview $'sar_echo EECC55 orthoview <x> <y> <z> [zoom] [direction|ang <pitch> <yaw>] - requires cheats$'" // Just read args into svars and do arg count validation, and check for cheats
sar_function __orthoview "cond ?__orthozoom=?__empty svar_set __orthozoom 1; __orthoview_readdir; __orthoview_do"
sar_function __orthoview_readdir conds ?__orthodir=ang nop "svar_set __orthopitch 90; svar_set __orthoyaw 0; __orthoview_dirs -x 0 180 +x 0 0 -y 0 -90 +y 0 90 -z 90 0 +z -90 0" // [direction|ang <pitch> <yaw>]
sar_function __orthoview_dirs cond !%$#=0 "__orthoview_dir $1 $2 $3; __orthoview_dir $+4"
sar_function __orthoview_dir cond "?__orthodir=$1" "svar_set __orthopitch $2; svar_set __orthoyaw $3"
sar_function __orthoview_do "sar_cam_control 1; sar_cam_ortho 1; sar_cam_setpos $__orthopos; sar_cam_setang $__orthopitch $__orthoyaw; sar_cam_ortho_scale $__orthozoom; r_portalsopenall 1; sar_cam_ortho_nearz -128"
// Generates a random number such that 0 <= n < $1
// Updated from RainbowwPhoenixx's version
// https://en.wikipedia.org/wiki/Linear_congruential_generator
// Return variable: rng_ret / rand_ret / random_ret
// Dependencies: gettick, neg
svar_set __lcg_a 1103515
svar_set __lcg_b 12345
svar_set __lcg_m 42949672
sar_alias lcg_set_state svar_set __lcg_state
sar_alias lcg_init_seed "gettick; sar_expand lcg_set_state $gettick_ret"
sar_alias lcg_advance_state "svar_mul __lcg_state __lcg_a; svar_add __lcg_state __lcg_b; svar_mod __lcg_state __lcg_m; sar_expand neg $__lcg_state; cond ?neg_ret=1 svar_add __lcg_state __i32_max"
sar_on_config_exec lcg_init_seed // introduces some base randomness since config exec is based on network
sar_function __rng "lcg_advance_state; sar_expand svar_set $1_ret $$__lcg_state; svar_mod $1_ret $2"
sar_alias rng __rng rng
sar_alias rand __rng rand
sar_alias random __rnd random
// Appends / prepends the contents of svar $2 to svar $1
sar_function svar_append sar_expand svar_set "$1" "$$$1$$$2"
sar_function svar_prepend sar_expand svar_set "$1" "$$$2$$$1"
// Map svar $1 from between $2 and $3 to between $4 and $5
sar_function svar_map "svar_fsub $1 $2; svar_set __tmp_map $3; svar_fsub __tmp_map $2; svar_fdiv $1 __tmp_map; svar_set __tmp_map $5; svar_fsub __tmp_map $4; svar_fmul $1 __tmp_map; svar_fadd $1 $4"
// Dependencies: less_than
sar_function svar_max "sar_expand less_than $'$$$1$' $'$2$'; cond ?less_than_ret=1 svar_set $'$1$' $'$2$'" // Sets svar $1 to the larger of itself and $2
sar_function svar_min "sar_expand less_than $'$$$1$' $'$2$'; cond ?less_than_ret=0 svar_set $'$1$' $'$2$'" // Sets svar $1 to the smaller of itself and $2
// Clamps svar $1 between $2 and $3
// Dependencies: svar_max, svar_min
sar_function svar_clamp "svar_max $1 $2; svar_min $1 $3"
// Swaps svars $1 and $2
sar_function svar_swap sar_expand "svar_set $$'$1$$' $$'$$$2$$'; svar_set $$'$2$$' $$'$$$1$$'"
// Repeats command $1 $2 times
// Dependencies: neg
sar_function repeat conds "%$#=2" "sar_expand __repeat_h1 $$'$1$$' $2" "sar_echo EECC55 repeat <command> <times>"
sar_function __repeat_h1 "svar_set __tmp_repeat $'$2$'; svar_sub __tmp_repeat 1; sar_expand neg $$__tmp_repeat; cond $'?neg_ret=0$' sar_expand $'$1; __repeat_h1 $$'$1$$' $$__tmp_repeat$'"
// Repeats command $2 while cond $1 is true
svar_set while_limit 500
sar_function while "svar_set while_i 0; _while $'$1$' $'$2$'"
sar_function _while "svar_add while_i 1; cond $'$1$' __while $'$1$' $'$2$'"
sar_function __while "$2; cond $'?while_i=$while_limit$' echo $'While recursion limit ($while_limit) reached$'; cond $'!?while_i=$while_limit$' _while $'$1$' $'$2$'"
// Decimal to hex converter
// Return variable: hex_ret
// Dependencies: while, svar_prepend
svar_set hex_i0 0; svar_set hex_i1 1; svar_set hex_i2 2; svar_set hex_i3 3; svar_set hex_i4 4; svar_set hex_i5 5; svar_set hex_i6 6; svar_set hex_i7 7
svar_set hex_i8 8; svar_set hex_i9 9; svar_set hex_i10 A; svar_set hex_i11 B; svar_set hex_i12 C; svar_set hex_i13 D; svar_set hex_i14 E; svar_set hex_i15 F
sar_function hex "svar_set hex_in $'$1$'; svar_add hex_in 0; svar_set hex_ret $'$'; cond ?hex_in=0 svar_set hex_ret 0; while !?hex_in=0 _hex"
sar_function _hex "svar_set hex_mod $hex_in; svar_mod hex_mod 16; sar_expand svar_prepend hex_ret hex_i$$hex_mod; svar_div hex_in 16"
// RGB to hex converter
// Return variable: rgb_hex_ret
// Dependencies: less_than, hex, svar_append
sar_function rgb_hex "svar_set rgb_hex_ret $'$'; __rgb_hex $'$1$'; __rgb_hex $'$2$'; __rgb_hex $'$3$'"
sar_function __rgb_hex "less_than $'$1$' 16; cond $'?less_than_ret=1$' sar_expand svar_set rgb_hex_ret $'$rgb_hex_ret$-0$'; hex $'$1$'; svar_append rgb_hex_ret hex_ret"
// Hue to RGB converter
// Input: 0 - 360
// Return variable: hue_rgb_ret
// Dependencies: less_than, svar_append, svar_abs, svar_clamp, svar_max
sar_function hue_rgb "svar_set __tmp $'$1$'; svar_fmod __tmp 360; sar_expand _hue_rgb $$__tmp 180 4.25 -255 r; sar_expand _hue_rgb $$__tmp 120 -4.25 510 g; sar_expand _hue_rgb $$__tmp 240 -4.25 510 b; sar_expand svar_set hue_rgb_ret $$__hue_rgb_r $$__hue_rgb_g $$__hue_rgb_b"
sar_function _hue_rgb "svar_set __hue_rgb_$5 $1; svar_fsub __hue_rgb_$5 $2; svar_abs __hue_rgb_$5; svar_fmul __hue_rgb_$5 $3; svar_fadd __hue_rgb_$5 $4; svar_clamp __hue_rgb_$5 0 255"
// Hue to hex converter
sar_function hue_hex "hue_rgb $'$1$'; sar_expand rgb_hex $$hue_rgb_ret; sar_expand svar_set hue_hex_ret $$rgb_hex_ret"
// LUT for hue_hex to optimise performance
// sar_alias hue_hex_lut "svar_set __tmp 0; repeat __hue_hex_lut 360; sar_function hue_hex sar_expand svar_set hue_hex_ret $'$$hue_hex_$1$'; sar_alias hue_hex_lut nop"
// sar_function __hue_hex_lut "hue_hex $__tmp; sar_expand svar_set hue_hex_$__tmp $'$$hue_hex_ret$'; svar_add __tmp 1"
// hue_hex_lut
// setvel <x> <y> <z> - sets velocity. Use - to keep velocity on axis. Unspecified arguments are 0.
// Dependencies: cheats_only, __getplayer
sar_function setvel cheats_only "__setvel $1 $2 $3" "setvel"
sar_function setvel_both cheats_only "__setvel_both $1 $2 $3" "setvel_both"
sar_function __setvel "__getplayer; __setvel_h1 $+1"
sar_function __setvel_both conds coop "__setvel_both_h $+1" "__setvel $+1"
sar_function __setvel_both_h "svar_set __player blue; __setvel_h1 $+1; svar_set __player red; __setvel_h1 $+1"
sar_function __setvel_h1 "__setvel_h2 x $1; __setvel_h2 y $2; __setvel_h2 z $3; __setvel_set"
sar_function __setvel_h2 "svar_set __setvel_$1 $'$2$'; cond ?__setvel_$1=- svar_set __setvel_$1 $__player.GetVelocity().$1; cond ?__setvel_$1=?__empty svar_set __setvel_$1 0"
sar_function __setvel_set script $__player.SetVelocity(Vector($__setvel_x, $__setvel_y, $__setvel_z))
// printargs [...] - prints its given args
sar_function printargs "svar_set __tmp 1; __printargs $+1"
sar_function __printargs cond !?__zero=$# "sar_expand sar_echo ffffff $$'$__tmp : $1$$'; svar_add __tmp 1; __printargs $+2"
sar_function __getplayer "svar_from_cvar __tmp in_forceuser; svar_add __tmp 0; cond !coop svar_set __player Entities.FindByClassname(null, $'player$'); cond coop svar_set __player Entities.FindByName(null, $'blue$'); cond $'coop & (orange | ?__tmp=1)$' svar_set __player Entities.FindByName(null, $'red$')"
// NOCLIP
sar_alias __getnoclipstate "__getplayer; __getnoclipstate_h"
sar_function __getnoclipstate_h veval $__player.IsNoclipping() ? "svar_set __noclip 1; $1 $+2" : "svar_set __noclip 0; $1 $+2"
sar_function +noclip_both "cmd1 noclip 1; cmd2 noclip 1; noclip_fixup 0; cl_upspeed $__upspeed; nop"
sar_function -noclip_both "cmd1 noclip 0; cmd2 noclip 0; noclip_fixup 0; cl_upspeed $__upspeed; nop"
sar_function +noclip "noclip 1; noclip_fixup 0; cl_upspeed $__upspeed; nop"
sar_function -noclip "noclip 0; noclip_fixup 0; cl_upspeed $__upspeed; nop"
sar_function noclip_toggle "noclip; noclip_fixup 0; cl_upspeed $__upspeed; nop"
// Minecraft jump-fly
svar_set __fly_delay 12 // double-press space within this many ticks to toggle fly
sar_on_load sar_expand svar_set __fly_lastjump -$__fly_delay
// Replace +jump and +duck binds with +mjump and +mduck for minecraft-fly movement
sar_function +mjump __choosecheats "+__mjump $1" "+jump $1"
sar_function -mjump __choosecheats "-__mjump $1" "-jump $1"
sar_function +mduck __choosecheats "+__mduck $1" "+duck $1"
sar_function -mduck __choosecheats "-__mduck $1" "-duck $1"
sar_alias __fly_toggle __getnoclipstate __fly_toggle_h
sar_function __fly_toggle_h "svar_add __noclip 1; svar_mod __noclip 2; sar_expand __cmd noclip $$__noclip; noclip_fixup 0; cl_upspeed $__upspeed; __cmd -moveup $1; __cmd -jump $1; svar_set __fly_lastjump -$__fly_delay; cond ?__jump=1 conds ?__noclip=1 $'__cmd +moveup $1$' $'__cmd +jump $1$'"
sar_alias +__mjump "svar_set __jump 1; __getnoclipstate +__mjump_h"
sar_function +__mjump_h "conds ?__noclip=1 $'__cmd +moveup $1$' $'__cmd +jump $1$'; gettick; svar_sub __fly_lastjump gettick_ret; sar_expand less_than -$__fly_delay $$__fly_lastjump; conds ?less_than_ret=1 $'__fly_toggle $1$' $'sar_expand svar_set __fly_lastjump $$gettick_ret$'"
sar_function -__mjump "svar_set __jump 0; __cmd -moveup $1; __cmd -jump $1"
sar_alias +__mduck __getnoclipstate +__mduck_h
sar_function +__mduck_h conds ?__noclip=1 "__cmd +movedown $1" "__cmd +duck $1"
sar_function -__mduck "__cmd -movedown $1; __cmd -duck $1"
sar_function __cmd "svar_from_cvar __tmp in_forceuser; svar_add __tmp 1; sar_expand cmd$$__tmp $+1"
sar_alias cmd101 nop // for tas
sar_alias fizzle_portals cheats_only "ent_fire prop_portal fizzle" "fizzle_portals"
svar_set get_keyframe_error "Cinematic mode cannot be used outside of demo player."
sar_function get_keyframe_data "svar_set keyframe_idx 1; svar_capture_quiet keyframe_data sar_cam_path_getkfs; svar_set replace_ret $'$'; cond !?keyframe_data=?get_keyframe_error get_keyframe_data_h1; sar_expand get_keyframe_data_h2 $$replace_ret$'"
sar_function get_keyframe_data_h1 replace "$keyframe_data" ";" " "
sar_function get_keyframe_data_h2 cond !%$#=0 "svar_set keyframe$keyframe_idx$-_tick $2; svar_set keyframe$keyframe_idx$-_posx $3; svar_set keyframe$keyframe_idx$-_posy $4; svar_set keyframe$keyframe_idx$-_posz $5; svar_set keyframe$keyframe_idx$-_rotx $6; svar_set keyframe$keyframe_idx$-_roty $7; svar_set keyframe$keyframe_idx$-_rotz $8; svar_set keyframe$keyframe_idx$-_fov $9; svar_add keyframe_idx 1; get_keyframe_data_h2 $+10"
// // Cubic interpolation
// // in: x 0..1
// sar_function interp "svar_set __tmp $1; svar_fmul __tmp $1; svar_fmul __tmp $1; svar_fmul __tmp 3; svar_fsub __tmp $1; svar_fmul __tmp 2; svar_set interp_ret __tmp"
// Easing functions
// easing <from> <to> <t> <method>
// Return variable: easing_ret
sar_function easing "svar_set __tmp_easing_from $1; svar_set __tmp_easing_to $2; svar_set __tmp_easing_t $3; svar_set easing_ret 0; sar_function_run easing_$4"
sar_function easing_linear "svar_set easing_ret $__tmp_easing_to; svar_fsub easing_ret $__tmp_easing_from; svar_fmul easing_ret $__tmp_easing_t; svar_fadd easing_ret $__tmp_easing_from"
sar_function easing_cubic "less_than $__tmp_easing_t 0.5; conds ?less_than_ret=1 __easing_cubic_a __easing_cubic_b; easing_linear"
sar_function __easing_cubic_a "svar_fmul __tmp_easing_t 4; svar_fmul __tmp_easing_t $__tmp_easing_t; svar_fmul __tmp_easing_t $__tmp_easing_t"
sar_function __easing_cubic_b "svar_fmul __tmp_easing_t -2; svar_fadd __tmp_easing_t 2; svar_fmul __tmp_easing_t __tmp_easing_t; svar_fmul __tmp_easing_t __tmp_easing_t; svar_fmul __tmp_easing_t -1; svar_fdiv __tmp_easing_t 2; svar_fadd __tmp_easing_t 1"
sar_function easing_exp "svar_set easing_ret $__tmp_easing_to; svar_fsub easing_ret $__tmp_easing_from; sar_expand svar_fmul easing_ret $$__tmp_easing_t; svar_fadd easing_ret $__tmp_easing_from; sar_expand svar_fmul easing_ret $$__tmp_easing_t; svar_fadd easing_ret $__tmp_easing_from; sar_expand svar_fmul easing_ret $$__tmp_easing_t; svar_fadd easing_ret $__tmp_easing_from"
sar_function easing_bounce_out "svar_set __tmp_easing_bounce $__tmp_easing_t; less_than $__tmp_easing_t 0.36363636363636365; conds ?less_than_ret=1 __easing_bounce_out_a __easing_bounce_out_h1; svar_set easing_ret $__tmp_easing_to; svar_fsub easing_ret $__tmp_easing_from; sar_expand svar_fmul easing_ret $$__tmp_easing_bounce; svar_fadd easing_ret $__tmp_easing_from"
sar_function __easing_bounce_out_h1 "less_than $__tmp_easing_t 0.7272727272727273; conds ?less_than_ret=1 __easing_bounce_out_b __easing_bounce_out_h2"
sar_function __easing_bounce_out_h2 "less_than $__tmp_easing_t 0.9090909090909091; conds ?less_than_ret=1 __easing_bounce_out_c __easing_bounce_out_d"
sar_function __easing_bounce_out_a "svar_fmul __tmp_easing_bounce __tmp_easing_bounce; svar_fmul __tmp_easing_bounce 7.5625"
sar_function __easing_bounce_out_b "svar_fsub __tmp_easing_bounce 0.5454545454545454; svar_fmul __tmp_easing_bounce __tmp_easing_bounce; svar_fmul __tmp_easing_bounce 7.5625; svar_fadd __tmp_easing_bounce 0.75"
sar_function __easing_bounce_out_c "svar_fsub __tmp_easing_bounce 0.8181818181818182; svar_fmul __tmp_easing_bounce __tmp_easing_bounce; svar_fmul __tmp_easing_bounce 7.5625; svar_fadd __tmp_easing_bounce 0.9375"
sar_function __easing_bounce_out_d "svar_fsub __tmp_easing_bounce 0.9545454545454546; svar_fmul __tmp_easing_bounce __tmp_easing_bounce; svar_fmul __tmp_easing_bounce 7.5625; svar_fadd __tmp_easing_bounce 0.984375"
sar_function easing_sin_out "svar_fmul __tmp_easing_t 90; sar_expand sin $$__tmp_easing_t; sar_expand svar_set __tmp_easing_t $$sin_ret; easing_linear"
sar_function easing_cos "svar_fmul __tmp_easing_t 90; sar_expand cos $$__tmp_easing_t; sar_expand svar_set __tmp_easing_t $$cos_ret; easing_linear"
sar_function easing_tan "svar_fmul __tmp_easing_t 90; sar_expand tan $$__tmp_easing_t; sar_expand svar_set __tmp_easing_t $$tan_ret; easing_linear"
// Debug draw for ease
// ease_draw <linear|cubic|exp|bounce_out>
sar_function ease_draw "sv_cheats 1; sar_drawline_clear; svar_set __tmp_i 0; __ease_draw_borders; __ease_draw_h1 $1"
sar_function __ease_draw_borders "sar_drawline 0 699 -65 0 699 137 255 255 255; sar_drawline 0 699 137 0 901 137 255 255 255; sar_drawline 0 901 137 0 901 -65 255 255 255; sar_drawline 0 901 -65 0 699 -65 255 255 255"
sar_function __ease_draw_h1 cond !?__tmp_i=401 "__ease_draw_h2 $__tmp_i $1; svar_add __tmp_i 1; __ease_draw_h1 $1"
sar_function __ease_draw_h2 "svar_set __tmp_a $1; svar_fmul __tmp_a 0.0025; sar_expand easing 0 200 $$__tmp_a $2; svar_fmul __tmp_a 200; svar_fadd __tmp_a 700; svar_fsub easing_ret 64; sar_expand sar_drawline 0 $$__tmp_a -64 0 $$__tmp_a $$easing_ret 255 255 255"
// ease between easing types on a debug draw
svar_set __easings_len 0
sar_function __tmp cond !%$#=0 "svar_set __easings_$__easings_len $1; svar_add __easings_len 1; $0 $+2"
__tmp linear cubic exp bounce_out sin_out cos tan
sar_function ease_draw_multiple "sv_cheats 1; sar_drawline_clear; sv_alternateticks 0; svar_add tick 1; sar_expand svar_set gettick_ret $$tick; sar_expand svar_set gettick2_ret $$gettick_ret; svar_div gettick2_ret 60; svar_mod gettick2_ret $__easings_len; svar_mod gettick_ret 60; svar_fdiv gettick_ret 60; svar_set __tmp_i 0; __ease_draw_borders; __ease_draw_multiple_h1"
sar_function __ease_draw_multiple_h1 cond !?__tmp_i=101 "__ease_draw_multiple_h2 $__tmp_i; svar_add __tmp_i 1; __ease_draw_multiple_h1"
sar_function __ease_draw_multiple_get "sar_expand easing 0 200 $__tmp_a $$__easings_$1; sar_expand svar_set __ease_draw_multiple_a $$easing_ret; sar_expand easing 0 200 $__tmp_a $$__easings_$2; sar_expand svar_set __ease_draw_multiple_b $$easing_ret"
sar_function __ease_draw_multiple_h2 "svar_set __tmp_a $1; svar_fmul __tmp_a 0.01; svar_add gettick2_ret 1; svar_mod gettick2_ret $__easings_len; sar_expand __ease_draw_multiple_get $gettick2_ret $$gettick2_ret; sar_expand easing $$__ease_draw_multiple_a $$__ease_draw_multiple_b $gettick_ret cubic; svar_set gettick2_ret $gettick2_ret; sar_expand __ease_draw_multiple_h3"
sar_function __ease_draw_multiple_h3 "svar_fmul __tmp_a 200; svar_fadd __tmp_a 700; sar_expand less_than $$easing_ret 200; cond ?less_than_ret=0 svar_set easing_ret 200; svar_fsub easing_ret 64; sar_expand sar_drawline 0 $$__tmp_a -64 0 $$__tmp_a $$easing_ret 255 255 255"
sar_function ease_draw_multiple_loop cond !?stop=1 "ease_draw_multiple; seq nop nop nop ease_draw_multiple_loop"
sar_alias draw_thing ease_draw
sar_function echo_and_do "sar_echo eeff88 $'$+1$'; $+1"
// sin
// LUT for each degree from 0 to 90 and lerp
svar_set __sin_len 0
sar_function __tmp cond !%$#=0 "svar_set __sin_$__sin_len $1; svar_add __sin_len 1; $0 $+2"
__tmp 0 0.01745240643728351 0.03489949670250097 0.05233595624294383 0.0697564737441253 0.08715574274765817 0.10452846326765346 0.12186934340514748 0.13917310096006544 0.15643446504023087 0.17364817766693033 0.1908089953765448 0.20791169081775931 0.224951054343865 0.24192189559966773 0.25881904510252074 0.27563735581699916 0.29237170472273677 0.3090169943749474 0.32556815445715664 0.3420201433256687 0.35836794954530027 0.374606593415912
__tmp 0.3907311284892737 0.40673664307580015 0.42261826174069944 0.4383711467890774 0.45399049973954675 0.4694715627858908 0.48480962024633706 0.49999999999999994 0.5150380749100542 0.5299192642332049 0.5446390350150271 0.5591929034707469 0.573576436351046 0.5877852522924731 0.6018150231520483 0.6156614753256582 0.6293203910498374 0.6427876096865393 0.6560590289905072 0.6691306063588582 0.6819983600624985 0.6946583704589973 0.7071067811865476
__tmp 0.7193398003386511 0.7313537016191705 0.7431448254773941 0.754709580222772 0.766044443118978 0.7771459614569708 0.788010753606722 0.7986355100472928 0.8090169943749475 0.8191520442889918 0.8290375725550417 0.8386705679454239 0.8480480961564261 0.8571673007021122 0.8660254037844386 0.8746197071393957 0.8829475928589269 0.8910065241883678 0.898794046299167 0.9063077870366499 0.9135454576426009 0.9205048534524403 0.9271838545667874
__tmp 0.9335804264972017 0.9396926207859083 0.9455185755993167 0.9510565162951535 0.9563047559630354 0.9612616959383189 0.9659258262890683 0.9702957262759965 0.9743700647852352 0.9781476007338056 0.981627183447664 0.984807753012208 0.9876883405951378 0.9902680687415703 0.992546151641322 0.9945218953682733 0.9961946980917455 0.9975640502598242 0.9986295347545738 0.9993908270190958 0.9998476951563913 1 0.9998476951563913 0.9993908270190958
__tmp 0.9986295347545738 0.9975640502598242 0.9961946980917455 0.9945218953682734 0.9925461516413221 0.9902680687415704 0.9876883405951377 0.984807753012208 0.981627183447664 0.9781476007338057 0.9743700647852352 0.9702957262759965 0.9659258262890683 0.9612616959383189 0.9563047559630355 0.9510565162951536 0.9455185755993168 0.9396926207859084 0.9335804264972017 0.9271838545667874 0.9205048534524404 0.913545457642601 0.90630778703665
__tmp 0.8987940462991669 0.8910065241883679 0.8829475928589271 0.8746197071393959 0.8660254037844387 0.8571673007021123 0.8480480961564261 0.838670567945424 0.8290375725550417 0.819152044288992 0.8090169943749475 0.7986355100472927 0.788010753606722 0.777145961456971 0.766044443118978 0.7547095802227718 0.7431448254773942 0.7313537016191706 0.7193398003386514 0.7071067811865476 0.6946583704589971 0.6819983600624985 0.6691306063588583
__tmp 0.6560590289905073 0.6427876096865395 0.6293203910498377 0.6156614753256584 0.6018150231520482 0.5877852522924732 0.5735764363510464 0.5591929034707469 0.5446390350150269 0.5299192642332049 0.5150380749100544 0.49999999999999994 0.48480962024633717 0.4694715627858911 0.45399049973954686 0.4383711467890773 0.4226182617406995 0.40673664307580043 0.39073112848927416 0.37460659341591224 0.3583679495453002 0.3420201433256689 0.32556815445715703
__tmp 0.3090169943749475 0.29237170472273705 0.27563735581699966 0.258819045102521 0.24192189559966773 0.22495105434386478 0.20791169081775931 0.19080899537654497 0.17364817766693028 0.15643446504023098 0.13917310096006574 0.12186934340514755 0.10452846326765373 0.08715574274765864 0.06975647374412552 0.05233595624294381 0.0348994967025007 0.01745240643728344
sar_function sin "svar_set __tmp_sin $1; svar_set __tmp_sin2 $1; svar_add __tmp_sin2 1; sar_expand $'__sin_lut_get $$__tmp_sin __tmp_sin; __sin_lut_get $$__tmp_sin2 __tmp_sin2$'; svar_set __tmp_sin3 $1; svar_fmod __tmp_sin3 1; sar_expand svar_set sin_ret $$__tmp_sin2; svar_fsub sin_ret __tmp_sin; svar_fmul sin_ret __tmp_sin3; svar_fadd sin_ret __tmp_sin"
sar_function __sin_lut_get "svar_set __tmp_sin_lut $1; svar_floor __tmp_sin_lut; svar_fmod __tmp_sin_lut 360; sar_expand less_than $$__tmp_sin_lut 180; svar_mod __tmp_sin_lut 180; sar_expand sar_expand svar_set $2 $$$$__sin_$$__tmp_sin_lut; cond ?less_than_ret=0 svar_fmul $2 -1"
sar_function cos "svar_set cos_ret $1; svar_fadd cos_ret 90; sar_expand sin $$cos_ret; sar_expand svar_set cos_ret $$sin_ret"
sar_function tan "sin $1; sar_expand svar_set tan_ret $$sin_ret; cos $1; svar_fdiv tan_ret cos_ret"
// bletchley <string> [index]
// faux-bletchley decryption, cleartext until index 0
// Dependencies: length_of, rng
svar_set __tmp_len 0
sar_function __tmp cond !%$#=0 "svar_set __alphanum_$__tmp_len $1; svar_set __numalpha_$1 $__tmp_len; svar_add __tmp_len 1; $0 $+2"
__tmp a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
__tmp 0 1 2 3 4 5 6 7 8 9 ! @ # % ^ & * ( ) _ + - = { } [ ] | \ : ' < > , . ? / ~
sar_function rng_string "svar_set rng_string_ret $'$'; svar_set __tmp_rng_string $1; svar_set __tmp_rng_string2 0; less_than $1 1; cond ?less_than_ret=0 __rng_string_h1"
sar_function __rng_string_h1 cond !?__tmp_rng_string=?__tmp_rng_string2 "rng 90; sar_expand sar_expand svar_set rng_string_ret $$'$rng_string_ret$$$$__alphanum_$$rng_ret$$'; svar_add __tmp_rng_string2 1; __rng_string_h1"
sar_function bletchley "svar_set bletchley_ret $'$1$'; svar_set __tmp_bletchley2 $'$2$'; cond ?__tmp_bletchley2=?__empty svar_set __tmp_bletchley2 0; length_of $'$1$'; sar_expand rng_string $$length_of_ret; __bletchley_h1"
sar_function __bletchley_h1 "svar_substr bletchley_ret 0 $__tmp_bletchley2; svar_substr rng_string_ret $__tmp_bletchley2; sar_expand svar_set bletchley_ret $'$$bletchley_ret$$rng_string_ret$'"
// bletchley_random <string> [%]
sar_function bletchley_random "svar_set bletchley_ret $'$'; svar_set __tmp_bletchley $'$1$'; svar_set __tmp_bletchley2 $2; cond ?__tmp_bletchley2=?__empty svar_set __tmp_bletchley2 0; length_of $'$1$'; sar_expand rng_string $$length_of_ret; svar_set __tmp_bletchley_random 0; __bletchley_random_h1;"
sar_function __bletchley_random_h1 cond !?__tmp_bletchley_random=?length_of_ret "rng 100; sar_expand less_than $$rng_ret $__tmp_bletchley2; conds ?less_than_ret=1 __bletchley_random_h4 __bletchley_random_h5; svar_add __tmp_bletchley_random 1; __bletchley_random_h1"
// sar_function __bletchley_random_h2 cond !?__tmp_bletchley_random2=?length_of_ret "svar_set __tmp_bletchley_random3 0; svar_set __tmp_bletchley_random4 0; __bletchley_random_h3; conds ?__tmp_bletchley_random4=1 __bletchley_random_h4 __bletchley_random_h5; svar_add __tmp_bletchley_random2 1; __bletchley_random_h2"
// sar_function __bletchley_random_h3 cond !?__tmp_bletchley_random3=?__tmp_bletchley_random "cond ?__tmp_bletchley_random_$__tmp_bletchley_random3=?__tmp_bletchley_random2 svar_set __tmp_bletchley_random4 1; svar_add __tmp_bletchley_random3 1; __bletchley_random_h3"
sar_function __bletchley_random_h4 "svar_set __tmp_bletchley_random2 $'$__tmp_bletchley$'; svar_substr __tmp_bletchley_random2 $__tmp_bletchley_random 1; sar_expand svar_set bletchley_ret $'$$bletchley_ret$$__tmp_bletchley_random2$'"
sar_function __bletchley_random_h5 "svar_set __tmp_bletchley_random2 $'$rng_string_ret$'; svar_substr __tmp_bletchley_random2 $__tmp_bletchley_random 1; sar_expand svar_set bletchley_ret $'$$bletchley_ret$$__tmp_bletchley_random2$'"