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 = 32772; |
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 |
for (var n = 0; n <= 6; n++) |
31 |
{ |
32 |
if (p[n] == true && n < 6) |
33 |
{ |
34 |
p[n] = false; |
35 |
p[n + 1] = true; |
36 |
break; |
37 |
} |
38 |
} |
39 |
} |
40 |
if (global.up_keyp) |
41 |
{ |
42 |
audio_play_sound(snd_mainmenu_select, 1, 0); |
43 |
for (var n = 0; n <= 6; n++) |
44 |
{ |
45 |
if (p[n] == true && n > 0) |
46 |
{ |
47 |
p[n] = false; |
48 |
p[n - 1] = true; |
49 |
break; |
50 |
} |
51 |
} |
52 |
} |
53 |
if (p[4] == true) |
54 |
{ |
55 |
if (global.left_key && global.gamepad_deadzone > 0.01) |
56 |
global.gamepad_deadzone -= 0.01; |
57 |
if (global.right_key && global.gamepad_deadzone < 0.99) |
58 |
global.gamepad_deadzone += 0.01; |
59 |
} |
60 |
} |
61 |
gamepad_get_device_count(); |
62 |
if (!gamepad_is_connected(0) || gamepad_is_supported() == false) |
63 |
{ |
64 |
binding = false; |
65 |
exit; |
66 |
} |
67 |
if (keyboard_check_pressed(vk_shift) || keyboard_check_pressed(ord("X"))) |
68 |
{ |
69 |
binding = false; |
70 |
waiter = 0; |
71 |
if (p[1] == true) |
72 |
global.buttonText1 = lastText; |
73 |
else if (p[2] == true) |
74 |
global.buttonText2 = lastText; |
75 |
else if (p[3] == true) |
76 |
global.buttonText3 = lastText; |
77 |
exit; |
78 |
} |
79 |
var pressedButton, pressedText; |
80 |
if (binding == true && waiter == 1) |
81 |
{ |
82 |
if (gamepad_button_check_pressed(0, gp_face1)) |
83 |
{ |
84 |
pressedText = "1(A)"; |
85 |
pressedButton = 32769; |
86 |
waiter = 2; |
87 |
} |
88 |
else if (gamepad_button_check_pressed(0, gp_face2)) |
89 |
{ |
90 |
pressedText = "2(B)"; |
91 |
pressedButton = 32770; |
92 |
waiter = 2; |
93 |
} |
94 |
else if (gamepad_button_check_pressed(0, gp_face3)) |
95 |
{ |
96 |
pressedText = "3(X)"; |
97 |
pressedButton = 32771; |
98 |
waiter = 2; |
99 |
} |
100 |
else if (gamepad_button_check_pressed(0, gp_face4)) |
101 |
{ |
102 |
pressedText = "4(Y)"; |
103 |
pressedButton = 32772; |
104 |
waiter = 2; |
105 |
} |
106 |
} |
107 |
if (binding == true && waiter == 2) |
108 |
{ |
109 |
if (p[1] == true) |
110 |
{ |
111 |
if (pressedButton == global.button2) |
112 |
{ |
113 |
global.button2 = global.button1; |
114 |
global.buttonText2 = lastText; |
115 |
} |
116 |
else if (pressedButton == global.button3) |
117 |
{ |
118 |
global.button3 = global.button1; |
119 |
global.buttonText3 = lastText; |
120 |
} |
121 |
global.button1 = pressedButton; |
122 |
global.buttonText1 = pressedText; |
123 |
} |
124 |
else if (p[2] == true) |
125 |
{ |
126 |
if (pressedButton == global.button1) |
127 |
{ |
128 |
global.button1 = global.button2; |
129 |
global.buttonText1 = lastText; |
130 |
} |
131 |
else if (pressedButton == global.button3) |
132 |
{ |
133 |
global.button3 = global.button2; |
134 |
global.buttonText3 = lastText; |
135 |
} |
136 |
global.button2 = pressedButton; |
137 |
global.buttonText2 = pressedText; |
138 |
} |
139 |
else if (p[3] == true) |
140 |
{ |
141 |
if (pressedButton == global.button1) |
142 |
{ |
143 |
global.button1 = global.button3; |
144 |
global.buttonText1 = lastText; |
145 |
} |
146 |
else if (pressedButton == global.button2) |
147 |
{ |
148 |
global.button2 = global.button3; |
149 |
global.buttonText2 = lastText; |
150 |
} |
151 |
global.button3 = pressedButton; |
152 |
global.buttonText3 = pressedText; |
153 |
} |
154 |
binding = false; |
155 |
waiter = 0; |
156 |
} |
157 |
if (binding == true && waiter == 0) |
158 |
{ |
159 |
waiter++; |
160 |
if (p[1] == true) |
161 |
{ |
162 |
lastText = global.buttonText1; |
163 |
global.buttonText1 = "[PRESS BUTTON]"; |
164 |
} |
165 |
else if (p[2] == true) |
166 |
{ |
167 |
lastText = global.buttonText2; |
168 |
global.buttonText2 = "[PRESS BUTTON]"; |
169 |
} |
170 |
else if (p[3] == true) |
171 |
{ |
172 |
lastText = global.buttonText3; |
173 |
global.buttonText3 = "[PRESS BUTTON]"; |
174 |
} |
175 |
} |