Deltarune (Chapter 4) 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
        ossafe_fill_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); d_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 + 1); 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 && !demo_mode) { 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); if (!arg1 && demo_mode) { draw_set_halign(fa_center); draw_set_valign(fa_middle); draw_set_font(fnt_mainbig); draw_text_outline(arg0 + 2, bottomy - 100, "DEMO", 2, 2, 0); draw_set_halign(fa_left); draw_set_valign(fa_top); } } ...
(_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
                    ossafe_fill_rectangle(250, _rec_line - 1, 290, _rec_line + 1, 1);
132
                else
133
                    ossafe_fill_rectangle(250, _rec_line - 1, 310, _rec_line + 1, 1);
134
            }
135
            else if (rec_type[i] == 1)
136
            {
137
                if (instrument == 2)
138
                    ossafe_fill_rectangle(295, _rec_line - 1, 335, _rec_line + 1, 1);
139
                else
140
                    ossafe_fill_rectangle(320, _rec_line - 1, 380, _rec_line + 1, 1);
141
            }
142
            else if (rec_type[i] == 2)
143
            {
144
                if (instrument == 2)
145
                    ossafe_fill_rectangle(340, _rec_line - 2, 380, _rec_line + 2, 1);
146
                else
147
                    ossafe_fill_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
                ossafe_fill_rectangle(270 + _type + 10, _rec_line - notelength, 270 + _type + 20, _rec_line, true);
155
            else
156
                ossafe_fill_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
    ossafe_fill_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 (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
    ossafe_fill_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
    ossafe_fill_rectangle((camerax() + 640) - 25, (cameray() + 480) - 25, (camerax() + 640) - 15, (cameray() + 480) - 15, false);
185
    ossafe_fill_rectangle((camerax() + 640) - 25, cameray() + 15, (camerax() + 640) - 15, cameray() + 25, false);
186
    ossafe_fill_rectangle((camerax() + 640) - 22, cameray() + 20, (camerax() + 640) - 18, (cameray() + 480) - 20, false);
187
    if (last_pause >= 0)
188
        draw_sprite_ext(spr_rhythmgame_editor_arrow, 0, (camerax() + 640) - 38, lerp((cameray() + 480) - 21, cameray() + 19, last_pause / track_length), 1, 1, 0, _remcolor, 1);
189
    if (rem_pos >= 0)
190
        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);
191
    var _walk_sprite = 5636;
192
    if (instrument == 1)
193
        _walk_sprite = 5143;
194
    else if (instrument == 2)
195
        _walk_sprite = 3320;
196
    gpu_set_fog(true, c_black, 0, 1);
197
    draw_sprite(_walk_sprite, trackpos / notespacing, (camerax() + 640) - 28, lerp((cameray() + 480) - 28, cameray() + 12, trackpos / track_length) - 1);
198
    draw_sprite(_walk_sprite, trackpos / notespacing, (camerax() + 640) - 28, lerp((cameray() + 480) - 28, cameray() + 12, trackpos / track_length) + 1);
199
    gpu_set_fog(false, c_black, 0, 0);
200
    draw_sprite(_walk_sprite, trackpos / notespacing, (camerax() + 640) - 28, lerp((cameray() + 480) - 28, cameray() + 12, trackpos / track_length));
201
    if (savecon != 0 || changesmade)
202
    {
203
        var _savestring = "";
204
        if (savecon == 1)
205
        {
206
            if (has_file && load_source == 2)
207
                _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");
208
            else
209
                _savestring = string_hash_to_newline("Do you want to save this track?#Unsaved changes will be saved#Z: I want this, X: Do not");
210
        }
211
        else if (savecon == 2)
212
        {
213
            _savestring = string_hash_to_newline("Track has been saved.##Z/X: Cool");
214
        }
215
        else if (savecon == -1)
216
        {
217
            _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");
218
        }
219
        else if (savecon == -2)
220
        {
221
            _savestring = string_hash_to_newline("Track has been loaded.##Z/X: Cool");
222
        }
223
        else if (changesmade)
224
        {
225
            _savestring = "You have unsaved changes!";
226
        }
227
        draw_text(camerax() + 10, (cameray() + 480) - 200, _savestring);
228
    }
229
    if (paused)
230
    {
231
        draw_sprite(spr_poppup_mouse, 0, mouse_x, mouse_y);
232
        if (mouse_x >= 250 && mouse_x <= 380)
233
        {
234
            var _prec = keyboard_check(vk_lalt) ? 3 : 4;
235
            if (keyboard_check(vk_ralt))
236
                _prec *= 2;
237
            var _mouse_pos = scr_round_to_beat(trackpos + ((bottomy - mouse_y) / _notespeed), bpm, _prec);
238
            var _mouse_height = bottomy - ((_mouse_pos - trackpos) * _notespeed);
239
            var _mouse_side = (mouse_x < 320) ? 0 : 1;
240
            if (instrument == 2)
241
            {
242
                if (mouse_x > 335)
243
                    _mouse_side = 2;
244
                else if (mouse_x > 305)
245
                    _mouse_side = 1;
246
                else
247
                    _mouse_side = 0;
248
            }
249
            else if (instrument == 1 && keyboard_check(vk_lshift))
250
            {
251
                _mouse_side = 2;
252
            }
253
            var _highlighted_note = collision_point(mouse_x, mouse_y, obj_rhythmgame_editor_note_node, false, true);
254
            var _lastmouse = mousecon;
255
            if (mouse_button == mb_left)
256
                mousecon = 1;
257
            else if (mouse_button == mb_right)
258
                mousecon = 2;
259
            else
260
                mousecon = 0;
261
            if (mousecon == 1 && _lastmouse == 0)
262
            {
263
                if (_highlighted_note != -4)
264
                {
265
                    notemod_index = _highlighted_note.noteindex;
266
                    if (keyboard_check(vk_lshift) && instrument != 1)
267
                    {
268
                        noteeditmode = 2;
269
                    }
270
                    else if (keyboard_check(vk_lcontrol))
271
                    {
272
                        scr_rhythmgame_editor_note_anim(notemod_index);
273
                        noteeditmode = 3;
274
                    }
275
                    else
276
                    {
277
                        noteeditmode = 1;
278
                    }
279
                }
280
            }
281
            if (mousecon == 1 && noteeditmode == 2)
282
            {
283
                var _notetype = notetype[notemod_index];
284
                var notey = (bottomy - (notetime[notemod_index] * _notespeed)) + (trackpos * _notespeed);
285
                var notelength = (_mouse_pos - notetime[notemod_index]) * _notespeed;
286
                var _longx = _xstart;
287
                if (instrument == 2)
288
                    _longx -= 5;
289
                ossafe_fill_rectangle(_longx + (_notetype * _xwidth) + 12, notey - notelength, _longx + (_notetype * _xwidth) + 18, notey, false);
290
            }
291
            if (_lastmouse == 1 && mousecon == 0)
292
            {
293
                if (noteeditmode == 1)
294
                {
295
                    if (notetime[notemod_index] != _mouse_pos || notetype[notemod_index] != _mouse_side)
296
                    {
297
                        scr_rhythmgame_editor_move_note(notemod_index, _mouse_pos, _mouse_side, noteend[notemod_index]);
298
                        changesmade = true;
299
                    }
300
                }
301
                else if (noteeditmode == 2)
302
                {
303
                    var _endtime = 0;
304
                    if (_mouse_pos > notetime[notemod_index])
305
                        _endtime = _mouse_pos;
306
                    if (_endtime != noteend[notemod_index])
307
                    {
308
                        scr_rhythmgame_editor_record_undo(notemod_index);
309
                        changesmade = true;
310
                        noteend[notemod_index] = _endtime;
311
                        scr_rhythmgame_editor_refresh();
312
                    }
313
                }
314
                else if (noteeditmode == 3)
315
                {
316
                    mousecon = 0;
317
                }
318
                else
319
                {
320
                    mousecon = 0;
321
                    newnote_time = _mouse_pos;
322
                    newnote_type = _mouse_side;
323
                    if (instrument == 2 && !keyboard_check(vk_lcontrol))
324
                        scr_rhythmgame_editor_insert_note(_mouse_pos, _mouse_side, _mouse_pos + (meter / 16));
325
                    else
326
                        scr_rhythmgame_editor_insert_note(_mouse_pos, _mouse_side);
327
                }
328
                notemod_index = -1;
329
                noteeditmode = 0;
330
            }
331
            if (_lastmouse == 2)
332
            {
333
                if (_highlighted_note != -4)
334
                {
335
                    _highlighted_note.active = false;
336
                    scr_rhythmgame_editor_delete_note(_highlighted_note.noteindex);
337
                }
338
            }
339
            var _outline = (mousecon == 0) ? 1 : 0;
340
            var _xoff = _mouse_side * _xwidth;
341
            var _rx = _xwidth - 10;
342
            if (noteeditmode == 1)
343
            {
344
                var _note_height = bottomy - ((notetime[notemod_index] - trackpos) * _notespeed);
345
                var _note_xoff = notetype[notemod_index] * _xwidth;
346
                draw_set_color(c_yellow);
347
                ossafe_fill_rectangle((_xstart + _note_xoff) - 2, _note_height - 5, _xstart + _rx + _note_xoff + 2, _note_height + 5, false);
348
                draw_set_color(c_gray);
349
                ossafe_fill_rectangle(_xstart + _note_xoff, _note_height - 3, _xstart + _rx + _note_xoff, _note_height + 3, false);
350
            }
351
            else if (_highlighted_note != -4)
352
            {
353
                draw_set_color(c_yellow);
354
                ossafe_fill_rectangle(_xstart + _xoff, _mouse_height - 3, _xstart + _rx + _xoff, _mouse_height + 3, false);
355
            }
356
            draw_set_color(c_red);
357
            ossafe_fill_rectangle(_xstart + _xoff, _mouse_height - 3, _xstart + _rx + _xoff, _mouse_height + 3, _outline);
358
        }
359
        else if (mousecon == 1 && mouse_button != mb_left)
360
        {
361
            mousecon = 0;
362
        }
363
        draw_text(camerax() + 20, (cameray() + 480) - 60, "scrollcon = " + string(scrollcon));
364
        draw_sprite(spr_sneo_playback, 1, camerax() + 40, (cameray() + 480) - 40);
365
    }
366
    draw_set_halign(fa_right);
367
    var _message;
368
    if (tooltips)
369
        _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");
370
    else
371
        _message = string_hash_to_newline("Tab: Show tooltips");
372
    draw_text((camerax() + 640) - 40, cameray() + 20, _message);
373
    draw_set_halign(fa_left);
374
}