diff --git a/Minecraft Note Block Studio.yyp b/Minecraft Note Block Studio.yyp index da199a7dd..c70989e2e 100644 --- a/Minecraft Note Block Studio.yyp +++ b/Minecraft Note Block Studio.yyp @@ -654,6 +654,14 @@ "resourceType": "GMScript" } }, + { + "Key": "252af0d3-fda0-4686-99ee-e50c77599791", + "Value": { + "id": "6b3ab05d-6386-40a1-9e9d-e82a79991252", + "resourcePath": "scripts\\draw_downloadprogress\\draw_downloadprogress.yy", + "resourceType": "GMScript" + } + }, { "Key": "262425f5-3f8a-4051-87ac-9e5516650c6f", "Value": { @@ -1046,6 +1054,14 @@ "resourceType": "GMFolder" } }, + { + "Key": "3c1514e1-5885-49b4-86ef-115f1fdec3ea", + "Value": { + "id": "a12fd799-06e2-4b03-94e2-28c9e406f39e", + "resourcePath": "scripts\\check_updates\\check_updates.yy", + "resourceType": "GMScript" + } + }, { "Key": "3c3845a5-e4dd-4c4f-85c2-1ec8e589979c", "Value": { @@ -3494,6 +3510,14 @@ "resourceType": "GMScript" } }, + { + "Key": "d3a39dce-0492-40fc-8e8d-a08108169343", + "Value": { + "id": "63f2cecf-c0e7-4079-928b-4015d1c3bf5c", + "resourcePath": "scripts\\string_truncate\\string_truncate.yy", + "resourceType": "GMScript" + } + }, { "Key": "d4189216-0a7f-4e01-8696-5601ff46b705", "Value": { @@ -3838,6 +3862,14 @@ "resourceType": "GMSprite" } }, + { + "Key": "e74f03fa-1407-4d25-93ab-0dccb3eb91ca", + "Value": { + "id": "922ab784-ea4b-4bb9-83da-0ddc43463332", + "resourcePath": "scripts\\get_update\\get_update.yy", + "resourceType": "GMScript" + } + }, { "Key": "e7ef2956-a38a-44fc-858f-fcc654140bb3", "Value": { @@ -3950,6 +3982,14 @@ "resourceType": "GMScript" } }, + { + "Key": "f136e3ca-963a-4648-ae87-60c3ee8476a9", + "Value": { + "id": "af2a944a-2b4a-4349-adf6-66e1b3b3936e", + "resourcePath": "scripts\\file_get_size\\file_get_size.yy", + "resourceType": "GMScript" + } + }, { "Key": "f156b801-b9bb-4929-af5c-2b9df4acc238", "Value": { @@ -4195,6 +4235,8 @@ "0ce5a906-0342-42fb-89f3-04f3609f5689", "3ef34f15-11b7-471c-aa91-4f191100f959", "0097ab11-b126-461a-8194-e3aaf09a6ddd", + "3c1514e1-5885-49b4-86ef-115f1fdec3ea", + "e74f03fa-1407-4d25-93ab-0dccb3eb91ca", "f51781f2-7a5a-49bf-895e-4338650ab87c", "5a190bcc-d435-4a9c-ab94-dc50a0f3107d", "5dcc6852-84c3-404a-9c42-174e7315465a", @@ -4234,11 +4276,13 @@ "af9a3525-3682-420e-b2a0-d952cc347296", "a0fe9bd7-a654-4de6-abd8-41b5be7e41a8", "7dfa1c5c-2dd7-4604-a776-ff2a1c2d26b0", + "f136e3ca-963a-4648-ae87-60c3ee8476a9", "1501c0c9-c863-4723-9ccc-f004078dc78d", "c032c6f1-0ef4-493c-82d0-cbc09ed91a90", "c54d19c6-44b4-403d-83b5-46645ef6d7d0", "9aa9d93b-2ff5-4629-af23-f0e369bc6008", "c1ae4275-cc48-48bb-bc3a-7c638ac064ec", + "d3a39dce-0492-40fc-8e8d-a08108169343", "684ae517-6f0d-4c08-b1ff-3863deb988e9", "6d1d68e3-6bec-469d-80a7-1033b318611c", "b3da5933-67e7-4020-9adf-2298e0500949", @@ -4308,6 +4352,7 @@ "28131748-b621-459e-952c-fcd16de0bd8b", "36bf530d-9afd-4915-8e0f-6d9162ea03b2", "f6cfba59-defd-47c1-b2fa-8fa627a1c1a4", + "252af0d3-fda0-4686-99ee-e50c77599791", "ffdb58ba-3567-4019-acf7-c6e674131bbb", "bb77e968-5a4f-4c9d-954b-7ddca77d2c0a", "a38ae6de-e436-4b50-af0b-964bf5f26cd9", diff --git a/scripts/action_redo/action_redo.gml b/scripts/action_redo/action_redo.gml index c41d78567..d6b3d438c 100644 --- a/scripts/action_redo/action_redo.gml +++ b/scripts/action_redo/action_redo.gml @@ -21,7 +21,7 @@ arg14 = history[historypos, 15] changed = 1 if (t = h_addblock) { - add_block(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) + add_block(arg0, arg1, arg2, arg3, arg4, arg5, arg6) } else if (t = h_removeblock) { remove_block(arg0, arg1) } else if (t = h_changeblock) { diff --git a/scripts/action_undo/action_undo.gml b/scripts/action_undo/action_undo.gml index b9d0e764b..e4a51b0c0 100644 --- a/scripts/action_undo/action_undo.gml +++ b/scripts/action_undo/action_undo.gml @@ -22,7 +22,7 @@ changed = 1 if (t = h_addblock) { remove_block(arg0, arg1) } else if (t = h_removeblock) { - add_block(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) + add_block(arg0, arg1, arg2, arg3, arg4, arg5, arg6) } else if (t = h_changeblock) { change_block(arg0, arg1, arg7, arg8, arg9, arg10, arg11) } else if (t = h_selectadd) { diff --git a/scripts/add_block/add_block.gml b/scripts/add_block/add_block.gml index f79ddcc1e..2c312f148 100644 --- a/scripts/add_block/add_block.gml +++ b/scripts/add_block/add_block.gml @@ -1,4 +1,4 @@ -// add_block(x, y, ins, key, vel, pan, [insnum]) +// add_block(x, y, ins, key, vel, pan, pit, [insnum]) var a, b, c, xx, yy, ins, key, vel, pan, pit, insnum; xx = argument[0] yy = argument[1] @@ -51,6 +51,7 @@ if (!insnum) { if (ins.user) block_custom += 1 } if (key < 33 || key > 57) block_outside += 1 +if (pit != 0) block_pitched += 1 totalblocks += 1 if (colfirst[xx] = -1 || yy < colfirst[xx]) colfirst[xx] = yy diff --git a/scripts/add_block_manual/add_block_manual.gml b/scripts/add_block_manual/add_block_manual.gml index 259eefd3c..017420946 100644 --- a/scripts/add_block_manual/add_block_manual.gml +++ b/scripts/add_block_manual/add_block_manual.gml @@ -53,6 +53,7 @@ rowamount[yy] += 1 ins.num_blocks++ if (key < 33 || key > 57) block_outside += 1 if (ins.user) block_custom += 1 +if (pit != 0) block_pitched += 1 totalblocks += 1 changed = 1 work_add += 1 diff --git a/scripts/add_block_select/add_block_select.gml b/scripts/add_block_select/add_block_select.gml index 0da69bbca..b0b684201 100644 --- a/scripts/add_block_select/add_block_select.gml +++ b/scripts/add_block_select/add_block_select.gml @@ -1,4 +1,4 @@ -// add_block_select(x, y, ins, key, vel, pan) +// add_block_select(x, y, ins, key, vel, pan, pit) var a, b, c, xx, yy, ins, key, vel, pan, pit; xx = argument0 yy = argument1 @@ -44,6 +44,7 @@ rowamount[yy] += 1 ins.num_blocks++ if (key < 33 || key > 57) block_outside += 1 if (ins.user) block_custom += 1 +if (pit != 0) block_pitched += 1 totalblocks += 1 if (colfirst[xx] = -1 || yy < colfirst[xx]) colfirst[xx] = yy diff --git a/scripts/calculate_size/calculate_size.gml b/scripts/calculate_size/calculate_size.gml index 457cb0450..0fe6a9e04 100644 --- a/scripts/calculate_size/calculate_size.gml +++ b/scripts/calculate_size/calculate_size.gml @@ -5,6 +5,9 @@ if (block_outside > 0) { if (block_custom > 0) { if (!question("Some note blocks have a custom instrument assigned to them. Export anyway?", "Minecraft Compatibility")) return 0 } +if (block_pitched > 0) { + if (!question("Some note blocks have fine pitch tuning, which isn't supported in note blocks. Export anyway?", "Minecraft Compatibility")) return 0 +} if (tempo != 10 && tempo != 5 && tempo != 2.5) { message("The tempo of the song is not compatible with Minecraft. As a result, the playback speed of the song in-game will differ from the one in the program.", "Tempo") } diff --git a/scripts/change_block_manual/change_block_manual.gml b/scripts/change_block_manual/change_block_manual.gml index 6abedab67..69397df5b 100644 --- a/scripts/change_block_manual/change_block_manual.gml +++ b/scripts/change_block_manual/change_block_manual.gml @@ -24,3 +24,5 @@ history_set(h_changeblock, xx, yy, ins, key, vel, pan, pit, pins, pkey, pvel, pp changed = 1 if (pkey >= 33 && pkey <= 57 && (key < 33 || key > 57)) block_outside += 1 if (key >= 33 && key <= 57 && (pkey < 33 || pkey > 57)) block_outside -= 1 +if (ppit = 0 && pit != 0) block_pitched += 1 +if (ppit != 0 && pit = 0) block_pitched -= 1 diff --git a/scripts/check_updates/check_updates.gml b/scripts/check_updates/check_updates.gml new file mode 100644 index 000000000..649d5e0da --- /dev/null +++ b/scripts/check_updates/check_updates.gml @@ -0,0 +1,34 @@ +// check_updates() +// Handles the update checking +// update values: +// -1: unable to check for update +// 1: update found +// 2: up to date + +if (async_load[? "id"] = update_http) { + update_http = -1 + if (async_load[? "http_status"] = 200) { + var res = async_load[? "result"]; + if (is_string(res)) { + res = json_decode(res) + if(res[?"tag_name"] != undefined){ + var newVersion = string_replace(res[?"tag_name"],"v","") + if (string_count(".", newVersion) = 2) { + if (newVersion = version) { + update = 2 + } else { + if (question("Version " + newVersion + " is available! Do you want to download it?", "Update available!")) { + update_download = http_get_file("https://github.com/HielkeMinecraft/OpenNoteBlockStudio/releases/latest/download/Minecraft.Note.Block.Studio.exe", update_file) + update = 4 + } else { + update = 1 + } + } + } + }else + update = -1 + }else + update = -1 + } else + update = -1 +} diff --git a/scripts/check_updates/check_updates.yy b/scripts/check_updates/check_updates.yy new file mode 100644 index 000000000..6f8dc9cb8 --- /dev/null +++ b/scripts/check_updates/check_updates.yy @@ -0,0 +1,8 @@ +{ + "id": "3c1514e1-5885-49b4-86ef-115f1fdec3ea", + "modelName": "GMScript", + "mvc": "1.0", + "name": "check_updates", + "IsCompatibility": false, + "IsDnD": false +} \ No newline at end of file diff --git a/scripts/control_create/control_create.gml b/scripts/control_create/control_create.gml index 1bc1391b7..06c9abeee 100644 --- a/scripts/control_create/control_create.gml +++ b/scripts/control_create/control_create.gml @@ -19,7 +19,6 @@ window_set_min_height(100) cam_window = camera_create() view_set_camera(0, cam_window) window_background = c_white -window2 = 0 // Application update = 0 @@ -48,6 +47,7 @@ tonextbackup = 0 filename = "" changed = 0 midifile = "" +song_midi = "" for (a = 0; a < 11; a += 1) { mididevice_instrument[a] = -1 recent_song[a] = "" @@ -99,6 +99,7 @@ song_played[0, 0] = 0 song_added[0, 0] = 0 block_outside = 0 block_custom = 0 +block_pitched = 0 midi_devices = 0 colamount[0] = 0 @@ -334,15 +335,24 @@ save_version = nbs_version load_settings() change_theme() if (show_welcome) window = w_greeting + +// Updates if (check_update) update_http = http_get("https://api.github.com/repos/HielkeMinecraft/OpenNoteBlockStudio/releases/latest") else update_http = -1 +update_download = -1 +downloaded_size = 0 +total_size = -1 if (file_exists_lib(settings_file) && vers != version) { window = w_update update = 3 } -log("Startup OK") + +// Delete old installer +if (file_exists_lib(update_file)) { + files_delete_lib(update_file) +} // Auto-recovery if (file_exists_lib(backup_file)) { @@ -355,4 +365,6 @@ if (file_exists_lib(backup_file)) { if (parameter_count() > 0) { filename = parameter_string(1) if (filename != "") load_song(filename) -} \ No newline at end of file +} + +log("Startup OK") \ No newline at end of file diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index 0f5ed08d6..cddb29f7c 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -21,7 +21,7 @@ remove_emitters() if (selected = 0) { if (block_outside = 0 && block_custom = 0) { - if (tempo = 10 || tempo = 5 || tempo = 2.5) compatible = 1 + if ((tempo = 10 || tempo = 5 || tempo = 2.5) && block_pitched = 0) compatible = 1 else compatible = 2 } else compatible = 0 } @@ -78,8 +78,9 @@ if (show_layers) { } else { totalcols = floor(rw / 32) } -if show_piano = 1 { - rhval = 270 +rhval = 270 +if (!show_piano) { + rhval = 130 } totalrows = floor((rh - rhval) / 32) if (min(keysmax, floor((rw - 32) / 39)) != keysshow) { @@ -280,7 +281,9 @@ if (floor(marker_pos) != floor(marker_prevpos) && floor(marker_pos) <= enda && ( a = 1 if (b < endb2) { c = (layervol[b] /100) * song_vel[xx, b] - d = (layerstereo[b] + song_pan[xx, b]) / 2 + if layerstereo[b] = 100 { + d = song_pan[xx, b] + } else d = (layerstereo[b] + song_pan[xx, b]) / 2 e = song_pit[xx, b] } if (solostr != "") { @@ -827,7 +830,7 @@ for (b = 0; b < totalrows; b += 1) { layername[startb + b] = draw_text_edit(100 + startb + b, layername[startb + b], x1 + 11, y1 + 10, 72, 14, 1, 0) if (layername[startb + b] = "") { draw_set_color(c_gray) - if(theme = 2) draw_set_color(c_white) + if(theme = 2) draw_set_color(make_color_rgb(160, 160, 160)) draw_text(x1 + 11, y1 + 10, "Layer " + string(startb + b + 1)) } draw_theme_color() @@ -857,25 +860,29 @@ for (b = 0; b < totalrows; b += 1) { } // Stereo if (!realstereo) { - c = ((dragstereob = startb + b && window2 = w_dragstereo) || (mouse_rectangle(x1 + 108, y1 + 5, 16, 25) && window2 = 0)) + c = ((dragstereob = startb + b && window = w_dragstereo) || (mouse_rectangle(x1 + 108, y1 + 5, 16, 25) && window = 0)) if (startb + b >= endb2) { a = 100 } else { a = layerstereo[startb + b] } draw_sprite_ext(spr_stereo, a / 50, x1 + 110, y1 + 11 - c * 5, 1, 1, 0, iconcolor, 0.7) - popup_set(x1 + 110, y1 + 5, 12, 17, "Stereo Pan: " + string(a) + "%\n(Click and drag to change)") + var stereostr + if (a > 100) { stereostr = "R " + string(a-100) } + if (a = 100) { stereostr = "Center" } + if (a < 100) { stereostr = "L " + string(-(a-100)) } + popup_set(x1 + 110, y1 + 5, 12, 17, "Stereo pan: " + stereostr + "\n(Click and drag to change)") if (c) { draw_set_font(fnt_small) draw_set_halign(fa_center) - if a > 100 {draw_text(x1 + 120, y1 + 18, "R " + string(a-100))} - if a = 100 {draw_text(x1 + 120, y1 + 18, "MONO")} - if a < 100 {draw_text(x1 + 120, y1 + 18, "L " + string((a-100)*-1)) } + if a > 100 {draw_text(x1 + 116, y1 + 18, "R " + string(a-100))} + if a = 100 {draw_text(x1 + 116, y1 + 18, "MONO")} + if a < 100 {draw_text(x1 + 116, y1 + 18, "L " + string((a-100)*-1)) } draw_set_halign(fa_left) draw_set_font(fnt_main) curs = cr_size_ns if (mouse_check_button_pressed(mb_left)) { - window2 = w_dragstereo + window = w_dragstereo dragstereob = startb + b dragstereo = layerstereo[startb + b] } @@ -901,9 +908,11 @@ for (b = 0; b < totalrows; b += 1) { } } // Select all - if (draw_layericon(2, x1 + 162 - !realvolume-realstereo * 10, y1 + 8, "Select all note blocks in this layer", 0, 0)) { + if (draw_layericon(2, x1 + 162 - !realvolume-realstereo * 10, y1 + 8, "Select all note blocks in this layer\n(Hold Shift to select multiple layers)", 0, 0)) { playing = 0 - selection_place(0) + if (!keyboard_check(vk_shift)) { + selection_place(0) + } selection_add(0, startb + b, enda, startb + b, 0, 0) } // Add layer @@ -927,22 +936,29 @@ for (b = 0; b < totalrows; b += 1) { shift_layers(startb + b, startb + b + 1, false) } } - if (window = w_dragvol) { - dragvol += (mouse_yprev - mouse_y) * 2 - dragvol = median(0, dragvol, 100) - layervol[dragvolb] = floor(dragvol / 10) * 10 - if (!mouse_check_button(mb_left)) { - window = w_releasemouse - } +} +if (window = w_dragvol) { + dragvol += (mouse_yprev - mouse_y) + dragvol = median(0, dragvol, 100) + if (!keyboard_check(vk_shift)) { + layervol[dragvolb] = floor(dragvol / 10) * 10 + } else { + layervol[dragvolb] = dragvol } - if (window2 = w_dragstereo) { - dragstereo += (mouse_yprev - mouse_y) * 2 - dragstereo = median(0, dragstereo, 200) - layerstereo[dragstereob] = floor(dragstereo / 10) * 10 - if (!mouse_check_button(mb_left)) { - window2 = w_releasemouse - window2 = 0 - } + if (!mouse_check_button(mb_left)) { + window = w_releasemouse + } +} +if (window = w_dragstereo) { + dragstereo += (mouse_yprev - mouse_y) + dragstereo = median(0, dragstereo, 200) + if (!keyboard_check(vk_shift)) { + layerstereo[dragstereob] = floor(dragstereo / 10) * 10 + } else { + layerstereo[dragstereob] = dragstereo + } + if (!mouse_check_button(mb_left)) { + window = w_releasemouse } } // Macro Bar @@ -978,7 +994,7 @@ if (draw_tab("File")) { for (b = 0; b < 11; b += 1) { if (recent_song[b] = "") break c = floor(date_second_span(recent_song_time[b], date_current_datetime())) - str += seconds_to_str(c) + "$" + clean(filename_name(recent_song[b])) + "|" + str += seconds_to_str(c) + "$" + string_truncate(clean(filename_name(recent_song[b])), 310) + "|" } show_menu_ext("file", 0, 19, icon(icons.NEW)+"Ctrl + N$New song|"+ icon(icons.OPEN)+"Ctrl+O$Open song...|Recent songs...|\\|" + str + condstr(recent_song[0] != "", "-|Clear recent songs") + condstr(recent_song[0] = "", "^!No recent songs") + "|/|-|"+ @@ -1044,7 +1060,7 @@ if (draw_tab("Settings")) { icon(icons.INSTRUMENTS)+"Instrument settings...|/|-|" + icon(icons.INFORMATION) + "Song info...|" + icon(icons.PROPERTIES) + "Song properties...|Song stats...|-|" + icon(icons.MIDI_INPUT) + "MIDI device manager|Save options...|Preferences...") } if (draw_tab("Help")) { - show_menu_ext("help", 109, 19, icon(icons.HELP) + "Tutorial videos|\\|Part 1: Composing note block music|Part 2: Opening MIDI files|Part 3: Importing songs into Minecraft|Part 4: Editing songs made in Minecraft |-|F1$View all|/|-|" + icon(icons.INTERNET) + "Minecraft Forums topic...|Minecraft Wiki page...|-|Changelist...|About...|Github") + show_menu_ext("help", 109, 19, icon(icons.HELP) + "Tutorial videos|\\|Part 1: Composing note block music|Part 2: Opening MIDI files|Part 3: Importing songs into Minecraft|Part 4: Editing songs made in Minecraft |-|F1$View all|/|-|" + icon(icons.INTERNET) + "Minecraft Forums topic...|Minecraft Wiki page...|-|Changelist...|About...|GitHub") } // Icons @@ -1111,6 +1127,7 @@ if (compatible = 1) { draw_sprite(spr_minecraft, 0, rw - 30, 25) draw_sprite(spr_minecraft, 0, rw - 59, 25) draw_set_color(c_green) + if (theme == 2) draw_set_color(c_lime) draw_text(rw - 166, 28, "Fully compatible") draw_theme_color() draw_set_font(fnt_main) @@ -1259,7 +1276,7 @@ if (show_layers) { } draw_set_halign(fa_left) a = mouse_rectangle(108, 57, 64, 22) - if (a && window = 0 && window2 = 0) { + if (a && window = 0) { curs = cr_size_ns if (mouse_check_button(mb_left)) { tempodrag = tempo @@ -1312,6 +1329,13 @@ if (mouse_check_button_released(mb_left)) { } if (window = w_releasemouse && !mouse_check_button(mb_left)) window = 0 draw_windows() + +// Draw update progress bar +if (update == 4) { + window = -1 + draw_downloadprogress("Update", "Downloading update...", downloaded_size, total_size) +} + window_set_cursor(curs) mouse_xprev = mouse_x mouse_yprev = mouse_y diff --git a/scripts/control_http/control_http.gml b/scripts/control_http/control_http.gml index 999056c11..3985d4e71 100644 --- a/scripts/control_http/control_http.gml +++ b/scripts/control_http/control_http.gml @@ -1,30 +1,5 @@ // control_http() -// Handles the update checking -// update values: -// -1: unable to check for update -// 1: update found -// 2: up to date +// Handles the check for updates, then attempts to download it if one is available -if (async_load[? "id"] = update_http) { - update_http = -1 - if (async_load[? "http_status"] = 200) { - var res = async_load[? "result"]; - if (is_string(res)) { - res = json_decode(res) - if(res[?"tag_name"] != undefined){ - var newVersion = string_replace(res[?"tag_name"],"v","") - if (string_count(".", newVersion) = 2) { - if (newVersion = version) { - update = 2 - } else { - if (question("Version " + newVersion + " is available! Do you want to download it?", "Update available!")) open_url(link_download) - update = 1 - } - } - }else - update = -1 - }else - update = -1 - } else - update = -1 -} +check_updates() +get_update() \ No newline at end of file diff --git a/scripts/dat_makefolders/dat_makefolders.gml b/scripts/dat_makefolders/dat_makefolders.gml index d306e0e6e..b5cf58435 100644 --- a/scripts/dat_makefolders/dat_makefolders.gml +++ b/scripts/dat_makefolders/dat_makefolders.gml @@ -24,7 +24,7 @@ if path != "" { } var tempdir = data_directory + "TempDatapack\\" -if (directory_exists(tempdir)) directory_destroy(tempdir) +if (directory_exists_lib(tempdir)) directory_destroy(tempdir) directory_create_lib(tempdir) directory_create_lib(tempdir + "data\\") diff --git a/scripts/dat_preview/dat_preview.gml b/scripts/dat_preview/dat_preview.gml index bfff34bb8..942a847e1 100644 --- a/scripts/dat_preview/dat_preview.gml +++ b/scripts/dat_preview/dat_preview.gml @@ -21,4 +21,4 @@ if (string_lettersdigits(name) = "") { } } -return string_maxwidth(preview, 350) + condstr(string_width(preview) > 350, "...") \ No newline at end of file +return string_truncate(preview, 350) \ No newline at end of file diff --git a/scripts/draw_downloadprogress/draw_downloadprogress.gml b/scripts/draw_downloadprogress/draw_downloadprogress.gml new file mode 100644 index 000000000..9055e380d --- /dev/null +++ b/scripts/draw_downloadprogress/draw_downloadprogress.gml @@ -0,0 +1,33 @@ +// draw_downloadprogress(caption, desc, downloaded_size, total_size) +var caption, desc, done, total, done_mb, total_mb, done_text, total_text, text, percent, x1, y1; +caption = argument0 +desc = argument1 +done = argument2 +total = argument3 +percent = done/total +done_mb = done/power(1024, 2) +total_mb = total/power(1024, 2) +x1 = floor(window_width / 2 - 150) +y1 = floor(window_height / 2 - 50) +draw_theme_color() +draw_window(x1, y1, x1 + 300, y1 + 100) +draw_set_font(fnt_mainbold) +draw_text(x1 + 16, y1 + 16, caption) +draw_set_font(fnt_main) +draw_set_halign(fa_center) +draw_text(floor(window_width / 2), y1 + 40, desc) +draw_set_color(10512464) +draw_rectangle(x1 + 30, y1 + 60, x1 + 30 + percent * 240, y1 + 80, 0) +draw_theme_color() +draw_rectangle(x1 + 30, y1 + 60, x1 + 270, y1 + 80, 1) +if (percent > 0.5) draw_set_color(c_white) +if (total <= 0) { + done_text = "-.--" + total_text = "-.--" +} else { + done_text = string_format(done_mb, 0, 2) + total_text = string_format(total_mb, 0, 2) +} +text = done_text + "/" + total_text + " MB (" + string(round(percent * 100)) + "%)" +draw_text(floor(window_width / 2), y1 + 65, text) +draw_set_halign(fa_left) diff --git a/scripts/draw_downloadprogress/draw_downloadprogress.yy b/scripts/draw_downloadprogress/draw_downloadprogress.yy new file mode 100644 index 000000000..6ff61dd8a --- /dev/null +++ b/scripts/draw_downloadprogress/draw_downloadprogress.yy @@ -0,0 +1,8 @@ +{ + "id": "252af0d3-fda0-4686-99ee-e50c77599791", + "modelName": "GMScript", + "mvc": "1.0", + "name": "draw_downloadprogress", + "IsCompatibility": false, + "IsDnD": false +} \ No newline at end of file diff --git a/scripts/draw_window_greeting/draw_window_greeting.gml b/scripts/draw_window_greeting/draw_window_greeting.gml index ad97ee579..4024bf48e 100644 --- a/scripts/draw_window_greeting/draw_window_greeting.gml +++ b/scripts/draw_window_greeting/draw_window_greeting.gml @@ -23,10 +23,11 @@ if (check_update) { } if (update = 2) { draw_set_color(c_green) + if (theme == 2) draw_set_color(c_lime) draw_text_center(x1 + 132, y1 + 248, "You are using the latest version!") } if (update = 3) { - draw_set_color(c_green) + draw_set_color(c_lime) draw_text_center(x1 + 132, y1 + 248, "Successfully updated!") } } else { @@ -37,7 +38,7 @@ draw_set_font(fnt_main) draw_theme_color() draw_text_center(x1 + 132, y1 + 233, "Version " + version + " - Released " + version_date) draw_text_center(x1 + 132, y1 + 280, "Open source Minecraft Note Block Studio") -draw_set_color(c_blue) +draw_set_color(make_color_rgb(62, 144, 255)) draw_text_center(x1 + 132, y1 + 296, "www.git.io/fjQH3") draw_line(x1 + 85, y1 + 309, x1 + 177, y1 + 309) @@ -50,7 +51,7 @@ if (a) { draw_theme_color() draw_text_center(x1 + 132, y1 + 340, "Original created by David Norgren") -draw_set_color(c_blue) +draw_set_color(make_color_rgb(62, 144, 255)) draw_text_center(x1 + 132, y1 + 356, "www.stuffbydavid.com") draw_line(x1 + 70, y1 + 369, x1 + 193, y1 + 369) a = mouse_rectangle(x1 + 71, y1 + 358, 123, 12) @@ -75,7 +76,7 @@ a += (a && (mouse_check_button(mb_left) || mouse_check_button_released(mb_left)) draw_sprite(spr_frame2, a + 3 * theme, b, c) draw_sprite(spr_bigicons, 0, b + (a > 1), c + (a > 1)) draw_text(b + 48 + (a > 1), c + 9 + (a > 1), "Create a new song") -if (a = 2 && mouse_check_button_released(mb_left)) window = 0 song_midi = "" +if (a = 2 && mouse_check_button_released(mb_left)) window = 0 c += 44 b = x1 + 300 @@ -118,7 +119,7 @@ for (a = 0; a < 11; a += 1) { } } draw_sprite(spr_frame5, theme * 3 + m, b, c) - draw_text(b + 2 + (m = 2), c + 1 + (m = 2), filename_name(recent_song[a])) + draw_text(b + 2 + (m = 2), c + 1 + (m = 2), string_truncate(filename_name(recent_song[a]), 220)) draw_set_halign(fa_right) draw_text(b + 316 + (m = 2), c + 1 + (m = 2), seconds_to_str(floor(date_second_span(recent_song_time[a], date_current_datetime())))) draw_set_halign(fa_left) diff --git a/scripts/draw_window_instruments/draw_window_instruments.gml b/scripts/draw_window_instruments/draw_window_instruments.gml index 67fdef2d3..e14f91e86 100644 --- a/scripts/draw_window_instruments/draw_window_instruments.gml +++ b/scripts/draw_window_instruments/draw_window_instruments.gml @@ -8,7 +8,7 @@ draw_window(x1, y1, x1 + 550, y1 + 350) draw_set_font(fnt_mainbold) draw_text(x1 + 10, y1 + 8, "Instrument Settings") draw_set_font(fnt_main) -// draw_text(x1 + 12, y1 + 31, "These settings only apply to this song. To import the settings from another\nsong, click \"Import\". The sound files must be located in the \"Sounds\" folder.") +draw_text(x1 + 12, y1 + 31, "These settings only apply to this song. To import the settings from another\nsong, click \"Import\". The sound files must be located in the \"Sounds\" folder.") draw_set_color(c_white) if(theme = 2) draw_set_color(c_dark) draw_rectangle(x1 + 12, y1 + 66, x1 + 535, y1 + 310, 0) @@ -32,7 +32,7 @@ draw_text(x1 + 18 + 194, y1 + 70, "Sound") draw_window(x1 + 13, y1 + 67, x1 + 14 + 194, y1 + 67 + 20) popup_set_window(x1 + 13, y1 + 67, 194, 20, "The name of this instrument.") draw_text(x1 + 18, y1 + 70, "Name") -// if (draw_button2(x1 + 12, y1 + 318, 80, "Import")) load_instruments("") +if (draw_button2(x1 + 12, y1 + 318, 80, "Import")) load_instruments("") c = 0 if (draw_button2(x1 + 256, y1 + 318, 80, "Add", user_instruments >= 18) && wmenu = 0) { changed = true diff --git a/scripts/draw_window_macro_arpeggio/draw_window_macro_arpeggio.gml b/scripts/draw_window_macro_arpeggio/draw_window_macro_arpeggio.gml index 006235963..fd916e4df 100644 --- a/scripts/draw_window_macro_arpeggio/draw_window_macro_arpeggio.gml +++ b/scripts/draw_window_macro_arpeggio/draw_window_macro_arpeggio.gml @@ -2,13 +2,13 @@ var x1, y1, a, i, pattern, str, total_vals, val, arplen curs = cr_default text_exists[0] = 0 +if (selected = 0) return 0 x1 = floor(window_width / 2 - 80) y1 = floor(window_height / 2 - 80) draw_window(x1, y1, x1 + 140, y1 + 130) draw_set_font(fnt_mainbold) draw_text(x1 + 8, y1 + 8, "Arpeggio") pattern = "" -if (selected = 0) return 0 draw_set_font(fnt_main) if (theme = 0) { draw_set_color(c_white) diff --git a/scripts/draw_window_macro_portamento/draw_window_macro_portamento.gml b/scripts/draw_window_macro_portamento/draw_window_macro_portamento.gml index 071c34863..5c5ebabcf 100644 --- a/scripts/draw_window_macro_portamento/draw_window_macro_portamento.gml +++ b/scripts/draw_window_macro_portamento/draw_window_macro_portamento.gml @@ -2,12 +2,12 @@ var x1, y1, a, b, str, total_vals, val, decr, inc; curs = cr_default text_exists[0] = 0 +if (selected = 0) return 0 x1 = floor(window_width / 2 - 80) y1 = floor(window_height / 2 - 80) draw_window(x1, y1, x1 + 140, y1 + 130) draw_set_font(fnt_mainbold) draw_text(x1 + 8, y1 + 8, "Portamento") -if (selected = 0) return 0 draw_set_font(fnt_main) if (theme = 0) { draw_set_color(c_white) diff --git a/scripts/draw_window_macro_setpanning/draw_window_macro_setpanning.gml b/scripts/draw_window_macro_setpanning/draw_window_macro_setpanning.gml index b08684c2d..43c0f1357 100644 --- a/scripts/draw_window_macro_setpanning/draw_window_macro_setpanning.gml +++ b/scripts/draw_window_macro_setpanning/draw_window_macro_setpanning.gml @@ -2,12 +2,13 @@ var x1, y1, a, b, str, total_vals, val, decr, inc; curs = cr_default text_exists[0] = 0 +if (selected = 0) return 0 x1 = floor(window_width / 2 - 80) y1 = floor(window_height / 2 - 80) draw_window(x1, y1, x1 + 140, y1 + 130) draw_set_font(fnt_mainbold) draw_text(x1 + 8, y1 + 8, "Set note panning") -if (selected = 0) return 0 + draw_set_font(fnt_main) if (theme = 0) { draw_set_color(c_white) diff --git a/scripts/draw_window_macro_setpitch/draw_window_macro_setpitch.gml b/scripts/draw_window_macro_setpitch/draw_window_macro_setpitch.gml index cdbc88aa8..15e041941 100644 --- a/scripts/draw_window_macro_setpitch/draw_window_macro_setpitch.gml +++ b/scripts/draw_window_macro_setpitch/draw_window_macro_setpitch.gml @@ -2,12 +2,12 @@ var x1, y1, a, b, str, total_vals, val, decr, inc; curs = cr_default text_exists[0] = 0 +if (selected = 0) return 0 x1 = floor(window_width / 2 - 80) y1 = floor(window_height / 2 - 80) draw_window(x1, y1, x1 + 140, y1 + 130) draw_set_font(fnt_mainbold) draw_text(x1 + 8, y1 + 8, "Set note pitch") -if (selected = 0) return 0 draw_set_font(fnt_main) if (theme = 0) { draw_set_color(c_white) diff --git a/scripts/draw_window_macro_setvelocity/draw_window_macro_setvelocity.gml b/scripts/draw_window_macro_setvelocity/draw_window_macro_setvelocity.gml index 49e30d5fd..2bd661f0b 100644 --- a/scripts/draw_window_macro_setvelocity/draw_window_macro_setvelocity.gml +++ b/scripts/draw_window_macro_setvelocity/draw_window_macro_setvelocity.gml @@ -2,12 +2,12 @@ var x1, y1, a, b, str, total_vals, val, decr, inc; curs = cr_default text_exists[0] = 0 +if (selected = 0) return 0 x1 = floor(window_width / 2 - 80) y1 = floor(window_height / 2 - 80) draw_window(x1, y1, x1 + 140, y1 + 130) draw_set_font(fnt_mainbold) draw_text(x1 + 8, y1 + 8, "Set note velocity") -if (selected = 0) return 0 draw_set_font(fnt_main) if (theme = 0) { draw_set_color(c_white) diff --git a/scripts/draw_window_macro_stagger/draw_window_macro_stagger.gml b/scripts/draw_window_macro_stagger/draw_window_macro_stagger.gml index d953f6a14..bfcc45144 100644 --- a/scripts/draw_window_macro_stagger/draw_window_macro_stagger.gml +++ b/scripts/draw_window_macro_stagger/draw_window_macro_stagger.gml @@ -2,6 +2,7 @@ var x1, y1, a, b, i, pattern, str, total_vals, val, arplen, maxlength, conf; curs = cr_default text_exists[0] = 0 +if (selected = 0) return 0 x1 = floor(window_width / 2 - 80) y1 = floor(window_height / 2 - 70) draw_window(x1, y1, x1 + 150, y1 + 160) @@ -12,7 +13,6 @@ draw_set_color(c_red) draw_text(x1 + 8, y1 + 23, "(CANNOT BE UNDONE)") draw_theme_color() pattern = "" -if (selected = 0) return 0 draw_set_font(fnt_main) if (theme = 0) { draw_set_color(c_white) diff --git a/scripts/draw_window_macro_stereo/draw_window_macro_stereo.gml b/scripts/draw_window_macro_stereo/draw_window_macro_stereo.gml index f25fec237..e2ab20962 100644 --- a/scripts/draw_window_macro_stereo/draw_window_macro_stereo.gml +++ b/scripts/draw_window_macro_stereo/draw_window_macro_stereo.gml @@ -2,12 +2,12 @@ var x1, y1, a, b, str, total_vals, val; curs = cr_default text_exists[0] = 0 +if (selected = 0) return 0 x1 = floor(window_width / 2 - 80) y1 = floor(window_height / 2 - 80) draw_window(x1, y1, x1 + 140, y1 + 130) draw_set_font(fnt_mainbold) draw_text(x1 + 8, y1 + 8, "Stereo") -if (selected = 0) return 0 draw_set_font(fnt_main) if (theme = 0) { draw_set_color(c_white) diff --git a/scripts/draw_window_macro_tremolo/draw_window_macro_tremolo.gml b/scripts/draw_window_macro_tremolo/draw_window_macro_tremolo.gml index 7eefd7310..598fce6d4 100644 --- a/scripts/draw_window_macro_tremolo/draw_window_macro_tremolo.gml +++ b/scripts/draw_window_macro_tremolo/draw_window_macro_tremolo.gml @@ -2,6 +2,7 @@ var x1, y1, a, i, pattern, str, total_vals, val; curs = cr_default text_exists[0] = 0 +if (selected = 0) return 0 x1 = floor(window_width / 2 - 72) y1 = floor(window_height / 2 - 145) draw_window(x1, y1, x1 + 150, y1 + 240) @@ -10,7 +11,6 @@ draw_text(x1 + 8, y1 + 8, "Tremolo") draw_set_color(c_red) draw_text(x1 + 8, y1 + 23, "(CANNOT BE UNDONE)") draw_theme_color() -if (selected = 0) return 0 draw_set_font(fnt_main) if (theme = 0) { draw_set_color(c_white) diff --git a/scripts/draw_window_midi_import/draw_window_midi_import.gml b/scripts/draw_window_midi_import/draw_window_midi_import.gml index eec8aa628..ca0d22dba 100644 --- a/scripts/draw_window_midi_import/draw_window_midi_import.gml +++ b/scripts/draw_window_midi_import/draw_window_midi_import.gml @@ -21,7 +21,7 @@ if (draw_checkbox(x1 + 300, y1 + 72, w_midi_octave, "Keep within octave range", if (draw_checkbox(x1 + 300, y1 + 92, w_midi_vel, "Read note velocity", "Whether to copy the volume data found\nin each MIDI note.") && wmenu = 0) w_midi_vel=!w_midi_vel if (draw_checkbox(x1 + 12, y1 + 374, w_midi_remember, "Remember changes", "Whether to use these settings the\nnext time you import a MIDI file.") && wmenu = 0) w_midi_remember=!w_midi_remember if (draw_button2(x1 + 520, y1 + 368, 72, "Import") && wmenu = 0) {w_midi_tab = 0 window = -1 import_midi()} -if (draw_button2(x1 + 520 - 80, y1 + 368, 72, "Cancel") && wmenu = 0) {w_midi_tab = 0 window = 0} +if (draw_button2(x1 + 520 - 80, y1 + 368, 72, "Cancel") && wmenu = 0) {midifile = "" w_midi_tab = 0 window = 0} if (draw_button2(x1 + 520 - 160, y1 + 368, 72, "Use default") && wmenu = 0) { if (question("Are you sure?", "Confirm")) { midi_instruments() diff --git a/scripts/draw_window_minecraft/draw_window_minecraft.gml b/scripts/draw_window_minecraft/draw_window_minecraft.gml index f49b56a75..1c57eb2e6 100644 --- a/scripts/draw_window_minecraft/draw_window_minecraft.gml +++ b/scripts/draw_window_minecraft/draw_window_minecraft.gml @@ -87,6 +87,7 @@ if (selected_tab_mc = 0) { // Schematic if (tempo = 10 || tempo = 5 || tempo = 2.5) { draw_set_color(c_green) + if (theme == 2) draw_set_color(c_lime) draw_text(x1 + 45, yy + 16, "The tempo is " + string(tempo) + " ticks per second.") } else { draw_set_color(c_red) @@ -126,6 +127,7 @@ if (selected_tab_mc = 0) { // Schematic } } else { draw_set_color(c_green) + if (theme == 2) draw_set_color(c_lime) draw_text(x1 + 45, yy + 16, "There are no blocks outside the 2 octave range.") } draw_theme_color() @@ -138,13 +140,14 @@ if (selected_tab_mc = 0) { // Schematic if (block_custom > 0) { draw_set_color(c_red) if (block_custom = 1) draw_text(x1 + 45, yy + 16, "There is 1 block with custom instruments.") - else draw_text(x1 + 45, yy + 16, "There are " + string(block_custom) + "blocks with custom instruments.") + else draw_text(x1 + 45, yy + 16, "There are " + string(block_custom) + " blocks with custom instruments.") if (draw_button2(x1 + 45, yy + 34, 160, "Select affected blocks")) { select_custom() window = 0 } } else { draw_set_color(c_green) + if (theme == 2) draw_set_color(c_lime) draw_text(x1 + 45, yy + 16, "There are no blocks with custom instruments.") } draw_theme_color() @@ -158,6 +161,7 @@ if (selected_tab_mc = 0) { // Schematic if (tempo = 20 || tempo = 10 || tempo = 5 || tempo = 4 || tempo = 2.5 || tempo = 2 || tempo = 1.25 || tempo = 1 || tempo = 0.5 || tempo = 0.25) { draw_sprite(spr_yesno, 1, x1 + 25, yy + 8) draw_set_color(c_green) + if (theme == 2) draw_set_color(c_lime) draw_text(x1 + 45, yy + 32, "The tempo is " + string(tempo) + " ticks per second.") } else { draw_sprite(spr_yesno, 2, x1 + 25, yy + 8) @@ -207,6 +211,7 @@ if (selected_tab_mc = 0) { // Schematic } else { draw_sprite(spr_yesno, 1, x1 + 25, yy + 8) draw_set_color(c_green) + if (theme == 2) draw_set_color(c_lime) draw_text(x1 + 45, yy + 32, "There are no blocks outside the 2 octave range.") } draw_theme_color() @@ -220,7 +225,7 @@ if (selected_tab_mc = 0) { // Schematic draw_sprite(spr_yesno, 2, x1 + 25, yy + 8) draw_set_color(c_orange) if (block_custom = 1) draw_text(x1 + 45, yy + 32, "There is 1 block with custom instruments.") - else draw_text(x1 + 45, yy + 32, "There are " + string(block_custom) + "blocks with custom instruments.") + else draw_text(x1 + 45, yy + 32, "There are " + string(block_custom) + " blocks with custom instruments.") if (draw_button2(x1 + 45, yy + 50, 160, "Select affected blocks")) { select_custom() window = 0 @@ -228,6 +233,7 @@ if (selected_tab_mc = 0) { // Schematic } else { draw_sprite(spr_yesno, 1, x1 + 25, yy + 8) draw_set_color(c_green) + if (theme == 2) draw_set_color(c_lime) draw_text(x1 + 45, yy + 32, "There are no blocks with custom instruments.") } draw_theme_color() diff --git a/scripts/draw_window_preferences/draw_window_preferences.gml b/scripts/draw_window_preferences/draw_window_preferences.gml index abae76a59..7671b1eea 100644 --- a/scripts/draw_window_preferences/draw_window_preferences.gml +++ b/scripts/draw_window_preferences/draw_window_preferences.gml @@ -100,10 +100,10 @@ if (selected_tab = 0) { refreshrate=1 } - draw_text(x1 + 22, y1 + 260, "Song folder: " + string_maxwidth(songfolder, 360) + condstr(string_width(songfolder) > 360, "...")) + draw_text(x1 + 22, y1 + 260, "Song folder: " + string_truncate(songfolder, 360)) popup_set_window(x1 + 22, y1 + 260, 430, 18, songfolder) if (draw_button2(x1 + 22, y1 + 276, 76, "Open")) { - if (!directory_exists(songfolder)) { + if (!directory_exists_lib(songfolder)) { message("The indicated folder doesn't exist!", "Error") } else { open_url(songfolder) @@ -116,10 +116,10 @@ if (selected_tab = 0) { } if (draw_button2(x1 + 22 + 84 + 84, y1 + 276, 96, "Use default")) songfolder = songs_directory - draw_text(x1 + 22, y1 + 310, "Pattern folder: " + string_maxwidth(patternfolder, 360) + condstr(string_width(patternfolder) > 360, "...")) + draw_text(x1 + 22, y1 + 310, "Pattern folder: " + string_truncate(patternfolder, 360)) popup_set_window(x1 + 22, y1 + 300, 430, 18, patternfolder) if (draw_button2(x1 + 22, y1 + 326, 76, "Open")) { - if (!directory_exists(patternfolder)) { + if (!directory_exists_lib(patternfolder)) { message("The indicated folder doesn't exist!", "Error") } else { open_url(patternfolder) @@ -142,13 +142,7 @@ if (selected_tab = 0) { if (draw_checkbox(x1 + 40, y1 + 200, fade, "No fading", "Disables transparency animations on note block sprites")) fade = !fade if (draw_checkbox(x1 + 40, y1 + 220, show_layers, "Show layer boxes", "Whether the layer boxes should be\nshown to the right of the workspace.")) show_layers = !show_layers draw_areaheader(x1 + 22, y1 + 260, 456, 95, "Piano") - if (draw_checkbox(x1 + 40, y1 + 276, show_piano, "Show piano", "Whether the piano should be visible.")) { - show_piano=!show_piano - rhval=130 - if show_piano = 1 { - rhval=270 - } -} + if (draw_checkbox(x1 + 40, y1 + 276, show_piano, "Show piano", "Whether the piano should be visible.")) show_piano = !show_piano if (draw_checkbox(x1 + 40, y1 + 296, show_keynames, "Show key names", "If the names of the keys should be shown.")) show_keynames=!show_keynames if (draw_checkbox(x1 + 40, y1 + 316, show_keyboard, "Show keyboard shortcuts", "Show the keyboard shortcuts of the keys.")) show_keyboard=!show_keyboard if (draw_checkbox(x1 + 40, y1 + 336, show_notechart, "Show note chart when hovering over keys", "Whether to show a note chart\nwhen hovering over the keys.")) show_notechart=!show_notechart diff --git a/scripts/draw_window_properties/draw_window_properties.gml b/scripts/draw_window_properties/draw_window_properties.gml index 15c81fd93..6b9babe1a 100644 --- a/scripts/draw_window_properties/draw_window_properties.gml +++ b/scripts/draw_window_properties/draw_window_properties.gml @@ -3,16 +3,16 @@ var x1, y1, a; curs = cr_default text_exists[0] = 0 x1 = floor(window_width / 2 - 220) -y1 = floor(window_height / 2 - 215) -draw_window(x1, y1, x1 + 440, y1 + 430) +y1 = floor(window_height / 2 - 180) +draw_window(x1, y1, x1 + 440, y1 + 360) draw_set_font(fnt_mainbold) draw_text(x1 + 8, y1 + 8, "Song Properties") draw_set_font(fnt_main) if (theme = 0) { draw_set_color(c_white) - draw_rectangle(x1 + 6, y1 + 26, x1 + 434, y1 + 392, 0) + draw_rectangle(x1 + 6, y1 + 26, x1 + 434, y1 + 322, 0) draw_set_color(make_color_rgb(137, 140, 149)) - draw_rectangle(x1 + 6, y1 + 26, x1 + 434, y1 + 392, 1) + draw_rectangle(x1 + 6, y1 + 26, x1 + 434, y1 + 322, 1) } draw_areaheader(x1 + 22, y1 + 48, 396, 200, "Information") @@ -41,38 +41,18 @@ a = song_desc song_desc = draw_textarea(4, x1 + 158, y1 + 64 + 23 * 3, 240, 100, song_desc, "Enter a description for your song.") if (a != song_desc) changed = 1 -draw_areaheader(x1 + 22, y1 + 270, 396, 70, "Auto-saving") -a = autosave -if (draw_checkbox(x1 + 40, y1 + 290, autosave, "Enable auto-saving", "Whether the song should automatically\nbe saved every now and then.")) autosave=!autosave -if (a != autosave) { - changed = 1 - if (autosave = 0) tonextsave = 0 - if (autosave = 1) tonextsave = autosavemins -} -draw_theme_color() -if (autosave = 0) { - draw_set_color(c_white) - draw_text(x1 + 71, y1 + 311, "Minutes between savings:") - draw_set_color(8421504) -} -draw_text(x1 + 70, y1 + 310, "Minutes between savings:") -a = autosavemins -autosavemins = median(1, draw_dragvalue(2, x1 + 220, y1 + 310, autosavemins, 1, !autosave), 60) -if (autosavemins != a) {changed = 1 tonextsave = autosavemins} -popup_set_window(x1 + 70, y1 + 310, 180, 16, "The amount of minutes between each auto-save.") - draw_theme_color() -draw_text(x1 + 32, y1 + 348, "Time signature:") -timesignature = median(2, draw_dragvalue(3, x1 + 120, y1 + 348, timesignature, 1), 8) -draw_text(x1 + 120 + string_width(string(timesignature)), y1 + 348, " / 4") -popup_set_window(x1 + 32, y1 + 346, 110, 18, "The time signature of the song.") +draw_text(x1 + 32, y1 + 270, "Time signature:") +timesignature = median(2, draw_dragvalue(3, x1 + 120, y1 + 270, timesignature, 1), 8) +draw_text(x1 + 120 + string_width(string(timesignature)), y1 + 270, " / 4") +popup_set_window(x1 + 32, y1 + 268, 110, 18, "The time signature of the song.") -draw_text(x1 + 232, y1 + 348, "Loop start tick:") -loopstart = median(0, draw_dragvalue(7, x1 + 320, y1 + 348, loopstart, 0.5), obj_controller.enda) +draw_text(x1 + 232, y1 + 270, "Loop start tick:") +loopstart = median(0, draw_dragvalue(7, x1 + 320, y1 + 270, loopstart, 0.5), obj_controller.enda) -draw_text(x1 + 232, y1 + 368, "Times to loop:") -loopmax = median(0, draw_dragvalue(13, x1 + 320, y1 + 368, loopmax, 0.5), 10) -if loopmax = 0 draw_text(x1 + 340, y1 + 368, "(infinite)") +draw_text(x1 + 232, y1 + 290, "Times to loop:") +loopmax = median(0, draw_dragvalue(13, x1 + 320, y1 + 290, loopmax, 0.5), 10) +if loopmax = 0 draw_text(x1 + 340, y1 + 290, "(infinite)") timestoloop = loopmax -if (draw_button2(x1 + 320, y1 + 398, 72, "OK")) {window = 0} +if (draw_button2(x1 + 320, y1 + 328, 72, "OK")) {window = 0} window_set_cursor(curs) diff --git a/scripts/draw_window_songinfo/draw_window_songinfo.gml b/scripts/draw_window_songinfo/draw_window_songinfo.gml index 8be2c964b..4c867059c 100644 --- a/scripts/draw_window_songinfo/draw_window_songinfo.gml +++ b/scripts/draw_window_songinfo/draw_window_songinfo.gml @@ -1,5 +1,5 @@ // draw_window_songinfo() -var x1, y1, a, b, n, str, w, h, yy, w1, w2, w3, w4, col, r, g, b, str2, cut; +var x1, y1, a, b, n, str, w, h, yy, w1, w2, w3, w4, w5, w6, col, r, g, b, str2, cut; with (obj_popup) instance_destroy() global.popup = 0 if (song_name = "" && window = w_songinfo) {window = 0 return 0} @@ -12,16 +12,22 @@ if (str[0] = "") str[0] = "Untitled song" str[1] = song_author str[2] = song_orauthor +str[3] = song_midi draw_set_font(fnt_info_big) w = max(string_width(str[0]) + 32, 400) draw_set_font(fnt_info_med_bold) w2 = string_width(str[1]) w4 = string_width(str[2]) +draw_set_font(fnt_mainbold) +w6 = string_width(str[3]) draw_set_font(fnt_info_med) w1 = string_width("Created by ") w3 = string_width("Originally created by ") -w = max(w1 + w2, w) +draw_set_font(fnt_main) +w5 = string_width("Imported from ") +w = max(w1 + w2 + 32, w) w = max(w3 + w4 + 32, w) +w = max(w5 + w6 + 32, w) draw_set_font(fnt_main) var songdescwrap, songdeschei; songdescwrap = string_word_wrap(song_desc, 216) diff --git a/scripts/draw_window_update/draw_window_update.gml b/scripts/draw_window_update/draw_window_update.gml index abc20e6b2..253f62863 100644 --- a/scripts/draw_window_update/draw_window_update.gml +++ b/scripts/draw_window_update/draw_window_update.gml @@ -9,6 +9,7 @@ else draw_text(x1 + 8, y1 + 8, "Changelist") draw_set_font(fnt_main) if (window = w_update) draw_text(x1 + 32, y1 + 32, "Thank you for upgrading to version " + version + "!") fullstr = "" +fullstr += "Changes in v3.7.1 (2020.01.20):\n* Added an auto-updater. When a new version is available, Note Block Studio\nwill now be able to download and install it automatically. You don't even need\nto open your browser!\n* Pressing Shift while clicking 'Select all note blocks in this layer' will add those\nnotes to the selection rather than clearing it.\n* Holding Shift while dragging layer volumes/stereo will change them in\nincrements of 1, allowing a finer control.\n* Note panning is now prioritized over layer panning. Layers that haven't had\ntheir panning changed will not have any effect on note panning.\n* Re-added the option to import instruments from another song.\n* Bugfixes and improvements:\n * Fixed layer volume and stereo controls being too sensitive.\n * Fixed selection being automatically cleared once every minute.\n * Fixed contents of macro windows not being shown in some circumstances,\nforcing you to quit the program.\n * Fixed MIDI import setting pitch of all notes to +1.\n * Fixed lower notes not playing all the way through/stopping too early.\n * Fixed note count on 'Song stats' not being reset when creating a new song\n(and showing wrong percentages).\n * Fixed a crash when redoing a manual block placement.\n * Fixed a crash when opening the program with the greeting window disabled.\n * Fixed long recent file names overflowing the greeting window.\n * Fixed song area height being calculated incorrectly when the piano is\ndisabled.\n * Improved contrast of various pieces of text in the dark theme.\n * Removed the ability to drag the layer stereo controls with a window open.\n\n" fullstr += "Changes in v3.7.0 (2019.12.31):\n* Added a cool demo song to showcase the new features in 3.7.0!\n* It's now possible to set velocity, panning and detune on each individual note.\n* Added a metronome.\n* Added an option to display tempo as BPM rather than t/s.\n* Auto-save is now a global preference rather than being saved per song.\n* Added an auto-recovery feature so work is not lost if the program crashes.\n* Added Patterns. You can export note block data as a pattern, and import it\ninto whatever song you wish.\n* Note block songs now save song looping.\n* Added a bars/beats/sixteenths display.\n* Added lines that mark each bar in a song.\n* Added an option to choose if looping should wait for the end of the bar.\n* Added an option to show or hide layer boxes.\n* Added four edit modes, which allow you to change different properties of\nnotes (key/velocity/panning/pitch).\n* Holding Shift while scrolling over a note will change a whole octave, or\nfine-tune its velocity/panning/pitch.\n* Added Macros:\n(Accessible by right-clicking a selection, or from the new macro bar)\n * Tremolo\n * Stereo\n * Arpeggio\n * Portamento\n * Vibrato\n * Stagger\n * Chorus\n * Volume LFO\n * Fade in\n * Fade out\n * Replace key\n * Set velocity\n * Set panning\n * Set pitch\n* Added branch export, a new layout for exporting as schematics.\n* Added a metronome function.\n* Added layer management buttons (shift layers up and down, insert, delete).\n* Added a secret clipboard editor for power users.\n* (Slightly) Improved MIDI import, and made it support note velocity.\n* Improved data pack performance; impact on tick rate should be negligible.\n* Data packs can now export notes outside the octave range by providing\na resource pack.\n* Data packs can now be exported as ZIP.\n* Data packs now allow any tempo to be imported into Minecraft.\n* It's now possible to set a custom namespace and path for data pack functions.\n* Added six types of visualizers to data packs.\n* Double-clicking a NBS file will now open the song.\n* Added the ability to export songs in previous NBS format versions\nvia the Save Options window.\n* Note Block Studio will now refuse to load NBS versions made in the future.\n* NBS format updated to version 4.\n* Improved contrast of layer icons in dark theme.\n* Prevented dragging layer stereo from changing the song tempo.\n* Fixed 'Keys to show' resetting to 20 when enabling the piano.\n* Fixed crash in MP3 and data pack export.\n* Fixed crash on opening after updating.\n* Fixed memory leak from audio emitters piling up.\n\n" fullstr += "Changes in v3.6.0 (2019.08.08):\n* Added MP3 export option to select whether you want to include\n locked layers.\n* Added loop button to loop the current song.\n* Readded colored note blocks, added option for the shaped ones.\n* Added option to toggle piano visibility.\n* Updated icon.\n* NBS format updated to version 3. Now stores song length again.\n* Fixed an issue where there was an unintended gradient over sprites.\n* Fixed typo in preferences.\n* Fixed instrument icons being blank.\n* Fixed preferences not saving.\n\n" fullstr += "Changes in v3.5.1 (2019.07.14):\n* Fixed MIDI Import crash\n\n" diff --git a/scripts/file_get_size/file_get_size.gml b/scripts/file_get_size/file_get_size.gml new file mode 100644 index 000000000..f421b4cc9 --- /dev/null +++ b/scripts/file_get_size/file_get_size.gml @@ -0,0 +1,12 @@ +// file_get_size(path) +// Returns the size of a file, in bytes. + +var path, file, size +path = argument0 +if (file_exists(path)) { + file = file_bin_open(path, 0) + size = file_bin_size(file) + file_bin_close(file) + return size +} +return 0 diff --git a/scripts/file_get_size/file_get_size.yy b/scripts/file_get_size/file_get_size.yy new file mode 100644 index 000000000..e3111ed65 --- /dev/null +++ b/scripts/file_get_size/file_get_size.yy @@ -0,0 +1,8 @@ +{ + "id": "f136e3ca-963a-4648-ae87-60c3ee8476a9", + "modelName": "GMScript", + "mvc": "1.0", + "name": "file_get_size", + "IsCompatibility": false, + "IsDnD": false +} \ No newline at end of file diff --git a/scripts/get_update/get_update.gml b/scripts/get_update/get_update.gml new file mode 100644 index 000000000..a553622bc --- /dev/null +++ b/scripts/get_update/get_update.gml @@ -0,0 +1,29 @@ +// get_update() +// Attempts to download a newer version if one is available +// status: +// 1 - receiving packets (download in progress) +// 0 - success (download complete) + +if (async_load[? "id"] == update_download) { + var status = async_load[? "status"] + if (status == 1) { + downloaded_size = async_load[? "sizeDownloaded"] + total_size = async_load[? "contentLength"] + } else if (status == 0) { + // Download was interrupted, may have been successful or not (if connection was interrupted) + update = 5 + if (file_get_size(update_file) == total_size) { + show_message("Download complete! Click OK to begin installing the update.") + // At this point, the game is paused until the user dismisses the message + ExecuteShell("\"" + update_file + "\"", false, true) + game_end() + } else { + if (question("Failed to download update. Do you want to open the Note Block Studio website and update manually?", "Failed")) { + open_url(link_download) + } + window = w_greeting + update_download = -1 + update = 1 + } + } +} \ No newline at end of file diff --git a/scripts/get_update/get_update.yy b/scripts/get_update/get_update.yy new file mode 100644 index 000000000..48397d03e --- /dev/null +++ b/scripts/get_update/get_update.yy @@ -0,0 +1,8 @@ +{ + "id": "e74f03fa-1407-4d25-93ab-0dccb3eb91ca", + "modelName": "GMScript", + "mvc": "1.0", + "name": "get_update", + "IsCompatibility": false, + "IsDnD": false +} \ No newline at end of file diff --git a/scripts/import_midi/import_midi.gml b/scripts/import_midi/import_midi.gml index 21a98ecd9..8c3a489c0 100644 --- a/scripts/import_midi/import_midi.gml +++ b/scripts/import_midi/import_midi.gml @@ -130,7 +130,7 @@ for (t = 0; t < midi_tracks; t += 1) { // Add block, go lower if failed a = 0 while (1) { - if (add_block(pos, yy, instrument_list[| ins], note, vel, 100, true)) break + if (add_block(pos, yy, instrument_list[| ins], note, vel, 100, 0, true)) break yy += 1 a += 1 if (a >= w_midi_maxheight && w_midi_maxheight < 20) break diff --git a/scripts/load_instruments/load_instruments.gml b/scripts/load_instruments/load_instruments.gml index 7387ba305..711e488c6 100644 --- a/scripts/load_instruments/load_instruments.gml +++ b/scripts/load_instruments/load_instruments.gml @@ -1,69 +1,99 @@ -/// @description load_instruments(filename) -/// @function load_instruments -/// @param filename +// load_instruments(filename) +// Loads custom instruments from a song and adds them to the current song. -var fn, a, b, hei2; +var fn, a, b, nbsver, height; fn = argument0 if (fn = "") { - if (!directory_exists(songfolder)) songfolder = songs_directory + if (!directory_exists_lib(songfolder)) songfolder = songs_directory fn = string(get_open_filename_ext("Note Block Songs (*.nbs)|*.nbs", "", songfolder, "Load instruments from song")) } if (fn = "" || !file_exists_lib(fn)) return 0 - buffer = buffer_import(fn) -buffer_read_short() -hei2 = buffer_read_short() + +if (buffer_read_short() == 0) { + nbsver = buffer_read_byte() +} else { + nbsver = 0 +} + +// Future version +if (nbsver > nbs_version) { + message("Warning: You are opening an NBS file created in a later version of Note Block Studio.\nPlease save the song as a version " + string(nbs_version) + " file or lower via the Save Options menu.","Error") + return -1 +} + +// Header +if (nbsver >= 1) buffer_read_byte() // Custom instrument index +if (nbsver >= 3) buffer_read_short() // Song length +height = buffer_read_short() +buffer_read_string_int() // Song name +buffer_read_string_int() // Soung author +buffer_read_string_int() // Song original author +buffer_read_string_int() // Song description +buffer_read_short() // Tempo +buffer_read_byte() // Autosave +buffer_read_byte() // Autosave minutes +buffer_read_byte() // Time signature +buffer_read_int() // Minutes spent +buffer_read_int() // Left-clicks +buffer_read_int() // Right-clicks +buffer_read_int() // Blocks added +buffer_read_int() // Blocks removed +buffer_read_string_int() // MIDI filename +if (nbsver >= 4) { + buffer_read_byte() // Loop + buffer_read_byte() // Loop count + buffer_read_short() // Loop start tick +} -buffer_read_string_int() -buffer_read_string_int() -buffer_read_string_int() -buffer_read_string_int() -buffer_read_short() -buffer_read_byte() -buffer_read_byte() -buffer_read_byte() -a = buffer_read_int() -a = buffer_read_int() -a = buffer_read_int() -a = buffer_read_int() -a = buffer_read_int() -a = buffer_read_string_int() // Note blocks -while (1) { +while (true) { a = buffer_read_short() if (a = 0) break - while (1) { + while (true) { a = buffer_read_short() if (a = 0) break - repeat (2) buffer_read_byte() + buffer_read_byte() // Instrument + buffer_read_byte() // Key + if (nbsver >= 4) { + buffer_read_byte() // Velocity + buffer_read_byte() // Pan + buffer_read_short() // Pitch + } } } if (buffer_is_eof()) { - message("This file does not contain any custom instruments.", "Error") - return 0 + message("This file does not contain any custom instruments.", "Error") + return 0 } -//buffer_read_short() -for (b = 0; b < hei2; b += 1) { - buffer_read_string_int() - buffer_read_byte() + +// Layers +for (b = 0; b < height; b++) { + buffer_read_string_int() // Layer name + if (nbsver >= 4) buffer_read_byte() // Layer lock + buffer_read_byte() // Layer volume + if (nbsver >= 2) buffer_read_byte() // Layer stereo } if (buffer_is_eof()) { - message("This file does not contain any custom instruments.", "Error") - return 0 + message("This file does not contain any custom instruments.", "Error") + return 0 } + +// Instruments a = buffer_read_byte() if (a = 0) { message("This file does not contain any custom instruments.", "Error") return 0 } -for (b = 0; b < a; b += 1) { - var name = buffer_read_string_int(); - var filename = buffer_read_string_int(); - var key = buffer_read_byte(); - var press = buffer_read_byte(); - var ins = new_instrument(name, filename, true, press, key); +for (b = 0; b < a; b++) { + var name = buffer_read_string_int() + var filename = buffer_read_string_int() + var key = buffer_read_byte() + var press = buffer_read_byte() + var ins = new_instrument(name, filename, true, press, key) with (ins) instrument_load() ds_list_add(instrument_list, ins) } changed = true + diff --git a/scripts/load_settings/load_settings.gml b/scripts/load_settings/load_settings.gml index 765f1bca4..2822c9cd7 100644 --- a/scripts/load_settings/load_settings.gml +++ b/scripts/load_settings/load_settings.gml @@ -28,7 +28,7 @@ show_piano = ini_read_real( "preferences", "show_piano", show_p keysmax = ini_read_real( "preferences", "keys_to_show", keysmax) show_keynames = ini_read_real( "preferences", "show_keynames", show_keynames) show_keyboard = ini_read_real( "preferences", "show_keyboard", show_keyboard) -show_notechart = ini_read_real( "preferences", "show_numbers", show_numbers) +show_notechart = ini_read_real( "preferences", "show_notechart", show_notechart) mousewheel = ini_read_real( "preferences", "mousewheel", mousewheel) changepitch = ini_read_real( "preferences", "change_pitch", changepitch) select_lastpressed = ini_read_real( "preferences", "select_lastpressed", select_lastpressed) diff --git a/scripts/load_song/load_song.gml b/scripts/load_song/load_song.gml index 8925d81d9..85783d861 100644 --- a/scripts/load_song/load_song.gml +++ b/scripts/load_song/load_song.gml @@ -7,7 +7,7 @@ if (argument_count > 1) { } if (confirm() < 0) return 0 if (!backup && fn = "") { - if (!directory_exists(songfolder)) songfolder = songs_directory + if (!directory_exists_lib(songfolder)) songfolder = songs_directory fn = string(get_open_filename_ext("Note Block Songs (*.nbs)|*.nbs|MIDI Sequences (*.mid)|*.mid;*.midi|Minecraft Schematics (*.schematic)|*.schematic", "", songfolder, "Load song")) } if (fn = "" || !file_exists_lib(fn)) return 0 @@ -86,9 +86,7 @@ if (file_ext = ".nbs") { a = buffer_read_int() work_remove = max(0, a) // MIDI FILENAME - a = buffer_read_string_int() - if (filename_ext(a) = ".mid" || filename_ext(a) = ".midi") song_midi = a - else song_midi = "" + song_midi = buffer_read_string_int() // LOOP if (song_nbs_version >= 4) { loop = buffer_read_byte() diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index 0ede6f96e..3882a3fad 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -1,10 +1,10 @@ #macro gm_runtime_version "2.2.3.344" -#macro version_date "2019.12.31" -#macro version "3.7.0" +#macro version_date "2020.01.20" +#macro version "3.7.1" #macro nbs_version 4 #macro pat_version 1 -#macro link_download "https://github.com/HielkeMinecraft/OpenNoteBlockStudio/releases/latest" +#macro link_download "https://hielkeminecraft.github.io/OpenNoteBlockStudio/" #macro link_topic "https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-tools/2945101-open-minecraft-note-block-studio" #macro file_directory game_save_id @@ -14,6 +14,7 @@ #macro pattern_directory data_directory + "Patterns\\" #macro log_file file_directory + "log.txt" #macro temp_file file_directory + "tmp.file" +#macro update_file file_directory + "Minecraft Note Block Studio Installer.exe" #macro settings_file file_directory + "settings.ini" #macro backup_file file_directory + "backup.nbs" @@ -40,7 +41,7 @@ #macro w_releasemouse 29 #macro w_mididevices 28 #macro w_dragvol 27 -#macro w_dragstereo 30 +#macro w_dragstereo 41 #macro w_dragsection_end 26 #macro w_dragsection_start 25 #macro w_dragselection 24 diff --git a/scripts/menu_click/menu_click.gml b/scripts/menu_click/menu_click.gml index 5e519ccd6..5410df6ba 100644 --- a/scripts/menu_click/menu_click.gml +++ b/scripts/menu_click/menu_click.gml @@ -55,6 +55,9 @@ switch (m) { break } case "edit": { + if ((editmode = m_key) && (sel >= 15)) { + sel += 2 + } if (sel = 0) action_undo() if (sel = 1) action_redo() if (sel = 2) action_copy() @@ -96,6 +99,9 @@ switch (m) { break } case "editext": { + if ((editmode = m_key) && (sel >= 15)) { + sel += 2 + } if (sel = 0) action_copy() if (sel = 1) action_cut() if (sel = 2) action_paste(obj_menu.pastex, obj_menu.pastey) @@ -119,7 +125,7 @@ switch (m) { if (sel = 14) mode_action(4) if (sel = 15 && editmode != m_key) mode_action(5) if (sel = 16 && editmode != m_key) mode_action(6) - if (sel > 17 && sel < 16 + ds_list_size(instrument_list)) selection_changeins(instrument_list[| sel - 18]) + if (sel > 17 && sel < 18 + ds_list_size(instrument_list)) selection_changeins(instrument_list[| sel - 18]) if (sel = 18 + ds_list_size(instrument_list)) selection_expand() if (sel = 19 + ds_list_size(instrument_list)) selection_compress() if (sel = 21 + ds_list_size(instrument_list)) window = w_tremolo diff --git a/scripts/new_song/new_song.gml b/scripts/new_song/new_song.gml index 2b5a8ecd0..d22a596b7 100644 --- a/scripts/new_song/new_song.gml +++ b/scripts/new_song/new_song.gml @@ -1,5 +1,4 @@ // new_song() -song_midi = "" if (confirm() > -1) { reset() backup_clear() diff --git a/scripts/open_midi/open_midi.gml b/scripts/open_midi/open_midi.gml index e6ef0499c..115175408 100644 --- a/scripts/open_midi/open_midi.gml +++ b/scripts/open_midi/open_midi.gml @@ -25,7 +25,6 @@ if (r != 0 && r != 1 && r != 2) {message("Error loading MIDI file:\n\nFormat not midi_tracks = buffer_read_short_be() midifile = filename_name(fn) -song_midi = string(midifile) midi_trackamount[midi_tracks] = 0 reset_midi() midi_tempo = buffer_read_short_be() diff --git a/scripts/open_schematic/open_schematic.gml b/scripts/open_schematic/open_schematic.gml index 956e6a17f..a53328d1a 100644 --- a/scripts/open_schematic/open_schematic.gml +++ b/scripts/open_schematic/open_schematic.gml @@ -444,7 +444,7 @@ with (new(obj_dummy)) { if (debugstr) str += chr(13) + chr(10) + "Added note block no. " + string(queuenoteblocks) + "!" with (obj_controller) { d = sqrt(2000 * 256 * 2000) - while (!add_block(start + cd, b, instrument_list[| a], c)) b += 1 + while (!add_block(start + cd, b, instrument_list[| a], c, 100, 100, 0)) b += 1 } break } diff --git a/scripts/pattern_export/pattern_export.gml b/scripts/pattern_export/pattern_export.gml index 305c5a4dd..60fb36cc2 100644 --- a/scripts/pattern_export/pattern_export.gml +++ b/scripts/pattern_export/pattern_export.gml @@ -5,7 +5,7 @@ if (selected = 0) return 0 if (fn = "") { playing = 0 fsave = filename_name(filename) - if (!directory_exists(patternfolder)) patternfolder = pattern_directory + if (!directory_exists_lib(patternfolder)) patternfolder = pattern_directory fn = string(get_save_filename_ext("Note Block Pattern (*.nbp)|*.nbp", fsave, patternfolder, "Save pattern")) if (fn = "") return 0 } diff --git a/scripts/pattern_import/pattern_import.gml b/scripts/pattern_import/pattern_import.gml index 0f6f55ed2..2c9cc5ef4 100644 --- a/scripts/pattern_import/pattern_import.gml +++ b/scripts/pattern_import/pattern_import.gml @@ -4,7 +4,7 @@ var a, b, fn, file_ext, nw, temp_colfirst, temp_enda, temp_endb, temp_collast, t fn = "" if (selected != 0) return 0 if (fn = "") { - if (!directory_exists(patternfolder)) patternfolder = pattern_directory + if (!directory_exists_lib(patternfolder)) patternfolder = pattern_directory fn = string(get_open_filename_ext("Note Block Pattern (*.nbp)|*.nbp", "", patternfolder, "Load pattern")) } if (fn = "" || !file_exists_lib(fn)) return 0 diff --git a/scripts/play_sound/play_sound.gml b/scripts/play_sound/play_sound.gml index c3b52eb18..8dd1ccd0a 100644 --- a/scripts/play_sound/play_sound.gml +++ b/scripts/play_sound/play_sound.gml @@ -26,5 +26,5 @@ audio_play_sound_on(emitter,ins.sound, 0, 0) //Schedule emitter to be deleted from memory newemitter = ds_list_create() ds_list_add(newemitter,emitter) //store emitter id -ds_list_add(newemitter, (audio_sound_length(ins.sound) * 600000) + get_timer()) //store moment of which the emitter should be removed +ds_list_add(newemitter, (audio_sound_length(ins.sound) * 1000000 * (1/audio_emitter_get_pitch(emitter))) + get_timer()) //store moment at which the emitter should be removed ds_list_add(emitters_to_remove, newemitter) \ No newline at end of file diff --git a/scripts/remove_block/remove_block.gml b/scripts/remove_block/remove_block.gml index 82157939f..2d5ccb943 100644 --- a/scripts/remove_block/remove_block.gml +++ b/scripts/remove_block/remove_block.gml @@ -8,6 +8,7 @@ song_exists[xx, yy] = 0 song_ins[xx, yy].num_blocks-- if (song_key[xx, yy] < 33 || song_key[xx, yy] > 57) block_outside -= 1 if (song_ins[xx, yy].user) block_custom -= 1 +if (song_pit[xx, yy] != 0) block_pitched -= 1 song_ins[xx, yy] = 0 song_key[xx, yy] = 0 song_vel[xx, yy] = 0 diff --git a/scripts/remove_block_manual/remove_block_manual.gml b/scripts/remove_block_manual/remove_block_manual.gml index 632ad4bc0..777d77c39 100644 --- a/scripts/remove_block_manual/remove_block_manual.gml +++ b/scripts/remove_block_manual/remove_block_manual.gml @@ -13,6 +13,7 @@ pit = song_pit[xx, yy] ins.num_blocks-- if (song_key[xx, yy] < 33 || song_key[xx, yy] > 57) block_outside -= 1 if (ins.user) block_custom -= 1 +if (song_pit[xx, yy] != 0) block_pitched -= 1 song_ins[xx, yy] = 0 song_key[xx, yy] = 0 song_vel[xx, yy] = 0 diff --git a/scripts/remove_block_select/remove_block_select.gml b/scripts/remove_block_select/remove_block_select.gml index 827181857..b422d7b47 100644 --- a/scripts/remove_block_select/remove_block_select.gml +++ b/scripts/remove_block_select/remove_block_select.gml @@ -8,6 +8,7 @@ song_exists[xx, yy] = 0 song_ins[xx, yy].num_blocks-- if (song_key[xx, yy] < 33 || song_key[xx, yy] > 57) block_outside -= 1 if (song_ins[xx, yy].user) block_custom -= 1 +if (song_pit[xx, yy] != 0) block_pitched -= 1 song_ins[xx, yy] = 0 song_key[xx, yy] = 0 diff --git a/scripts/reset/reset.gml b/scripts/reset/reset.gml index 50dc57e9b..ae05c3085 100644 --- a/scripts/reset/reset.gml +++ b/scripts/reset/reset.gml @@ -26,6 +26,7 @@ for (a = 0; a <= enda; a += 1) { // File filename = "" changed = 0 +song_midi = midifile midifile = "" // Playback @@ -47,6 +48,7 @@ endb2 = 0 compatible = 1 block_outside = 0 block_custom = 0 +block_pitched = 0 colamount[0] = 0 rowamount[0] = 0 @@ -116,6 +118,12 @@ with (obj_instrument) { user_instruments = 0 instrument = instrument_list[| 0] +// Reset note count per instrument +for (a = 0; a < ds_list_size(instrument_list); a++) { + var ins = instrument_list[| a] + ins.num_blocks = 0 +} + // Macros stereo_reverse = 0 tremolotype = 0 diff --git a/scripts/save_song/save_song.gml b/scripts/save_song/save_song.gml index a9eac5c96..af8117fbb 100644 --- a/scripts/save_song/save_song.gml +++ b/scripts/save_song/save_song.gml @@ -8,11 +8,11 @@ if (argument_count > 1) { if ((!backup) && (fn = "" || filename_ext(filename) != ".nbs")) { playing = 0 fsave = filename_name(filename) - if (!directory_exists(songfolder)) songfolder = songs_directory + if (!directory_exists_lib(songfolder)) songfolder = songs_directory fn = string(get_save_filename_ext("Note Block Songs (*.nbs)|*.nbs", fsave, songfolder, "Save song")) if (fn = "") return 0 } -if (selected > 0) selection_place(0) +if ((!backup) && (selected > 0)) selection_place(0) if (backup) { nbsver = nbs_version diff --git a/scripts/selection_draw/selection_draw.gml b/scripts/selection_draw/selection_draw.gml index 512022210..8d0854593 100644 --- a/scripts/selection_draw/selection_draw.gml +++ b/scripts/selection_draw/selection_draw.gml @@ -18,7 +18,11 @@ if (floor(marker_pos) != floor(marker_prevpos) && marker_pos >= selection_x && m if (selection_exists[xx, b]) { a = 1 if (selection_y + b < endb2) c = (layervol[selection_y + b] / 100) * selection_vel[xx,b] - if (selection_y + b < endb2) d = (layerstereo[selection_y + b] + selection_pan[xx,b]) / 2 + if (selection_y + b < endb2) { + if layerstereo[selection_y + b] = 100 { + d = selection_pan[xx,b] + } else d = (layerstereo[selection_y + b] + selection_pan[xx,b]) / 2 + } if (selection_y + b < endb2) e = selection_pit[xx,b] if (solostr != "") { if (string_count("|" + string(selection_y + b) + "|", solostr) = 0) { diff --git a/scripts/string_truncate/string_truncate.gml b/scripts/string_truncate/string_truncate.gml new file mode 100644 index 000000000..b95d3b82b --- /dev/null +++ b/scripts/string_truncate/string_truncate.gml @@ -0,0 +1,11 @@ +// string_truncate(str, maxwidth) +// Truncates a string to maxwidth and adds ellipses (...) at the end + +var str, maxwidth +str = argument0 +maxwidth = argument1 + +if (string_width(str) > maxwidth) { + return string_maxwidth(str, maxwidth) + "..." +} +return str \ No newline at end of file diff --git a/scripts/string_truncate/string_truncate.yy b/scripts/string_truncate/string_truncate.yy new file mode 100644 index 000000000..7a9e3a68e --- /dev/null +++ b/scripts/string_truncate/string_truncate.yy @@ -0,0 +1,8 @@ +{ + "id": "d3a39dce-0492-40fc-8e8d-a08108169343", + "modelName": "GMScript", + "mvc": "1.0", + "name": "string_truncate", + "IsCompatibility": false, + "IsDnD": false +} \ No newline at end of file diff --git a/scripts/toggle_playing/toggle_playing.gml b/scripts/toggle_playing/toggle_playing.gml index 96c30dbb2..3e3d3a103 100644 --- a/scripts/toggle_playing/toggle_playing.gml +++ b/scripts/toggle_playing/toggle_playing.gml @@ -26,7 +26,9 @@ if (playing = 1) { e = 0 if (b < endb2) { c = (layervol[b] / 100 ) * song_vel[xx, b] - d = (layerstereo[b] / 100 ) * song_pan[xx, b] + if layerstereo[b] = 100 { + d = song_pan[xx, b] + } else d = (layerstereo[b] + song_pan[xx, b]) / 2 e = song_pit[xx, b] } if (solostr != "") { diff --git a/views/56f20c67-9fcc-4085-9cad-4785628f8831.yy b/views/56f20c67-9fcc-4085-9cad-4785628f8831.yy index 4ac67695c..393d5fa7b 100644 --- a/views/56f20c67-9fcc-4085-9cad-4785628f8831.yy +++ b/views/56f20c67-9fcc-4085-9cad-4785628f8831.yy @@ -15,7 +15,9 @@ "caf03170-c1fc-42ce-abd4-cc04c23cc07e", "0ce5a906-0342-42fb-89f3-04f3609f5689", "3ef34f15-11b7-471c-aa91-4f191100f959", - "0097ab11-b126-461a-8194-e3aaf09a6ddd" + "0097ab11-b126-461a-8194-e3aaf09a6ddd", + "3c1514e1-5885-49b4-86ef-115f1fdec3ea", + "e74f03fa-1407-4d25-93ab-0dccb3eb91ca" ], "filterType": "GMScript", "folderName": "Controller", diff --git a/views/851a6098-0a35-48ef-8f86-8d6cd677f3fd.yy b/views/851a6098-0a35-48ef-8f86-8d6cd677f3fd.yy index 102e78982..eef07bed5 100644 --- a/views/851a6098-0a35-48ef-8f86-8d6cd677f3fd.yy +++ b/views/851a6098-0a35-48ef-8f86-8d6cd677f3fd.yy @@ -21,6 +21,7 @@ "28131748-b621-459e-952c-fcd16de0bd8b", "36bf530d-9afd-4915-8e0f-6d9162ea03b2", "f6cfba59-defd-47c1-b2fa-8fa627a1c1a4", + "252af0d3-fda0-4686-99ee-e50c77599791", "ffdb58ba-3567-4019-acf7-c6e674131bbb", "bb77e968-5a4f-4c9d-954b-7ddca77d2c0a", "a38ae6de-e436-4b50-af0b-964bf5f26cd9", diff --git a/views/8f90c88c-a49b-4a15-b19e-952f818913ff.yy b/views/8f90c88c-a49b-4a15-b19e-952f818913ff.yy index eec654836..c3d606364 100644 --- a/views/8f90c88c-a49b-4a15-b19e-952f818913ff.yy +++ b/views/8f90c88c-a49b-4a15-b19e-952f818913ff.yy @@ -8,6 +8,7 @@ "c54d19c6-44b4-403d-83b5-46645ef6d7d0", "9aa9d93b-2ff5-4629-af23-f0e369bc6008", "c1ae4275-cc48-48bb-bc3a-7c638ac064ec", + "d3a39dce-0492-40fc-8e8d-a08108169343", "684ae517-6f0d-4c08-b1ff-3863deb988e9", "6d1d68e3-6bec-469d-80a7-1033b318611c", "b3da5933-67e7-4020-9adf-2298e0500949", diff --git a/views/a89d59b8-0ac7-4c34-a3aa-a1c4e95fa1e3.yy b/views/a89d59b8-0ac7-4c34-a3aa-a1c4e95fa1e3.yy index 71b17a16a..8bfea894a 100644 --- a/views/a89d59b8-0ac7-4c34-a3aa-a1c4e95fa1e3.yy +++ b/views/a89d59b8-0ac7-4c34-a3aa-a1c4e95fa1e3.yy @@ -16,7 +16,8 @@ "395e2149-7095-4b85-9a90-9b808723ddb7", "af9a3525-3682-420e-b2a0-d952cc347296", "a0fe9bd7-a654-4de6-abd8-41b5be7e41a8", - "7dfa1c5c-2dd7-4604-a776-ff2a1c2d26b0" + "7dfa1c5c-2dd7-4604-a776-ff2a1c2d26b0", + "f136e3ca-963a-4648-ae87-60c3ee8476a9" ], "filterType": "GMScript", "folderName": "File",