Skip to content

Commit e239e0e

Browse files
committed
Change NBS version to 5 + Prevent saving in older ver when incompatible
1 parent 9aef45f commit e239e0e

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

scripts/draw_window_instruments/draw_window_instruments.gml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,13 @@ function draw_window_instruments() {
7272
instrument_swap(userselect, instrument_list[| insselect])
7373
c = 1
7474
}
75-
if (draw_button2(x1 + 455, y1 + 318, 80, "OK") && wmenu = 0) window = 0
75+
if (draw_button2(x1 + 456, y1 + 318, 80, "OK") && wmenu = 0) {
76+
window = 0
77+
if (save_version < 5 && user_instruments > 18) {
78+
show_message("This song contains more than 18 instruments and cannot be saved in version " + string(save_version) + ". The save version will be changed to " + string(nbs_version) + ".")
79+
save_version = nbs_version
80+
}
81+
}
7682
if (mouse_check_button_pressed(mb_left)) {
7783
insedit = -1
7884
}

scripts/draw_window_save_options/draw_window_save_options.gml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
function draw_window_save_options() {
22
// draw_window_save_options()
3-
var x1, y1;
3+
var x1, y1, min_version;
44
curs = cr_default
55
text_exists[0] = 0
66
x1 = floor(window_width / 2 - 72)
7-
y1 = floor(window_height / 2 - 80)
8-
draw_window(x1, y1, x1 + 140, y1 + 147)
7+
y1 = floor(window_height / 2 - 90)
8+
draw_window(x1, y1, x1 + 140, y1 + 162)
99
draw_set_font(fnt_mainbold)
1010
draw_text(x1 + 8, y1 + 8, "Save options")
1111
draw_set_font(fnt_main)
@@ -16,14 +16,21 @@ function draw_window_save_options() {
1616
draw_rectangle(x1 + 6, y1 + 26, x1 + 134, y1 + 117, 1)
1717
}
1818
draw_theme_color()
19+
20+
min_version = 0
21+
if (user_instruments > 18) {
22+
min_version = 5
23+
}
24+
save_version = max(save_version, min_version)
1925

20-
if (draw_radiobox(x1 + 15, y1 + 35, save_version = 4, "v4", "Includes note velocity/pan/pitch and looping")) save_version = 4
21-
if (draw_radiobox(x1 + 15, y1 + 50, save_version = 3, "v3", "Includes song length")) save_version = 3
22-
if (draw_radiobox(x1 + 15, y1 + 65, save_version = 2, "v2", "Includes layer panning")) save_version = 2
23-
if (draw_radiobox(x1 + 15, y1 + 80, save_version = 1, "v1", "Includes custom instrument index")) save_version = 1
24-
if (draw_radiobox(x1 + 15, y1 + 95, save_version = 0, "Classic", "Doesn't have any of the above, but works on all versions.")) save_version = 0
26+
if (draw_radiobox(x1 + 15, y1 + 35, save_version = 5, "v5", "Increases custom instrument limit\nAllows custom sounds in subfolders", min_version > 5)) save_version = nbs_version
27+
if (draw_radiobox(x1 + 15, y1 + 50, save_version = 4, "v4", "Includes note velocity/pan/pitch and looping", min_version > 4)) save_version = 4
28+
if (draw_radiobox(x1 + 15, y1 + 65, save_version = 3, "v3", "Includes song length", min_version > 3)) save_version = 3
29+
if (draw_radiobox(x1 + 15, y1 + 80, save_version = 2, "v2", "Includes layer panning", min_version > 2)) save_version = 2
30+
if (draw_radiobox(x1 + 15, y1 + 95, save_version = 1, "v1", "Includes custom instrument index", min_version > 1)) save_version = 1
31+
if (draw_radiobox(x1 + 15, y1 + 110, save_version = 0, "Classic", "Doesn't have any of the above, but works on all versions.", min_version > 0)) save_version = 0
2532

26-
if (draw_button2(x1 + 40, y1 + 120, 60, "OK")) {
33+
if (draw_button2(x1 + 40, y1 + 135, 60, "OK")) {
2734
if save_version != nbs_version question("Some of the song's data will be lost if you save in a previous version! Are you sure?", "Confirm")
2835
changed = 1
2936
window = 0

scripts/macros/macros.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function macros() {
22
#macro gm_runtime_version "2.2.3.344"
33
#macro version_date "2020.07.02"
44
#macro version "3.8.0"
5-
#macro nbs_version 4
5+
#macro nbs_version 5
66
#macro pat_version 1
77

88
#macro link_download "https://hielkeminecraft.github.io/OpenNoteBlockStudio/"

0 commit comments

Comments
 (0)