-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathui.cpp
More file actions
1731 lines (1534 loc) · 71.8 KB
/
ui.cpp
File metadata and controls
1731 lines (1534 loc) · 71.8 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
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
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <cstring>
#include <xlog/xlog.h>
#include <patch_common/FunHook.h>
#include <patch_common/CallHook.h>
#include <patch_common/CodeInjection.h>
#include <patch_common/AsmWriter.h>
#include <format>
#include <algorithm>
#include "alpine_settings.h"
#include "misc.h"
#include "../main/main.h"
#include "../graphics/gr.h"
#include "../rf/ui.h"
#include "../rf/sound/sound.h"
#include "../rf/input.h"
#include "../rf/player/player.h"
#include "../rf/misc.h"
#include "../rf/os/os.h"
#include "../object/object.h"
#define DEBUG_UI_LAYOUT 0
#define SHARP_UI_TEXT 1
// options menu elements
static rf::ui::Gadget* new_gadgets[6]; // Allocate space for 6 options buttons
static rf::ui::Button alpine_options_btn;
// alpine options panel elements
static rf::ui::Panel alpine_options_panel; // parent to all subpanels
static rf::ui::Panel alpine_options_panel0;
static rf::ui::Panel alpine_options_panel1;
static rf::ui::Panel alpine_options_panel2;
static rf::ui::Panel alpine_options_panel3;
static int alpine_options_panel_current_tab = 0;
std::vector<rf::ui::Gadget*> alpine_options_panel_settings;
std::vector<rf::ui::Label*> alpine_options_panel_labels;
std::vector<rf::ui::Label*> alpine_options_panel_tab_labels;
// alpine options tabs
static rf::ui::Checkbox ao_tab_0_cbox;
static rf::ui::Label ao_tab_0_label;
static rf::ui::Checkbox ao_tab_1_cbox;
static rf::ui::Label ao_tab_1_label;
static rf::ui::Checkbox ao_tab_2_cbox;
static rf::ui::Label ao_tab_2_label;
static rf::ui::Checkbox ao_tab_3_cbox;
static rf::ui::Label ao_tab_3_label;
// alpine options inputboxes and labels
static rf::ui::Checkbox ao_retscale_cbox;
static rf::ui::Label ao_retscale_label;
static rf::ui::Label ao_retscale_butlabel;
static char ao_retscale_butlabel_text[9];
static rf::ui::Checkbox ao_fov_cbox;
static rf::ui::Label ao_fov_label;
static rf::ui::Label ao_fov_butlabel;
static char ao_fov_butlabel_text[9];
static rf::ui::Checkbox ao_fpfov_cbox;
static rf::ui::Label ao_fpfov_label;
static rf::ui::Label ao_fpfov_butlabel;
static char ao_fpfov_butlabel_text[9];
static rf::ui::Checkbox ao_ms_cbox;
static rf::ui::Label ao_ms_label;
static rf::ui::Label ao_ms_butlabel;
static char ao_ms_butlabel_text[9];
static rf::ui::Checkbox ao_scannersens_cbox;
static rf::ui::Label ao_scannersens_label;
static rf::ui::Label ao_scannersens_butlabel;
static char ao_scannersens_butlabel_text[9];
static rf::ui::Checkbox ao_scopesens_cbox;
static rf::ui::Label ao_scopesens_label;
static rf::ui::Label ao_scopesens_butlabel;
static char ao_scopesens_butlabel_text[9];
static rf::ui::Checkbox ao_maxfps_cbox;
static rf::ui::Label ao_maxfps_label;
static rf::ui::Label ao_maxfps_butlabel;
static char ao_maxfps_butlabel_text[9];
static rf::ui::Checkbox ao_loddist_cbox;
static rf::ui::Label ao_loddist_label;
static rf::ui::Label ao_loddist_butlabel;
static char ao_loddist_butlabel_text[9];
static rf::ui::Checkbox ao_simdist_cbox;
static rf::ui::Label ao_simdist_label;
static rf::ui::Label ao_simdist_butlabel;
static char ao_simdist_butlabel_text[9];
// alpine options checkboxes and labels
static rf::ui::Checkbox ao_mpcharlod_cbox;
static rf::ui::Label ao_mpcharlod_label;
static rf::ui::Checkbox ao_dinput_cbox;
static rf::ui::Label ao_dinput_label;
static rf::ui::Checkbox ao_linearpitch_cbox;
static rf::ui::Label ao_linearpitch_label;
static rf::ui::Checkbox ao_bighud_cbox;
static rf::ui::Label ao_bighud_label;
static rf::ui::Checkbox ao_ctfwh_cbox;
static rf::ui::Label ao_ctfwh_label;
static rf::ui::Checkbox ao_flag_overdrawwh_cbox;
static rf::ui::Label ao_flag_overdrawwh_label;
static rf::ui::Checkbox ao_hill_overdrawwh_cbox;
static rf::ui::Label ao_hill_overdrawwh_label;
static rf::ui::Checkbox ao_sbanim_cbox;
static rf::ui::Label ao_sbanim_label;
static rf::ui::Checkbox ao_teamlabels_cbox;
static rf::ui::Label ao_teamlabels_label;
static rf::ui::Checkbox ao_minimaltimer_cbox;
static rf::ui::Label ao_minimaltimer_label;
static rf::ui::Checkbox ao_targetnames_cbox;
static rf::ui::Label ao_targetnames_label;
static rf::ui::Checkbox ao_always_show_spectators_cbox{};
static rf::ui::Label ao_always_show_spectators_label{};
static rf::ui::Checkbox ao_staticscope_cbox;
static rf::ui::Label ao_staticscope_label;
static rf::ui::Checkbox ao_hitsounds_cbox;
static rf::ui::Label ao_hitsounds_label;
static rf::ui::Checkbox ao_taunts_cbox;
static rf::ui::Label ao_taunts_label;
static rf::ui::Checkbox ao_teamrad_cbox;
static rf::ui::Label ao_teamrad_label;
static rf::ui::Checkbox ao_globalrad_cbox;
static rf::ui::Label ao_globalrad_label;
static rf::ui::Checkbox ao_clicklimit_cbox;
static rf::ui::Label ao_clicklimit_label;
static rf::ui::Checkbox ao_gaussian_cbox;
static rf::ui::Label ao_gaussian_label;
static rf::ui::Checkbox ao_geochunk_cbox;
static rf::ui::Label ao_geochunk_label;
static rf::ui::Checkbox ao_autosave_cbox;
static rf::ui::Label ao_autosave_label;
static rf::ui::Checkbox ao_damagenum_cbox;
static rf::ui::Label ao_damagenum_label;
static rf::ui::Checkbox ao_showfps_cbox;
static rf::ui::Label ao_showfps_label;
static rf::ui::Checkbox ao_showping_cbox;
static rf::ui::Label ao_showping_label;
static rf::ui::Checkbox ao_locpings_cbox;
static rf::ui::Label ao_locpings_label;
static rf::ui::Checkbox ao_redflash_cbox;
static rf::ui::Label ao_redflash_label;
static rf::ui::Checkbox ao_deathbars_cbox;
static rf::ui::Label ao_deathbars_label;
static rf::ui::Checkbox ao_swapar_cbox;
static rf::ui::Label ao_swapar_label;
static rf::ui::Checkbox ao_swapgn_cbox;
static rf::ui::Label ao_swapgn_label;
static rf::ui::Checkbox ao_swapsg_cbox;
static rf::ui::Label ao_swapsg_label;
static rf::ui::Checkbox ao_weapshake_cbox;
static rf::ui::Label ao_weapshake_label;
static rf::ui::Checkbox ao_firelights_cbox;
static rf::ui::Label ao_firelights_label;
static rf::ui::Checkbox ao_glares_cbox;
static rf::ui::Label ao_glares_label;
static rf::ui::Checkbox ao_nearest_cbox;
static rf::ui::Label ao_nearest_label;
static rf::ui::Checkbox ao_camshake_cbox;
static rf::ui::Label ao_camshake_label;
static rf::ui::Checkbox ao_ricochet_cbox;
static rf::ui::Label ao_ricochet_label;
static rf::ui::Checkbox ao_fullbrightchar_cbox;
static rf::ui::Label ao_fullbrightchar_label;
static rf::ui::Checkbox ao_notex_cbox;
static rf::ui::Label ao_notex_label;
static rf::ui::Checkbox ao_meshstatic_cbox;
static rf::ui::Label ao_meshstatic_label;
static rf::ui::Checkbox ao_enemybullets_cbox;
static rf::ui::Label ao_enemybullets_label;
static rf::ui::Checkbox ao_togglecrouch_cbox;
static rf::ui::Label ao_togglecrouch_label;
static rf::ui::Checkbox ao_joinbeep_cbox;
static rf::ui::Label ao_joinbeep_label;
static rf::ui::Checkbox ao_vsync_cbox;
static rf::ui::Label ao_vsync_label;
static rf::ui::Checkbox ao_unclamplights_cbox;
static rf::ui::Label ao_unclamplights_label;
static rf::ui::Checkbox ao_bombrng_cbox;
static rf::ui::Label ao_bombrng_label;
static rf::ui::Checkbox ao_exposuredamage_cbox;
static rf::ui::Label ao_exposuredamage_label;
static rf::ui::Checkbox ao_painsounds_cbox;
static rf::ui::Label ao_painsounds_label;
// levelsounds audio options slider
std::vector<rf::ui::Gadget*> alpine_audio_panel_settings;
std::vector<rf::ui::Gadget*> alpine_audio_panel_settings_buttons;
static rf::ui::Slider levelsound_opt_slider;
static rf::ui::Button levelsound_opt_button;
static rf::ui::Label levelsound_opt_label;
// fflink info strings
static rf::ui::Label ao_fflink_label1;
static rf::ui::Label ao_fflink_label2;
static rf::ui::Label ao_fflink_label3;
static inline void debug_ui_layout([[ maybe_unused ]] rf::ui::Gadget& gadget)
{
#if DEBUG_UI_LAYOUT
int x = gadget.get_absolute_x() * rf::ui::scale_x;
int y = gadget.get_absolute_y() * rf::ui::scale_y;
int w = gadget.w * rf::ui::scale_x;
int h = gadget.h * rf::ui::scale_y;
rf::gr::set_color((x ^ y) & 255, 0, 0, 64);
rf::gr::rect(x, y, w, h);
#endif
}
void __fastcall UiButton_create(rf::ui::Button& this_, int, const char *normal_bm, const char *selected_bm, int x, int y, int id, const char *text, int font)
{
this_.key = id;
this_.x = x;
this_.y = y;
if (*normal_bm) {
this_.bg_bitmap = rf::bm::load(normal_bm, -1, false);
rf::gr::tcache_add_ref(this_.bg_bitmap);
rf::bm::get_dimensions(this_.bg_bitmap, &this_.w, &this_.h);
}
if (*selected_bm) {
this_.selected_bitmap = rf::bm::load(selected_bm, -1, false);
rf::gr::tcache_add_ref(this_.selected_bitmap);
if (this_.bg_bitmap < 0) {
rf::bm::get_dimensions(this_.selected_bitmap, &this_.w, &this_.h);
}
}
this_.text = _strdup(text);
this_.font = font;
}
FunHook UiButton_create_hook{0x004574D0, UiButton_create};
void __fastcall UiButton_set_text(rf::ui::Button& this_, int, const char *text, int font)
{
delete[] this_.text;
this_.text = _strdup(text);
this_.font = font;
}
FunHook UiButton_set_text_hook{0x00457710, UiButton_set_text};
void __fastcall UiButton_render(rf::ui::Button& this_)
{
int x = static_cast<int>(this_.get_absolute_x() * rf::ui::scale_x);
int y = static_cast<int>(this_.get_absolute_y() * rf::ui::scale_y);
int w = static_cast<int>(this_.w * rf::ui::scale_x);
int h = static_cast<int>(this_.h * rf::ui::scale_y);
if (this_.bg_bitmap >= 0) {
rf::gr::set_color(255, 255, 255, 255);
rf::gr::bitmap_scaled(this_.bg_bitmap, x, y, w, h, 0, 0, this_.w, this_.h, false, false, rf::gr::bitmap_clamp_mode);
}
if (!this_.enabled) {
rf::gr::set_color(96, 96, 96, 255);
}
else if (this_.highlighted) {
rf::gr::set_color(240, 240, 240, 255);
}
else {
rf::gr::set_color(192, 192, 192, 255);
}
if (this_.enabled && this_.highlighted && this_.selected_bitmap >= 0) {
auto mode = addr_as_ref<rf::gr::Mode>(0x01775B0C);
rf::gr::bitmap_scaled(this_.selected_bitmap, x, y, w, h, 0, 0, this_.w, this_.h, false, false, mode);
}
// Change clip region for text rendering
int clip_x, clip_y, clip_w, clip_h;
rf::gr::get_clip(&clip_x, &clip_y, &clip_w, &clip_h);
rf::gr::set_clip(x, y, w, h);
std::string_view text_sv{this_.text};
int num_lines = 1 + std::count(text_sv.begin(), text_sv.end(), '\n');
int text_h = rf::gr::get_font_height(this_.font) * num_lines;
int text_y = (h - text_h) / 2;
rf::gr::string(rf::gr::center_x, text_y, this_.text, this_.font);
// Restore clip region
rf::gr::set_clip(clip_x, clip_y, clip_w, clip_h);
debug_ui_layout(this_);
}
FunHook UiButton_render_hook{0x004577A0, UiButton_render};
void __fastcall UiLabel_create(rf::ui::Label& this_, int, rf::ui::Gadget *parent, int x, int y, const char *text, int font)
{
this_.parent = parent;
this_.x = x;
this_.y = y;
const auto [text_w, text_h] = rf::gr::get_string_size(text, font);
this_.w = static_cast<int>(text_w / rf::ui::scale_x);
this_.h = static_cast<int>(text_h / rf::ui::scale_y);
this_.text = _strdup(text);
this_.font = font;
this_.align = rf::gr::ALIGN_LEFT;
this_.clr.set(0, 0, 0, 255);
}
FunHook UiLabel_create_hook{0x00456B60, UiLabel_create};
void __fastcall UiLabel_create2(rf::ui::Label& this_, int, rf::ui::Gadget *parent, int x, int y, int w, int h, const char *text, int font)
{
this_.parent = parent;
this_.x = x;
this_.y = y;
this_.w = w;
this_.h = h;
if (*text == ' ') {
while (*text == ' ') {
++text;
}
this_.align = rf::gr::ALIGN_CENTER;
}
else {
this_.align = rf::gr::ALIGN_LEFT;
}
this_.text = _strdup(text);
this_.font = font;
this_.clr.set(0, 0, 0, 255);
}
FunHook UiLabel_create2_hook{0x00456C20, UiLabel_create2};
void __fastcall UiLabel_set_text(rf::ui::Label& this_, int, const char *text, int font)
{
delete[] this_.text;
this_.text = _strdup(text);
this_.font = font;
}
FunHook UiLabel_set_text_hook{0x00456DC0, UiLabel_set_text};
void __fastcall UiLabel_render(rf::ui::Label& this_) {
if (this_.text) {
if (!this_.enabled) {
rf::gr::set_color(48, 48, 48, 128);
} else if (this_.highlighted) {
rf::gr::set_color(240, 240, 240, 255);
} else {
rf::gr::set_color(this_.clr);
}
int x = static_cast<int>(this_.get_absolute_x() * rf::ui::scale_x);
int y = static_cast<int>(this_.get_absolute_y() * rf::ui::scale_y);
const auto [text_w, text_h] = rf::gr::get_string_size(this_.text, this_.font);
if (this_.align == rf::gr::ALIGN_CENTER) {
x += static_cast<int>(this_.w * rf::ui::scale_x / 2);
} else if (this_.align == rf::gr::ALIGN_RIGHT) {
x += static_cast<int>(this_.w * rf::ui::scale_x);
} else {
x += static_cast<int>(1 * rf::ui::scale_x);
}
rf::gr::string_aligned(this_.align, x, y, this_.text, this_.font);
}
debug_ui_layout(this_);
}
FunHook UiLabel_render_hook{0x00456ED0, UiLabel_render};
void __fastcall UiInputBox_create(rf::ui::InputBox& this_, int, rf::ui::Gadget *parent, int x, int y, const char *text, int font, int w)
{
this_.parent = parent;
this_.x = x;
this_.y = y;
this_.w = w;
this_.h = static_cast<int>(rf::gr::get_font_height(font) / rf::ui::scale_y);
this_.max_text_width = static_cast<int>(w * rf::ui::scale_x);
this_.font = font;
std::strncpy(this_.text, text, std::size(this_.text));
this_.text[std::size(this_.text) - 1] = '\0';
}
FunHook UiInputBox_create_hook{0x00456FE0, UiInputBox_create};
void __fastcall UiInputBox_render(rf::ui::InputBox& this_, void*)
{
if (this_.enabled && this_.highlighted) {
rf::gr::set_color(240, 240, 240, 255);
}
else {
rf::gr::set_color(192, 192, 192, 255);
}
int x = static_cast<int>((this_.get_absolute_x() + 1) * rf::ui::scale_x);
int y = static_cast<int>(this_.get_absolute_y() * rf::ui::scale_y);
int clip_x, clip_y, clip_w, clip_h;
rf::gr::get_clip(&clip_x, &clip_y, &clip_w, &clip_h);
rf::gr::set_clip(x, y, this_.max_text_width, static_cast<int>(this_.h * rf::ui::scale_y + 5)); // for some reason input fields are too thin
int text_offset_x = static_cast<int>(1 * rf::ui::scale_x);
rf::gr::string(text_offset_x, 0, this_.text, this_.font);
if (this_.enabled && this_.highlighted) {
rf::ui::update_input_box_cursor();
if (rf::ui::input_box_cursor_visible) {
const auto [text_w, text_h] = rf::gr::get_string_size(this_.text, this_.font);
rf::gr::string(text_offset_x + text_w, 0, "_", this_.font);
}
}
rf::gr::set_clip(clip_x, clip_y, clip_w, clip_h);
debug_ui_layout(this_);
}
FunHook UiInputBox_render_hook{0x004570E0, UiInputBox_render};
void __fastcall UiCycler_add_item(rf::ui::Cycler& this_, int, const char *text, int font)
{
if (this_.num_items < rf::ui::Cycler::max_items) {
this_.items_text[this_.num_items] = _strdup(text);
this_.items_font[this_.num_items] = font;
++this_.num_items;
}
}
FunHook UiCycler_add_item_hook{0x00458080, UiCycler_add_item};
void __fastcall UiCycler_render(rf::ui::Cycler& this_)
{
if (this_.enabled && this_.highlighted) {
rf::gr::set_color(255, 255, 255, 255);
}
else if (this_.enabled) {
rf::gr::set_color(192, 192, 192, 255);
}
else {
rf::gr::set_color(96, 96, 96, 255);
}
int x = static_cast<int>(this_.get_absolute_x() * rf::ui::scale_x);
int y = static_cast<int>(this_.get_absolute_y() * rf::ui::scale_y);
const char* text = this_.items_text[this_.current_item];
int font = this_.items_font[this_.current_item];
int font_h = rf::gr::get_font_height(font);
int text_x = x + static_cast<int>(this_.w * rf::ui::scale_x / 2);
int text_y = y + static_cast<int>((this_.h * rf::ui::scale_y - font_h) / 2);
rf::gr::string_aligned(rf::gr::ALIGN_CENTER, text_x, text_y, text, font);
debug_ui_layout(this_);
}
FunHook UiCycler_render_hook{0x00457F40, UiCycler_render};
CallHook<void(int*, int*, const char*, int, int, char, int)> popup_set_text_gr_split_str_hook{
0x00455A7D,
[](int *n_chars, int *start_indices, const char *str, int max_pixel_w, int max_lines, char ignore_char, int font) {
max_pixel_w = static_cast<int>(max_pixel_w * rf::ui::scale_x);
popup_set_text_gr_split_str_hook.call_target(n_chars, start_indices, str, max_pixel_w, max_lines, ignore_char, font);
},
};
static bool is_any_font_modded()
{
auto rfpc_large_checksum = rf::get_file_checksum("rfpc-large.vf");
auto rfpc_medium_checksum = rf::get_file_checksum("rfpc-medium.vf");
auto rfpc_small_checksum = rf::get_file_checksum("rfpc-small.vf");
// Note: rfpc-large differs between Steam and CD game distributions
bool rfpc_large_modded = rfpc_large_checksum != 0x5E7DC24Au && rfpc_large_checksum != 0xEB80AD63u;
bool rfpc_medium_modded = rfpc_medium_checksum != 0x19E7184Cu;
bool rfpc_small_modded = rfpc_small_checksum != 0xAABA52E6u;
bool any_font_modded = rfpc_large_modded || rfpc_medium_modded || rfpc_small_modded;
if (any_font_modded) {
xlog::info("Detected modded fonts: rfpc-large {} ({:08X}) rfpc-medium {} ({:08X}) rfpc-small {} ({:08X})",
rfpc_large_modded, rfpc_large_checksum,
rfpc_medium_modded, rfpc_medium_checksum,
rfpc_small_modded, rfpc_small_checksum
);
}
return any_font_modded;
}
FunHook<void()> menu_init_hook{
0x00442BB0,
[]() {
menu_init_hook.call_target();
#if SHARP_UI_TEXT
xlog::info("UI scale: {:.4f} {:.4f}", rf::ui::scale_x, rf::ui::scale_y);
if (rf::ui::scale_y > 1.0f && !is_any_font_modded()) {
int large_font_size = std::min(128, static_cast<int>(std::round(rf::ui::scale_y * 14.5f))); // 32
int medium_font_size = std::min(128, static_cast<int>(std::round(rf::ui::scale_y * 9.0f))); // 20
int small_font_size = std::min(128, static_cast<int>(std::round(rf::ui::scale_y * 7.5f))); // 16
xlog::info("UI font sizes: {} {} {}", large_font_size, medium_font_size, small_font_size);
rf::ui::large_font = rf::gr::load_font(std::format("boldfont.ttf:{}", large_font_size).c_str());
rf::ui::medium_font_0 = rf::gr::load_font(std::format("regularfont.ttf:{}", medium_font_size).c_str());
rf::ui::medium_font_1 = rf::ui::medium_font_0;
rf::ui::small_font = rf::gr::load_font(std::format("regularfont.ttf:{}", small_font_size).c_str());
}
#endif
},
};
auto UiInputBox_add_char = reinterpret_cast<bool (__thiscall*)(void *this_, char c)>(0x00457260);
extern FunHook<bool __fastcall(void*, int, rf::Key)> UiInputBox_process_key_hook;
bool __fastcall UiInputBox_process_key_new(void *this_, int edx, rf::Key key)
{
if (key == (rf::KEY_V | rf::KEY_CTRLED)) {
char buf[256];
rf::os_get_clipboard_text(buf, static_cast<int>(std::size(buf) - 1));
for (int i = 0; buf[i]; ++i) {
UiInputBox_add_char(this_, buf[i]);
}
return true;
}
return UiInputBox_process_key_hook.call_target(this_, edx, key);
}
FunHook<bool __fastcall(void *this_, int edx, rf::Key key)> UiInputBox_process_key_hook{
0x00457300,
UiInputBox_process_key_new,
};
void ao_play_button_snd(bool on) {
if (on) {
rf::snd_play(45, 0, 0.0f, 1.0f);
}
else {
rf::snd_play(44, 0, 0.0f, 1.0f);
}
}
void ao_play_tab_snd() {
rf::snd_play(41, 0, 0.0f, 1.0f);
}
void ao_tab_button_on_click_0(int x, int y) {
alpine_options_panel_current_tab = 0;
ao_play_tab_snd();
}
void ao_tab_button_on_click_1(int x, int y) {
alpine_options_panel_current_tab = 1;
ao_play_tab_snd();
}
void ao_tab_button_on_click_2(int x, int y) {
alpine_options_panel_current_tab = 2;
ao_play_tab_snd();
}
void ao_tab_button_on_click_3(int x, int y) {
alpine_options_panel_current_tab = 3;
ao_play_tab_snd();
}
void ao_bighud_cbox_on_click(int x, int y) {
g_alpine_game_config.big_hud = !g_alpine_game_config.big_hud;
ao_bighud_cbox.checked = g_alpine_game_config.big_hud;
set_big_hud(g_alpine_game_config.big_hud);
ao_play_button_snd(g_alpine_game_config.big_hud);
}
void ao_dinput_cbox_on_click(int x, int y)
{
g_alpine_game_config.direct_input = !g_alpine_game_config.direct_input;
ao_dinput_cbox.checked = g_alpine_game_config.direct_input;
ao_play_button_snd(g_alpine_game_config.direct_input);
}
void ao_linearpitch_cbox_on_click(int x, int y) {
g_alpine_game_config.mouse_linear_pitch = !g_alpine_game_config.mouse_linear_pitch;
ao_linearpitch_cbox.checked = g_alpine_game_config.mouse_linear_pitch;
ao_play_button_snd(g_alpine_game_config.mouse_linear_pitch);
}
// fov
void ao_fov_cbox_on_click_callback() {
char str_buffer[7] = "";
rf::ui::popup_get_input(str_buffer, sizeof(str_buffer));
std::string str = str_buffer;
try {
float new_fov = std::stof(str);
g_alpine_game_config.set_horz_fov(new_fov);
}
catch (const std::exception& e) {
xlog::info("Invalid FOV input: '{}', reason: {}", str, e.what());
}
}
void ao_fov_cbox_on_click(int x, int y) {
rf::ui::popup_message("Enter new FOV value (0 for automatic scaling):", "", ao_fov_cbox_on_click_callback, 1);
}
// fpgun fov
void ao_fpfov_cbox_on_click_callback() {
char str_buffer[7] = "";
rf::ui::popup_get_input(str_buffer, sizeof(str_buffer));
std::string str = str_buffer;
try {
float new_fpfov = std::stof(str);
g_alpine_game_config.set_fpgun_fov_scale(new_fpfov);
}
catch (const std::exception& e) {
xlog::info("Invalid FPGun FOV input: '{}', reason: {}", str, e.what());
}
}
void ao_fpfov_cbox_on_click(int x, int y) {
rf::ui::popup_message("Enter new FPGun FOV modifier value:", "", ao_fpfov_cbox_on_click_callback, 1);
}
// ms
void ao_ms_cbox_on_click_callback() {
char str_buffer[7] = "";
rf::ui::popup_get_input(str_buffer, sizeof(str_buffer));
std::string str = str_buffer;
try {
float new_ms = std::stof(str);
rf::local_player->settings.controls.mouse_sensitivity = new_ms;
}
catch (const std::exception& e) {
xlog::info("Invalid sensitivity input: '{}', reason: {}", str, e.what());
}
}
void ao_ms_cbox_on_click(int x, int y) {
rf::ui::popup_message("Enter new mouse sensitivity value:", "", ao_ms_cbox_on_click_callback, 1);
}
// scanner ms
void ao_scannersens_cbox_on_click_callback() {
char str_buffer[7] = "";
rf::ui::popup_get_input(str_buffer, sizeof(str_buffer));
std::string str = str_buffer;
try {
float new_scale = std::stof(str);
g_alpine_game_config.set_scanner_sens_mod(new_scale);
update_scanner_sensitivity();
}
catch (const std::exception& e) {
xlog::info("Invalid modifier input: '{}', reason: {}", str, e.what());
}
}
void ao_scannersens_cbox_on_click(int x, int y) {
rf::ui::popup_message("Enter new scanner sensitivity modifier value:", "", ao_scannersens_cbox_on_click_callback, 1);
}
// scope ms
void ao_scopesens_cbox_on_click_callback() {
char str_buffer[7] = "";
rf::ui::popup_get_input(str_buffer, sizeof(str_buffer));
std::string str = str_buffer;
try {
float new_scale = std::stof(str);
g_alpine_game_config.set_scope_sens_mod(new_scale);
update_scope_sensitivity();
}
catch (const std::exception& e) {
xlog::info("Invalid modifier input: '{}', reason: {}", str, e.what());
}
}
void ao_scopesens_cbox_on_click(int x, int y) {
rf::ui::popup_message("Enter new scope sensitivity modifier value:", "", ao_scopesens_cbox_on_click_callback, 1);
}
// reticle scale
void ao_retscale_cbox_on_click_callback() {
char str_buffer[7] = "";
rf::ui::popup_get_input(str_buffer, sizeof(str_buffer));
std::string str = str_buffer;
try {
float new_scale = std::stof(str);
g_alpine_game_config.set_reticle_scale(new_scale);
}
catch (const std::exception& e) {
xlog::info("Invalid reticle scale input: '{}', reason: {}", str, e.what());
}
}
void ao_retscale_cbox_on_click(int x, int y) {
rf::ui::popup_message("Enter new reticle scale value:", "", ao_retscale_cbox_on_click_callback, 1);
}
// max fps
void ao_maxfps_cbox_on_click_callback()
{
char str_buffer[7] = "";
rf::ui::popup_get_input(str_buffer, sizeof(str_buffer));
std::string str = str_buffer;
try {
unsigned new_fps = std::stoi(str);
g_alpine_game_config.set_max_fps(new_fps);
}
catch (const std::exception& e) {
xlog::info("Invalid max FPS input: '{}', reason: {}", str, e.what());
}
}
void ao_maxfps_cbox_on_click(int x, int y)
{
rf::ui::popup_message("Enter new maximum FPS value:", "", ao_maxfps_cbox_on_click_callback, 1);
}
// lod dist scale
void ao_loddist_cbox_on_click_callback()
{
char str_buffer[7] = "";
rf::ui::popup_get_input(str_buffer, sizeof(str_buffer));
std::string str = str_buffer;
try {
float new_dist = std::stof(str);
g_alpine_game_config.set_lod_dist_scale(new_dist);
}
catch (const std::exception& e) {
xlog::info("Invalid LOD distance scale input: '{}', reason: {}", str, e.what());
}
}
void ao_loddist_cbox_on_click(int x, int y)
{
rf::ui::popup_message("Enter new LOD distance scale value:", "", ao_loddist_cbox_on_click_callback, 1);
}
// simulation distance
void ao_simdist_cbox_on_click_callback()
{
char str_buffer[7] = "";
rf::ui::popup_get_input(str_buffer, sizeof(str_buffer));
std::string str = str_buffer;
try {
float new_dist = std::stof(str);
g_alpine_game_config.set_entity_sim_distance(new_dist);
apply_entity_sim_distance();
}
catch (const std::exception& e) {
xlog::info("Invalid simulation distance input: '{}', reason: {}", str, e.what());
}
}
void ao_simdist_cbox_on_click(int x, int y)
{
rf::ui::popup_message("Enter new simulation distance value:", "", ao_simdist_cbox_on_click_callback, 1);
}
void ao_mpcharlod_cbox_on_click(int x, int y) {
g_alpine_game_config.multi_no_character_lod = !g_alpine_game_config.multi_no_character_lod;
ao_mpcharlod_cbox.checked = !g_alpine_game_config.multi_no_character_lod;
ao_play_button_snd(!g_alpine_game_config.multi_no_character_lod);
}
void ao_damagenum_cbox_on_click(int x, int y) {
g_alpine_game_config.world_hud_damage_numbers = !g_alpine_game_config.world_hud_damage_numbers;
ao_damagenum_cbox.checked = g_alpine_game_config.world_hud_damage_numbers;
ao_play_button_snd(g_alpine_game_config.world_hud_damage_numbers);
}
void ao_hitsounds_cbox_on_click(int x, int y) {
g_alpine_game_config.play_hit_sounds = !g_alpine_game_config.play_hit_sounds;
ao_hitsounds_cbox.checked = g_alpine_game_config.play_hit_sounds;
ao_play_button_snd(g_alpine_game_config.play_hit_sounds);
}
void ao_taunts_cbox_on_click(int x, int y) {
g_alpine_game_config.play_taunt_sounds = !g_alpine_game_config.play_taunt_sounds;
ao_taunts_cbox.checked = g_alpine_game_config.play_taunt_sounds;
ao_play_button_snd(g_alpine_game_config.play_taunt_sounds);
}
void ao_teamrad_cbox_on_click(int x, int y) {
g_alpine_game_config.play_team_rad_msg_sounds = !g_alpine_game_config.play_team_rad_msg_sounds;
ao_teamrad_cbox.checked = g_alpine_game_config.play_team_rad_msg_sounds;
ao_play_button_snd(g_alpine_game_config.play_team_rad_msg_sounds);
}
void ao_bombrng_cbox_on_click(int x, int y) {
g_alpine_game_config.static_bomb_code = !g_alpine_game_config.static_bomb_code;
ao_bombrng_cbox.checked = !g_alpine_game_config.static_bomb_code;
ao_play_button_snd(!g_alpine_game_config.static_bomb_code);
}
void ao_exposuredamage_cbox_on_click(int x, int y) {
g_alpine_game_config.apply_exposure_damage = !g_alpine_game_config.apply_exposure_damage;
ao_exposuredamage_cbox.checked = g_alpine_game_config.apply_exposure_damage;
ao_play_button_snd(g_alpine_game_config.apply_exposure_damage);
}
void ao_painsounds_cbox_on_click(int x, int y) {
g_alpine_game_config.entity_pain_sounds = !g_alpine_game_config.entity_pain_sounds;
ao_painsounds_cbox.checked = g_alpine_game_config.entity_pain_sounds;
ao_play_button_snd(g_alpine_game_config.entity_pain_sounds);
}
void ao_togglecrouch_cbox_on_click(int x, int y) {
rf::local_player->settings.toggle_crouch = !rf::local_player->settings.toggle_crouch;
ao_togglecrouch_cbox.checked = rf::local_player->settings.toggle_crouch;
ao_play_button_snd(rf::local_player->settings.toggle_crouch);
}
void ao_joinbeep_cbox_on_click(int x, int y) {
g_alpine_game_config.player_join_beep = !g_alpine_game_config.player_join_beep;
ao_joinbeep_cbox.checked = g_alpine_game_config.player_join_beep;
ao_play_button_snd(g_alpine_game_config.player_join_beep);
}
void ao_vsync_cbox_on_click(int x, int y) {
g_alpine_system_config.vsync = !g_alpine_system_config.vsync;
g_alpine_system_config.save();
ao_vsync_cbox.checked = g_alpine_system_config.vsync;
ao_play_button_snd(g_alpine_system_config.vsync);
gr_d3d_update_vsync();
}
void ao_unclamplights_cbox_on_click(int x, int y) {
g_alpine_game_config.full_range_lighting = !g_alpine_game_config.full_range_lighting;
ao_unclamplights_cbox.checked = g_alpine_game_config.full_range_lighting;
ao_play_button_snd(g_alpine_game_config.full_range_lighting);
}
void ao_globalrad_cbox_on_click(int x, int y) {
g_alpine_game_config.play_global_rad_msg_sounds = !g_alpine_game_config.play_global_rad_msg_sounds;
ao_globalrad_cbox.checked = g_alpine_game_config.play_global_rad_msg_sounds;
ao_play_button_snd(g_alpine_game_config.play_global_rad_msg_sounds);
}
void ao_clicklimit_cbox_on_click(int x, int y) {
g_alpine_game_config.unlimited_semi_auto = !g_alpine_game_config.unlimited_semi_auto;
ao_clicklimit_cbox.checked = !g_alpine_game_config.unlimited_semi_auto;
ao_play_button_snd(!g_alpine_game_config.unlimited_semi_auto);
}
void ao_gaussian_cbox_on_click(int x, int y) {
g_alpine_game_config.gaussian_spread = !g_alpine_game_config.gaussian_spread;
ao_gaussian_cbox.checked = g_alpine_game_config.gaussian_spread;
ao_play_button_snd(g_alpine_game_config.gaussian_spread);
}
void ao_geochunk_cbox_on_click(int x, int y) {
g_alpine_game_config.geo_chunk_physics = !g_alpine_game_config.geo_chunk_physics;
ao_geochunk_cbox.checked = g_alpine_game_config.geo_chunk_physics;
ao_play_button_snd(g_alpine_game_config.geo_chunk_physics);
}
void ao_autosave_cbox_on_click(int x, int y) {
g_alpine_game_config.autosave = !g_alpine_game_config.autosave;
ao_autosave_cbox.checked = g_alpine_game_config.autosave;
ao_play_button_snd(g_alpine_game_config.autosave);
}
void ao_showfps_cbox_on_click(int x, int y) {
g_alpine_game_config.fps_counter = !g_alpine_game_config.fps_counter;
ao_showfps_cbox.checked = g_alpine_game_config.fps_counter;
ao_play_button_snd(g_alpine_game_config.fps_counter);
}
void ao_showping_cbox_on_click(int x, int y) {
g_alpine_game_config.ping_display = !g_alpine_game_config.ping_display;
ao_showping_cbox.checked = g_alpine_game_config.ping_display;
ao_play_button_snd(g_alpine_game_config.ping_display);
}
void ao_locpings_cbox_on_click(int x, int y) {
g_alpine_game_config.show_location_pings = !g_alpine_game_config.show_location_pings;
ao_locpings_cbox.checked = g_alpine_game_config.show_location_pings;
ao_play_button_snd(g_alpine_game_config.show_location_pings);
}
void ao_redflash_cbox_on_click(int x, int y) {
g_alpine_game_config.damage_screen_flash = !g_alpine_game_config.damage_screen_flash;
ao_redflash_cbox.checked = g_alpine_game_config.damage_screen_flash;
ao_play_button_snd(g_alpine_game_config.damage_screen_flash);
}
void ao_deathbars_cbox_on_click(int x, int y) {
g_alpine_game_config.death_bars = !g_alpine_game_config.death_bars;
ao_deathbars_cbox.checked = g_alpine_game_config.death_bars;
ao_play_button_snd(g_alpine_game_config.death_bars);
}
void ao_ctfwh_cbox_on_click(int x, int y) {
g_alpine_game_config.world_hud_ctf_icons = !g_alpine_game_config.world_hud_ctf_icons;
ao_ctfwh_cbox.checked = g_alpine_game_config.world_hud_ctf_icons;
ao_play_button_snd(g_alpine_game_config.world_hud_ctf_icons);
}
void ao_flag_overdrawwh_cbox_on_click(int x, int y) {
g_alpine_game_config.world_hud_flag_overdraw = !g_alpine_game_config.world_hud_flag_overdraw;
ao_flag_overdrawwh_cbox.checked = g_alpine_game_config.world_hud_flag_overdraw;
ao_play_button_snd(g_alpine_game_config.world_hud_flag_overdraw);
}
void ao_hill_overdrawwh_cbox_on_click(int x, int y) {
g_alpine_game_config.world_hud_hill_overdraw = !g_alpine_game_config.world_hud_hill_overdraw;
ao_hill_overdrawwh_cbox.checked = g_alpine_game_config.world_hud_hill_overdraw;
ao_play_button_snd(g_alpine_game_config.world_hud_hill_overdraw);
}
void ao_sbanim_cbox_on_click(int x, int y) {
g_alpine_game_config.scoreboard_anim = !g_alpine_game_config.scoreboard_anim;
ao_sbanim_cbox.checked = g_alpine_game_config.scoreboard_anim;
ao_play_button_snd(g_alpine_game_config.scoreboard_anim);
}
void ao_teamlabels_cbox_on_click(int x, int y) {
g_alpine_game_config.world_hud_team_player_labels = !g_alpine_game_config.world_hud_team_player_labels;
ao_teamlabels_cbox.checked = g_alpine_game_config.world_hud_team_player_labels;
ao_play_button_snd(g_alpine_game_config.world_hud_team_player_labels);
}
void ao_minimaltimer_cbox_on_click(int x, int y) {
g_alpine_game_config.verbose_time_left_display = !g_alpine_game_config.verbose_time_left_display;
ao_minimaltimer_cbox.checked = !g_alpine_game_config.verbose_time_left_display;
build_time_left_string_format();
ao_play_button_snd(!g_alpine_game_config.verbose_time_left_display);
}
void ao_targetnames_cbox_on_click(int x, int y) {
g_alpine_game_config.display_target_player_names = !g_alpine_game_config.display_target_player_names;
ao_targetnames_cbox.checked = g_alpine_game_config.display_target_player_names;
ao_play_button_snd(g_alpine_game_config.display_target_player_names);
}
void ao_always_show_spectators_cbox_on_click(const int x, const int y) {
g_alpine_game_config.always_show_spectators = !g_alpine_game_config.always_show_spectators;
ao_always_show_spectators_cbox.checked = g_alpine_game_config.always_show_spectators;
ao_play_button_snd(g_alpine_game_config.always_show_spectators);
}
void ao_staticscope_cbox_on_click(int x, int y) {
g_alpine_game_config.scope_static_sensitivity = !g_alpine_game_config.scope_static_sensitivity;
ao_staticscope_cbox.checked = g_alpine_game_config.scope_static_sensitivity;
ao_play_button_snd(g_alpine_game_config.scope_static_sensitivity);
}
void ao_swapar_cbox_on_click(int x, int y) {
g_alpine_game_config.swap_ar_controls = !g_alpine_game_config.swap_ar_controls;
ao_swapar_cbox.checked = g_alpine_game_config.swap_ar_controls;
ao_play_button_snd(g_alpine_game_config.swap_ar_controls);
}
void ao_swapgn_cbox_on_click(int x, int y) {
g_alpine_game_config.swap_gn_controls = !g_alpine_game_config.swap_gn_controls;
ao_swapgn_cbox.checked = g_alpine_game_config.swap_gn_controls;
ao_play_button_snd(g_alpine_game_config.swap_gn_controls);
}
void ao_swapsg_cbox_on_click(int x, int y) {
g_alpine_game_config.swap_sg_controls = !g_alpine_game_config.swap_sg_controls;
ao_swapsg_cbox.checked = g_alpine_game_config.swap_sg_controls;
ao_play_button_snd(g_alpine_game_config.swap_sg_controls);
}
void ao_camshake_cbox_on_click(int x, int y) {
g_alpine_game_config.screen_shake_force_off = !g_alpine_game_config.screen_shake_force_off;
ao_camshake_cbox.checked = !g_alpine_game_config.screen_shake_force_off;
ao_play_button_snd(!g_alpine_game_config.screen_shake_force_off);
}
void ao_ricochet_cbox_on_click(int x, int y) {
g_alpine_game_config.multi_ricochet = !g_alpine_game_config.multi_ricochet;
ao_ricochet_cbox.checked = g_alpine_game_config.multi_ricochet;
ao_play_button_snd(g_alpine_game_config.multi_ricochet);
}
void ao_firelights_cbox_on_click(int x, int y) {
g_alpine_game_config.try_disable_muzzle_flash_lights = !g_alpine_game_config.try_disable_muzzle_flash_lights;
ao_firelights_cbox.checked = !g_alpine_game_config.try_disable_muzzle_flash_lights;
ao_play_button_snd(!g_alpine_game_config.try_disable_muzzle_flash_lights);
}
void ao_glares_cbox_on_click(int x, int y) {
g_alpine_game_config.show_glares = !g_alpine_game_config.show_glares;
ao_glares_cbox.checked = g_alpine_game_config.show_glares;
ao_play_button_snd(g_alpine_game_config.show_glares);
}
void ao_nearest_cbox_on_click(int x, int y) {
g_alpine_game_config.nearest_texture_filtering = !g_alpine_game_config.nearest_texture_filtering;
ao_nearest_cbox.checked = g_alpine_game_config.nearest_texture_filtering;
gr_update_texture_filtering();
ao_play_button_snd(g_alpine_game_config.nearest_texture_filtering);
}
void ao_weapshake_cbox_on_click(int x, int y) {
g_alpine_game_config.try_disable_weapon_shake = !g_alpine_game_config.try_disable_weapon_shake;
ao_weapshake_cbox.checked = !g_alpine_game_config.try_disable_weapon_shake;
evaluate_restrict_disable_ss();
ao_play_button_snd(!g_alpine_game_config.try_disable_weapon_shake);
}
void ao_fullbrightchar_cbox_on_click(int x, int y) {
g_alpine_game_config.try_fullbright_characters = !g_alpine_game_config.try_fullbright_characters;
ao_fullbrightchar_cbox.checked = g_alpine_game_config.try_fullbright_characters;
evaluate_fullbright_meshes();
ao_play_button_snd(g_alpine_game_config.try_fullbright_characters);
}
void ao_notex_cbox_on_click(int x, int y) {
g_alpine_game_config.try_disable_textures = !g_alpine_game_config.try_disable_textures;
ao_notex_cbox.checked = g_alpine_game_config.try_disable_textures;
evaluate_lightmaps_only();
ao_play_button_snd(g_alpine_game_config.try_disable_textures);
}
void ao_meshstatic_cbox_on_click(int x, int y) {
g_alpine_game_config.mesh_static_lighting = !g_alpine_game_config.mesh_static_lighting;
ao_meshstatic_cbox.checked = g_alpine_game_config.mesh_static_lighting;
recalc_mesh_static_lighting();
ao_play_button_snd(g_alpine_game_config.mesh_static_lighting);
}
void ao_enemybullets_cbox_on_click(int x, int y) {
g_alpine_game_config.show_enemy_bullets = !g_alpine_game_config.show_enemy_bullets;
ao_enemybullets_cbox.checked = g_alpine_game_config.show_enemy_bullets;
apply_show_enemy_bullets();
ao_play_button_snd(g_alpine_game_config.show_enemy_bullets);
}
void alpine_options_panel_handle_key(rf::Key* key){
// todo: more key support (tab, etc.)
// close panel on escape
if (*key == rf::Key::KEY_ESC) {
rf::ui::options_close_current_panel();
rf::snd_play(43, 0, 0.0f, 1.0f);
return;
}
}
void alpine_options_panel_handle_mouse(int x, int y) {