Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_rhythmgame_editor_Draw_0

(view raw script w/o annotations or w/e)
1
draw_self();
2
if (song_menu)
3
{
4
    var _xalign = camerax() + 220;
5
    var _yalign = cameray() + 50;
6
    scr_draw_simple_menu(selection, _xalign, _yalign, 16, tracklist);
7
    _xalign = camerax() + 320;
8
    _yalign += 200;
9
    draw_set_halign(fa_center);
10
    if (instrument == 1)
11
    {
12
        draw_set_color(#EA79C8);
13
        draw_sprite(spr_board_susie_walk_down, 0, _xalign - 100 - 8, _yalign - 20);
14
    }
15
    else
16
    {
17
        draw_set_color(merge_color(#EA79C8, c_black, 0.5));
18
    }
19
    draw_text(_xalign - 100, _yalign, "DRUMS");
20
    if (instrument == 0)
21
    {
22
        draw_set_color(#00A2E8);
23
        draw_sprite(spr_board_kris_walk_down, 0, _xalign - 8, _yalign - 20);
24
    }
25
    else
26
    {
27
        draw_set_color(merge_color(#00A2E8, c_black, 0.5));
28
    }
29
    draw_text(_xalign, _yalign, "GUITAR");
30
    if (instrument == 2)
31
    {
32
        draw_set_color(#B5E61D);
33
        draw_sprite(spr_board_ralsei_walk_down, 0, (_xalign + 100) - 8, _yalign - 20);
34
    }
35
    else
36
    {
37
        draw_set_color(merge_color(#B5E61D, c_black, 0.5));
38
    }
39
    if (song_id == 0 || song_id == 2)
40
        draw_text(_xalign + 100, _yalign, "VOCALS");
41
    else
42
        draw_text(_xalign + 100, _yalign, "TAMBOURINE");
43
    draw_set_halign(fa_left);
44
    exit;
45
}
46
if (song_initialized)
47
{
48
    if (!paused || scrollcon < 2)
49
        trackpos = audio_sound_get_track_position(track1_instance);
50
    bottomy = cameray() + 270;
51
    var _notespeed = notespeed;
52
    var _centerx = 320;
53
    scr_rhythmgame_draw_backing(_notespeed, _centerx, true);
54
    var _remcolor = 8421504;
55
    if (rem_pos > 0)
56
    {
57
        if (rem_mode)
58
            _remcolor = 255;
59
        draw_set_color(_remcolor);
60
        var _rem_y = (bottomy - (rem_pos * _notespeed)) + (trackpos * _notespeed);
61
        draw_rectangle(270, _rem_y, 360, _rem_y, true);
62
    }
63
    draw_set_color(merge_color(c_fuchsia, c_white, 2 / (pressedtimer[0] + 1)));
64
    draw_line(camerax(), bottomy, _centerx, bottomy);
65
    draw_set_color(merge_color(c_blue, c_white, 2 / (pressedtimer[1] + 1)));
66
    draw_line(_centerx, bottomy, camerax() + 640, bottomy);
67
    draw_set_color(c_white);
68
    var _xstart = (instrument == 2) ? 280 : 285;
69
    var _xwidth = (instrument == 2) ? 30 : 40;
70
    
scr_rhythmgame_draw
scr_rhythmgame_draw

function
scr_rhythmgame_draw(arg0, arg1, arg2 = false)
{ scr_rhythmgame_draw_backing(arg0, arg1, arg2); if (!arg2) scr_rhythmgame_draw_combo(arg1); scr_rhythmgame_draw_chart(arg0, arg1, arg2); } function scr_rhythmgame_draw_backing(arg0, arg1, arg2 = false, arg3 = 0) { if (arg2) fade = 0; if (fade == 1 && brightness == 1) draw_set_color(c_gray); else draw_set_color(merge_color(c_black, c_gray, fade * brightness)); var _gray = merge_color(c_black, c_gray, brightness); draw_set_color(c_black); var _flash = 0; if (invc > 0 && fade == 1) _flash = remap_clamped(0, 6, 0, 1, hurt_flash); draw_set_alpha(0.75); ossafe_fill_rectangle(arg1 - 40, bottomy - 200, arg1 + 40, bottomy + 50, false); draw_set_alpha(1); draw_set_blend_mode(bm_normal); var whitebar = -1; var linegap = arg0 * notespacing * 16; var linestart = (bottomy - linegap) + (((trackpos - startoffset) % notespacing) * arg0); var whitebarstart = (bottomy - linegap) + (((trackpos - startoffset) % (notespacing * 4)) * arg0); draw_set_color(_gray); for (var i = 0; i < 20; i++) { var liney = linestart + (notespacing * arg0 * i); if (!arg2 && (liney < (bottomy - 200) || liney > (bottomy + 50))) continue; draw_set_color(_gray); draw_line(arg1 - 40, liney, arg1 + 40, liney); } var nextBar = floor(trackpos / meter); for (var i = 0; i < 5; i++) { var liney = whitebarstart + (notespacing * 4 * arg0 * i); if (arg2) { draw_text(arg1 - 70, liney - 1 - 8, (nextBar - i) + 4); draw_text(arg1 + 70, liney - 1 - 8, (((nextBar - i) + 4) * meter) - 0.01); } if (!arg2 && ((liney - 1) < (bottomy - 200) || (liney + 1) > (bottomy + 50))) continue; ossafe_fill_rectangle(arg1 - 40, liney - 1, arg1 + 40, liney + 1, false); } if (_flash > 0) { draw_set_blend_mode(bm_add); var _flashCol = merge_color(c_black, c_red, _flash * fade * brightness); ossafe_fill_rectangle_color(arg1 - 40, bottomy - 200, arg1 + 40, bottomy + 50, c_black, c_black, _flashCol, _flashCol, false); draw_set_blend_mode(bm_normal); } draw_set_color(c_white); } function scr_rhythmgame_draw_border(arg0, arg1 = false) { var _bordercolor = note_color[1]; if (invc > 0) _bordercolor = merge_color(note_color[1], c_red, scr_rhythmgame_damage_flash()); draw_set_color(merge_color(c_black, _bordercolor, brightness)); if (!arg1) { var _jp = global.lang == "ja"; var _name, _hoff; if (instrument == 0) { _name = _jp ? spr_ja_bnamekris : spr_bnamekris; _hoff = 21; } else if (instrument == 1) { _name = _jp ? spr_ja_bnamesusie : spr_bnamesusie; _hoff = 24; } else if (instrument == 2) { _name = _jp ? spr_ja_bnameralsei : spr_bnameralsei; _hoff = 30; } draw_sprite_ext(_name, 0, arg0 - _hoff, bottomy - 230, 1, 1, 0, draw_get_color(), 1); } ossafe_fill_rectangle(arg0 - 40, bottomy - 200, arg0 + 40, bottomy + 50, true); ossafe_fill_rectangle(arg0 - 41, bottomy - 201, arg0 + 41, bottomy + 51, true); } function scr_rhythmgame_draw_combo(arg0) { if (combo > 0) { draw_set_halign(fa_center); draw_set_font(fnt_main); var _combotext = (combo > 999) ? stringsetloc(
BIG
"BIG", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_125_0"
) : combo;
draw_text_transformed_color(arg0 + 2, bottomy - 121, _combotext, (combo >= 100) ? 3.5 : 5, 5, 0, #666666, #666666, #BBBBBB, #BBBBBB, 0.25); draw_text_transformed_color(arg0 + 2, bottomy - 60, stringsetloc(
COMBO
"COMBO", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_127_0"
), 2, 2, 0, #BBBBBB, #BBBBBB, #DDDDDD, #DDDDDD, 0.25);
...
(_notespeed, _centerx, true);
71
    if (do_refresh)
72
        do_refresh = false;
73
    if (missnotecon == 1)
74
    {
75
        snd_play_x(snd_hurt1, 0.6, 0.9);
76
        note_streak = 0;
77
        combo -= 200;
78
        if (instrument == 0)
79
        {
80
            if (oneAtATime)
81
                mus_volume(track1_instance, 1, 0);
82
            mus_volume(track2_instance, 0, 0);
83
        }
84
        missnotecon = 2;
85
        missnotetimer = 0;
86
    }
87
    if (!paused)
88
    {
89
        if (keyboard_check_pressed(ord("Z")))
90
        {
91
            scr_rhythmgame_editor_trail_add(trackpos, 0);
92
            rec_hold = trackpos;
93
        }
94
        if (keyboard_check_pressed(ord("X")))
95
        {
96
            scr_rhythmgame_editor_trail_add(trackpos, 1);
97
            rec_hold = trackpos;
98
        }
99
        if (instrument != 0 && keyboard_check_pressed(ord("C")))
100
        {
101
            scr_rhythmgame_editor_trail_add(trackpos, 2);
102
            rec_hold = trackpos;
103
        }
104
    }
105
    if (rec_hold > 0 && !keyboard_check(ord("Z")) && !keyboard_check(ord("X")) && !keyboard_check(ord("C")))
106
    {
107
        if ((trackpos - rec_hold) > 0.25 || instrument == 2)
108
            rec_endtime[rec_count - 1] = trackpos;
109
        rec_hold = 0;
110
    }
111
    if (keyboard_check_pressed(vk_backspace))
112
    {
113
        rec_count = 0;
114
        rec_hold = 0;
115
    }
116
    draw_set_color(c_gray);
117
    draw_set_blend_mode(bm_add);
118
    for (i = 0; i < rec_count; i++)
119
    {
120
        var _type = rec_type[i] * 40;
121
        if (instrument == 2)
122
            _type *= 0.75;
123
        var _rec_line = bottomy + ((trackpos - rec_time[i]) * _notespeed);
124
        if (_rec_line < (cameray() - 20) || (_rec_line > (cameray() + 500) && rec_endtime[i] <= 0))
125
            continue;
126
        if (instrument != 2 || paused)
127
        {
128
            if (rec_type[i] == 0)
129
            {
130
                if (instrument == 2)
131
                    draw_rectangle(250, _rec_line - 1, 290, _rec_line + 1, 1);
132
                else
133
                    draw_rectangle(250, _rec_line - 1, 310, _rec_line + 1, 1);
134
            }
135
            else if (rec_type[i] == 1)
136
            {
137
                if (instrument == 2)
138
                    draw_rectangle(295, _rec_line - 1, 335, _rec_line + 1, 1);
139
                else
140
                    draw_rectangle(320, _rec_line - 1, 380, _rec_line + 1, 1);
141
            }
142
            else if (rec_type[i] == 2)
143
            {
144
                if (instrument == 2)
145
                    draw_rectangle(340, _rec_line - 2, 380, _rec_line + 2, 1);
146
                else
147
                    draw_rectangle(240, _rec_line - 2, 390, _rec_line + 2, 1);
148
            }
149
        }
150
        if (instrument != 1 && rec_endtime[i] > 0)
151
        {
152
            var notelength = (rec_endtime[i] - rec_time[i]) * _notespeed;
153
            if (instrument == 2)
154
                draw_rectangle(270 + _type + 10, _rec_line - notelength, 270 + _type + 20, _rec_line, true);
155
            else
156
                draw_rectangle(280 + _type + 10, _rec_line - notelength, 280 + _type + 20, _rec_line, true);
157
        }
158
    }
159
    draw_set_blend_mode(bm_normal);
160
    draw_sprite_ext(spr_whitegradientdown_center, 0, camerax() + 320, cameray() + 400, 16, 4, 0, c_black, 1);
161
    draw_set_color(c_black);
162
    draw_rectangle(0, 400, 640, 480, false);
163
    draw_set_color(c_red);
164
    draw_text(0, 0, trackpos);
165
    draw_text(0, 30, remtrackpos[3]);
166
    if (maxnote > 0)
167
        draw_text(0, 60, notetime[0]);
168
    draw_text(0, 90, trackpos / meter);
169
    draw_set_color(c_white);
170
    
scr_draw_circle_width_radius
scr_draw_circle_width_radius

function
scr_draw_circle_width_radius(arg0, arg1, arg2, arg3, arg4)
{ var xx = arg0; var yy = arg1; var radius = arg2; var inner_radius = max(arg3, 0); var steps = arg4; draw_primitive_begin(pr_trianglelist); for (var i = 0; i < steps; i += 1) { draw_vertex(xx + lengthdir_x(inner_radius, (360 * i) / steps), yy + lengthdir_y(inner_radius, (360 * i) / steps)); draw_vertex(xx + lengthdir_x(radius, (360 * i) / steps), yy + lengthdir_y(radius, (360 * i) / steps)); draw_vertex(xx + lengthdir_x(radius, (360 * (i + 1)) / steps), yy + lengthdir_y(radius, (360 * (i + 1)) / steps)); draw_vertex(xx + lengthdir_x(radius, (360 * (i + 1)) / steps), yy + lengthdir_y(radius, (360 * (i + 1)) / steps)); draw_vertex(xx + lengthdir_x(inner_radius, (360 * (i + 1)) / steps), yy + lengthdir_y(inner_radius, (360 * (i + 1)) / steps)); draw_vertex(xx + lengthdir_x(inner_radius, (360 * i) / steps), yy + lengthdir_y(inner_radius, (360 * i) / steps)); } draw_primitive_end(); }
(500, 400, 50, 46, 24);
171
    draw_set_color(c_black);
172
    draw_rectangle(450, 400, 550, 450, false);
173
    draw_set_color(c_red);
174
    draw_sprite_ext(spr_werewire_throwarrow, 0, 500, 400, 1, 1, 180 - (((combo + hold_score) / max_score) * 180), c_white, 1);
175
    draw_set_valign(fa_middle);
176
    draw_set_halign(fa_center);
177
    draw_text_transformed(500, 400, total_score + hold_score, score_scale, score_scale, 0);
178
    if (score_scale > 2)
179
        score_scale = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(score_scale, 2, 0.2);
180
    if (note_streak > 0)
181
        draw_text_transformed(320, 400, string(note_streak), 2, 2, 0);
182
    draw_set_valign(fa_top);
183
    draw_set_halign(fa_left);
184
    draw_rectangle((camerax() + 640) - 25, (cameray() + 480) - 25, (camerax() + 640) - 15, (cameray() + 480) - 15, false);
185
    draw_rectangle((camerax() + 640) - 25, cameray() + 15, (camerax() + 640) - 15, cameray() + 25, false);
186
    draw_rectangle((camerax() + 640) - 22, cameray() + 20, (camerax() + 640) - 18, (cameray() + 480) - 20, false);
187
    if (rem_pos > 0)
188
        draw_sprite_ext(spr_sneo_bullet_arrow, 0, (camerax() + 640) - 38, lerp((cameray() + 480) - 21, cameray() + 19, rem_pos / track_length), 1, 1, 0, _remcolor, 1);
189
    var _walk_sprite = 4778;
190
    if (instrument == 1)
191
        _walk_sprite = 486;
192
    else if (instrument == 2)
193
        _walk_sprite = 2318;
194
    gpu_set_fog(true, c_black, 0, 1);
195
    draw_sprite(_walk_sprite, trackpos / notespacing, (camerax() + 640) - 28, lerp((cameray() + 480) - 28, cameray() + 12, trackpos / track_length) - 1);
196
    draw_sprite(_walk_sprite, trackpos / notespacing, (camerax() + 640) - 28, lerp((cameray() + 480) - 28, cameray() + 12, trackpos / track_length) + 1);
197
    gpu_set_fog(false, c_black, 0, 0);
198
    draw_sprite(_walk_sprite, trackpos / notespacing, (camerax() + 640) - 28, lerp((cameray() + 480) - 28, cameray() + 12, trackpos / track_length));
199
    if (savecon != 0 || changesmade)
200
    {
201
        var _savestring = "";
202
        if (savecon == 1)
203
        {
204
            if (has_file && load_source == 2)
205
                _savestring = string_hash_to_newline("Do you want to save this track?#This will OVERWRITE current save file#Z: I want this, X: Do not");
206
            else
207
                _savestring = string_hash_to_newline("Do you want to save this track?#Unsaved changes will be saved#Z: I want this, X: Do not");
208
        }
209
        else if (savecon == 2)
210
        {
211
            _savestring = string_hash_to_newline("Track has been saved.##Z/X: Cool");
212
        }
213
        else if (savecon == -1)
214
        {
215
            _savestring = string_hash_to_newline("What do you want to load?#Unsaved changes will vanish forever.#1/Z: Manual Save, 2: Auto-Save#3: Exported chart, 4/X: Nevermind");
216
        }
217
        else if (savecon == -2)
218
        {
219
            _savestring = string_hash_to_newline("Track has been loaded.##Z/X: Cool");
220
        }
221
        else if (changesmade)
222
        {
223
            _savestring = "You have unsaved changes!";
224
        }
225
        draw_text(camerax() + 10, (cameray() + 480) - 200, _savestring);
226
    }
227
    if (paused)
228
    {
229
        draw_sprite(spr_poppup_mouse, 0, mouse_x, mouse_y);
230
        if (mouse_x >= 250 && mouse_x <= 380)
231
        {
232
            var _prec = keyboard_check(vk_lalt) ? 3 : 4;
233
            if (keyboard_check(vk_ralt))
234
                _prec *= 2;
235
            var _mouse_pos = scr_round_to_beat(trackpos + ((bottomy - mouse_y) / _notespeed), bpm, _prec);
236
            var _mouse_height = bottomy - ((_mouse_pos - trackpos) * _notespeed);
237
            var _mouse_side = (mouse_x < 320) ? 0 : 1;
238
            if (instrument == 2)
239
            {
240
                if (mouse_x > 335)
241
                    _mouse_side = 2;
242
                else if (mouse_x > 305)
243
                    _mouse_side = 1;
244
                else
245
                    _mouse_side = 0;
246
            }
247
            else if (instrument == 1 && keyboard_check(vk_lshift))
248
            {
249
                _mouse_side = 2;
250
            }
251
            var _highlighted_note = collision_point(mouse_x, mouse_y, obj_rhythmgame_editor_note_node, false, true);
252
            var _lastmouse = mousecon;
253
            if (mouse_button == mb_left)
254
                mousecon = 1;
255
            else if (mouse_button == mb_right)
256
                mousecon = 2;
257
            else
258
                mousecon = 0;
259
            if (mousecon == 1 && _lastmouse == 0)
260
            {
261
                if (_highlighted_note != -4)
262
                {
263
                    notemod_index = _highlighted_note.noteindex;
264
                    if (keyboard_check(vk_lshift) && instrument != 1)
265
                    {
266
                        noteeditmode = 2;
267
                    }
268
                    else if (keyboard_check(vk_lcontrol))
269
                    {
270
                        scr_rhythmgame_editor_note_anim(notemod_index);
271
                        noteeditmode = 3;
272
                    }
273
                    else
274
                    {
275
                        noteeditmode = 1;
276
                    }
277
                }
278
            }
279
            if (mousecon == 1 && noteeditmode == 2)
280
            {
281
                var _notetype = notetype[notemod_index];
282
                var notey = (bottomy - (notetime[notemod_index] * _notespeed)) + (trackpos * _notespeed);
283
                var notelength = (_mouse_pos - notetime[notemod_index]) * _notespeed;
284
                var _longx = _xstart;
285
                if (instrument == 2)
286
                    _longx -= 5;
287
                draw_rectangle(_longx + (_notetype * _xwidth) + 12, notey - notelength, _longx + (_notetype * _xwidth) + 18, notey, false);
288
            }
289
            if (_lastmouse == 1 && mousecon == 0)
290
            {
291
                if (noteeditmode == 1)
292
                {
293
                    if (notetime[notemod_index] != _mouse_pos || notetype[notemod_index] != _mouse_side)
294
                    {
295
                        scr_rhythmgame_editor_move_note(notemod_index, _mouse_pos, _mouse_side, noteend[notemod_index]);
296
                        changesmade = true;
297
                    }
298
                }
299
                else if (noteeditmode == 2)
300
                {
301
                    var _endtime = 0;
302
                    if (_mouse_pos > notetime[notemod_index])
303
                        _endtime = _mouse_pos;
304
                    if (_endtime != noteend[notemod_index])
305
                    {
306
                        scr_rhythmgame_editor_record_undo(notemod_index);
307
                        changesmade = true;
308
                        noteend[notemod_index] = _endtime;
309
                        scr_rhythmgame_editor_refresh();
310
                    }
311
                }
312
                else if (noteeditmode == 3)
313
                {
314
                    mousecon = 0;
315
                }
316
                else
317
                {
318
                    mousecon = 0;
319
                    newnote_time = _mouse_pos;
320
                    newnote_type = _mouse_side;
321
                    if (instrument == 2)
322
                        scr_rhythmgame_editor_insert_note(_mouse_pos, _mouse_side, _mouse_pos + (meter / 16));
323
                    else
324
                        scr_rhythmgame_editor_insert_note(_mouse_pos, _mouse_side);
325
                }
326
                notemod_index = -1;
327
                noteeditmode = 0;
328
            }
329
            if (_lastmouse == 2)
330
            {
331
                if (_highlighted_note != -4)
332
                {
333
                    _highlighted_note.active = false;
334
                    scr_rhythmgame_editor_delete_note(_highlighted_note.noteindex);
335
                }
336
            }
337
            var _outline = (mousecon == 0) ? 1 : 0;
338
            var _xoff = _mouse_side * _xwidth;
339
            var _rx = _xwidth - 10;
340
            if (noteeditmode == 1)
341
            {
342
                var _note_height = bottomy - ((notetime[notemod_index] - trackpos) * _notespeed);
343
                var _note_xoff = notetype[notemod_index] * _xwidth;
344
                draw_set_color(c_yellow);
345
                draw_rectangle((_xstart + _note_xoff) - 2, _note_height - 5, _xstart + _rx + _note_xoff + 2, _note_height + 5, false);
346
                draw_set_color(c_gray);
347
                draw_rectangle(_xstart + _note_xoff, _note_height - 3, _xstart + _rx + _note_xoff, _note_height + 3, false);
348
            }
349
            else if (_highlighted_note != -4)
350
            {
351
                draw_set_color(c_yellow);
352
                draw_rectangle(_xstart + _xoff, _mouse_height - 3, _xstart + _rx + _xoff, _mouse_height + 3, false);
353
            }
354
            draw_set_color(c_red);
355
            draw_rectangle(_xstart + _xoff, _mouse_height - 3, _xstart + _rx + _xoff, _mouse_height + 3, _outline);
356
        }
357
        else if (mousecon == 1 && mouse_button != mb_left)
358
        {
359
            mousecon = 0;
360
        }
361
        draw_text(camerax() + 20, (cameray() + 480) - 60, "scrollcon = " + string(scrollcon));
362
        draw_sprite(spr_sneo_playback, 1, camerax() + 40, (cameray() + 480) - 40);
363
    }
364
    draw_set_halign(fa_right);
365
    var _message;
366
    if (tooltips)
367
        _message = string_hash_to_newline("LMB: Write#RMB: Erase#Shift+LMB on existing note: Extend#Alt: Snap to thirds#Space/P: Pause/Play#-/+ (=): Zoom in/out#W/E: Disable/Enable guitar stem#T: Refresh notes#V: Set playback start#B: Toggle playback start#N: Return to playback start#Backspace: Clear note memory#Q: Autoplay#U: Save#I: Load#Tab: Hide tooltips");
368
    else
369
        _message = string_hash_to_newline("Tab: Show tooltips");
370
    draw_text((camerax() + 640) - 40, cameray() + 20, _message);
371
    draw_set_halign(fa_left);
372
}