Deltarune (Chapter 5) script viewer

← back to main script listing

gml_GlobalScript_scr_rhythmgame_draw

(view raw script w/o annotations or w/e)
1
function 
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_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 _icon, _hoff, _name; if (instrument == 0) { _icon = 4138; _name = _jp ? spr_ja_bnamekris : spr_bnamekris; _hoff = 21; } else if (instrument == 1) { _icon = 4145; _name = _jp ? spr_ja_bnamesusie : spr_bnamesusie; _hoff = 24; } else if (instrument == 2) { _icon = 4140; _name = _jp ? spr_ja_bnameralsei : spr_bnameralsei; _hoff = 30; } var _hurt = invc > 50 || scr_rhythmgame_damage_flash() > 0; draw_sprite_ext(_icon, _hurt ? 5 : 0, arg0 - _hoff - 20, bottomy - 234, 1, 1, 0, merge_color(c_black, c_white, brightness), 1); draw_sprite_ext(_name, 0, (arg0 - _hoff) + 20, bottomy - 228, 1, 1, 0, draw_get_color(), 1); } draw_set_color(c_black); draw_set_alpha(0.5); ossafe_fill_rectangle((arg0 - 40) + 2, (bottomy - 200) + 2, arg0 + 40 + 2, bottomy + 50 + 2, true); ossafe_fill_rectangle((arg0 - 41) + 2, (bottomy - 201) + 2, arg0 + 41 + 2, bottomy + 51 + 2, true); draw_set_alpha(1); draw_set_color(merge_color(c_black, _bordercolor, brightness)); 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_font(fnt_main); draw_set_halign(fa_left); draw_set_valign(fa_top); } } 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_b"
) : 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_b"
), 2, 2, 0, #BBBBBB, #BBBBBB, #DDDDDD, #DDDDDD, 0.25);
draw_set_halign(fa_left); } } function scr_rhythmgame_draw_chart(arg0, arg1, arg2 = false) { var _hitspeed = !arg2 ? obj_rhythmgame.pitch : 1; if (!arg2 && obj_rhythmgame.lose_con == 2) _hitspeed = 0; var _xstart = (instrument == 2) ? 280 : 280; var _xwidth = (instrument == 2) ? 30 : 40; var _beam = 0; var _notecol = []; var _flash = 0; var _altcolor = 0; if (invc > 0) _flash = scr_rhythmgame_damage_flash(); _notecol[0] = merge_color(note_color[0], c_red, _flash); _notecol[0] = merge_color(c_black, _notecol[0], brightness); _notecol[1] = merge_color(note_color[1], c_red, _flash); _notecol[1] = merge_color(c_black, _notecol[1], brightness); _notecol[2] = merge_color(note_color[2], c_red, _flash); _notecol[2] = merge_color(c_black, _notecol[2], brightness); var _yellow = merge_color(c_black, merge_color(c_yellow, c_red, _flash), brightness); var _gold = merge_color(c_black, #FFED72, brightness); var _orange = merge_color(c_black, merge_color(c_orange, c_red, _flash), brightness); var _white = merge_color(c_black, merge_color(c_white, c_red, _flash), brightness); var _gray = merge_color(c_black, merge_color(c_gray, c_red, _flash), brightness); if (instrument == 1 && !arg2) { draw_sprite_ext(spr_rhythmgame_button, 4, arg1 - 20, bottomy, 1, 1, 0, _notecol[0], 1); draw_sprite_ext(spr_rhythmgame_button, 4, arg1 + 20, bottomy, 1, 1, 0, _notecol[1], 1); ...
(arg0, arg1, arg2 = false)
2
{
3
    
scr_rhythmgame_draw_backing
scr_rhythmgame_draw_backing

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; var _ts = signature; var _bpm = bpm; var _posoffset = startoffset; var _rts = max(4, floor(signature)); draw_set_color(c_red); if (arg2) { var _sigmul = _ts % 1; if (_sigmul == 0) _sigmul = 1; draw_text(10, 80, "Time Signature: " + string(_ts / _sigmul) + "/" + string(4 / _sigmul)); draw_text(10, 100, "BPM: " + string(_bpm)); } draw_set_color(c_black); var _bpm_mul = 1; if (bpm_count > 1) _bpm_mul = _bpm / bpm_change[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 _lead = floor_to_multiple(16, _ts); var _lead_num = _lead / _ts; var whitebar = -1; var _bpmi = bpm_index; var _notespacing = notespacing; if (signature_index != 0 && bpm_index != 0) _posoffset = max(bpm_time[_bpmi], signature_time[signature_index]); else if (signature_index != 0) _posoffset = signature_time[signature_index]; else if (bpm_index != 0) _posoffset = bpm_time[_bpmi]; var linegap = arg0 * _notespacing; var linestart = bottomy + (((trackpos - _posoffset) % (_notespacing * _ts)) * arg0); draw_set_color(_gray); var liney = linestart; draw_set_color(_gray); var _bpm_changed = true; var _next_bpm = _bpm; var _next_bpm_time = -1; if (bpm_count > 1 && _bpmi < (bpm_count - 1)) { _next_bpm = bpm_change[_bpmi + 1]; _next_bpm_time = bpm_time[_bpmi + 1]; _bpm_changed = false; } var nextBar = floor(trackpos / meter); var _ts_changed = true; var _next_ts = _ts; var _next_ts_time = -1; if (signature_count > 1 && signature_index < (signature_count - 1)) { _next_ts = signature_change[signature_index + 1]; _next_ts_time = signature_time[signature_index + 1]; _ts_changed = false; } var _barcount = 0; var _pregap = linegap; if (bpm_index > 0 && ((trackpos + ((bottomy - liney) / arg0)) - 0.5) < bpm_time[bpm_index]) _pregap = (60 / bpm_change[bpm_index - 1]) * arg0; draw_set_color(c_gray); if (signature_index > 0) { var _last_ts = _ts; if ((trackpos - 0.5) < signature_time[signature_index]) _last_ts = signature_change[signature_index - 1]; if ((_last_ts % 1) != 0) liney -= (linegap / 2); } for (var i = 0; i < _rts; i++) { liney += _pregap; if (!arg2 && (liney + 1) > (bottomy + 50)) break; d_line(arg1 - 40, liney, arg1 + 40, liney); } liney = linestart; var _eighths = (_ts % 1) == 0.5; var _oddts = false; if (_eighths) { if (((trackpos - signature_time[signature_index]) % (_ts * 2)) >= _ts) _oddts = true; } for (var i = 0; i < max(20, _rts * 2); i++) { if (i > 0) liney -= linegap; ...
(arg0, arg1, arg2);
4
    if (!arg2)
5
        scr_rhythmgame_draw_combo(arg1);
6
    scr_rhythmgame_draw_chart(arg0, arg1, arg2);
7
}
8
9
function scr_rhythmgame_draw_border(arg0, arg1 = false)
10
{
11
    var _bordercolor = note_color[1];
12
    if (invc > 0)
13
        _bordercolor = merge_color(note_color[1], c_red, scr_rhythmgame_damage_flash());
14
    draw_set_color(merge_color(c_black, _bordercolor, brightness));
15
    if (!arg1 && !demo_mode)
16
    {
17
        var _jp = global.lang == "ja";
18
        var _icon, _hoff, _name;
19
        if (instrument == 0)
20
        {
21
            _icon = 4138;
22
            _name = _jp ? spr_ja_bnamekris : spr_bnamekris;
23
            _hoff = 21;
24
        }
25
        else if (instrument == 1)
26
        {
27
            _icon = 4145;
28
            _name = _jp ? spr_ja_bnamesusie : spr_bnamesusie;
29
            _hoff = 24;
30
        }
31
        else if (instrument == 2)
32
        {
33
            _icon = 4140;
34
            _name = _jp ? spr_ja_bnameralsei : spr_bnameralsei;
35
            _hoff = 30;
36
        }
37
        var _hurt = invc > 50 || scr_rhythmgame_damage_flash() > 0;
38
        draw_sprite_ext(_icon, _hurt ? 5 : 0, arg0 - _hoff - 20, bottomy - 234, 1, 1, 0, merge_color(c_black, c_white, brightness), 1);
39
        draw_sprite_ext(_name, 0, (arg0 - _hoff) + 20, bottomy - 228, 1, 1, 0, draw_get_color(), 1);
40
    }
41
    draw_set_color(c_black);
42
    draw_set_alpha(0.5);
43
    ossafe_fill_rectangle((arg0 - 40) + 2, (bottomy - 200) + 2, arg0 + 40 + 2, bottomy + 50 + 2, true);
44
    ossafe_fill_rectangle((arg0 - 41) + 2, (bottomy - 201) + 2, arg0 + 41 + 2, bottomy + 51 + 2, true);
45
    draw_set_alpha(1);
46
    draw_set_color(merge_color(c_black, _bordercolor, brightness));
47
    ossafe_fill_rectangle(arg0 - 40, bottomy - 200, arg0 + 40, bottomy + 50, true);
48
    ossafe_fill_rectangle(arg0 - 41, bottomy - 201, arg0 + 41, bottomy + 51, true);
49
    if (!arg1 && demo_mode)
50
    {
51
        draw_set_halign(fa_center);
52
        draw_set_valign(fa_middle);
53
        draw_set_font(fnt_mainbig);
54
        draw_text_outline(arg0 + 2, bottomy - 100, "DEMO", 2, 2, 0);
55
        draw_set_font(fnt_main);
56
        draw_set_halign(fa_left);
57
        draw_set_valign(fa_top);
58
    }
59
}
60
61
function scr_rhythmgame_draw_combo(arg0)
62
{
63
    if (combo > 0)
64
    {
65
        draw_set_halign(fa_center);
66
        draw_set_font(fnt_main);
67
        var _combotext = (combo > 999) ? stringsetloc(
BIG
"BIG", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_125_0_b"
) : combo;
68
        draw_text_transformed_color(arg0 + 2, bottomy - 121, _combotext, (combo >= 100) ? 3.5 : 5, 5, 0, #666666, #666666, #BBBBBB, #BBBBBB, 0.25);
69
        draw_text_transformed_color(arg0 + 2, bottomy - 60, stringsetloc(
COMBO
"COMBO", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_127_0_b"
), 2, 2, 0, #BBBBBB, #BBBBBB, #DDDDDD, #DDDDDD, 0.25);
70
        draw_set_halign(fa_left);
71
    }
72
}
73
74
function scr_rhythmgame_draw_chart(arg0, arg1, arg2 = false)
75
{
76
    var _hitspeed = !arg2 ? obj_rhythmgame.pitch : 1;
77
    if (!arg2 && obj_rhythmgame.lose_con == 2)
78
        _hitspeed = 0;
79
    var _xstart = (instrument == 2) ? 280 : 280;
80
    var _xwidth = (instrument == 2) ? 30 : 40;
81
    var _beam = 0;
82
    var _notecol = [];
83
    var _flash = 0;
84
    var _altcolor = 0;
85
    if (invc > 0)
86
        _flash = scr_rhythmgame_damage_flash();
87
    _notecol[0] = merge_color(note_color[0], c_red, _flash);
88
    _notecol[0] = merge_color(c_black, _notecol[0], brightness);
89
    _notecol[1] = merge_color(note_color[1], c_red, _flash);
90
    _notecol[1] = merge_color(c_black, _notecol[1], brightness);
91
    _notecol[2] = merge_color(note_color[2], c_red, _flash);
92
    _notecol[2] = merge_color(c_black, _notecol[2], brightness);
93
    var _yellow = merge_color(c_black, merge_color(c_yellow, c_red, _flash), brightness);
94
    var _gold = merge_color(c_black, #FFED72, brightness);
95
    var _orange = merge_color(c_black, merge_color(c_orange, c_red, _flash), brightness);
96
    var _white = merge_color(c_black, merge_color(c_white, c_red, _flash), brightness);
97
    var _gray = merge_color(c_black, merge_color(c_gray, c_red, _flash), brightness);
98
    if (instrument == 1 && !arg2)
99
    {
100
        draw_sprite_ext(spr_rhythmgame_button, 4, arg1 - 20, bottomy, 1, 1, 0, _notecol[0], 1);
101
        draw_sprite_ext(spr_rhythmgame_button, 4, arg1 + 20, bottomy, 1, 1, 0, _notecol[1], 1);
102
    }
103
    if (instrument == 2)
104
    {
105
        draw_set_color(c_black);
106
        ossafe_fill_rectangle(arg1 - 40, bottomy - 2, arg1 + 40, bottomy + 2, false);
107
        draw_set_color(_orange);
108
        ossafe_fill_rectangle(arg1 - 40, bottomy - 1, arg1 + 40, bottomy + 1, false);
109
    }
110
    if (instrument == 2 && !arg2 && obj_rhythmgame.song_id != 10 && !clapping)
111
    {
112
        var _maxbeam = 0;
113
        for (var i = 0; i < 3; i++)
114
        {
115
            _beam = 
scr_ease_in
scr_ease_in

function
scr_ease_in(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_in_bounce(arg0, 0, 1, 1); case -2: return ease_in_elastic(arg0, 0, 1, 1); case -1: var _s = 1.70158; return arg0 * arg0 * (((_s + 1) * arg0) - _s); case 0: return arg0; case 1: return -cos(arg0 * 1.5707963267948966) + 1; case 6: return power(2, 10 * (arg0 - 1)); case 7: return -(sqrt(1 - sqr(arg0)) - 1); default: return power(arg0, arg1); } }
(note_hit_timer[i] / 5, 2);
116
            _maxbeam = max(_beam, _maxbeam);
117
            if (note_hit_timer[i] > 0)
118
            {
119
                draw_sprite_ext(spr_whitegradientdown_rhythm, 1, (arg1 - 30) + (30 * i), bottomy, _beam * 0.75, 1, 0, _gold, 1);
120
                draw_sprite_ext(spr_whitegradientdown_rhythm, 2, (arg1 - 30) + (30 * i), bottomy, _beam * 0.75, 1, 0, _white, 1);
121
                if (last_note != i && cooldown > 1)
122
                    notex = clamp01(last_note - i) * 6;
123
                else if (cooldown <= 1)
124
                    notex = 0;
125
            }
126
            note_hit_timer[i] -= _hitspeed;
127
        }
128
        if (cooldown > 0)
129
        {
130
            var _arrow = (cooldown == 2) ? _yellow : _white;
131
            draw_sprite_ext(spr_singing_arrow, 0, (arg1 - 30) + (30 * last_note) + notex, bottomy + 3, 1, 1, 0, _arrow, clamp01(cooldown));
132
            notex = 
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); } }
(notex, 0, 4);
133
            cooldown -= (1/15);
134
        }
135
    }
136
    else
137
    {
138
        for (var i = 0; i < 2; i++)
139
        {
140
            if (note_hit_timer[i] > 0)
141
            {
142
                _beam = 
scr_ease_in
scr_ease_in

function
scr_ease_in(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_in_bounce(arg0, 0, 1, 1); case -2: return ease_in_elastic(arg0, 0, 1, 1); case -1: var _s = 1.70158; return arg0 * arg0 * (((_s + 1) * arg0) - _s); case 0: return arg0; case 1: return -cos(arg0 * 1.5707963267948966) + 1; case 6: return power(2, 10 * (arg0 - 1)); case 7: return -(sqrt(1 - sqr(arg0)) - 1); default: return power(arg0, arg1); } }
(note_hit_timer[i] / 5, 2);
143
                var _ease = note_hit_timer[i] / 5;
144
                var _col = _white;
145
                var _cool = false;
146
                var _side = (i * 2) - 1;
147
                var _cenx = arg1 + (20 * _side);
148
                var _score = 0;
149
                var _beamheight = 1;
150
                if (instrument == 0)
151
                {
152
                    _score = note_hit_score[i];
153
                    _cool = _score >= 100;
154
                    _col = _cool ? _gold : _white;
155
                }
156
                if (instrument == 2)
157
                    _score = 100;
158
                if (instrument == 1)
159
                {
160
                    if (auto_play)
161
                    {
162
                        _score = 100;
163
                        _cool = true;
164
                        _col = _gold;
165
                    }
166
                    draw_sprite_ext(spr_rhythmgame_button, 3, _cenx, bottomy, 1, 1, 0, _white, note_hit_timer[i] / 5);
167
                }
168
                if (instrument == 2)
169
                {
170
                    _cool = true;
171
                    _col = _gold;
172
                    _cenx = arg1;
173
                    draw_set_color(_white);
174
                    draw_set_alpha(note_hit_timer[i] / 5);
175
                    ossafe_fill_rectangle(arg1 - 40, bottomy - 2, arg1 + 40, bottomy + 2, false);
176
                    draw_set_alpha(1);
177
                }
178
                if (!arg2 && obj_rhythmgame.fame >= 12000 && obj_rhythmgame.combo >= 15 && _score > 0)
179
                {
180
                    if (instrument != 2)
181
                    {
182
                        draw_sprite_ext(spr_rhythmgame_note_hit, (1 - _beam) * 2.9, _cenx + (_side * (1 - _ease) * 2), bottomy, 2 - _beam, 2 - _beam, 0, merge_color(_white, _col, 1 - _ease), _ease);
183
                    }
184
                    else
185
                    {
186
                        var _beam_scale = 1 - _beam;
187
                        draw_sprite_ext(spr_rhythmgame_note_hit_big, (1 - _beam) * 2.9, _cenx, bottomy, (_beam_scale * 0.5) + 1, (_beam_scale * 0.5) + 1, 0, merge_color(_white, _col, 1 - _ease), _ease);
188
                    }
189
                }
190
                if (instrument == 2)
191
                {
192
                    var _beam_scale = 1 - _beam;
193
                    draw_sprite_ext(spr_whitegradientdown_rhythm, 1, _cenx, bottomy, 2, _beam_scale + 0.25, 0, _gold, clamp01(_beam * 2));
194
                    draw_sprite_ext(spr_whitegradientdown_rhythm, 2, _cenx, bottomy, 2, _beam_scale + 0.25, 0, _white, clamp01(_beam * 2));
195
                }
196
                else if (_cool)
197
                {
198
                    draw_sprite_ext(spr_whitegradientdown_rhythm, 1, _cenx, bottomy, _beam, 1, 0, _gold, 1);
199
                    draw_sprite_ext(spr_whitegradientdown_rhythm, 2, _cenx, bottomy, _beam, 1, 0, _white, 1);
200
                }
201
                else
202
                {
203
                    draw_sprite_ext(spr_whitegradientdown_rhythm, 0, _cenx, bottomy, _beam, 1, 0, _white, 1);
204
                }
205
                note_hit_timer[i] -= _hitspeed;
206
            }
207
        }
208
    }
209
    if (!arg2 && !paused)
210
    {
211
        scr_draw_set_mask(true);
212
        ossafe_fill_rectangle(arg1 - 40, bottomy + 50, arg1 + 40, bottomy - 200, false);
213
        scr_draw_in_mask_begin();
214
    }
215
    var _looper = !arg2 && (loop || (chart_end > track_length && maxnote > 0 && notetime[0] < chart_start));
216
    var _loopcheck = false;
217
    var _averagetimeunit = ((trackpos - remtrackpos[0]) + (remtrackpos[0] - remtrackpos[1]) + (remtrackpos[1] - remtrackpos[2])) / 3;
218
    var _end_buffer = trackpos - (3.6 * _averagetimeunit);
219
    if (!arg2 && instrument == 0 && hardmode)
220
        _end_buffer = trackpos - (2.4 * _averagetimeunit);
221
    var notei = max(minnote - 8, 0);
222
    for (; notei < maxnote; notei++)
223
    {
224
        var _notetime = notetime[notei];
225
        var _notealive = notealive[notei];
226
        var _notescore = notescore[notei];
227
        var _noteend = noteend[notei];
228
        if (!arg2 && instrument != 1 && obj_rhythmgame.song_id == 0)
229
        {
230
            _notetime = scr_rhythmgame_noteskip(notetime[notei]);
231
            if (_noteend > 0)
232
                _noteend = scr_rhythmgame_noteskip(_noteend);
233
        }
234
        else if (_loopcheck)
235
        {
236
            _notetime = scr_rhythmgame_noteloop(notetime[notei]);
237
            if (_notetime > (track_length / 2))
238
            {
239
                _notealive = 1;
240
                _notescore = 0;
241
            }
242
            else
243
            {
244
                _notealive = 0;
245
                if (notei >= (maxnote - 5))
246
                    _notescore = last_score[notei - (maxnote - 5)];
247
            }
248
            if (_noteend > 0)
249
                _noteend = scr_rhythmgame_noteloop(_noteend);
250
        }
251
        var notey = (bottomy - (_notetime * arg0)) + (trackpos * arg0);
252
        var _topy = camy - 20;
253
        if (notey < _topy)
254
        {
255
            if (_looper && !_loopcheck && trackpos < 4 && maxnote > 9)
256
            {
257
                _loopcheck = true;
258
                notei = maxnote - 9;
259
                continue;
260
            }
261
            break;
262
        }
263
        if (notey >= _topy && (notei >= minnote || _notescore <= 0 || (_loopcheck && _notealive)))
264
        {
265
            _end_buffer = trackpos - 0.12000000000000001;
266
            if (!arg2 && instrument == 0 && hardmode)
267
                _end_buffer = trackpos - 0.08666666666666667;
268
            if (_loopcheck == 0 && _notetime < _end_buffer)
269
            {
270
                if (notescore[notei] <= 0 && notealive[notei] == 1 && fade == 1)
271
                {
272
                    missnotecon = 1;
273
                    if (instrument == 0 && !arg2)
274
                        miss++;
275
                }
276
                notealive[notei] = 0;
277
                minnote = notei + 1;
278
            }
279
            if (_notealive == 1)
280
                draw_set_color(_notecol[notetype[notei]]);
281
            else
282
                draw_set_color(_gray);
283
            if (_notescore >= 100)
284
                draw_set_color(_yellow);
285
            else if (_notescore >= 30)
286
                draw_set_color(_orange);
287
            if (_notealive == 1 || _notescore <= 0)
288
            {
289
                if (_notescore < 0 && _noteend > 0 && _notealive == 0)
290
                {
291
                    _notetime -= notescore[notei];
292
                    notey = (bottomy - (_notetime * arg0)) + (trackpos * arg0);
293
                    _notescore = 0;
294
                }
295
                if (noteanim[notei] > 0 && arg2)
296
                {
297
                    var _oldcolor = draw_get_color();
298
                    draw_set_color(_yellow);
299
                    draw_circle((arg1 - 20 - 15) + (notetype[notei] * 40), notey, 3, false);
300
                    draw_circle((arg1 - 20) + 15 + (notetype[notei] * 40), notey, 3, false);
301
                    draw_set_color(_oldcolor);
302
                }
303
                if (instrument == 2 && _noteend == 0)
304
                    scr_rhythmgame_draw_note_clap(arg1, notey, notetype[notei]);
305
                else
306
                    scr_rhythmgame_draw_note(arg1, notey, notetype[notei]);
307
                if (arg2 && paused && do_refresh)
308
                {
309
                    var _xleft = arg1;
310
                    if (instrument == 2)
311
                        _xleft -= 15;
312
                    else
313
                        _xleft += 5;
314
                    var _node = instance_create((_xleft - _xwidth) + (notetype[notei] * _xwidth) + 15, notey, obj_rhythmgame_editor_note_node);
315
                    _node.depth = depth + 1;
316
                    _node.noteindex = notei;
317
                    if (instrument == 2)
318
                        _node.image_xscale = 1.375;
319
                }
320
                if (_noteend > 0)
321
                {
322
                    var notelength = (_noteend - _notetime) * arg0;
323
                    scr_rhythmgame_draw_note_long(arg1, notey, notetype[notei], notelength, false);
324
                }
325
            }
326
        }
327
        if (_looper && !_loopcheck && (notei + 1) == maxnote && trackpos > (track_length - 4))
328
        {
329
            notei = -1;
330
            _loopcheck = true;
331
        }
332
    }
333
    var _note_count = (instrument == 0) ? 1 : 2;
334
    for (var i = 0; i <= _note_count; i++)
335
    {
336
        if (hold_end[i] > 0)
337
        {
338
            var note_end = (hold_end[i] - trackpos) * arg0;
339
            draw_set_color(_orange);
340
            scr_rhythmgame_draw_note_long(arg1, bottomy, i, note_end, true);
341
            draw_set_color(_yellow);
342
            scr_rhythmgame_draw_note(arg1, bottomy, i);
343
        }
344
    }
345
    if (!arg2 && !paused)
346
        scr_draw_in_mask_end();
347
}
348
349
function scr_rhythmgame_draw_note(arg0, arg1, arg2, arg3 = 0)
350
{
351
    if (instrument == 2)
352
    {
353
        arg0 = (arg0 - 30) + (arg2 * 30);
354
        if (paused)
355
            ossafe_fill_rectangle(arg0 - 10, arg1 - 3, arg0 + 10, arg1 + 3, false);
356
        else
357
            draw_sprite_ext(spr_rhythmgame_heldnote, 0, arg0, arg1, 1, 1, 0, draw_get_color(), 1);
358
    }
359
    else if (instrument == 1 && arg2 == 2)
360
    {
361
        ossafe_fill_rectangle(arg0 - 45, arg1 - 1, arg0 + 45, arg1 + 1, false);
362
    }
363
    else
364
    {
365
        arg0 = (arg0 - 20) + (arg2 * 40);
366
        draw_sprite_ext(spr_rhythmgame_note, 0, arg0, arg1, 1, 1, 0, draw_get_color(), 1);
367
    }
368
}
369
370
function scr_rhythmgame_draw_note_long(arg0, arg1, arg2, arg3, arg4 = false)
371
{
372
    if (instrument == 2)
373
    {
374
        arg0 = (arg0 - 30) + (arg2 * 30);
375
        var _col = draw_get_color();
376
        draw_sprite_ext(spr_rhythmgame_heldnote, 0, arg0, arg1 - arg3, 1, 1, 0, _col, 1);
377
        draw_sprite_ext(spr_rhythmgame_heldnote, 0, arg0, arg1, 1, 1, 0, _col, 1);
378
    }
379
    else
380
    {
381
        arg0 = (arg0 - 20) + (arg2 * 40);
382
    }
383
    ossafe_fill_rectangle(arg0 - 3, arg1 - arg3, arg0 + 3, arg1, false);
384
    if (arg4)
385
    {
386
        var _endColor = merge_color(c_yellow, c_orange, clamp01(inverselerp(arg1, arg1 - 40, arg1 - arg3)));
387
        _endColor = merge_color(c_black, _endColor, brightness);
388
        var _startColor = merge_color(c_black, c_yellow, brightness);
389
        if (instrument == 2)
390
        {
391
            draw_set_color(_endColor);
392
            draw_sprite_ext(spr_rhythmgame_heldnote, 0, arg0, arg1 - arg3, 1, 1, 0, _endColor, 1);
393
        }
394
        ossafe_fill_rectangle_color(arg0 - 3, arg1 - arg3, arg0 + 3, arg1, _endColor, _endColor, _startColor, _startColor, false);
395
    }
396
}
397
398
function scr_rhythmgame_draw_note_clap(arg0, arg1, arg2, arg3 = 0)
399
{
400
    draw_sprite_ext(spr_rhythmgame_note_big, 0, arg0, arg1, 1, 1, 0, draw_get_color(), 1);
401
}
402
403
function scr_rhythmgame_noteloop(arg0)
404
{
405
    if (arg0 < (track_length / 2))
406
        arg0 += scr_round_to_beat(track_length, bpm);
407
    else
408
        arg0 -= scr_round_to_beat(track_length, bpm);
409
    return arg0;
410
}
411
412
function scr_rhythmgame_noteskip(arg0)
413
{
414
    with (obj_rhythmgame)
415
    {
416
        if (solo_difficulty < 2)
417
        {
418
            var _skiplength = timestamp[3] - timestamp[solo_difficulty + 1];
419
            var _solodiff = timestamp[solo_difficulty + 1];
420
            if (trackpos <= _solodiff && arg0 >= timestamp[3])
421
                arg0 -= _skiplength;
422
            else if (trackpos >= timestamp[3] && arg0 <= _solodiff)
423
                arg0 += _skiplength;
424
        }
425
        if (solo_difficulty > 0)
426
        {
427
            var _skiplength = timestamp[solo_difficulty] - timestamp[0];
428
            var _solodiff = timestamp[solo_difficulty];
429
            if (trackpos <= timestamp[0] && arg0 >= _solodiff)
430
                arg0 -= _skiplength;
431
            else if (trackpos >= _solodiff && arg0 <= timestamp[0])
432
                arg0 += _skiplength;
433
        }
434
    }
435
    return arg0;
436
}
437
438
function scr_rhythmgame_damage_flash(arg0 = false)
439
{
440
    if (invc > 0)
441
    {
442
        var _flash;
443
        if (arg0)
444
            _flash = remap_clamped(0, 6, 0, 1, hurt_flash);
445
        else
446
            _flash = remap_clamped(0, 6, 0, 1, hurt_flash);
447
        return _flash;
448
    }
449
    else
450
    {
451
        return 0;
452
    }
453
}
454
455
function scr_rhythmgame_songlist()
456
{
457
    var _trackname = [];
458
    _trackname[0] = stringsetloc(
Rude Buster
"Rude Buster", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_597_0"
);
459
    _trackname[1] = stringsetloc(
Field of Hopes and Dreams
"Field of Hopes and Dreams", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_598_0"
);
460
    _trackname[2] = stringsetloc(
Knock You Down!!
"Knock You Down!!", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_599_0"
);
461
    _trackname[3] = stringsetloc(
Raise Up Your Bat
"Raise Up Your Bat", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_600_0"
);
462
    _trackname[4] = stringsetloc(
It's TV Time!
"It's TV Time!", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_601_0"
);
463
    if (global.chapter >= 5)
464
    {
465
        _trackname[5] = stringsetloc(
Third Sanctuary
"Third Sanctuary", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_588_0"
);
466
        _trackname[6] = stringsetloc(
A DARK ZONE
"A DARK ZONE", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_589_0"
);
467
        _trackname[7] = stringsetloc(
Flower Man
"Flower Man", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_590_0"
);
468
        _trackname[8] = stringsetloc(
reserved
"reserved", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_592_0"
);
469
        _trackname[9] = stringsetloc(
4rd Sanctuary
"4rd Sanctuary", "scr_rhythmgame_draw_slash_scr_rhythmgame_draw_gml_593_0"
);
470
    }
471
    return _trackname;
472
}