From 08ecb013b213970f6b0013a9e4540d9391f41095 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Wed, 1 Jan 2020 03:42:41 -0300 Subject: [PATCH 01/30] Fix wrong menu actions in key edit mode Since there are two fewer menu items on the key edit mode, the actions following 'Decrease key' were all incorrect. The code now makes up for that by adding 2 to 'sel' (the number of the menu item clicked) when it is greater than that value and when editing the key. --- scripts/menu_click/menu_click.gml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 From 5c20d43abfb966079541a860d75330578e6a9b2e Mon Sep 17 00:00:00 2001 From: ShinkoNet Date: Sun, 5 Jan 2020 15:53:38 +1100 Subject: [PATCH 02/30] Note panning is prioritized over layer panning When layer panning is mono, note panning does not average. --- scripts/control_draw/control_draw.gml | 4 +++- scripts/selection_draw/selection_draw.gml | 6 +++++- scripts/toggle_playing/toggle_playing.gml | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index 0f5ed08d6..8de764afe 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -280,7 +280,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 != "") { 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/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 != "") { From ffa292a6c214e9d79d51ff745b0bee6974f62aed Mon Sep 17 00:00:00 2001 From: Bentroen Date: Sun, 5 Jan 2020 20:31:28 -0300 Subject: [PATCH 03/30] Revert directory exists check to use external library Due to the sandbox, using the built-in functions won't work in most of these cases (e.g. the song and pattern folders were always reported as non-existing). Fixes part of #106 --- scripts/dat_makefolders/dat_makefolders.gml | 2 +- scripts/draw_window_preferences/draw_window_preferences.gml | 4 ++-- scripts/load_instruments/load_instruments.gml | 2 +- scripts/load_song/load_song.gml | 2 +- scripts/pattern_export/pattern_export.gml | 2 +- scripts/pattern_import/pattern_import.gml | 2 +- scripts/save_song/save_song.gml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) 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/draw_window_preferences/draw_window_preferences.gml b/scripts/draw_window_preferences/draw_window_preferences.gml index abae76a59..00663b2a6 100644 --- a/scripts/draw_window_preferences/draw_window_preferences.gml +++ b/scripts/draw_window_preferences/draw_window_preferences.gml @@ -103,7 +103,7 @@ if (selected_tab = 0) { draw_text(x1 + 22, y1 + 260, "Song folder: " + string_maxwidth(songfolder, 360) + condstr(string_width(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) @@ -119,7 +119,7 @@ if (selected_tab = 0) { draw_text(x1 + 22, y1 + 310, "Pattern folder: " + string_maxwidth(patternfolder, 360) + condstr(string_width(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) diff --git a/scripts/load_instruments/load_instruments.gml b/scripts/load_instruments/load_instruments.gml index 7387ba305..cba79e91c 100644 --- a/scripts/load_instruments/load_instruments.gml +++ b/scripts/load_instruments/load_instruments.gml @@ -5,7 +5,7 @@ var fn, a, b, hei2; 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 diff --git a/scripts/load_song/load_song.gml b/scripts/load_song/load_song.gml index 8925d81d9..dd49dc720 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 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/save_song/save_song.gml b/scripts/save_song/save_song.gml index a9eac5c96..1d04a31c4 100644 --- a/scripts/save_song/save_song.gml +++ b/scripts/save_song/save_song.gml @@ -8,7 +8,7 @@ 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 } From 8133f78284556471699f734921e3174abe69f151 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Sun, 5 Jan 2020 20:36:49 -0300 Subject: [PATCH 04/30] Fix 'Show note chart' preference not being loaded properly It was loading the value from the 'Show key numbers' entry instead. Fixes #106 --- scripts/load_settings/load_settings.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From 9545a5ebcdd56994fed2f1268485122010a79227 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Sun, 5 Jan 2020 20:55:04 -0300 Subject: [PATCH 05/30] Prevent macro windows from locking the program If the selection was cleared between clicking a macro and its window opening, the window and title would be drawn, but not the rest, leaving you locked in it. Fixes part of #107 --- .../draw_window_macro_arpeggio/draw_window_macro_arpeggio.gml | 2 +- .../draw_window_macro_portamento.gml | 2 +- .../draw_window_macro_setpanning.gml | 3 ++- .../draw_window_macro_setpitch/draw_window_macro_setpitch.gml | 2 +- .../draw_window_macro_setvelocity.gml | 2 +- .../draw_window_macro_stagger/draw_window_macro_stagger.gml | 2 +- scripts/draw_window_macro_stereo/draw_window_macro_stereo.gml | 2 +- .../draw_window_macro_tremolo/draw_window_macro_tremolo.gml | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) 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) From 144474f46e3e73cf2e047fb16b50d08e134c272a Mon Sep 17 00:00:00 2001 From: Bentroen Date: Sun, 5 Jan 2020 20:56:22 -0300 Subject: [PATCH 06/30] Prevent auto-recovery save from clearing the selection Fixes #107 --- scripts/save_song/save_song.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/save_song/save_song.gml b/scripts/save_song/save_song.gml index 1d04a31c4..af8117fbb 100644 --- a/scripts/save_song/save_song.gml +++ b/scripts/save_song/save_song.gml @@ -12,7 +12,7 @@ if ((!backup) && (fn = "" || filename_ext(filename) != ".nbs")) { 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 From 305b818b6bf24a45a94a676ccf72d1063cf1836b Mon Sep 17 00:00:00 2001 From: Bentroen Date: Mon, 6 Jan 2020 01:09:23 -0300 Subject: [PATCH 07/30] Fix layer volume and stereo dragging being too sensitive Commit e5d94dfce9ac7bdd81277fee0f09a8f12847df0f was causing the dragging code for layer volume and stereo to be executed as many layers as there were on the screen, making it too sensitive (moving the mouse just a little bit would apply the intended difference many times over). Fixes #104. --- scripts/control_draw/control_draw.gml | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index 8de764afe..367f391ab 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -929,22 +929,22 @@ 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) * 2 + dragvol = median(0, dragvol, 100) + layervol[dragvolb] = floor(dragvol / 10) * 10 + if (!mouse_check_button(mb_left)) { + window = w_releasemouse } - 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 (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 } } // Macro Bar From 43951436f450a316102adc52bf3cf86a24441a6e Mon Sep 17 00:00:00 2001 From: Bentroen Date: Mon, 6 Jan 2020 01:20:42 -0300 Subject: [PATCH 08/30] Remove the ability to drag layer stereo with a window open Also fixed: data pack export and stereo drag were using the same window ID --- scripts/control_create/control_create.gml | 1 - scripts/control_draw/control_draw.gml | 11 +++++------ scripts/macros/macros.gml | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/control_create/control_create.gml b/scripts/control_create/control_create.gml index 1bc1391b7..2995c7ec5 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 diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index 367f391ab..b64ebc927 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -859,7 +859,7 @@ 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 { @@ -877,7 +877,7 @@ for (b = 0; b < totalrows; b += 1) { 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] } @@ -938,13 +938,12 @@ if (window = w_dragvol) { window = w_releasemouse } } -if (window2 = w_dragstereo) { +if (window = 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 + window = w_releasemouse } } // Macro Bar @@ -1261,7 +1260,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 diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index 0ede6f96e..aa1975f6e 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -40,7 +40,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 From 0895fecf713af01f1167069a31916b4e17e2106c Mon Sep 17 00:00:00 2001 From: Bentroen Date: Mon, 6 Jan 2020 01:38:02 -0300 Subject: [PATCH 09/30] Allow appending all notes in a layer to the selection by holding Shift Previously, clicking 'Select all note blocks in this layer' would always clear the selection prior to the operation --- scripts/control_draw/control_draw.gml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index b64ebc927..e06fac767 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -903,9 +903,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 From 9fead0c0e046cc1d7e848c71334ea3972ef126c6 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Mon, 6 Jan 2020 04:41:21 -0300 Subject: [PATCH 10/30] Allow precise control of layer volume/stereo by holding Shift - Layer volume and stereo can now be changed in increments of 1, not only 10 - Made normal control (without holding Shift) a bit less sensitive --- scripts/control_draw/control_draw.gml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index e06fac767..2169cdb72 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -933,17 +933,25 @@ for (b = 0; b < totalrows; b += 1) { } } if (window = w_dragvol) { - dragvol += (mouse_yprev - mouse_y) * 2 + dragvol += (mouse_yprev - mouse_y) dragvol = median(0, dragvol, 100) - layervol[dragvolb] = floor(dragvol / 10) * 10 + if (!keyboard_check(vk_shift)) { + layervol[dragvolb] = floor(dragvol / 10) * 10 + } else { + layervol[dragvolb] = dragvol + } if (!mouse_check_button(mb_left)) { window = w_releasemouse } } if (window = w_dragstereo) { - dragstereo += (mouse_yprev - mouse_y) * 2 + dragstereo += (mouse_yprev - mouse_y) dragstereo = median(0, dragstereo, 200) - layerstereo[dragstereob] = floor(dragstereo / 10) * 10 + if (!keyboard_check(vk_shift)) { + layerstereo[dragstereob] = floor(dragstereo / 10) * 10 + } else { + layerstereo[dragstereob] = dragstereo + } if (!mouse_check_button(mb_left)) { window = w_releasemouse } From a9e54903d7a7ce5cc5fbf0ea6508fcf2c10a4f6c Mon Sep 17 00:00:00 2001 From: Bentroen Date: Tue, 7 Jan 2020 02:05:31 -0300 Subject: [PATCH 11/30] Fix MIDI import setting pitch of all notes to +1 The MIDI import code was passing a `true` parameter as the note pitch, which should be the value for something else. Since true = 1, all notes generated by it were receiving that pitch. Also fixed descriptions of some functions missing parameters. Discovered while testing #108 --- scripts/add_block/add_block.gml | 2 +- scripts/add_block_select/add_block_select.gml | 2 +- scripts/import_midi/import_midi.gml | 2 +- scripts/open_schematic/open_schematic.gml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/add_block/add_block.gml b/scripts/add_block/add_block.gml index f79ddcc1e..a629d5990 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] diff --git a/scripts/add_block_select/add_block_select.gml b/scripts/add_block_select/add_block_select.gml index 0da69bbca..5d14c98ad 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 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/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 } From 062a262363238cf1cd0b69b2ad924b9d015754ec Mon Sep 17 00:00:00 2001 From: Bentroen Date: Tue, 7 Jan 2020 17:48:41 -0300 Subject: [PATCH 12/30] Reset note count per instrument when creating a new song Fixes #89 --- scripts/reset/reset.gml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/reset/reset.gml b/scripts/reset/reset.gml index 50dc57e9b..e92470205 100644 --- a/scripts/reset/reset.gml +++ b/scripts/reset/reset.gml @@ -116,6 +116,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 From 03de267bf843bbfe128c7c5a246be5294e765c17 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Thu, 9 Jan 2020 03:24:13 -0300 Subject: [PATCH 13/30] Download update automatically when one is detected The function which previously only checked if an update was available (control_http) was split into two different functions, check_updates (previous functionality) and get_update, which will attempt to download the file. draw_loading, an obsolete function to draw a loading bar to the screen, was repurposed and now shows, in MB, how much is left for the download to complete (as well as the percentage). The program version was temporarily changed to 3.6.0 in order for it to detect updates (remember to revert this later, lol). Currently, if the connection is interrupted during the download, the program will still think the download was successful, even though the file was only partially downloaded. This happens because both the download status and HTTP status return the same value (0 and 200, respectively) both when the file is downloaded completely, and when it fails. A way for detecting if the download didn't complete is being investigated. --- Minecraft Note Block Studio.yyp | 18 ++++++++++ scripts/check_updates/check_updates.gml | 34 +++++++++++++++++++ scripts/check_updates/check_updates.yy | 8 +++++ scripts/control_create/control_create.gml | 3 ++ scripts/control_draw/control_draw.gml | 8 +++++ scripts/control_http/control_http.gml | 31 ++--------------- scripts/draw_loading/draw_loading.gml | 17 ++++++---- scripts/get_update/get_update.gml | 28 +++++++++++++++ scripts/get_update/get_update.yy | 8 +++++ scripts/macros/macros.gml | 5 +-- views/56f20c67-9fcc-4085-9cad-4785628f8831.yy | 4 ++- 11 files changed, 126 insertions(+), 38 deletions(-) create mode 100644 scripts/check_updates/check_updates.gml create mode 100644 scripts/check_updates/check_updates.yy create mode 100644 scripts/get_update/get_update.gml create mode 100644 scripts/get_update/get_update.yy diff --git a/Minecraft Note Block Studio.yyp b/Minecraft Note Block Studio.yyp index 4d5147f1f..8b073c947 100644 --- a/Minecraft Note Block Studio.yyp +++ b/Minecraft Note Block Studio.yyp @@ -1030,6 +1030,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": { @@ -3814,6 +3822,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": { @@ -4163,6 +4179,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", 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 2995c7ec5..edf6d76fd 100644 --- a/scripts/control_create/control_create.gml +++ b/scripts/control_create/control_create.gml @@ -337,6 +337,9 @@ 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 diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index 2169cdb72..66bea674d 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -1323,6 +1323,14 @@ if (mouse_check_button_released(mb_left)) { } if (window = w_releasemouse && !mouse_check_button(mb_left)) window = 0 draw_windows() + +// Draw update progress +if (update == 4) { + window = -1 + // show_debug_message(string(downloaded_size) + "/" + string(total_size)) + draw_loading("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/draw_loading/draw_loading.gml b/scripts/draw_loading/draw_loading.gml index e7fee6a14..8802b5ce6 100644 --- a/scripts/draw_loading/draw_loading.gml +++ b/scripts/draw_loading/draw_loading.gml @@ -1,8 +1,12 @@ -/*draw_loading(caption, desc, percent) -var caption, desc, perc, x1, y1; +// draw_loading(caption, desc, percent) +var caption, desc, done, total, done_mb, total_mb, percent, x1, y1; caption = argument0 desc = argument1 -perc = argument2 +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() @@ -13,10 +17,9 @@ 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 + perc * 240, y1 + 80, 0) +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 (perc > 0.5) draw_set_color(c_white) -draw_text(floor(window_width / 2), y1 + 65, string(floor(perc * 100)) + "% done") +if (percent > 0.5) draw_set_color(c_white) +draw_text(floor(window_width / 2), y1 + 65, string_format(done_mb, 0, 2) + "/" + string_format(total_mb, 0, 2) + " MB (" + string(round(percent * 100)) + "%)") draw_set_halign(fa_left) -screen_refresh() diff --git a/scripts/get_update/get_update.gml b/scripts/get_update/get_update.gml new file mode 100644 index 000000000..4279dd986 --- /dev/null +++ b/scripts/get_update/get_update.gml @@ -0,0 +1,28 @@ +// 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 http_status = async_load[? "http_status"] + var status = async_load[? "status"] + show_debug_message(string(http_status)) + if (status == 1) { + downloaded_size = async_load[? "sizeDownloaded"] + total_size = async_load[? "contentLength"] + } else if (status == 0) { + show_debug_message(string(http_status)) + 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/macros/macros.gml b/scripts/macros/macros.gml index aa1975f6e..bf9c3ecba 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 "3.6.0" #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 + "update.exe" #macro settings_file file_directory + "settings.ini" #macro backup_file file_directory + "backup.nbs" 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", From 89ca8079723fc60dbfa5ceb6207c5e5aa0b957e6 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Sat, 11 Jan 2020 02:41:37 -0300 Subject: [PATCH 14/30] Properly detect incomplete download The update system now detects if the download failed by comparing the file size against the total size sent by the server. This is done as soon as the "success" status is received and triggers either the success message, which closes the program and opens the installer, or an error message which asks if the user wants to open the website to update manually. Renamed the installer to 'Minecraft Note Block Studio Installer.exe' (more user-friendly in the User Account Control popup). --- Minecraft Note Block Studio.yyp | 9 +++++++++ scripts/control_draw/control_draw.gml | 19 +++++++++++++++++-- scripts/file_get_size/file_get_size.gml | 12 ++++++++++++ scripts/file_get_size/file_get_size.yy | 8 ++++++++ scripts/get_update/get_update.gml | 15 ++------------- scripts/macros/macros.gml | 2 +- views/a89d59b8-0ac7-4c34-a3aa-a1c4e95fa1e3.yy | 3 ++- 7 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 scripts/file_get_size/file_get_size.gml create mode 100644 scripts/file_get_size/file_get_size.yy diff --git a/Minecraft Note Block Studio.yyp b/Minecraft Note Block Studio.yyp index 8b073c947..7b026f2c0 100644 --- a/Minecraft Note Block Studio.yyp +++ b/Minecraft Note Block Studio.yyp @@ -3934,6 +3934,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": { @@ -4220,6 +4228,7 @@ "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", diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index 66bea674d..6a45a9ce6 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -1325,10 +1325,25 @@ if (window = w_releasemouse && !mouse_check_button(mb_left)) window = 0 draw_windows() // Draw update progress -if (update == 4) { +if (update == 4 or update == 5) { window = -1 - // show_debug_message(string(downloaded_size) + "/" + string(total_size)) draw_loading("Update", "Downloading update...", downloaded_size, total_size) + if (update == 5) { + if (file_get_size(update_file) == total_size) { + update = 1 + 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 + } + } } window_set_cursor(curs) 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 index 4279dd986..76d37e0aa 100644 --- a/scripts/get_update/get_update.gml +++ b/scripts/get_update/get_update.gml @@ -7,22 +7,11 @@ if (async_load[? "id"] == update_download) { var http_status = async_load[? "http_status"] var status = async_load[? "status"] - show_debug_message(string(http_status)) if (status == 1) { downloaded_size = async_load[? "sizeDownloaded"] total_size = async_load[? "contentLength"] } else if (status == 0) { - show_debug_message(string(http_status)) - 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 + // Download was interrupted, may have been successful or not (if connection was interrupted) + update = 5 } } \ No newline at end of file diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index bf9c3ecba..13b84508a 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -14,7 +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 + "update.exe" +#macro update_file file_directory + "Minecraft Note Block Studio Setup.exe" #macro settings_file file_directory + "settings.ini" #macro backup_file file_directory + "backup.nbs" 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", From 99b42913d3e9f2835b8cc8ee817ba4a02326535b Mon Sep 17 00:00:00 2001 From: Bentroen Date: Sat, 18 Jan 2020 01:30:57 -0300 Subject: [PATCH 15/30] Move update check back to the get_update script --- scripts/control_draw/control_draw.gml | 20 ++------------------ scripts/get_update/get_update.gml | 14 +++++++++++++- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index 6a45a9ce6..bcdbef5e0 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -1324,26 +1324,10 @@ if (mouse_check_button_released(mb_left)) { if (window = w_releasemouse && !mouse_check_button(mb_left)) window = 0 draw_windows() -// Draw update progress -if (update == 4 or update == 5) { +// Draw update progress bar +if (update == 4) { window = -1 draw_loading("Update", "Downloading update...", downloaded_size, total_size) - if (update == 5) { - if (file_get_size(update_file) == total_size) { - update = 1 - 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 - } - } } window_set_cursor(curs) diff --git a/scripts/get_update/get_update.gml b/scripts/get_update/get_update.gml index 76d37e0aa..8719eee3e 100644 --- a/scripts/get_update/get_update.gml +++ b/scripts/get_update/get_update.gml @@ -5,7 +5,6 @@ // 0 - success (download complete) if (async_load[? "id"] == update_download) { - var http_status = async_load[? "http_status"] var status = async_load[? "status"] if (status == 1) { downloaded_size = async_load[? "sizeDownloaded"] @@ -13,5 +12,18 @@ if (async_load[? "id"] == update_download) { } 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 From df25c8f0ec2202823afdd4fe4e8080cde0e04508 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Sat, 18 Jan 2020 01:41:27 -0300 Subject: [PATCH 16/30] Restore original draw_loading code and move new code to a new script Restored the original loading bar drawing code for historical reasons (despite unused, it's still mentioned in a few places in the code). Moved the download progress bar drawing code to a new script called draw_downloadprogress(). --- Minecraft Note Block Studio.yyp | 9 +++++++ scripts/control_draw/control_draw.gml | 2 +- .../draw_downloadprogress.gml | 25 +++++++++++++++++++ .../draw_downloadprogress.yy | 8 ++++++ views/851a6098-0a35-48ef-8f86-8d6cd677f3fd.yy | 1 + 5 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 scripts/draw_downloadprogress/draw_downloadprogress.gml create mode 100644 scripts/draw_downloadprogress/draw_downloadprogress.yy diff --git a/Minecraft Note Block Studio.yyp b/Minecraft Note Block Studio.yyp index 7b026f2c0..a560fb1d4 100644 --- a/Minecraft Note Block Studio.yyp +++ b/Minecraft Note Block Studio.yyp @@ -646,6 +646,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": { @@ -4303,6 +4311,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/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index bcdbef5e0..aab49422d 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -1327,7 +1327,7 @@ draw_windows() // Draw update progress bar if (update == 4) { window = -1 - draw_loading("Update", "Downloading update...", downloaded_size, total_size) + draw_downloadprogress("Update", "Downloading update...", downloaded_size, total_size) } window_set_cursor(curs) diff --git a/scripts/draw_downloadprogress/draw_downloadprogress.gml b/scripts/draw_downloadprogress/draw_downloadprogress.gml new file mode 100644 index 000000000..4769f1f4c --- /dev/null +++ b/scripts/draw_downloadprogress/draw_downloadprogress.gml @@ -0,0 +1,25 @@ +// draw_downloadprogress(caption, desc, downloaded_size, total_size) +var caption, desc, done, total, done_mb, total_mb, 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) +draw_text(floor(window_width / 2), y1 + 65, string_format(done_mb, 0, 2) + "/" + string_format(total_mb, 0, 2) + " MB (" + string(round(percent * 100)) + "%)") +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/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", From 279132a0868f59864b2f982170c845b3e0867383 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Sun, 19 Jan 2020 02:59:03 -0300 Subject: [PATCH 17/30] Minor optimizations to updater - Add quotation marks to the shell command to allow spaces in the filename - Draw a placeholder in the download progress bar while the file size isn't retrieved (-.-- instead of 0.00) - Restore original draw_loading() code (for sure this time) - Change "Setup" to "Installer" in the filename - Delete old installers on startup - Shift some stuff in the startup code - Restore version number to current version --- scripts/control_create/control_create.gml | 12 ++++++++++-- .../draw_downloadprogress.gml | 12 ++++++++++-- scripts/draw_loading/draw_loading.gml | 17 +++++++---------- scripts/get_update/get_update.gml | 2 +- scripts/macros/macros.gml | 4 ++-- 5 files changed, 30 insertions(+), 17 deletions(-) diff --git a/scripts/control_create/control_create.gml b/scripts/control_create/control_create.gml index edf6d76fd..b656f17dd 100644 --- a/scripts/control_create/control_create.gml +++ b/scripts/control_create/control_create.gml @@ -333,6 +333,8 @@ 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 @@ -344,7 +346,11 @@ 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)) { @@ -357,4 +363,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/draw_downloadprogress/draw_downloadprogress.gml b/scripts/draw_downloadprogress/draw_downloadprogress.gml index 4769f1f4c..9055e380d 100644 --- a/scripts/draw_downloadprogress/draw_downloadprogress.gml +++ b/scripts/draw_downloadprogress/draw_downloadprogress.gml @@ -1,5 +1,5 @@ // draw_downloadprogress(caption, desc, downloaded_size, total_size) -var caption, desc, done, total, done_mb, total_mb, percent, x1, y1; +var caption, desc, done, total, done_mb, total_mb, done_text, total_text, text, percent, x1, y1; caption = argument0 desc = argument1 done = argument2 @@ -21,5 +21,13 @@ 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) -draw_text(floor(window_width / 2), y1 + 65, string_format(done_mb, 0, 2) + "/" + string_format(total_mb, 0, 2) + " MB (" + string(round(percent * 100)) + "%)") +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_loading/draw_loading.gml b/scripts/draw_loading/draw_loading.gml index 8802b5ce6..e7fee6a14 100644 --- a/scripts/draw_loading/draw_loading.gml +++ b/scripts/draw_loading/draw_loading.gml @@ -1,12 +1,8 @@ -// draw_loading(caption, desc, percent) -var caption, desc, done, total, done_mb, total_mb, percent, x1, y1; +/*draw_loading(caption, desc, percent) +var caption, desc, perc, 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) +perc = argument2 x1 = floor(window_width / 2 - 150) y1 = floor(window_height / 2 - 50) draw_theme_color() @@ -17,9 +13,10 @@ 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_rectangle(x1 + 30, y1 + 60, x1 + 30 + perc * 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) -draw_text(floor(window_width / 2), y1 + 65, string_format(done_mb, 0, 2) + "/" + string_format(total_mb, 0, 2) + " MB (" + string(round(percent * 100)) + "%)") +if (perc > 0.5) draw_set_color(c_white) +draw_text(floor(window_width / 2), y1 + 65, string(floor(perc * 100)) + "% done") draw_set_halign(fa_left) +screen_refresh() diff --git a/scripts/get_update/get_update.gml b/scripts/get_update/get_update.gml index 8719eee3e..a553622bc 100644 --- a/scripts/get_update/get_update.gml +++ b/scripts/get_update/get_update.gml @@ -15,7 +15,7 @@ if (async_load[? "id"] == update_download) { 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) + 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")) { diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index 13b84508a..83f1508c5 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -1,6 +1,6 @@ #macro gm_runtime_version "2.2.3.344" #macro version_date "2019.12.31" -#macro version "3.6.0" +#macro version "3.7.0" #macro nbs_version 4 #macro pat_version 1 @@ -14,7 +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 Setup.exe" +#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" From 2c1f7484f4f7e14485820c814c263aba550e3b18 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Sun, 19 Jan 2020 04:28:33 -0300 Subject: [PATCH 18/30] Fix crash when redoing a manual block placement On undo/redo, add_block was passing a wrong argument that was causing the program to crash. Fixes #115 --- scripts/action_redo/action_redo.gml | 2 +- scripts/action_undo/action_undo.gml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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) { From 41d5c68d9d1b7fc2542b49d13462d84715feafb1 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Sun, 19 Jan 2020 05:36:42 -0300 Subject: [PATCH 19/30] Fix text overflow in various places - Add a new string_truncate function that automatically adds ellipses (...) when necessary - Replace in-place check for the string width in three different places of the code (datapack preview, song/pattern folder) - Truncate recent file names in the greeting window + menu (the latter is still not fixed, there's something wrong with the menu width calculation) - Width of the 'Song info' window now adapts to the MIDI file name as well --- Minecraft Note Block Studio.yyp | 9 +++++++++ scripts/control_draw/control_draw.gml | 2 +- scripts/dat_preview/dat_preview.gml | 2 +- scripts/draw_window_greeting/draw_window_greeting.gml | 2 +- .../draw_window_preferences.gml | 4 ++-- scripts/draw_window_songinfo/draw_window_songinfo.gml | 10 ++++++++-- scripts/string_truncate/string_truncate.gml | 11 +++++++++++ scripts/string_truncate/string_truncate.yy | 8 ++++++++ views/8f90c88c-a49b-4a15-b19e-952f818913ff.yy | 1 + 9 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 scripts/string_truncate/string_truncate.gml create mode 100644 scripts/string_truncate/string_truncate.yy diff --git a/Minecraft Note Block Studio.yyp b/Minecraft Note Block Studio.yyp index a560fb1d4..b4ce7a5f4 100644 --- a/Minecraft Note Block Studio.yyp +++ b/Minecraft Note Block Studio.yyp @@ -3486,6 +3486,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": { @@ -4242,6 +4250,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/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index aab49422d..ea0df132e 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -989,7 +989,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") + "|/|-|"+ 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_window_greeting/draw_window_greeting.gml b/scripts/draw_window_greeting/draw_window_greeting.gml index ad97ee579..d0922e5f1 100644 --- a/scripts/draw_window_greeting/draw_window_greeting.gml +++ b/scripts/draw_window_greeting/draw_window_greeting.gml @@ -118,7 +118,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_preferences/draw_window_preferences.gml b/scripts/draw_window_preferences/draw_window_preferences.gml index 00663b2a6..fe1ae3c8a 100644 --- a/scripts/draw_window_preferences/draw_window_preferences.gml +++ b/scripts/draw_window_preferences/draw_window_preferences.gml @@ -100,7 +100,7 @@ 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_lib(songfolder)) { @@ -116,7 +116,7 @@ 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_lib(patternfolder)) { 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/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/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", From 11f5423d3512df5159638fd3fc677f01f9b6d451 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Sun, 19 Jan 2020 19:01:26 -0300 Subject: [PATCH 20/30] Improve contrast of some colors in dark theme - Layers without a name now display the default text in gray (as in light mode) - Changed link colors in greeting window to a lighter blue (better contrast in dark mode and still readable in light mode) - Changed green text to be lime in dark mode. Affects: up to date text in greeting window, "Compatible" indicator, reports in the Compatibility window. --- scripts/control_draw/control_draw.gml | 3 ++- scripts/draw_window_greeting/draw_window_greeting.gml | 7 ++++--- scripts/draw_window_minecraft/draw_window_minecraft.gml | 6 ++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index ea0df132e..1eccaeec7 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -829,7 +829,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() @@ -1122,6 +1122,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) diff --git a/scripts/draw_window_greeting/draw_window_greeting.gml b/scripts/draw_window_greeting/draw_window_greeting.gml index d0922e5f1..c9ebc6996 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) diff --git a/scripts/draw_window_minecraft/draw_window_minecraft.gml b/scripts/draw_window_minecraft/draw_window_minecraft.gml index f49b56a75..4dd3141bc 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() @@ -145,6 +147,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 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() @@ -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() From 292e7187f90079de299c8fb92c4d5475e12f878f Mon Sep 17 00:00:00 2001 From: Bentroen Date: Sun, 19 Jan 2020 19:41:35 -0300 Subject: [PATCH 21/30] Fix missing space in Compatibility window Fixes #111 --- scripts/draw_window_minecraft/draw_window_minecraft.gml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/draw_window_minecraft/draw_window_minecraft.gml b/scripts/draw_window_minecraft/draw_window_minecraft.gml index 4dd3141bc..1c57eb2e6 100644 --- a/scripts/draw_window_minecraft/draw_window_minecraft.gml +++ b/scripts/draw_window_minecraft/draw_window_minecraft.gml @@ -140,7 +140,7 @@ 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 @@ -225,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 From d08ed95d0650d88e5ecac5a056212880f3af6f18 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Mon, 20 Jan 2020 01:59:15 -0300 Subject: [PATCH 22/30] Fix crash due to undefined MIDI name variable In ec445fe791676e595d5ceeade77473c6b1596161, the variable song_midi wasn't initialized properly when the greeting window was disabled, causing the program to crash. It's now defined both on startup and in the reset code. What caused this whole business is the fact that MIDI import happens in two steps: open_midi (parses all the info in the file) and import_midi (converts the data into note blocks after you've picked instruments, etc.) Before the latter occurs, all the song data is reset, which also resets the MIDI filename that was stored on the first step. That made it necessary to remove it from the reset script and, instead, reset the name on unusual places, like in the greeting window and in the call for creating a new song. Applied solution: The first variable, midifile, stores the name on the first step. Every reset copies its value to a second variable, song_midi, used only for display. midifile is then set to "". With that, song_midi holds the song name for that session and displays it properly. When a song is created or loaded, a reset will occur and "" will be copied into song_midi, effectively clearing the display. This also fixes an unintended side effect of how the name was being handled: if you loaded a MIDI but clicked 'Cancel' in the MIDI settings window, the name would still be displayed in song info. To prevent that from happening, the first variable (midifile) is reset when the user clicks 'Cancel', to prevent it from being copied over to the display variable (song_midi) on the next reset. --- scripts/control_create/control_create.gml | 1 + scripts/draw_window_greeting/draw_window_greeting.gml | 2 +- scripts/draw_window_midi_import/draw_window_midi_import.gml | 2 +- scripts/load_song/load_song.gml | 4 +--- scripts/new_song/new_song.gml | 1 - scripts/open_midi/open_midi.gml | 1 - scripts/reset/reset.gml | 1 + 7 files changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/control_create/control_create.gml b/scripts/control_create/control_create.gml index b656f17dd..e80083069 100644 --- a/scripts/control_create/control_create.gml +++ b/scripts/control_create/control_create.gml @@ -47,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] = "" diff --git a/scripts/draw_window_greeting/draw_window_greeting.gml b/scripts/draw_window_greeting/draw_window_greeting.gml index c9ebc6996..4024bf48e 100644 --- a/scripts/draw_window_greeting/draw_window_greeting.gml +++ b/scripts/draw_window_greeting/draw_window_greeting.gml @@ -76,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 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/load_song/load_song.gml b/scripts/load_song/load_song.gml index dd49dc720..85783d861 100644 --- a/scripts/load_song/load_song.gml +++ b/scripts/load_song/load_song.gml @@ -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/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/reset/reset.gml b/scripts/reset/reset.gml index e92470205..0e5c3183c 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 From d269267e52101bbee57f639ddb9a13c03e0fff5b Mon Sep 17 00:00:00 2001 From: Bentroen Date: Mon, 20 Jan 2020 02:20:17 -0300 Subject: [PATCH 23/30] Fix wrong song area height when starting the program with piano disabled The height was being defined inside the Preferences window, once the 'Show piano' toggle was changed. Moved that to the drawing code, which updates in real time. --- scripts/control_draw/control_draw.gml | 5 +++-- .../draw_window_preferences/draw_window_preferences.gml | 8 +------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index 1eccaeec7..fbc904288 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -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) { diff --git a/scripts/draw_window_preferences/draw_window_preferences.gml b/scripts/draw_window_preferences/draw_window_preferences.gml index fe1ae3c8a..7671b1eea 100644 --- a/scripts/draw_window_preferences/draw_window_preferences.gml +++ b/scripts/draw_window_preferences/draw_window_preferences.gml @@ -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 From f945ba2fce94bf711d8a6b84d01e0082b62ee4a5 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Mon, 20 Jan 2020 02:55:36 -0300 Subject: [PATCH 24/30] Change stereo panning popup to L 100/R 100 instead of 0-200% Also made the hover text for the stereo icon a bit more centered --- scripts/control_draw/control_draw.gml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index fbc904288..ef0391b19 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -867,13 +867,17 @@ for (b = 0; b < totalrows; b += 1) { 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 From dd96a160d5ebb0e609b8f38d52df3bb11d0ccb90 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Mon, 20 Jan 2020 03:46:42 -0300 Subject: [PATCH 25/30] Keep track of blocks with fine pitch tuning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is for a future addition in the Compatibility window to transpose notes inside the ±100 pitch range. --- scripts/add_block/add_block.gml | 1 + scripts/add_block_manual/add_block_manual.gml | 1 + scripts/add_block_select/add_block_select.gml | 1 + scripts/calculate_size/calculate_size.gml | 3 +++ scripts/change_block_manual/change_block_manual.gml | 2 ++ scripts/control_create/control_create.gml | 1 + scripts/control_draw/control_draw.gml | 2 +- scripts/remove_block/remove_block.gml | 1 + scripts/remove_block_manual/remove_block_manual.gml | 1 + scripts/remove_block_select/remove_block_select.gml | 1 + scripts/reset/reset.gml | 1 + 11 files changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/add_block/add_block.gml b/scripts/add_block/add_block.gml index a629d5990..2c312f148 100644 --- a/scripts/add_block/add_block.gml +++ b/scripts/add_block/add_block.gml @@ -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 5d14c98ad..b0b684201 100644 --- a/scripts/add_block_select/add_block_select.gml +++ b/scripts/add_block_select/add_block_select.gml @@ -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/control_create/control_create.gml b/scripts/control_create/control_create.gml index e80083069..06c9abeee 100644 --- a/scripts/control_create/control_create.gml +++ b/scripts/control_create/control_create.gml @@ -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 diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index ef0391b19..469749a93 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 } 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 0e5c3183c..ae05c3085 100644 --- a/scripts/reset/reset.gml +++ b/scripts/reset/reset.gml @@ -48,6 +48,7 @@ endb2 = 0 compatible = 1 block_outside = 0 block_custom = 0 +block_pitched = 0 colamount[0] = 0 rowamount[0] = 0 From da7e0a8cce8052bf8626053d523fdc620d203816 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Mon, 20 Jan 2020 04:16:09 -0300 Subject: [PATCH 26/30] Re-add importing instruments from another song Updated to be compatible with all NBS versions up to date, which no longer crashes the program. --- .../draw_window_instruments.gml | 4 +- scripts/load_instruments/load_instruments.gml | 106 +++++++++++------- 2 files changed, 70 insertions(+), 40 deletions(-) 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/load_instruments/load_instruments.gml b/scripts/load_instruments/load_instruments.gml index cba79e91c..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_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 + From 0029b2747014daa6777d6d79e2bd8591de376f9e Mon Sep 17 00:00:00 2001 From: Bentroen Date: Mon, 20 Jan 2020 04:44:27 -0300 Subject: [PATCH 27/30] Fix lower notes not playing all the way through The time that each emitter will remain active for now depends on the pitch of the sound -- lower sounds will remain for longer, and vice-versa. --- scripts/play_sound/play_sound.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 9d17e36f04fc1376f85db5500356bab1a1b264b4 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Mon, 20 Jan 2020 04:56:40 -0300 Subject: [PATCH 28/30] Remove auto-save from the song properties window No longer per-song, it's now a global setting. --- .../draw_window_properties.gml | 48 ++++++------------- 1 file changed, 14 insertions(+), 34 deletions(-) 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) From 6098150038b1a4294d4a268189c368f5934fe0f5 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Mon, 20 Jan 2020 05:20:08 -0300 Subject: [PATCH 29/30] 3.7.1 --- scripts/draw_window_update/draw_window_update.gml | 1 + scripts/macros/macros.gml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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/macros/macros.gml b/scripts/macros/macros.gml index 83f1508c5..3882a3fad 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -1,6 +1,6 @@ #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 From 5199c42ffa95f7dd91447a758a53dcd9169a9bc0 Mon Sep 17 00:00:00 2001 From: Bentroen Date: Mon, 20 Jan 2020 05:21:54 -0300 Subject: [PATCH 30/30] Fix "Github" typo --- scripts/control_draw/control_draw.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index 469749a93..cddb29f7c 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -1060,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