Skip to content

Commit 641f066

Browse files
committed
Merge branch 'pr/448' into development
2 parents fdd5acc + e3f4668 commit 641f066

File tree

74 files changed

+950
-608
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+950
-608
lines changed

Minecraft Note Block Studio.yyp

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

objects/obj_controller/Create_0.gml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
script_execute(control_create,0,0,0,0,0);
1+
control_create();

objects/obj_controller/Draw_0.gml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
script_execute(control_draw,0,0,0,0,0);
1+
control_draw();

objects/obj_controller/Other_3.gml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
script_execute(control_end,0,0,0,0,0);
1+
control_end();

objects/obj_controller/Other_62.gml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
script_execute(control_http,0,0,0,0,0);
1+
control_http();

objects/obj_controller/Step_0.gml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
script_execute(control_step,0,0,0,0,0);
1+
control_step();

objects/obj_controller/obj_controller.yy

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/action_redo/action_redo.gml

+52-30
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,57 @@ function action_redo() {
2121
arg14 = history[historypos, 15]
2222
changed = 1
2323

24-
if (t = h_addblock) {
25-
add_block(arg0, arg1, arg2, arg3, arg4, arg5, arg6)
26-
} else if (t = h_removeblock) {
27-
remove_block(arg0, arg1)
28-
} else if (t = h_changeblock) {
29-
change_block(arg0, arg1, arg2, arg3, arg4, arg5, arg6)
30-
} else if (t = h_selectadd) {
31-
selection_add(arg0, arg1, arg2 - 1, arg3 - 1, arg4, 1)
32-
} else if (t = h_selectremove) {
33-
selection_remove(arg0, arg1, arg2, arg3, 0, 1)
34-
} else if (t = h_selectchange) {
35-
selection_delete(1)
36-
selection_load(arg0, arg1, arg2, 1)
37-
} else if (t = h_selectmove) {
38-
selection_x = arg0
39-
selection_y = arg1
40-
} else if (t = h_selectpaste) {
41-
selection_load(arg0, arg1, arg2, 1)
42-
} else if (t = h_select) {
43-
selection_place(1)
44-
selection_load_ext(arg0, arg1, arg2)
45-
} else if (t = h_addlayer) {
46-
add_layer(arg0, true, arg1, arg2, arg3, arg4, arg5, arg6)
47-
} else if (t = h_removelayer) {
48-
remove_layer(arg0, true)
49-
} else if (t = h_swaplayer) {
50-
shift_layers(arg0, arg1, true)
24+
switch (t) {
25+
case h_addblock: {
26+
add_block(arg0, arg1, arg2, arg3, arg4, arg5, arg6)
27+
break
28+
}
29+
case h_removeblock: {
30+
remove_block(arg0, arg1)
31+
break
32+
}
33+
case h_changeblock: {
34+
change_block(arg0, arg1, arg2, arg3, arg4, arg5, arg6)
35+
break
36+
}
37+
case h_selectadd: {
38+
selection_add(arg0, arg1, arg2 - 1, arg3 - 1, arg4, 1)
39+
break
40+
}
41+
case h_selectremove: {
42+
selection_remove(arg0, arg1, arg2, arg3, 0, 1)
43+
break
44+
}
45+
case h_selectchange: {
46+
selection_delete(1)
47+
selection_load(arg0, arg1, arg2, 1)
48+
break
49+
}
50+
case h_selectmove: {
51+
selection_x = arg0
52+
selection_y = arg1
53+
break
54+
}
55+
case h_selectpaste: {
56+
selection_load(arg0, arg1, arg2, 1)
57+
break
58+
}
59+
case h_select: {
60+
selection_place(1)
61+
selection_load_ext(arg0, arg1, arg2)
62+
break
63+
}
64+
case h_addlayer: {
65+
add_layer(arg0, true, arg1, arg2, arg3, arg4, arg5, arg6)
66+
break
67+
}
68+
case h_removelayer: {
69+
remove_layer(arg0, true)
70+
break
71+
}
72+
case h_swaplayer: {
73+
shift_layers(arg0, arg1, true)
74+
break
75+
}
5176
}
52-
53-
54-
5577
}

scripts/action_undo/action_undo.gml

+59-35
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,64 @@ function action_undo() {
2020
arg14 = history[historypos, 15]
2121
historypos += 1
2222
changed = 1
23-
if (t = h_addblock) {
24-
remove_block(arg0, arg1)
25-
} else if (t = h_removeblock) {
26-
add_block(arg0, arg1, arg2, arg3, arg4, arg5, arg6)
27-
} else if (t = h_changeblock) {
28-
change_block(arg0, arg1, arg7, arg8, arg9, arg10, arg11)
29-
} else if (t = h_selectadd) {
30-
selection_remove(arg0, arg1, arg2, arg3, 0, 1)
31-
} else if (t = h_selectremove) {
32-
selection_add(arg0, arg1, arg2 - 1, arg3 - 1, 0, 1)
33-
selection_delete(1)
34-
selection_load(arg4, arg5, arg6, true)
35-
region_code_load(arg0, arg1, arg7)
36-
} else if (t = h_selectchange) {
37-
selection_delete(1)
38-
selection_load(arg3, arg4, arg5, 1)
39-
} else if (t = h_selectmove) {
40-
selection_x = arg2
41-
selection_y = arg3
42-
} else if (t = h_selectpaste) {
43-
selection_delete(1)
44-
} else if (t = h_select) {
45-
selection_place(1)
46-
selection_load_ext(arg3, arg4, arg5)
47-
} else if (t = h_addlayer) {
48-
remove_layer(arg0, true)
49-
} else if (t = h_removelayer) {
50-
add_layer(arg0, true, arg1, arg2, arg3, arg4, arg5, arg6)
51-
} else if (t = h_swaplayer) {
52-
shift_layers(arg1, arg0, true)
53-
} else if (t = h_stereoize) {
54-
selection_load(arg0, arg1, arg2, true)
23+
switch (t) {
24+
case h_addblock: {
25+
remove_block(arg0, arg1)
26+
break
27+
}
28+
case h_removeblock: {
29+
add_block(arg0, arg1, arg2, arg3, arg4, arg5, arg6)
30+
break
31+
}
32+
case h_changeblock: {
33+
change_block(arg0, arg1, arg7, arg8, arg9, arg10, arg11)
34+
break
35+
}
36+
case h_selectadd: {
37+
selection_remove(arg0, arg1, arg2, arg3, 0, 1)
38+
break
39+
}
40+
case h_selectremove: {
41+
selection_add(arg0, arg1, arg2 - 1, arg3 - 1, 0, 1)
42+
selection_delete(1)
43+
selection_load(arg4, arg5, arg6, true)
44+
region_code_load(arg0, arg1, arg7)
45+
break
46+
}
47+
case h_selectchange: {
48+
selection_delete(1)
49+
selection_load(arg3, arg4, arg5, 1)
50+
break
51+
}
52+
case h_selectmove: {
53+
selection_x = arg2
54+
selection_y = arg3
55+
break
56+
}
57+
case h_selectpaste: {
58+
selection_delete(1)
59+
break
60+
}
61+
case h_select: {
62+
selection_place(1)
63+
selection_load_ext(arg3, arg4, arg5)
64+
break
65+
}
66+
case h_addlayer: {
67+
remove_layer(arg0, true)
68+
break
69+
}
70+
case h_removelayer: {
71+
add_layer(arg0, true, arg1, arg2, arg3, arg4, arg5, arg6)
72+
break
73+
}
74+
case h_swaplayer: {
75+
shift_layers(arg1, arg0, true)
76+
break
77+
}
78+
case h_stereoize: {
79+
selection_load(arg0, arg1, arg2, true)
80+
break
81+
}
5582
}
56-
57-
58-
5983
}

scripts/add_block/add_block.gml

+22-22
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ function add_block() {
1616

1717
// Initialize cells
1818
if (xx >= arraylength) {
19-
for (a = arraylength; a <= xx; a += 1) {
20-
colfirst[a] = -1
21-
collast[a] = -1
22-
colamount[a] = 0
23-
for (b = 0; b < max(yy + 1, arrayheight); b += 1) song_exists[a, b] = 0
24-
}
25-
arraylength = xx + 1
19+
for (a = xx; a >= arraylength; --a) {
20+
colfirst[@ a] = -1
21+
collast[@ a] = -1
22+
colamount[@ a] = 0
23+
for (b = max(yy + 1, arrayheight) - 1; b >= 0; --b) song_exists[@ a, b] = 0
24+
}
25+
arraylength = xx + 1
2626
}
2727
if (yy >= arrayheight) {
28-
for (a = 0; a < arraylength; a += 1) {
29-
for (b = arrayheight; b <= yy ;b += 1) {
30-
rowamount[b] = 0
31-
song_exists[a, b] = 0
28+
for (a = arraylength - 1; a >= 0; --a) {
29+
for (b = yy; b >= arrayheight; --b) {
30+
rowamount[@ b] = 0
31+
song_exists[@ a, b] = 0
3232
}
3333
}
3434
arrayheight = yy + 1
@@ -37,16 +37,16 @@ function add_block() {
3737
if (song_exists[xx, yy]) return 0
3838

3939
// Add block
40-
song_exists[xx, yy] = 1
41-
song_ins[xx, yy] = ins
42-
song_key[xx, yy] = key
43-
song_vel[xx, yy] = vel
44-
song_pan[xx, yy] = pan
45-
song_pit[xx, yy] = pit
46-
song_played[xx, yy] = 0
47-
song_added[xx, yy] = 0
48-
colamount[xx] += 1
49-
rowamount[yy] += 1
40+
song_exists[@ xx, yy] = 1
41+
song_ins[@ xx, yy] = ins
42+
song_key[@ xx, yy] = key
43+
song_vel[@ xx, yy] = vel
44+
song_pan[@ xx, yy] = pan
45+
song_pit[@ xx, yy] = pit
46+
song_played[@xx, yy] = 0
47+
song_added[@ xx, yy] = 0
48+
colamount[@ xx] += 1
49+
rowamount[@ yy] += 1
5050
if (!insnum) {
5151
ins.num_blocks++
5252
if (ins.user) block_custom += 1
@@ -56,7 +56,7 @@ function add_block() {
5656
totalblocks += 1
5757

5858
if (colfirst[xx] = -1 || yy < colfirst[xx]) colfirst[xx] = yy
59-
if (yy > collast[xx]) collast[xx] = yy
59+
if (yy > collast[xx]) collast[@ xx] = yy
6060

6161
if (xx >= enda) enda = xx
6262
if (yy >= endb) endb = yy

scripts/add_block_select/add_block_select.gml

+11-11
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ function add_block_select(argument0, argument1, argument2, argument3, argument4,
3333

3434
// Add block
3535
song_exists[xx, yy] = 1
36-
song_ins[xx, yy] = ins
37-
song_key[xx, yy] = key
38-
song_vel[xx, yy] = vel
39-
song_pan[xx, yy] = pan
40-
song_pit[xx, yy] = pit
41-
song_played[xx, yy] = 0
42-
song_added[xx, yy] = 0
43-
colamount[xx] += 1
44-
rowamount[yy] += 1
36+
song_ins[@ xx, yy] = ins
37+
song_key[@ xx, yy] = key
38+
song_vel[@ xx, yy] = vel
39+
song_pan[@ xx, yy] = pan
40+
song_pit[@ xx, yy] = pit
41+
song_played[@ xx, yy] = 0
42+
song_added[@ xx, yy] = 0
43+
colamount[@ xx] += 1
44+
rowamount[@ yy] += 1
4545
ins.num_blocks++
4646
if (key < 33 || key > 57) block_outside += 1
4747
if (ins.user) block_custom += 1
4848
if (pit != 0) block_pitched += 1
4949
totalblocks += 1
5050

51-
if (colfirst[xx] = -1 || yy < colfirst[xx]) colfirst[xx] = yy
52-
if (yy > collast[xx]) collast[xx] = yy
51+
if (colfirst[xx] = -1 || yy < colfirst[xx]) colfirst[@ xx] = yy
52+
if (yy > collast[xx]) collast[@ xx] = yy
5353

5454
if (xx >= enda) enda = xx
5555
if (yy >= endb) endb = yy
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
function array_grow_then_set(array, index, value) {
2+
// Set a value at the index of the array; also allows custom growth of the array
3+
4+
var length = array_length(array)
5+
if (index >= length) {
6+
var new_size = index + 1
7+
var new_length = new_size * 3 / 2; // 1.5x growth factor
8+
//var new_length = (new_size + (new_size >> 3) + 6) & ~3; // Python-style growth
9+
//show_debug_message(string(length) + " -> " + string(floor(new_length)))
10+
for (var i = new_length - 1; i >= length; --i) {
11+
array[@ i] = 0
12+
}
13+
}
14+
array[@ index] = value
15+
}

0 commit comments

Comments
 (0)