1 |
if (keyboard_multicheck_pressed(0) && control_test == false) |
2 |
{ |
3 |
if (binding == false) |
4 |
audio_play_sound(snd_confirm, 1, 0) |
5 |
if (p[0] == true) |
6 |
room_goto(rm_config Config screen) |
7 |
if (p[1] == true || p[2] == true || p[3] == true) |
8 |
binding = true |
9 |
if (p[5] == true) |
10 |
{ |
11 |
global.buttonText1 = "1(A)" |
12 |
global.buttonText2 = "2(B)" |
13 |
global.buttonText3 = "4(Y)" |
14 |
global.button1 = gp_face1 |
15 |
global.button2 = gp_face2 |
16 |
global.button3 = gp_face4 |
17 |
global.gamepad_deadzone = 0.15 |
18 |
} |
19 |
if (p[6] == true) |
20 |
{ |
21 |
control_test = true |
22 |
instance_create(160, 160, obj_testcircle) |
23 |
} |
24 |
} |
25 |
if (binding == false && control_test == false) |
26 |
{ |
27 |
if global.down_keyp |
28 |
{ |
29 |
audio_play_sound(snd_mainmenu_select, 1, 0) |
30 |
var n = 0 |
31 |
while (n <= 6) |
32 |
{ |
33 |
if (p[n] == true && n < 6) |
34 |
{ |
35 |
p[n] = false |
36 |
p[(n + 1)] = true |
37 |
break |
38 |
} |
39 |
else |
40 |
{ |
41 |
n++ |
42 |
continue |
43 |
} |
44 |
} |
45 |
} |
46 |
if global.up_keyp |
47 |
{ |
48 |
audio_play_sound(snd_mainmenu_select, 1, 0) |
49 |
n = 0 |
50 |
while (n <= 6) |
51 |
{ |
52 |
if (p[n] == true && n > 0) |
53 |
{ |
54 |
p[n] = false |
55 |
p[(n - 1)] = true |
56 |
break |
57 |
} |
58 |
else |
59 |
{ |
60 |
n++ |
61 |
continue |
62 |
} |
63 |
} |
64 |
} |
65 |
if (p[4] == true) |
66 |
{ |
67 |
if (global.left_key && global.gamepad_deadzone > 0.01) |
68 |
global.gamepad_deadzone -= 0.01 |
69 |
if (global.right_key && global.gamepad_deadzone < 0.99) |
70 |
global.gamepad_deadzone += 0.01 |
71 |
} |
72 |
} |
73 |
gamepad_get_device_count() |
74 |
if ((!gamepad_is_connected(0)) || gamepad_is_supported() == false) |
75 |
{ |
76 |
binding = false |
77 |
return; |
78 |
} |
79 |
if (keyboard_check_pressed(vk_shift) || keyboard_check_pressed(ord("X"))) |
80 |
{ |
81 |
binding = false |
82 |
waiter = 0 |
83 |
if (p[1] == true) |
84 |
global.buttonText1 = lastText |
85 |
else if (p[2] == true) |
86 |
global.buttonText2 = lastText |
87 |
else if (p[3] == true) |
88 |
global.buttonText3 = lastText |
89 |
return; |
90 |
} |
91 |
if (binding == true && waiter == 1) |
92 |
{ |
93 |
if gamepad_button_check_pressed(0, gp_face1) |
94 |
{ |
95 |
var pressedText = "1(A)" |
96 |
var pressedButton = gp_face1 |
97 |
waiter = 2 |
98 |
} |
99 |
else if gamepad_button_check_pressed(0, gp_face2) |
100 |
{ |
101 |
pressedText = "2(B)" |
102 |
pressedButton = gp_face2 |
103 |
waiter = 2 |
104 |
} |
105 |
else if gamepad_button_check_pressed(0, gp_face3) |
106 |
{ |
107 |
pressedText = "3(X)" |
108 |
pressedButton = gp_face3 |
109 |
waiter = 2 |
110 |
} |
111 |
else if gamepad_button_check_pressed(0, gp_face4) |
112 |
{ |
113 |
pressedText = "4(Y)" |
114 |
pressedButton = gp_face4 |
115 |
waiter = 2 |
116 |
} |
117 |
} |
118 |
if (binding == true && waiter == 2) |
119 |
{ |
120 |
if (p[1] == true) |
121 |
{ |
122 |
if (pressedButton == global.button2) |
123 |
{ |
124 |
global.button2 = global.button1 |
125 |
global.buttonText2 = lastText |
126 |
} |
127 |
else if (pressedButton == global.button3) |
128 |
{ |
129 |
global.button3 = global.button1 |
130 |
global.buttonText3 = lastText |
131 |
} |
132 |
global.button1 = pressedButton |
133 |
global.buttonText1 = pressedText |
134 |
} |
135 |
else if (p[2] == true) |
136 |
{ |
137 |
if (pressedButton == global.button1) |
138 |
{ |
139 |
global.button1 = global.button2 |
140 |
global.buttonText1 = lastText |
141 |
} |
142 |
else if (pressedButton == global.button3) |
143 |
{ |
144 |
global.button3 = global.button2 |
145 |
global.buttonText3 = lastText |
146 |
} |
147 |
global.button2 = pressedButton |
148 |
global.buttonText2 = pressedText |
149 |
} |
150 |
else if (p[3] == true) |
151 |
{ |
152 |
if (pressedButton == global.button1) |
153 |
{ |
154 |
global.button1 = global.button3 |
155 |
global.buttonText1 = lastText |
156 |
} |
157 |
else if (pressedButton == global.button2) |
158 |
{ |
159 |
global.button2 = global.button3 |
160 |
global.buttonText2 = lastText |
161 |
} |
162 |
global.button3 = pressedButton |
163 |
global.buttonText3 = pressedText |
164 |
} |
165 |
binding = false |
166 |
waiter = 0 |
167 |
} |
168 |
if (binding == true && waiter == 0) |
169 |
{ |
170 |
waiter++ |
171 |
if (p[1] == true) |
172 |
{ |
173 |
lastText = global.buttonText1 |
174 |
global.buttonText1 = "[PRESS BUTTON]" |
175 |
} |
176 |
else if (p[2] == true) |
177 |
{ |
178 |
lastText = global.buttonText2 |
179 |
global.buttonText2 = "[PRESS BUTTON]" |
180 |
} |
181 |
else if (p[3] == true) |
182 |
{ |
183 |
lastText = global.buttonText3 |
184 |
global.buttonText3 = "[PRESS BUTTON]" |
185 |
} |
186 |
} |