Skip to content

Commit 5d95073

Browse files
committed
bugfix: Fix the selection being duplicated when undoing a macro operation
- The text "(CANNOT BE UNDONE)" is changed to "(CAN BE UNDONE)"
1 parent acac3f9 commit 5d95073

6 files changed

Lines changed: 32 additions & 16 deletions

File tree

scripts/draw_window_macro_stagger/draw_window_macro_stagger.gml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ function draw_window_macro_stagger() {
1212
draw_theme_color()
1313
draw_theme_font(font_main_bold)
1414
draw_text_dynamic(x1 + 8, y1 + 8, "Stagger")
15-
draw_set_color(c_red)
16-
if (language != 1) draw_text_dynamic(x1 + 8, y1 + 23, "(CANNOT BE UNDONE)")
17-
else draw_text_dynamic(x1 + 8, y1 + 23, "(无法还原!!)")
15+
draw_set_color(c_green)
16+
if (language != 1) draw_text_dynamic(x1 + 8, y1 + 23, "(CAN BE UNDONE)")
17+
else draw_text_dynamic(x1 + 8, y1 + 23, "(无法还原!!)") // Please re-translate this
1818
draw_theme_color()
1919
pattern = ""
2020
draw_theme_font(font_main)
@@ -87,7 +87,10 @@ function draw_window_macro_stagger() {
8787
if val >= total_vals break
8888
}
8989
var new_str = array_to_selection(arr_data, total_vals)
90-
selection_load(selection_x, selection_y, new_str, true)
90+
var sel_x = selection_x
91+
var sel_y = selection_y
92+
selection_delete(true)
93+
selection_load_ext(sel_x, sel_y, new_str)
9194
history_set(h_selectchange, selection_x, selection_y, selection_code, selection_x, selection_y, str)
9295
if(!keyboard_check(vk_alt)) selection_place(false)
9396
}

scripts/draw_window_macro_tremolo/draw_window_macro_tremolo.gml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function draw_window_macro_tremolo() {
22
// draw_window_macro_tremolo()
3-
var x1, y1, a, i, pattern, str, total_vals, val;
3+
var x1, y1;
44
windowanim = 1
55
if (theme = 3) draw_set_alpha(windowalpha)
66
curs = cr_default
@@ -11,9 +11,9 @@ function draw_window_macro_tremolo() {
1111
draw_window(x1, y1, x1 + 150, y1 + 240)
1212
draw_theme_font(font_main_bold)
1313
draw_text_dynamic(x1 + 8, y1 + 8, "Tremolo")
14-
draw_set_color(c_red)
15-
if (language != 1) draw_text_dynamic(x1 + 8, y1 + 23, "(CANNOT BE UNDONE)")
16-
else draw_text_dynamic(x1 + 8, y1 + 23, "(无法还原!!)")
14+
draw_set_color(c_green)
15+
if (language != 1) draw_text_dynamic(x1 + 8, y1 + 23, "(CAN BE UNDONE)")
16+
else draw_text_dynamic(x1 + 8, y1 + 23, "(无法还原!!)") // Please re-translate this
1717
draw_theme_color()
1818
draw_theme_font(font_main)
1919
if (theme = 0) {
@@ -68,8 +68,8 @@ function draw_window_macro_tremolo() {
6868
return 1
6969
}
7070
if tremolotype = 0 macro_tremolo()
71-
if tremolotype = 1 macro_tremolo_fadein()
72-
if tremolotype = 2 macro_tremolo_fadeout()
71+
else if tremolotype = 1 macro_tremolo_fadein()
72+
else if tremolotype = 2 macro_tremolo_fadeout()
7373
windowalpha = 0
7474
windowclose = 0
7575
windowopen = 0

scripts/macro_tremolo/macro_tremolo.gml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ function macro_tremolo() {
99
total_cols = macro_column_count(arr_temp)
1010
//show_debug_message("total cols is "+string(total_cols))
1111
val = 0
12+
var arr_data = []
13+
var arr_col = []
1214
c = 0
1315
colcount = 0
1416
for (d = 0; d < total_cols; d++;) {
@@ -47,7 +49,10 @@ function macro_tremolo() {
4749
arr_data[0] = 0
4850
//show_debug_message("Out of loop. arr_data has been changed to " + string(array_to_selection(arr_data, c)))
4951
var new_str = array_to_selection(arr_data, array_length(arr_data))
50-
selection_load(selection_x, selection_y, new_str, true)
52+
var sel_x = selection_x
53+
var sel_y = selection_y
54+
selection_delete(true)
55+
selection_load_ext(sel_x, sel_y, new_str)
5156
history_set(h_selectchange, selection_x, selection_y, try_compress_selection(selection_code), selection_x, selection_y, try_compress_selection(str))
5257
if(!keyboard_check(vk_alt)) selection_place(false)
5358

scripts/macro_tremolo_fadein/macro_tremolo_fadein.gml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ function macro_tremolo_fadein() {
99
total_cols = macro_column_count(arr_temp)
1010
//show_debug_message("total cols is "+string(total_cols))
1111
val = 0
12+
var arr_data = []
13+
var arr_col = []
1214
c = 0
1315
colcount = 0
1416
prevlength = 0
@@ -81,8 +83,10 @@ function macro_tremolo_fadein() {
8183
arr_data[0] = 0
8284
//show_debug_message("Out of loop. arr_data has been changed to " + string(array_to_selection(arr_data, c)))
8385
var new_str = array_to_selection(arr_data, c)
84-
arr_data = 0
85-
selection_load(selection_x, selection_y, new_str, true)
86+
var sel_x = selection_x
87+
var sel_y = selection_y
88+
selection_delete(true)
89+
selection_load_ext(sel_x, sel_y, new_str)
8690
history_set(h_selectchange, selection_x, selection_y, selection_code, selection_x, selection_y, str)
8791
if(!keyboard_check(vk_alt)) selection_place(false)
8892

scripts/macro_tremolo_fadeout/macro_tremolo_fadeout.gml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ function macro_tremolo_fadeout() {
99
total_cols = macro_column_count(arr_temp)
1010
//show_debug_message("total cols is "+string(total_cols))
1111
val = 0
12+
var arr_data = []
13+
var arr_col = []
1214
c = 0
1315
colcount = 0
1416
prevlength = 0
@@ -78,8 +80,10 @@ function macro_tremolo_fadeout() {
7880
arr_data[0] = 0
7981
//show_debug_message("Out of loop. arr_data has been changed to " + string(array_to_selection(arr_data, c)))
8082
var new_str = array_to_selection(arr_data, c)
81-
arr_data = 0
82-
selection_load(selection_x, selection_y, new_str, true)
83+
var sel_x = selection_x
84+
var sel_y = selection_y
85+
selection_delete(true)
86+
selection_load_ext(sel_x, sel_y, new_str)
8387
history_set(h_selectchange, selection_x, selection_y, try_compress_selection(selection_code), selection_x, selection_y, try_compress_selection(str))
8488
if(!keyboard_check(vk_alt)) selection_place(false)
8589

scripts/remove_block_select/remove_block_select.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function remove_block_select(argument0, argument1) {
44
xx = argument0
55
yy = argument1
66

7-
if (song_exists[xx, yy] = 0) return 0
7+
if (xx >= arraylength || yy >= arrayheight || song_exists[xx, yy] == 0) return 0
88
song_exists[xx, yy] = 0
99
song_ins[xx, yy].num_blocks--
1010
if (song_key[xx, yy] < 33 || song_key[xx, yy] > 57) block_outside -= 1

0 commit comments

Comments
 (0)