-
Notifications
You must be signed in to change notification settings - Fork 2
/
Menu_Test.gd
1834 lines (1610 loc) · 82 KB
/
Menu_Test.gd
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
extends Container
enum {UP, RIGHT, DOWN, LEFT}
enum {KEY_FORWARD, KEY_LEFT, KEY_RIGHT, KEY_BACK, KEY_SHOOT, KEY_JUMP, KEY_CROUCH, KEY_RELOAD, KEY_ZOOM, KEY_USE, KEY_KICK, KEY_LEAN_LEFT, KEY_LEAN_RIGHT, KEY_WEAPON1, KEY_WEAPON2, KEY_LAST_WEAPON, KEY_TERTIARY, KEY_THROW_WEAPON, KEY_SUICIDE, KEY_STOCKS
# ADDITIONS
KEY_TOGGLE_FULLSCREEN,}
enum {START, LEVEL_SELECT, WEAPON_SELECT, IN_GAME, LEVEL_END, SETTINGS, CHARACTER, STOCKS,}
var confirmed = false
var cancel = false
enum {B_START, B_SETTINGS, B_QUIT, B_LEVEL, B_MISSION_START,
B_WEAPON_1, B_WEAPON_2, B_CHARACTER, B_STOCKS, B_W_PISTOL, B_W_SMG, B_W_SHOTGUN, B_W_RL, B_W_SNIPER, B_W_AR, B_W_S_SMG, B_W_NAMBU,
B_W_GAS_LAUNCHER, B_W_MG3, B_W_AUTOSHOTGUN, B_W_MAUSER, B_W_BORE, B_W_MKR, B_W_RADGUN, B_W_TRANQ, B_W_BLACKJACK, B_W_FLASHLIGHT, B_W_ZIPPY, B_W_AN94, B_W_VAG72, B_W_STEYR, B_W_CANCER, B_W_ROD, B_W_FLAMETHROWER, B_W_SKS, B_W_NAILER, B_W_SHOCK, B_W_LIGHT, B_EX_MENU, B_EX_LEVEL_SELECT, B_RETURN, B_RETRY, B_BONUS,
B_PREV_LEVELS, B_NEXT_LEVELS}
const BUTTON_TEXTURES: Array = [preload("res://Textures/Menu/start_normal.png"),
preload("res://Textures/Menu/settings_normal.png"),
preload("res://Textures/Menu/OS_normal.png"),
preload("res://Textures/Menu/implant_menu_button.png"),
preload("res://Textures/Menu/mission_start.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Menu/implant_menu_button.png"),
preload("res://Textures/Menu/stock.png"),
preload("res://Textures/Menu/Weapon_Buttons/Pistol.png"),
preload("res://Textures/Menu/Weapon_Buttons/SMG.png"),
preload("res://Textures/Menu/Weapon_Buttons/Shotgun.png"),
preload("res://Textures/Menu/Weapon_Buttons/RL.png"),
preload("res://Textures/Menu/Weapon_Buttons/Sniper.png"),
preload("res://Textures/Menu/Weapon_Buttons/AR.png"),
preload("res://Textures/Menu/Weapon_Buttons/S_SMG.png"),
preload("res://Textures/Menu/Weapon_Buttons/Nambu.png"),
preload("res://Textures/Menu/Weapon_Buttons/Gas_Launcher.png"),
preload("res://Textures/Menu/Weapon_Buttons/MG3.png"),
preload("res://Textures/Menu/Weapon_Buttons/Autoshotgun.png"),
preload("res://Textures/Menu/Weapon_Buttons/Mauser.png"),
preload("res://Textures/Menu/Weapon_Buttons/Bore.png"),
preload("res://Textures/Menu/Weapon_Buttons/MKR.png"),
preload("res://Textures/Menu/Weapon_Buttons/radgun.png"),
preload("res://Textures/Menu/Weapon_Buttons/tranq.png"),
preload("res://Textures/Menu/Weapon_Buttons/baton.png"),
preload("res://Textures/Menu/Weapon_Buttons/flashlight.png"),
preload("res://Textures/Menu/Weapon_Buttons/zippy.png"),
preload("res://Textures/Menu/Weapon_Buttons/AN94.png"),
preload("res://Textures/Menu/Weapon_Buttons/vag72.png"),
preload("res://Textures/Menu/Weapon_Buttons/steyr.png"),
preload("res://Textures/Menu/Weapon_Buttons/dna.png"),
preload("res://Textures/Menu/Weapon_Buttons/rod.png"),
preload("res://Textures/Menu/Weapon_Buttons/flamethrower.png"),
preload("res://Textures/Menu/Weapon_Buttons/SKS.png"),
preload("res://Textures/Menu/Weapon_Buttons/nailer.png"),
preload("res://Textures/Menu/Weapon_Buttons/shockwave.png"),
preload("res://Textures/Menu/Weapon_Buttons/light.png"),
preload("res://Textures/Menu/exit_menu_normal.png"),
preload("res://Textures/Menu/exit_level_normal.png"),
preload("res://Textures/Menu/return_normal.png"),
preload("res://Textures/Menu/retry_normal.png"),
preload("res://Textures/Menu/retry_normal.png")
]
const WEAPON_PROFILES: Array = [preload("res://Textures/Menu/Weapon_Profiles/Pistol.png"),
preload("res://Textures/Menu/Weapon_Profiles/SMG.png"),
preload("res://Textures/Menu/Weapon_Profiles/Shotgun.png"),
preload("res://Textures/Menu/Weapon_Profiles/RL.png"),
preload("res://Textures/Menu/Weapon_Profiles/Sniper.png"),
preload("res://Textures/Menu/Weapon_Profiles/AR.png"),
preload("res://Textures/Menu/Weapon_Profiles/S_SMG.png"),
preload("res://Textures/Menu/Weapon_Profiles/S_SMG.png"),
preload("res://Textures/Menu/Weapon_Profiles/S_SMG.png"),
preload("res://Textures/Menu/Weapon_Profiles/S_SMG.png"),
preload("res://Textures/Menu/Weapon_Profiles/S_SMG.png"),
preload("res://Textures/Menu/Weapon_Profiles/S_SMG.png"),
preload("res://Textures/Menu/Weapon_Profiles/S_SMG.png"),
preload("res://Textures/Menu/Weapon_Profiles/S_SMG.png")]
const BUTTON_TEXTURES_H: Array = [preload("res://Textures/Menu/hover.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
]
const BUTTON_TEXTURES_P: Array = [preload("res://Textures/Menu/hover.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
preload("res://Textures/Items/medkit1.png"),
]
const BUTTON_TEXTURES_D: Array = [preload("res://Textures/Menu/Disabled_Button/1.png"),
preload("res://Textures/Menu/Disabled_Button/2.png"),
preload("res://Textures/Menu/Disabled_Button/3.png"),
preload("res://Textures/Menu/Disabled_Button/4.png")]
const MYSTERY = preload("res://Textures/Menu/mystery.png")
enum {W_PISTOL, W_SMG, W_TRANQ, W_BLACKJACK, W_SHOTGUN, W_RL, W_SNIPER, W_AR, W_S_SMG, W_NAMBU, W_GAS_LAUNCHER, W_MG3, W_AUTOSHOTGUN, W_MAUSER, W_BORE, W_MKR, W_RADIATOR, W_FLASHLIGHT, W_ZIPPY, W_AN94, W_VAG72, W_STEYR, W_CANCER, W_ROD, W_FLAMETHROWER, W_SKS, W_NAILER, W_SHOCK, W_LIGHT}
const RESOLUTIONS: Array = [Vector2(1920, 1080), Vector2(1600, 900), Vector2(1366, 768), Vector2(1280, 720), Vector2(3840, 2160), Vector2(2560, 1440), Vector2(3840, 2400), Vector2(2560, 1600), Vector2(1920, 1200), Vector2(1680, 1050), Vector2(1440, 900), Vector2(3440, 1440), Vector2(2880, 1200), Vector2(2560, 1080), Vector2(1920, 800), Vector2(1600, 1200), Vector2(1440, 1080), Vector2(1024, 768), Vector2(800, 600), Vector2(640, 480), Vector2(1080, 1080)]
const RANK_LETTERS: Array = [
preload("res://Textures/rank_letters/C.png"),
preload("res://Textures/rank_letters/B.png"),
preload("res://Textures/rank_letters/A.png"),
preload("res://Textures/rank_letters/S.png"),
preload("res://Textures/rank_letters/N.png"),]
var LEVEL_NAMES: Array = ["Training Facility", "Headquarters", "Suburb", "Spaceport", "PD", "Mall", "Apartment", "Ship", "Swamp", "Casino", "Castle", "Office", "Archon Grid", "NEED", "HELP", "END", "PAIN", "NOW", "AAAAAA"]
const HANDLER_FRAMES: Array = [preload("res://Textures/Menu/Handler/1.png"),
preload("res://Textures/Menu/Handler/2.png"),
preload("res://Textures/Menu/Handler/3.png"),
preload("res://Textures/Menu/Handler/4.png")]
var key_pressed
var wait_for_key = false
var menu_dir: Array = [2, 1, 0, 3, 2, 1, 1, 2, 3, 3, 3, ]
var level_select_dir: Array = [2, 2, 1, 2, 3, 2, 1, 1, 1, 1, 2, 3, 3, 3, 3, 2, 1, 1, 1, 1, 2, 3, 3, 3, 3, ]
var menu: Array = []
var active_menus: Array = []
var active_element: Control
var level_buttons: Array = []
var current_menu = 0
var current_weapon_select = 0
var weapon_1 = 0
var weapon_2 = 1
var weapon_select_buttons: Array = []
var previous_menu = 0
var menu_button: Array = []
var button_size = Vector2(64, 64)
var b_position = Vector2(100, 100)
var dir = 0
var in_game = false
var resolution_list: ItemList
var time = 0
var all_buttons: Array
var hover_info
var menu_creation_level_index: int = 0
var menu_changing = false
onready var clear_button = $Settings / GridContainer / PanelContainer6 / VBoxContainer3 / ClearSave
class Menu extends Control:
var buttons:Array
var elements:Array
func _physics_process(delta):
if not is_instance_valid(hover_info):
return
time += 1
if in_game:
clear_button.hide()
else:
clear_button.show()
hover_info.get_parent().rect_global_position = get_global_mouse_position() + Vector2(50, 20)
hover_info.get_parent().rect_global_position.y = clamp(hover_info.get_parent().rect_global_position.y, 0, (720 - hover_info.get_parent().rect_size.y - 100) * rect_scale.x)
hover_info.get_parent().rect_global_position.x = clamp(hover_info.get_parent().rect_global_position.x, 0, (1280 - hover_info.get_parent().rect_size.x - 100) * rect_scale.y)
for button in all_buttons:
for b in level_buttons:
if button == b:
return
if button.disabled:
button.texture_disabled = BUTTON_TEXTURES_D[int(sin(button.get_index() + time * 0.05) * 3) % 3]
func get_key_index(action):
if action is InputEventKey:
return [action.scancode, "KEY"]
elif action is InputEventMouseButton:
return [action.button_index, "MOUSE"]
func get_scancodes():
var key_scancodes: Array = [get_key_index(InputMap.get_action_list("movement_forward")[0]),
get_key_index(InputMap.get_action_list("movement_left")[0]),
get_key_index(InputMap.get_action_list("movement_right")[0]),
get_key_index(InputMap.get_action_list("movement_backward")[0]),
get_key_index(InputMap.get_action_list("mouse_1")[0]),
get_key_index(InputMap.get_action_list("movement_jump")[0]),
get_key_index(InputMap.get_action_list("crouch")[0]),
get_key_index(InputMap.get_action_list("reload")[0]),
get_key_index(InputMap.get_action_list("zoom")[0]),
get_key_index(InputMap.get_action_list("Use")[0]),
get_key_index(InputMap.get_action_list("kick")[0]),
get_key_index(InputMap.get_action_list("Lean_Left")[0]),
get_key_index(InputMap.get_action_list("Lean_Right")[0]),
get_key_index(InputMap.get_action_list("weapon1")[0]),
get_key_index(InputMap.get_action_list("weapon2")[0]),
get_key_index(InputMap.get_action_list("switch_weapon")[0]),
get_key_index(InputMap.get_action_list("Tertiary_Weapon")[0]),
get_key_index(InputMap.get_action_list("drop")[0]),
get_key_index(InputMap.get_action_list("Suicide")[0]),
get_key_index(InputMap.get_action_list("Stocks")[0]),
get_key_index(InputMap.get_action_list("toggle_full")[0])]
return key_scancodes
# custom stuff
const MODBASE_BASE = "res://MOD_CONTENT/"
const MAX_PAGE_SIZE = 20
var CUSTOM_BTN_TEXTURES = [load(MODBASE_BASE + "CruS Mod Base/assets/prev.png"),
load(MODBASE_BASE + "CruS Mod Base/assets/next.png")]
var all_level_buttons = null
var custom_levels = []
var level_btn_index = 0
var page_btns = []
var next_page_size = MAX_PAGE_SIZE
var last_tooltip = ""
func update_level_page_buttons(init=false):
var begin_index = clamp(level_btn_index, 0, all_level_buttons.size())
var end_index = clamp(level_btn_index + next_page_size, 0, all_level_buttons.size())
for btn in page_btns:
menu[LEVEL_SELECT].remove_child(btn)
btn.queue_free()
page_btns = []
menu[LEVEL_SELECT].buttons += [B_PREV_LEVELS, B_NEXT_LEVELS]
if begin_index > 0:
page_btns.append(create_button(LEVEL_SELECT, "Previous levels", "_on_Prev_Levels_Button_Pressed", B_PREV_LEVELS))
if end_index < all_level_buttons.size():
page_btns.append(create_button(LEVEL_SELECT, "More levels", "_on_Next_Levels_Button_Pressed", B_NEXT_LEVELS))
if !init:
var i = 1
for btn in page_btns:
position_button(btn, menu[LEVEL_SELECT].buttons.size() - i)
btn.show()
i -= 1
func update_level_buttons(init=false):
if all_level_buttons == null:
all_level_buttons = level_buttons.duplicate()
var sz = menu[LEVEL_SELECT].buttons.size()
var begin_index = clamp(level_btn_index, 0, all_level_buttons.size())
var end_index = clamp(level_btn_index + next_page_size, 0, all_level_buttons.size())
# spacing for next/previous levels buttons
next_page_size = MAX_PAGE_SIZE
if begin_index > 0:
next_page_size -= 1
if end_index < all_level_buttons.size():
next_page_size -= 1
end_index = clamp(level_btn_index + next_page_size, 0, all_level_buttons.size())
menu[LEVEL_SELECT].buttons = [B_RETURN, B_CHARACTER, B_STOCKS, B_WEAPON_1, B_WEAPON_2, B_MISSION_START]
level_buttons = all_level_buttons.duplicate()
var menu_index = menu[LEVEL_SELECT].buttons.size() + 1
for i in range(all_level_buttons.size()):
if i < begin_index:
menu[LEVEL_SELECT].remove_child(level_buttons.front())
level_buttons.pop_front()
elif i >= end_index:
menu[LEVEL_SELECT].remove_child(level_buttons.back())
level_buttons.pop_back()
else:
if all_level_buttons[i].get_parent() != menu[LEVEL_SELECT]:
menu[LEVEL_SELECT].add_child(all_level_buttons[i])
menu[LEVEL_SELECT].buttons.append(B_LEVEL)
all_level_buttons[i].disabled = false
if !init:
position_button(all_level_buttons[i], menu_index)
all_level_buttons[i].show()
menu_index += 1
$Hover_Panel.hide()
update_level_page_buttons(init)
button_state()
func position_button(btn: TextureButton, menu_index: int):
btn.set_position(menu[LEVEL_SELECT].get_children()[0].rect_position)
btn.rect_position.y -= btn.rect_size.y
for i in range(menu_index):
match level_select_dir[i]:
UP:
btn.rect_position.y -= btn.rect_size.y
RIGHT:
btn.rect_position.x += btn.rect_size.x
DOWN:
btn.rect_position.y += btn.rect_size.y
LEFT:
btn.rect_position.x -= btn.rect_size.x
func add_level_ranks(level: Dictionary):
var G = Global
var types = [
{ "prefix": "normal", "ranks": [G.LEVEL_RANK_S, G.LEVEL_RANK_A, G.LEVEL_RANK_B, G.LEVEL_SRANK_S] },
{ "prefix": "hell", "ranks": [G.HELL_RANK_S, G.HELL_RANK_A, G.HELL_RANK_B, G.HELL_SRANK_S] }]
var ranks_dict = level.get("ranks") if level.has("ranks") else null
for t in types:
if ranks_dict:
var rank_time = null
var arr_valid = true
var stock_valid = true
if !(ranks_dict.get(t.prefix) is Array) or ranks_dict.get(t.prefix).size() != 3:
arr_valid = false
Mod.mod_log("WARNING: \"" + t.prefix + "\" in \"ranks\" of \"" + level.name + "\" level.json is not a valid array of three positive numbers, defaulting to 0", "CruS Mod Base")
if !((t.prefix + "_stock_s") in ranks_dict) or ranks_dict.get(t.prefix + "_stock_s") < 0:
print(!((t.prefix + "_stock_s") in ranks_dict))
print(ranks_dict.get(t.prefix + "_stock_s") < 0)
stock_valid = false
Mod.mod_log("WARNING: \"" + t.prefix + "_stock_s\" in \"ranks\" of \"" + level.name + "\" level.json is not a positive number, defaulting to 0", "CruS Mod Base")
for i in range(3):
rank_time = ranks_dict.get(t.prefix)[i] if ranks_dict and arr_valid else 0
t.ranks[i].append(rank_time if rank_time and rank_time > 0 else 0)
rank_time = ranks_dict.get(t.prefix + "_stock_s") if ranks_dict and stock_valid else 0
t.ranks[3].append(rank_time if rank_time and rank_time > 0 else 0)
else:
for i in range(4):
t.ranks[i].append(0)
Global.level_ranks.append("N")
Global.level_stock_ranks.append("N")
Global.hell_ranks.append("N")
Global.hell_stock_ranks.append("N")
func add_custom_levels():
for level in custom_levels:
menu[LEVEL_SELECT].buttons.append(B_LEVEL)
LEVEL_NAMES.append(level.name)
var lsd_len = level_select_dir.size()
var last_dirs = level_select_dir.slice(lsd_len - 4, lsd_len - 1)
match last_dirs:
[RIGHT, RIGHT, RIGHT, RIGHT], [LEFT, LEFT, LEFT, LEFT]:
level_select_dir.append(DOWN)
_:
if lsd_len < 7 or !last_dirs.has(DOWN):
print("ERROR: level select menu directions are messed up")
return
match last_dirs[-1]:
RIGHT, LEFT:
level_select_dir.append(last_dirs[-1])
DOWN:
level_select_dir.append(RIGHT if last_dirs[-2] == LEFT else LEFT)
_:
print("ERROR: bad level select direction")
return
var dialogue = ["..."]
var di = level.get("dialogue")
if di is Array and di.size() > 0:
dialogue = di
elif di is int and di < Global.DIALOGUE.DIALOGUE.size():
dialogue = Global.DIALOGUE.DIALOGUE[di]
Global.LEVEL_META.append(level)
Global.LEVEL_IMAGES.append(level.get("image") if level.get("image") else RANK_LETTERS.back())
Global.LEVEL_SONGS.append(level.get("music"))
Global.LEVEL_AMBIENCE.append(level.get("ambience"))
Global.LEVEL_REWARDS.append(level.get("reward") if level.get("reward") else 0)
Global.DIALOGUE.DIALOGUE.append(dialogue)
Global.LEVEL_PUNISHED.append(false)
Global.LEVEL_TIMES.append("N/A")
Global.LEVEL_TIMES_RAW.append(99999999)
Global.LEVEL_STIMES.append("N/A")
Global.LEVEL_STIMES_RAW.append(99999999)
Global.HELL_TIMES.append("N/A")
Global.HELL_TIMES_RAW.append(99999999)
Global.HELL_STIMES.append("N/A")
Global.HELL_STIMES_RAW.append(99999999)
Global.STOCKS.POSSIBLE_FISH.append(level.get("fish") if level.get("fish") else ["FISH", "DEAD"])
add_level_ranks(level)
Global.load_game()
func save_custom_levels_data():
var save_dict = {}
for level in range(custom_levels.size()):
level = level + Global.LEVELS.size()
var level_name = Global.LEVEL_META[level].get("name")
save_dict[level_name + "_raw_time"] = Global.LEVEL_TIMES_RAW[level]
save_dict[level_name + "_string_stime"] = Global.LEVEL_STIMES[level]
save_dict[level_name + "_raw_stime"] = Global.LEVEL_STIMES_RAW[level]
save_dict[level_name + "_string_time"] = Global.LEVEL_TIMES[level]
save_dict[level_name + "_hell_raw_time"] = Global.HELL_TIMES_RAW[level]
save_dict[level_name + "_hell_string_stime"] = Global.HELL_STIMES[level]
save_dict[level_name + "_hell_raw_stime"] = Global.HELL_STIMES_RAW[level]
save_dict[level_name + "_hell_string_time"] = Global.HELL_TIMES[level]
save_dict[level_name + "_punished"] = Global.LEVEL_PUNISHED[level]
var save_file = File.new()
if save_file.open("user://custom_level_times.save", File.WRITE) == OK:
save_file.store_line(to_json(save_dict))
save_file.close()
func load_custom_levels_data():
var time_categories = {
"_raw_time": "LEVEL_TIMES_RAW",
"_string_stime": "LEVEL_STIMES",
"_raw_stime": "LEVEL_STIMES_RAW",
"_string_time": "LEVEL_TIMES",
"_hell_raw_time": "HELL_TIMES_RAW",
"_hell_string_stime": "HELL_STIMES",
"_hell_raw_stime": "HELL_STIMES_RAW",
"_hell_string_time": "HELL_TIMES"
}
var time_ranks = {
"LEVEL_TIMES_RAW": {
"times": [Global.LEVEL_RANK_S, Global.LEVEL_RANK_A, Global.LEVEL_RANK_B],
"store": Global.level_ranks
},
"LEVEL_STIMES_RAW": {
"times": [Global.LEVEL_SRANK_S, Global.LEVEL_RANK_A, Global.LEVEL_RANK_B],
"store": Global.level_stock_ranks
},
"HELL_TIMES_RAW": {
"times": [Global.HELL_RANK_S, Global.HELL_RANK_A, Global.HELL_RANK_B],
"store": Global.hell_ranks
},
"HELL_STIMES_RAW": {
"times": [Global.HELL_SRANK_S, Global.HELL_RANK_A, Global.HELL_RANK_B],
"store": Global.hell_stock_ranks
}
}
var save_game = File.new()
if save_game.file_exists("user://custom_level_times.save") and save_game.open("user://custom_level_times.save", File.READ) == OK:
var save = parse_json(save_game.get_as_text())
for level in range(custom_levels.size()):
level = level + Global.LEVELS.size()
var level_name = Global.LEVEL_META[level].get("name")
for cat in time_categories.keys():
var cat_arr_name = time_categories[cat]
var cat_arr = Global.get(cat_arr_name)
if cat.find("raw") == -1: # load a display time
var time_str = save.get(level_name + cat)
if time_str:
cat_arr[level] = time_str
else: # load a raw time + rank
var time = save.get(level_name + cat)
if time:
cat_arr[level] = time
if time < time_ranks[cat_arr_name].times[0][level]:
time_ranks[cat_arr_name].store.append("S")
elif time < time_ranks[cat_arr_name].times[1][level]:
time_ranks[cat_arr_name].store.append("A")
elif time < time_ranks[cat_arr_name].times[2][level]:
time_ranks[cat_arr_name].store.append("B")
else:
time_ranks[cat_arr_name].store.append("C")
if save.get(level_name + "_punished"):
Global.LEVEL_PUNISHED[level] = true
save_game.close()
func _ready():
var cmb = Mod.get_node("CruS Mod Base")
# Idiot checks, just in case I break this again
assert(cmb != null, "Failed to load CruS Mod Base.")
assert("data" in cmb, "`data` member missing from CruS Mod Base node.")
# Now try to get crus modbase instance, and wait for signal
var cmb_init_node = cmb.get_node('Init')
if "debug_level" in cmb.data:
custom_levels = [cmb.data.debug_level]
else:
custom_levels = cmb.data.levels
if Global.ending_3:
$Level_Info_Grid / Level_Info_Vbox / Time_Panel / VBoxContainer / Chaos_Mode.show()
else:
$Level_Info_Grid / Level_Info_Vbox / Time_Panel / VBoxContainer / Chaos_Mode.hide()
$Settings / GridContainer / PanelContainer6 / VBoxContainer3 / Timer.pressed = Global.timer
$Settings / GridContainer / PanelContainer6 / VBoxContainer3 / Highperformance.pressed = Global.high_performance
Global.screenmat.set_shader_param("gamma", Global.gamma)
$Settings / GridContainer / PanelContainer / VBoxContainer / GAMMALABEL.text = "Gamma: " + str(Global.gamma)
$"Settings/GridContainer/PanelContainer/VBoxContainer/Camera Sway".pressed = Global.camera_sway
$Settings / GridContainer / PanelContainer5 / CheckBox.pressed = Global.full_screen
# if Global.full_screen:
# get_tree().set_screen_stretch(
# SceneTree.STRETCH_MODE_VIEWPORT,
# Global.full_screen_stretch_mode,
# Vector2(Global.resolution[0], Global.resolution[1]))
if Global.full_screen:
_on_Full_Screen_toggled(true)
$ConfirmationDialog.get_cancel().connect("pressed", self, "_on_Cancel_Pressed")
$Settings / GridContainer / PanelContainer / VBoxContainer / InvertYAxis.pressed = Global.invert_y
for level in range(Global.LEVELS.size()):
if Global.LEVEL_META[level] is String:
var meta_file = File.new()
meta_file.open(Global.LEVEL_META[level], File.READ)
var parsed_level_meta:Dictionary = {}
parsed_level_meta = parse_json(meta_file.get_as_text())
LEVEL_NAMES[level] = parsed_level_meta.get("name")
meta_file.close()
else:
LEVEL_NAMES[level] = Global.LEVEL_META[level].get("name")
$Settings / GridContainer / PanelContainer6 / VBoxContainer3 / Reflections.pressed = Global.reflections
$Settings / GridContainer / PanelContainer6 / VBoxContainer3 / Draw_Label.text = "Draw Distance:\n" + str(Global.draw_distance)
$Settings / GridContainer / PanelContainer6 / VBoxContainer3 / Drawslider.value = Global.draw_distance
_on_Civslider_value_changed(Global.civilian_reduction)
$Settings / GridContainer / PanelContainer6 / VBoxContainer3 / Civslider.value = Global.civilian_reduction
$Level_Info_Grid / Level_Info_Vbox / Weapons_Vbox / TextureRect.texture = $Weapon1_Viewport.get_texture()
$Level_Info_Grid / Level_Info_Vbox / Weapons_Vbox / TextureRect2.texture = $Weapon2_Viewport.get_texture()
var keylist = $Settings / GridContainer / PanelContainer2 / VBoxContainer4 / Key_List
keylist.add_item("Forward: " + InputMap.get_action_list("movement_forward")[0].as_text())
keylist.add_item("Left: " + InputMap.get_action_list("movement_left")[0].as_text())
keylist.add_item("Right: " + InputMap.get_action_list("movement_right")[0].as_text())
keylist.add_item("Back: " + InputMap.get_action_list("movement_backward")[0].as_text())
keylist.add_item("Shoot: " + InputMap.get_action_list("mouse_1")[0].as_text())
keylist.add_item("Jump: " + InputMap.get_action_list("movement_jump")[0].as_text())
keylist.add_item("Crouch: " + InputMap.get_action_list("crouch")[0].as_text())
keylist.add_item("Reload: " + InputMap.get_action_list("reload")[0].as_text())
keylist.add_item("Zoom: " + InputMap.get_action_list("zoom")[0].as_text())
keylist.add_item("Use: " + InputMap.get_action_list("Use")[0].as_text())
keylist.add_item("Kick: " + InputMap.get_action_list("kick")[0].as_text())
keylist.add_item("Lean Left: " + InputMap.get_action_list("Lean_Left")[0].as_text())
keylist.add_item("Lean Right: " + InputMap.get_action_list("Lean_Right")[0].as_text())
keylist.add_item("Weapon 1: " + InputMap.get_action_list("weapon1")[0].as_text())
keylist.add_item("Weapon 2: " + InputMap.get_action_list("weapon2")[0].as_text())
keylist.add_item("Last Weapon: " + InputMap.get_action_list("switch_weapon")[0].as_text())
keylist.add_item("Tertiary Weapon: " + InputMap.get_action_list("Tertiary_Weapon")[0].as_text())
keylist.add_item("Throw Weapon: " + InputMap.get_action_list("drop")[0].as_text())
keylist.add_item("Suicide: " + InputMap.get_action_list("Suicide")[0].as_text())
keylist.add_item("Stock Market: " + InputMap.get_action_list("Stocks")[0].as_text())
keylist.add_item("Toggle Fullscreen: " + InputMap.get_action_list("toggle_full")[0].as_text())
$MyWork.rect_global_position.x = 170
$MyWork.rect_global_position.y = 248
hover_info = $Hover_Panel / Hover_Info
# Testing if this is causing screen alignment issue
if OS.is_window_focused():
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
else:
print('[Menu_Test] Game window not foocused, skipping mouse capture mode activation.')
$Title_Screen.rect_size = Vector2(512, 512)
$Title_Screen.rect_global_position = Vector2(720, 128)
$Level_Info_Grid.rect_size = Vector2(720, 720)
$Level_Info_Grid.rect_global_position = Vector2(512, 0)
$Character_Menu.rect_size = Vector2(1024, 512)
$Character_Menu / Character_Container / TextureRect.rect_size = Vector2(384, 384)
$Character_Menu.rect_global_position = Vector2(128, 128)
$Character_Menu / Character_Container.rect_global_position = Vector2(256, 192)
$Character_Menu / Character_Container / Equip_Grid.rect_size = Vector2(384, 384)
$Character_Menu / Character_Container / TextureRect / Head_Button.rect_size = Vector2(48, 48)
$Character_Menu / Character_Container / TextureRect / Head_Button.rect_position = Vector2(168, -8)
$Character_Menu / Character_Container / TextureRect / Torso_Button.rect_size = Vector2(48, 48)
$Character_Menu / Character_Container / TextureRect / Torso_Button.rect_position = Vector2(168, 64)
$Character_Menu / Character_Container / TextureRect / Leg_Button.rect_size = Vector2(48, 48)
$Character_Menu / Character_Container / TextureRect / Leg_Button.rect_position = Vector2(64, 256)
$Character_Menu / Character_Container / TextureRect / Arm_Button.rect_size = Vector2(48, 48)
$Character_Menu / Character_Container / TextureRect / Arm_Button.rect_position = Vector2(64, 128)
$Stock_Menu.rect_size = Vector2(1024, 512)
$Stock_Menu / Character_Container / TextureRect.rect_size = Vector2(384, 384)
$Stock_Menu.rect_global_position = Vector2(128, 128)
$Stock_Menu / Character_Container.rect_global_position = Vector2(256, 192)
$Stock_Menu / Character_Container.stocklist.rect_size = Vector2(384, 384)
for button in $Level_End_Grid / Level_Info_Vbox.get_children():
if button.get_class() == "TextureButton":
button.connect("mouse_entered", self, "_on_mouse_entered", [0, button])
button.connect("mouse_exited", self, "_on_mouse_exited", [0, button])
for button in $Character_Menu / Character_Container / Equip_Grid.get_children():
button.rect_size = Vector2(10, 10)
for element in $Level_Info_Grid.get_children():
element.rect_size = Vector2(240, 240)
$Settings / GridContainer / PanelContainer / VBoxContainer / M_Sensitivity.value = Global.mouse_sensitivity * 100
$Settings / GridContainer / PanelContainer3 / VBoxContainer2 / Master_Volume.value = Global.master_volume + 105
$Settings / GridContainer / PanelContainer3 / VBoxContainer2 / Music_Volume.value = Global.music_volume + 105
$Settings / GridContainer / PanelContainer / VBoxContainer / FOV.value = Global.FOV
$Settings / GridContainer / PanelContainer / VBoxContainer / FOVLABEL.text = "FOV: " + str(Global.FOV)
$Settings / GridContainer / PanelContainer6 / VBoxContainer3 / SkipIntro.pressed = Global.skip_intro
$Settings / GridContainer / PanelContainer4 / VBoxContainer3 / Blood_Color_Rect.color = Global.blood_color
$Settings / GridContainer / PanelContainer4 / VBoxContainer3 / HBoxContainer / R.value = Global.blood_color.r
$Settings / GridContainer / PanelContainer4 / VBoxContainer3 / HBoxContainer2 / G.value = Global.blood_color.g
$Settings / GridContainer / PanelContainer4 / VBoxContainer3 / HBoxContainer3 / B.value = Global.blood_color.b
$Settings / GridContainer / PanelContainer4 / VBoxContainer3 / HBoxContainer4 / A.value = Global.blood_color.a
resolution_list = $Settings / GridContainer / PanelContainer5 / Resolution_List
for r in RESOLUTIONS:
resolution_list.add_item(str(r.x) + "x" + str(r.y))
for i in range(8):
var new_menu = Menu.new()
add_child(new_menu)
menu.append(new_menu)
menu[START].buttons = [B_START, B_SETTINGS, B_RETRY, B_EX_LEVEL_SELECT, B_EX_MENU, B_QUIT]
menu[SETTINGS].buttons = [B_RETURN]
menu[LEVEL_SELECT].buttons = [B_RETURN, B_CHARACTER, B_STOCKS, B_WEAPON_1, B_WEAPON_2, B_MISSION_START]
for level in Global.LEVELS:
menu[LEVEL_SELECT].buttons.append(B_LEVEL)
add_custom_levels()
load_custom_levels_data()
if "debug_level" in cmb.data:
Global.CURRENT_LEVEL = Global.LEVEL_META.size() - 1
menu[WEAPON_SELECT].buttons = [B_RETURN, B_W_PISTOL, B_W_SMG, B_W_TRANQ, B_W_BLACKJACK, B_W_SHOTGUN, B_W_RL, B_W_SNIPER, B_W_AR, B_W_S_SMG, B_W_NAMBU, B_W_GAS_LAUNCHER, B_W_MG3, B_W_AUTOSHOTGUN, B_W_MAUSER, B_W_BORE, B_W_MKR, B_W_RADGUN, B_W_FLASHLIGHT, B_W_ZIPPY, B_W_AN94, B_W_VAG72, B_W_STEYR, B_W_CANCER, B_W_ROD, B_W_FLAMETHROWER, B_W_SKS, B_W_NAILER, B_W_SHOCK, B_W_LIGHT]
menu[CHARACTER].buttons = [B_RETURN]
menu[STOCKS].buttons = [B_RETURN]
active_menus.append(menu[START])
for m in range(menu.size()):
create_buttons(m)
for child in menu[START].get_children():
child.show()
child.set_position(b_position)
b_position.x += button_size.x
update_level_info()
update_level_buttons(true)
hide_buttons(menu[START], 2, 4)
set_res(Global.resolution[0], Global.resolution[1])
func hide_buttons(m: Menu, a: int, b: int):
for ab in range(a, b + 1):
m.get_child(ab).hide()
var s = m.get_children().size()
for i in range(1, s):
if m.get_child(i - 1).visible == false:
for k in range(i, s):
m.get_child(k).rect_position.x -= button_size.x
func show_buttons(m: Menu, a: int, b: int):
var s = m.get_children().size()
for i in range(0, s - 1):
if m.get_child(i).visible == false:
for k in range(i + 1, s):
m.get_child(k).rect_position.x += button_size.x
for ab in range(a, b + 1):
m.get_child(ab).show()
func create_buttons(m: int):
var level = 0
var bonus = 0
for i in range(menu[m].buttons.size()):
match menu[m].buttons[i]:
B_NEXT_LEVELS:
create_button(m, "More levels", "_on_Next_Levels_Button_Pressed", menu[m].buttons[i])
B_PREV_LEVELS:
create_button(m, "Previous levels", "_on_Prev_Levels_Button_Pressed", menu[m].buttons[i])
B_RETRY:
create_button(m, "Retry", "_on_Retry_Button_Pressed", menu[m].buttons[i])
B_START:
create_button(m, "Start", "_on_Start_Button_Pressed", menu[m].buttons[i])
B_LEVEL:
level_buttons.append(create_button(m, LEVEL_NAMES[level], "_on_Level_Pressed", menu[m].buttons[i]))
if Global.LEVEL_META[level] is Dictionary:
level_buttons.back().hint_tooltip = str("By ", Global.LEVEL_META[level].author)
level += 1
B_SETTINGS:
create_button(m, "Settings", "_on_Settings_Button_Pressed", menu[m].buttons[i])
B_QUIT:
create_button(m, "Quit", "_on_Quit_Button_Pressed", menu[m].buttons[i])
B_EX_MENU:
create_button(m, "Exit to Menu", "_on_Exit_Menu_Pressed", menu[m].buttons[i])
B_EX_LEVEL_SELECT:
create_button(m, "Exit to Level Select", "_on_Exit_Level_Select_Pressed", menu[m].buttons[i])
B_RETURN:
create_button(m, "Return", "_on_Return_Button_Pressed", menu[m].buttons[i])
B_WEAPON_1:
weapon_select_buttons.append(create_button(m, "Select Weapon 1", "_on_Weapon_1_Pressed", menu[m].buttons[i]))
B_WEAPON_2:
weapon_select_buttons.append(create_button(m, "Select Weapon 2", "_on_Weapon_2_Pressed", menu[m].buttons[i]))
B_CHARACTER:
create_button(m, "Equipment & Implants", "_on_Implants_Button_Pressed", menu[m].buttons[i])
B_STOCKS:
create_button(m, "Stock Market", "_on_Stocks_Button_Pressed", menu[m].buttons[i])
B_W_PISTOL:
var wep = create_button(m, "Parasonic D2 Silenced Pistol", "_on_Pistol_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Uses special 10mm subsonic ammunition for extremely silent operation. Popular among high-end private security and wetworks services, as well as tactical wannabes."
B_W_SMG:
var wep = create_button(m, "K&H R5", "_on_SMG_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "One of the most widely used submachine guns since the 80s. Unmatched reliability and ease of operation."
B_W_S_SMG:
var wep = create_button(m, "Minato M9", "_on_S_SMG_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Imported in great quantities by people of taste after being featured in the anime Haato no DokiDoki: Zankokudan."
B_W_SHOTGUN:
var wep = create_button(m, "Balotelli Hypernova", "_on_Shotgun_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Following the rapid proliferation of advanced high quality body armor and the subsequent move from traditional buckshot to more effective flechette based shells, Belatelli Hypernova has proven to be the most cost effective solution."
B_W_RL:
var wep = create_button(m, "Security Systems Anti-Armor Device", "_on_RL_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "At some point arms manufacturer Security Systems managed to convince the world that it was absolutely necessary for corporate security to possess military-grade rocket launchers."
B_W_SNIPER:
var wep = create_button(m, "Stern AWS 3000", "_on_Sniper_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "The AWS 3000 uses a special sabot round with a 30 cm long depleted uranium penetrator. It is of course designed to counter armored targets but when it hits something soft it often tumbles and leaves more wound channel than target."
B_W_AR:
var wep = create_button(m, "K&H X20", "_on_AR_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "The Karl & Heinrich X20 immediately became a huge hit with elite security. It fires extremely accurate 3 round rapid fire bursts with very manageable recoil. The rounds are completely caseless meaning it can hold a large amount of ammunition without becoming cumbersome to carry, and doesn't leave behind as much evidence."
B_W_NAMBU:
var wep = create_button(m, "New Safety M62", "_on_Nambu_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Standard police issue handgun for more than a hundred years. While more efficient options exist the cops have decided to stick with this due to masculine associations created by the film industry."
B_W_GAS_LAUNCHER:
var wep = create_button(m, "Riot Pacifier", "_on_Gas_Launcher_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Fires a grenade filled with corrosive gas. Eats through almost everything. Hasn't seen much use since the food riots of the early 00s."
B_W_MG3:
var wep = create_button(m, "AMG4", "_on_MG3_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Traditionally a weapon of the highly augmented military grunt, it has recently seen increasing use in the corporate setting. Extremely high rate of fire and good armor penetration thanks to the DU rounds it usually comes with."
B_W_AUTOSHOTGUN:
var wep = create_button(m, "Precise Industries AS15", "_on_Autoshotgun_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "A fully automatic shotgun capable of tearing almost everything into shreds up close. Complete overkill but popular with killers emotionally dulled by battle drugs."
B_W_MAUSER:
var wep = create_button(m, "Mowzer SP99", "_on_Mauser_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Accurate and extremely silent bolt-action sniper rifle. Perfect for covert and illegal operations. An important symbol of the swamp cultist who claim to receive divine messages from them."
B_W_BORE:
var wep = create_button(m, "Security Systems Cerebral Bore", "_on_Bore_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Security Systems have done it once again. This incredibly high tech vat grown bioweapon is itself a small biobreeder, capable of creating a small burrower flesh orb that goes for the target's head and empties it on the floor. For energy it sucks some life force out of the user. Neat huh?"
B_W_MKR:
var wep = create_button(m, "Spectacular Dynamics MCR Carbine", "_on_MKR_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "A futuristic microcaliber platform that never reached a huge popularity despite many advantages. Uses strange factory sealed disposable magazines and proprietary caseless ammunition."
B_W_RADGUN:
var wep = create_button(m, "Bolt ACR", "_on_Radgun_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "The goal of the Advanced Combat Rifle program was to create an energy weapon that wouldn't need to be reloaded at all. One of the results was this unfortunate portable gamma radiation emitter. Though often said to be illegal due to international agreements regarding radiation based weapons (no such agreements exist), the reason it never got much use is that most of the test subjects ended up accidentally killing themselves."
B_W_TRANQ:
var wep = create_button(m, "SNOOZEFEST Animal Control Pistol", "_on_Tranq_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "As the cost of human life is low, there has been no real attempt to create a tranquilizer gun for security or military needs. Some have however adopted these animal control pistols as a less messy way to get past overly vigilant security."
B_W_BLACKJACK:
var wep = create_button(m, "Expandable Baton", "_on_Blackjack_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "A standard device for knocking people out cold. The design has been the same since the early middle ages, only the materials have been improved."
B_W_FLASHLIGHT:
var wep = create_button(m, "Flashlight", "_on_Flashlight_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "A simple flashlight, not very useful. Or is it?"
B_W_ZIPPY:
var wep = create_button(m, "Zippy 3000", "_on_Zippy_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "The ultimate weapon, in ejection failures and misfires. You'll be lucky to get two shots out of this thing without blowing off your fingers."
B_W_AN94:
var wep = create_button(m, "BN-99", "_on_AN94_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "A mysterious weapon lost to time. Made out of an accursed alloy. Has a unique two shot burst firing mechanism."
B_W_VAG72:
var wep = create_button(m, "BAG-82", "_on_VAG72_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Strange experimental caseless pistol created by an ancient civilization. Foul odour, who knows where this has been."
B_W_STEYR:
var wep = create_button(m, "Stern M17", "_on_Steyr_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Winner of the advanced combat rifle program. Has widely replaced most other rifles in elite military use. Rapid three round burst of flechette rounds significantly increases hit probability."
B_W_CANCER:
var wep = create_button(m, "Parasonic C3 DNA Scrambler", "_on_DNA_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "High value targets often have immediate access to body reconstruction services and as such it has become a popular choice to mangle their genetic makeup beyond all repair with a hi-tech weapon like the Parasonic C3."
B_W_ROD:
var wep = create_button(m, "Fiberglass Fishing Rod", "_on_Rod_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Enter the World of Fish and become who you were meant to be."
B_W_FLAMETHROWER:
var wep = create_button(m, "RPO-80 Sanitization System", "_on_FT_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Janitorial work in the age of bioprinters and homebrew infectious disease follows these simple rules: Contain, Purify, Control."
B_W_SKS:
var wep = create_button(m, "ZKZ Transactional Rifle", "_on_SKS_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Primordial weapon attuned to the beating heart of the financial system."
B_W_NAILER:
var wep = create_button(m, "Parasonic MP-1 Nailer", "_on_Nailer_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Parasonic's new personal defense weapon provides never before seen firepower in a compact form factor. Fires ultra high velocity depleted uranium nails from a high-capacity helical magazine."
B_W_SHOCK:
var wep = create_button(m, "Raymond Shocktroop Tactical", "_on_Shock_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "A compact but powerful semi-automatic shotgun, popular in the law enforcement business for clearing out regenerative art communes."
B_W_LIGHT:
var wep = create_button(m, "Abscess Ironworks Lux ff374f727ce9d6d6e93be0793733c321", "_on_Light_Pressed", menu[m].buttons[i])
wep.hint_tooltip = "Bask in the golden light of your radiant path."
B_MISSION_START:
create_button(m, "Start Mission", "_on_Mission_Start_Pressed", menu[m].buttons[i])
_:
print("BUTTON ERROR")
func create_button(m: int, n: String, connection: String, b: int):
var new_button = TextureButton.new()
menu[m].add_child(new_button)
new_button.name = n
if b == B_PREV_LEVELS:
new_button.texture_normal = CUSTOM_BTN_TEXTURES[0]
elif b == B_NEXT_LEVELS:
new_button.texture_normal = CUSTOM_BTN_TEXTURES[1]
else:
new_button.texture_normal = BUTTON_TEXTURES[b]
new_button.texture_hover = BUTTON_TEXTURES_H[0]
new_button.texture_disabled = BUTTON_TEXTURES_D[randi() % 3]
if b == B_LEVEL:
var level_index = level_buttons.size()
if level_index > Global.L_PUNISHMENT:
new_button.texture_disabled = MYSTERY
if Global.LEVEL_IMAGES.size() - 1 >= level_index:
new_button.texture_normal = Global.LEVEL_IMAGES[level_index]
else:
new_button.texture_normal = RANK_LETTERS.back()
if b == B_WEAPON_1:
new_button.texture_normal = BUTTON_TEXTURES[B_W_PISTOL + weapon_1]
if b == B_WEAPON_2:
new_button.texture_normal = BUTTON_TEXTURES[B_W_PISTOL + weapon_2]
new_button.expand = true
new_button.set_position(b_position)
new_button.rect_size = button_size
new_button.connect("pressed", self, connection, [m, new_button])
new_button.connect("mouse_exited", self, "_on_mouse_exited", [m, new_button])
new_button.connect("mouse_entered", self, "_on_mouse_entered", [m, new_button])
new_button.hide()
all_buttons.append(new_button)
return new_button
#region Input Signals
func _on_mouse_entered(m, button):
if button.disabled:
return
hover_info.get_node("Image").hide()
hover_info.get_parent().raise()
hover_info.get_node("Name").text = button.name
hover_info.get_node("Hint").text = ""
hover_info.get_parent().rect_size = Vector2(0, 0)
if button.hint_tooltip != "":
hover_info.get_node("Hint").show()
hover_info.get_node("Hint").text = button.hint_tooltip
else:
hover_info.get_node("Hint").hide()
if button.has_method("_get_name_override"):
hover_info.get_node("Name").text = button._get_name_override()
hover_info.get_parent().show()
func _on_mouse_exited(m, button):
hover_info.get_parent().hide()
hover_info.get_parent().rect_size = Vector2(0, 0)
func _on_Implants_Button_Pressed(m: int, button_id: TextureButton):
goto_menu(m, CHARACTER, button_id)
active_element = $Character_Menu
$Character_Menu / Character_Container.update_buttons()
$Character_Menu / Character_Container / TextureRect / Money.text = "$" + str(Global.money)
$Character_Menu.raise()
$Character_Menu.show()
func _on_Stocks_Button_Pressed(m: int, button_id: TextureButton):
goto_menu(m, STOCKS, button_id)
active_element = $Stock_Menu
$Stock_Menu.raise()
$Stock_Menu.show()
func _on_Start_Button_Pressed(m: int, button_id: TextureButton):
Global.save_settings()
if ( not in_game):
goto_menu(m, LEVEL_SELECT, button_id)
active_element = $Level_Info_Grid
$Level_Info_Grid.rect_position.x = 512
$Level_Info_Grid.rect_position.y = 40
$Level_Info_Grid.come()
$Level_Info_Grid / HBoxContainer / Description_Scroll / Description.speech_break = true
$Level_Info_Grid / HBoxContainer / Description_Scroll / Description.visible_characters = 0
for i in range(20):
yield (get_tree(), "idle_frame")
$Level_Info_Grid / HBoxContainer / Description_Scroll / Description.speech()
$Level_Info_Grid / HBoxContainer / Description_Scroll / Description.speech_break = false
else:
toggle_menu()
func _on_Settings_Button_Pressed(m: int, button_id: TextureButton):
goto_menu(m, SETTINGS, button_id)
active_element = $Settings
$Settings / GridContainer / PanelContainer6 / VBoxContainer3 / PlayTime.text = "Active Play Time:\n" + Global.time2str(Global.play_time)
$Settings.rect_position.x = 320
$Settings.raise()
$Settings.come()
func _on_Quit_Button_Pressed(m: int, button_id: TextureButton):
get_tree().quit()
func _on_Weapon_1_Pressed(m: int, button_id: TextureButton):
current_weapon_select = 1
goto_menu(m, WEAPON_SELECT, button_id)
button_state()
func _on_Weapon_2_Pressed(m: int, button_id: TextureButton):
current_weapon_select = 2
goto_menu(m, WEAPON_SELECT, button_id)
button_state()
func _on_Rod_Pressed(m: int, button_id: TextureButton):
set_weapon(W_ROD)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(BUTTON_TEXTURES[B_W_ROD])
func _on_SKS_Pressed(m: int, button_id: TextureButton):
set_weapon(W_SKS)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(BUTTON_TEXTURES[B_W_SKS])
func _on_Nailer_Pressed(m: int, button_id: TextureButton):
set_weapon(W_NAILER)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(BUTTON_TEXTURES[B_W_NAILER])
func _on_DNA_Pressed(m: int, button_id: TextureButton):
set_weapon(W_CANCER)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(BUTTON_TEXTURES[B_W_CANCER])
func _on_Pistol_Pressed(m: int, button_id: TextureButton):
set_weapon(W_PISTOL)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(BUTTON_TEXTURES[B_W_PISTOL])
func _on_SMG_Pressed(m: int, button_id: TextureButton):
set_weapon(W_SMG)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_S_SMG_Pressed(m: int, button_id: TextureButton):
set_weapon(W_S_SMG)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_Shotgun_Pressed(m: int, button_id: TextureButton):
set_weapon(W_SHOTGUN)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_Shock_Pressed(m: int, button_id: TextureButton):
set_weapon(W_SHOCK)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_RL_Pressed(m: int, button_id: TextureButton):
set_weapon(W_RL)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_Sniper_Pressed(m: int, button_id: TextureButton):
set_weapon(W_SNIPER)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_Steyr_Pressed(m: int, button_id: TextureButton):
set_weapon(W_STEYR)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_AR_Pressed(m: int, button_id: TextureButton):
set_weapon(W_AR)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_AN94_Pressed(m: int, button_id: TextureButton):
set_weapon(W_AN94)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_MKR_Pressed(m: int, button_id: TextureButton):
set_weapon(W_MKR)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_Nambu_Pressed(m: int, button_id: TextureButton):
set_weapon(W_NAMBU)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_Gas_Launcher_Pressed(m: int, button_id: TextureButton):
set_weapon(W_GAS_LAUNCHER)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_MG3_Pressed(m: int, button_id: TextureButton):
set_weapon(W_MG3)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_Autoshotgun_Pressed(m: int, button_id: TextureButton):
set_weapon(W_AUTOSHOTGUN)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_Mauser_Pressed(m: int, button_id: TextureButton):
set_weapon(W_MAUSER)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_Bore_Pressed(m: int, button_id: TextureButton):
set_weapon(W_BORE)
go_back(m, button_id)
weapon_select_buttons[current_weapon_select - 1].set_normal_texture(button_id.texture_normal)
func _on_Radgun_Pressed(m: int, button_id: TextureButton):
set_weapon(W_RADIATOR)