-
-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathmenu_click.gml
More file actions
487 lines (484 loc) · 18.5 KB
/
menu_click.gml
File metadata and controls
487 lines (484 loc) · 18.5 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
function menu_click(argument0) {
// menu_click(sel)
var sel, m, a, b, c, d, e;
sel = argument0
m = menu_shown
menu_shown = ""
window -= w_menu
wmenu = 1
if (window = 0) window = w_releasemouse
if (sel = -1) return 0
switch (m) {
case "file": {
if (sel = 0) new_song()
if (sel = 1) load_song("")
for (b = 0; b < 11; b += 1) if (recent_song[b] = "") break
for (c = 0; c < b; c += 1) {
if (sel = 3 + c && recent_song[c] != "") {
if (!file_exists_lib(recent_song[c])) {
if (language != 1) message("Could not find file:\n" + recent_song[c], "Error")
else message("找不到文件:\n" + recent_song[c], "错误")
for (d = 0; d < 10; d += 1) {
if (recent_song[d] = recent_song[c]) {
for (e = d; e < 10; e += 1) {
recent_song[e] = recent_song[e + 1]
recent_song_time[e] = recent_song_time[e + 1]
}
}
}
recent_song[10] = ""
recent_song_time[10] = 0
save_settings()
} else {
load_song(recent_song[c])
}
}
}
if (sel = b + 3) {
for (c = 0; c < 11; c += 1) {
recent_song[c] = ""
recent_song_time[c] = 0
}
save_settings()
}
if (sel = b + 4) save_song(songs[song].filename)
if (sel = b + 5) save_song("")
if (sel = b + 6) window = w_saveoptions
if (sel = b + 7) open_url(backup_directory)
if (sel = b + 9) pattern_import("")
if (sel = b + 10) open_midi("")
if (sel = b + 11) {
load_reference_audio()
}
if (sel = b + 12) {
var temppath = string(get_open_filename_ext("Image Files (*.png, *.jpg, *.jpeg)|*.png;*.jpg;*.jpeg", "", "", condstr(language != 1, "Open background image", "打开背景图片")))
wallpaper_init(temppath)
}
if (sel = b + 14) save_song_zip("")
if (sel = b + 15) pattern_export("")
if (sel = b + 16) window = w_mp3_export
if (sel = b + 17) {
if (calculate_size()) window = w_schematic_export
}
if (sel = b + 18) {
if (calculate_size()) window = w_track_export
}
if(sel = b + 19) window = w_datapack_export
if (sel = b + 20) game_end()
break
}
case "edit": {
if ((editmode = m_key) && (sel >= 17)) {
sel += 2
}
var insoffset = ds_list_size(songs[song].instrument_list) + insmenu - 1
var ins = sel - 20
ins -= floor(ins / 26) // subtract the "More..." entries to get the instrument number
if (sel = 0) action_undo()
if (sel = 1) action_redo()
if (sel = 2) action_copy()
if (sel = 3) action_cut()
if (sel = 4) {
var x1a = -2
var y1a = -2
if (!fullscreen && show_layers) {
x1a = 264
}
if (fullscreen) {
y1a = -2
} else {
y1a = 52 + get_tab_offset()
}
var selbxa = songs[song].starta + floor((mouse_x - (x1a + 2)) / 32)
var selbya = songs[song].startb + floor((mouse_y - (y1a + 34)) / 32)
if (selbxa > -1 && selbya > -1) action_paste(selbxa, selbya)
else action_paste(songs[song].starta, songs[song].startb)
}
if (sel = 5) action_delete()
if (sel = 6) select_all(-1, 0)
if (sel = 7) selection_place(0)
if (sel = 8) selection_invert()
if (sel = 9) selection_flip(0)
if (sel = 10) selection_flip(1)
if (sel = 11) select_all(songs[song].instrument, 0)
if (sel = 12) select_all(songs[song].instrument, 1)
if (sel = 13) mode_action(1)
if (sel = 14) mode_action(2)
if (sel = 15) mode_action(3)
if (sel = 16) mode_action(4)
if (sel = 17 && editmode != m_key) mode_action(5)
if (sel = 18 && editmode != m_key) mode_action(6)
if (sel > 19 && sel < 20 + insoffset) selection_changeins(songs[song].instrument_list[| ins])
if (sel = 20 + insoffset) selection_expand()
if (sel = 21 + insoffset) selection_compress()
if (sel = 23 + insoffset) window = w_tremolo
if (sel = 24 + insoffset) window = w_stereo
if (sel = 25 + insoffset) window = w_arpeggio
if (sel = 26 + insoffset) window = w_portamento
if (sel = 27 + insoffset) macro_vibrato()
if (sel = 28 + insoffset) window = w_stagger
if (sel = 29 + insoffset) macro_chorus()
if (sel = 30 + insoffset) macro_velocitylfo()
if (sel = 31 + insoffset) macro_fadein()
if (sel = 32 + insoffset) macro_fadeout()
if (sel = 33 + insoffset) macro_replacekey()
if (sel = 34 + insoffset) window = w_setvelocity
if (sel = 35 + insoffset) window = w_setpanning
if (sel = 36 + insoffset) window = w_setpitch
if (sel = 37 + insoffset) macro_reset()
if (sel = 38 + insoffset) {
if (language != 1) {if (question("Transpose selected notes so that they fall within Minecraft's 2 octaves?", "Transpose notes")) selection_transpose()}
else {if (question("转换音符使其在 Minecraft 的 2 八度以内吗?", "转换音符")) selection_transpose()}
}
break
}
case "editext": {
if ((editmode = m_key) && (sel >= 17)) {
sel += 2
}
var insoffset = ds_list_size(songs[song].instrument_list) + insmenu - 1
var ins = sel - 20
ins -= floor((ins) / 26) // subtract the "More..." entries to get the instrument number
if (sel = 0) action_copy()
if (sel = 1) action_cut()
if (sel = 2) action_paste(obj_menu.pastex, obj_menu.pastey)
if (sel = 3) action_delete()
if (sel = 4) select_all(-1, 0)
if (sel = 5) selection_place(0)
if (sel = 6) selection_invert()
if (sel = 7) {
selection_place(0)
selection_add(obj_menu.menuc + 1, 0, songs[song].enda, songs[song].endb, 0, 0)
}
if (sel = 8) {
selection_place(0)
selection_add(0, 0, obj_menu.menuc, songs[song].endb, 0, 0)
}
if (sel = 9) selection_flip(0)
if (sel = 10) selection_flip(1)
if (sel = 11) select_all(songs[song].instrument, 0)
if (sel = 12) select_all(songs[song].instrument, 1)
if (sel = 13) mode_action(1)
if (sel = 14) mode_action(2)
if (sel = 15) mode_action(3)
if (sel = 16) mode_action(4)
if (sel = 17 && editmode != m_key) mode_action(5)
if (sel = 18 && editmode != m_key) mode_action(6)
if (sel > 19 && sel < 20 + insoffset) selection_changeins(songs[song].instrument_list[| ins])
if (sel = 20 + insoffset) selection_expand()
if (sel = 21 + insoffset) selection_compress()
if (sel = 23 + insoffset) window = w_tremolo
if (sel = 24 + insoffset) window = w_stereo
if (sel = 25 + insoffset) window = w_arpeggio
if (sel = 26 + insoffset) window = w_portamento
if (sel = 27 + insoffset) macro_vibrato()
if (sel = 28 + insoffset) window = w_stagger
if (sel = 29 + insoffset) macro_chorus()
if (sel = 30 + insoffset) macro_velocitylfo()
if (sel = 31 + insoffset) macro_fadein()
if (sel = 32 + insoffset) macro_fadeout()
if (sel = 33 + insoffset) macro_replacekey()
if (sel = 34 + insoffset) window = w_setvelocity
if (sel = 35 + insoffset) window = w_setpanning
if (sel = 36 + insoffset) window = w_setpitch
if (sel = 37 + insoffset) macro_reset()
if (sel = 38 + insoffset) {
if (language != 1) {if (question("Transpose selected notes so that they fall within Minecraft's 2 octaves?", "Transpose notes")) selection_transpose()}
else {if (question("转换音符使其在 Minecraft 的 2 八度以内吗?", "转换音符")) selection_transpose()}
}
break
}
case "settings": {
var insoffset = ds_list_size(songs[song].instrument_list) + insmenu - 1
var ins = sel - 1
ins -= floor((ins) / 26) // subtract the "More..." entries to get the instrument number
if (sel < insoffset + 1) {songs[song].instrument = songs[song].instrument_list[| ins]; selected_vel = 100; selected_pan = 100; selected_pit = 0}
if (sel = insoffset + 1) window = w_instruments
if (sel = insoffset + 2) { window = w_sound_import update_asset_index_menu(0) }
if (sel = insoffset + 3) window = w_songinfoedit
if (sel = insoffset + 4) window = w_properties
if (sel = insoffset + 5) {selection_place(0) window = w_stats}
if (sel = insoffset + 6) window = w_mididevices
if (sel = insoffset + 7) window = w_preferences
break
}
case "help": {
if (language != 1) {
if (sel = 1) open_url("http://www.youtube.com/watch?v=2oD9Bw_Qau4")
if (sel = 2) open_url("http://www.youtube.com/watch?v=NIxNTK6nfJI")
if (sel = 3) open_url("http://www.youtube.com/watch?v=JMPkf7bS8lQ")
if (sel = 4) open_url("http://www.youtube.com/watch?v=Cg6dAcEjTs0")
if (sel = 5) open_url("http://www.youtube.com/playlist?list=PL7EA4F0D271DA6E86")
} else {
if (sel = 1) open_url("https://www.bilibili.com/video/BV1Mx411a76p?p=1")
if (sel = 2) open_url("https://www.bilibili.com/video/BV1Mx411a76p?p=2")
if (sel = 3) open_url("https://www.bilibili.com/video/BV1Mx411a76p?p=3")
if (sel = 4) open_url("https://www.bilibili.com/video/BV1Mx411a76p?p=4")
if (sel = 5) open_url("https://www.bilibili.com/video/BV1Mx411a76p")
}
if (sel = 6) open_url(link_website)
if (sel = 7) open_url(link_github)
if (sel = 8) open_url(link_discord)
if (sel = 9) open_url(link_report)
if (language == 0) {
if (sel = 10) open_url(link_donate)
if (sel = 11) window = w_changelist
if (sel = 12) window = w_about
} else if (language == 1) {
if (sel = 10) open_url(link_qq_group)
if (sel = 11) open_url(link_donate)
if (sel = 12) window = w_changelist
if (sel = 13) window = w_about
}
break
}
case "section": {
if (sel = 0) {
songs[song].section_exists = 0
songs[song].section_start = 0
songs[song].section_end = 0
}
if (sel = 1) {
songs[song].starta = songs[song].section_start
sb_val[0] = songs[song].starta
}
if (sel = 2) {
songs[song].starta = songs[song].section_end - 1
sb_val[0] = songs[song].starta
}
if (sel = 3) selection_add(songs[song].section_start, 0, songs[song].section_end - 1, songs[song].endb, 0, 0)
if (sel = 4) marker_start=!marker_start
if (sel = 5) marker_end=!marker_end
break
}
case "schexport_insblock": {
var str, block, data;
str = obj_menu.item_shortcut[obj_menu.selmenu, obj_menu.selitem]
block = real(string_copy(str, 1, string_pos(", ", str) - 1))
data = real(string_delete(str, 1, string_pos(", ", str)))
sch_exp_ins_block[obj_menu.menub] = block
sch_exp_ins_data[obj_menu.menub] = data
break
}
case "schexport_block": {
var str, block, data;
str = obj_menu.item_shortcut[obj_menu.selmenu, obj_menu.selitem]
block = real(string_copy(str, 1, string_pos(", ", str) - 1))
data = real(string_delete(str, 1, string_pos(", ", str)))
if (obj_menu.menua = 0) {
sch_exp_walkway_block = block
sch_exp_walkway_data = data
} else if (obj_menu.menua = 1) {
sch_exp_circuit_block = block
sch_exp_circuit_data = data
} else if (obj_menu.menua = 2) {
sch_exp_ground_block = block
sch_exp_ground_data = data
}
break
}
case "midiimport_ins": {
midi_channelins[obj_menu.menub] = sel - 1
break
}
case "midiimport_octave": {
midi_channeloctave[obj_menu.menub] = sel - 3
break
}
case "midiimport_percins": {
midi_percins[obj_menu.menub] = sel - 1
break
}
case "midiimport_percpitch": {
midi_percpitch[obj_menu.menub] = sel - floor((sel + 9) / 13) - 1
break
}
case "instruments_press": {
songs[song].instrument_list[| obj_menu.menub].press = !sel
break
}
case "instruments_pitch": {
songs[song].instrument_list[| obj_menu.menub].key = sel - floor((sel + 9) / 13) - 1
break
}
case "mididevices_ins": {
if (midi_set_device(obj_menu.mididevice) < 0) {midi_refresh_device() set_msg(condstr(language != 1, "That device no longer exists, refreshing...", "所指定的设备不存在,刷新中……"))}
if (sel - 3 < 0)
mididevice_instrument[obj_menu.mididevice] = sel - 3
else
mididevice_instrument[obj_menu.mididevice] = songs[song].instrument_list[| sel - 3]
break
}
case "refreshrate": {
if (sel = 0) game_set_speed(30,gamespeed_fps)
else if (sel = 1) game_set_speed(60,gamespeed_fps)
else if (sel = 2) game_set_speed(120,gamespeed_fps)
else if (sel = 3) game_set_speed(144,gamespeed_fps)
else if (sel = 4) game_set_speed(240,gamespeed_fps)
refreshrate = sel
break
}
case "theme": {
if (sel = 0) {theme = 0 change_theme() window_unset_darkmode()}
else if (sel = 2) {theme = 1 change_theme() window_unset_darkmode()}
else if (sel = 1) {theme = 2 change_theme() window_set_darkmode()}
else if (sel = 3) {theme = 3 change_theme() if (fdark) window_set_darkmode()}
break
}
case "filep": {
if (sel = 0) load_song("")
for (b = 0; b < 11; b += 1) if (recent_song[b] = "") break
for (c = 0; c < b; c += 1) {
if (sel = 2 + c && recent_song[c] != "") {
if (!file_exists_lib(recent_song[c])) {
if (language != 1) message("Could not find file:\n" + recent_song[c], "Error")
else message("找不到文件:\n" + recent_song[c], "错误")
for (d = 0; d < 10; d += 1) {
if (recent_song[d] = recent_song[c]) {
for (e = d; e < 10; e += 1) {
recent_song[e] = recent_song[e + 1]
recent_song_time[e] = recent_song_time[e + 1]
}
}
}
recent_song[10] = ""
recent_song_time[10] = 0
save_settings()
} else {
load_song(recent_song[c])
}
}
}
if (sel = b + 2) {
for (c = 0; c < 11; c += 1) {
recent_song[c] = ""
recent_song_time[c] = 0
}
save_settings()
}
if (sel = b + 3) open_midi("")
if (sel = b + 4) open_schematic("")
if (sel = b + 5) {
var temppath = string(get_open_filename_ext("Image Files (*.png, *.jpg, *.jpeg)|*.png;*.jpg;*.jpeg", "", "", condstr(language != 1, "Open background image", "打开背景图片")))
wallpaper_init(temppath)
}
if (sel = b + 6) game_end()
break
}
case "settingsp": {
if (sel = 0) window = w_songinfo
if (sel = 1) window = w_stats
if (sel = 2) window = w_preferences
break
}
case "tempo": {
if (sel = 0) use_bpm = false
else if (sel = 1) use_bpm = true
else if (sel = 2) { songs[song].real_tempo = 10 songs[song].changed = 1 }
else if (sel = 3) { songs[song].real_tempo = 12 songs[song].changed = 1 }
else if (sel = 4) { songs[song].real_tempo = 14 songs[song].changed = 1 }
else if (sel = 5) { songs[song].real_tempo = 16 songs[song].changed = 1 }
else if (sel = 6) { songs[song].real_tempo = 18 songs[song].changed = 1 }
else if (sel = 7) { songs[song].real_tempo = 20 songs[song].changed = 1 }
else if (sel = 8) { songs[song].real_tempo = 30 songs[song].changed = 1 }
else if (sel = 9) { songs[song].real_tempo = 60 songs[song].changed = 1 }
else if (sel = 10) window = w_tempotapper
update_tempo_changes()
break
}
case "language": {
language = sel
menu_macos_init()
break
}
case "audio_exp_format": {
switch (sel) {
case 0:
audio_exp_format = "MP3";
break;
case 1:
audio_exp_format = "WAV";
break;
//case 2:
// audio_exp_format = "OGG";
// break;
case 2:
audio_exp_format = "AIFF";
break;
case 3:
audio_exp_format = "FLAC";
break;
}
break;
}
case "audio_exp_sample_rate": {
switch (sel) {
case 0: audio_exp_sample_rate = 8000 break;
case 1: audio_exp_sample_rate = 11025 break;
case 2: audio_exp_sample_rate = 16000 break;
case 3: audio_exp_sample_rate = 22050 break;
case 4: audio_exp_sample_rate = 44100 break;
case 5: audio_exp_sample_rate = 48000 break;
case 6: audio_exp_sample_rate = 88200 break;
case 7: audio_exp_sample_rate = 96000 break;
case 8: audio_exp_sample_rate = 176400 break;
case 9: audio_exp_sample_rate = 192000 break;
case 10: audio_exp_sample_rate = 352800 break;
case 11: audio_exp_sample_rate = 384000 break;
}
break;
}
case "resourcepack": {
set_resourcepack(resourcepacks[sel].filename)
break;
}
case "songtab": {
switch (sel) {
case 0: {
array_insert(songs, menutab + 1, create(obj_song))
set_song(menutab + 1)
reset_add()
break;
}
case 1: close_song(menutab); break;
case 2: {
var menutabvar = menutab
for (var i = array_length(songs) - 1; i >= 0; i--) {
if (i != menutabvar) {
close_song(i)
if (i < menutab) menutabvar--
}
set_song(menutabvar)
}
break;
}
case 3: {
for (var i = array_length(songs) - 1; i > menutab; i--) {
close_song(i)
}
break;
}
}
menutab = -1
break;
}
case "sound_import_asset_index": {
sound_import_asset_index_select = sel;
update_asset_index_menu();
break;
}
case "add_event_ins": {
songs[song].changed = true
switch (sel) {
case 0:
ds_list_add(songs[song].instrument_list, new_instrument("Tempo Changer", "", true))
break;
case 1:
ds_list_add(songs[song].instrument_list, new_instrument("Sound Stopper", "", true))
break;
}
}
}
mouse_clear(mb_left)
io_clear()
}