Skip to content

Commit 7f72404

Browse files
committed
fix: mark song as unsaved when changing tempo
Affects the following instances: - making tempo compatible with schematics/data packs via Compatibility window - clicking 'OK' in the tempo tapper window - selecting a tempo option from the tempo box context menu - confirming a valid change typed to the tempo box Fixes #433
1 parent dc62b65 commit 7f72404

File tree

4 files changed

+28
-22
lines changed

4 files changed

+28
-22
lines changed

scripts/draw_window_minecraft/draw_window_minecraft.gml

+14-14
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ function draw_window_minecraft() {
147147
else draw_text_dynamic(x1 + 45, yy + 16, "目前速度为每秒 " + string(tempo) + " 红石刻。")
148148
if (draw_button2(x1 + 45, yy + 34, 140, condstr(language != 1, "Fix tempo for schematic", "针对 Schematic 调整速度"), 0, 1)) {
149149
var otempo = tempo
150-
if (otempo > 10) tempo = 10
151-
if (otempo < 10) tempo = 10
152-
if (otempo < 7.5) tempo = 5
153-
if (otempo < 3.75) tempo = 2.5
150+
if (otempo > 10) tempo = 10 changed = 1
151+
if (otempo < 10) tempo = 10 changed = 1
152+
if (otempo < 7.5) tempo = 5 changed = 1
153+
if (otempo < 3.75) tempo = 2.5 changed = 1
154154
}
155155
}
156156
draw_theme_color()
@@ -315,16 +315,16 @@ function draw_window_minecraft() {
315315
if (draw_button2(x1 + 45, yy + 50, 180, condstr(language != 1, "Optimize tempo for data pack", "针对数据包调整速度"), 0, 1)) {
316316
var otempo
317317
otempo = tempo
318-
if (otempo >= 15) tempo = 20
319-
if (otempo < 15) tempo = 10
320-
if (otempo < 7.5) tempo = 5
321-
if (otempo < 4.5) tempo = 4
322-
if (otempo < 3.25) tempo = 2.5
323-
if (otempo < 2.25) tempo = 2
324-
if (otempo < 1.625) tempo = 1.25
325-
if (otempo < 1.125) tempo = 1
326-
if (otempo < 0.75) tempo = 0.5
327-
if (otempo < 0.375) tempo = 0.25
318+
if (otempo >= 15) tempo = 20 changed = 1
319+
if (otempo < 15) tempo = 10 changed = 1
320+
if (otempo < 7.5) tempo = 5 changed = 1
321+
if (otempo < 4.5) tempo = 4 changed = 1
322+
if (otempo < 3.25) tempo = 2.5 changed = 1
323+
if (otempo < 2.25) tempo = 2 changed = 1
324+
if (otempo < 1.625) tempo = 1.25 changed = 1
325+
if (otempo < 1.125) tempo = 1 changed = 1
326+
if (otempo < 0.75) tempo = 0.5 changed = 1
327+
if (otempo < 0.375) tempo = 0.25 changed = 1
328328
}
329329
}
330330
draw_theme_color()

scripts/draw_window_set_tempo/draw_window_set_tempo.gml

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ function draw_window_set_tempo() {
1919
settempo = mouse_rectangle(xx, 57, w, 22)
2020
}
2121

22+
var otempo = tempo;
23+
2224
// Set tempo and close
2325
if ((mouse_check_button_released(mb_left) && !settempo && !mouse_rectangle(xx, 57, w, 22)) || keyboard_check_pressed(vk_enter)) {
2426
try {
@@ -33,6 +35,9 @@ function draw_window_set_tempo() {
3335
}
3436
tempo = median(0.25, tempo, 60)
3537
}
38+
if (tempo != otempo) {
39+
changed = 1
40+
}
3641
settempo = 0
3742
text_focus = -1
3843
window = 0

scripts/draw_window_tempo_tapper/draw_window_tempo_tapper.gml

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ function draw_window_tempo_tapper() {
5252
if (draw_button2(x1 + 10, y1 + 98, 60, condstr(language != 1, "OK", "确认")) && (windowopen = 1 || theme != 3)) {
5353
try {
5454
tempo = (ctempo * (1 + tapdouble)) / 15
55+
changed = 1
5556
taptempo = 0
5657
tapping = 0
5758
ltime = 0

scripts/menu_click/menu_click.gml

+8-8
Original file line numberDiff line numberDiff line change
@@ -336,14 +336,14 @@ function menu_click(argument0) {
336336
case "tempo": {
337337
if (sel = 0) use_bpm = false
338338
else if (sel = 1) use_bpm = true
339-
else if (sel = 2) tempo = 10
340-
else if (sel = 3) tempo = 12
341-
else if (sel = 4) tempo = 14
342-
else if (sel = 5) tempo = 16
343-
else if (sel = 6) tempo = 18
344-
else if (sel = 7) tempo = 20
345-
else if (sel = 8) tempo = 30
346-
else if (sel = 9) tempo = 60
339+
else if (sel = 2) { tempo = 10 changed = 1 }
340+
else if (sel = 3) { tempo = 12 changed = 1 }
341+
else if (sel = 4) { tempo = 14 changed = 1 }
342+
else if (sel = 5) { tempo = 16 changed = 1 }
343+
else if (sel = 6) { tempo = 18 changed = 1 }
344+
else if (sel = 7) { tempo = 20 changed = 1 }
345+
else if (sel = 8) { tempo = 30 changed = 1 }
346+
else if (sel = 9) { tempo = 60 changed = 1 }
347347
else if (sel = 10) window = w_tempotapper
348348
break
349349
}

0 commit comments

Comments
 (0)