Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_rhythmgame_Step_0

(view raw script w/o annotations or w/e)
1
if (freeplay < 0)
2
{
3
    if (up_p() && song_id > 0)
4
    {
5
        song_id--;
6
        snd_play(snd_menumove);
7
    }
8
    if (down_p() && song_id < (array_length(tracklist) - 1))
9
    {
10
        song_id++;
11
        snd_play(snd_menumove);
12
    }
13
    if (right_p() && !hardmode)
14
    {
15
        hardmode = true;
16
        snd_play(snd_menumove);
17
    }
18
    if (left_p() && hardmode)
19
    {
20
        hardmode = false;
21
        snd_play(snd_menumove);
22
    }
23
    exit;
24
}
25
if (tutorial == -1)
26
{
27
    fade = 
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); } }
(fade, 1, 0.05);
28
    with (obj_rhythmgame_chart)
29
        fade = 
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); } }
(fade, 1, 0.05);
30
    fame = 
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); } }
(fame, 6000, 300);
31
    if (fame == 6000 && fade == 1)
32
        tutorial = 0;
33
}
34
if (tutorial != 1 && tutorial != 2)
35
{
36
    if (tenna_boss && i_ex(obj_tenna_zoom) && obj_tenna_zoom.minigameinsanity == true)
37
    {
38
        chart_lerp = 
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); } }
(chart_lerp, show_chart, 0.2);
39
        chart_ease = 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(chart_lerp, 2);
40
    }
41
    else
42
    {
43
        chart_lerp = 
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); } }
(chart_lerp, show_chart, 0.05);
44
        chart_ease = 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(chart_lerp, 2);
45
    }
46
}
47
if (tutorial > 0)
48
{
49
    kchart_lerp = 
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); } }
(kchart_lerp, show_chart, 0.05);
50
    kchart_ease = 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(kchart_lerp, 2);
51
}
52
else
53
{
54
    kchart_lerp = chart_lerp;
55
    kchart_ease = chart_ease;
56
}
57
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
58
{
59
    if (keyboard_check_pressed(ord("U")))
60
        event_user(4);
61
    if (keyboard_check_pressed(ord("I")) || (show_debug && (gamepad_button_check_pressed(0, gp_face3) || gamepad_button_check_pressed(1, gp_face3))))
62
    {
63
        if (tutorial > 0)
64
        {
65
            debug_print("Can not alter autoplay during tutorial");
66
        }
67
        else if (auto_play == 0)
68
        {
69
            auto_play = 1;
70
            debug_print("Autoplay enabled.");
71
        }
72
        else if (auto_play == 1)
73
        {
74
            auto_play = 0;
75
            debug_print("Autoplay disabled.");
76
        }
77
    }
78
    if (keyboard_check_pressed(ord("O")) || (show_debug && (gamepad_button_check_pressed(0, gp_select) || gamepad_button_check_pressed(1, gp_select))))
79
    {
80
        show_debug = !show_debug;
81
        if (show_debug)
82
            debug_print("debug mode enabled");
83
        else
84
            debug_print("debug mode disabled");
85
    }
86
    if (song_id == 0 && solo_con == 0)
87
    {
88
        if (keyboard_check_pressed(ord("1")))
89
        {
90
            solo_difficulty = 0;
91
            
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("Solo difficulty set to easy.");
92
        }
93
        else if (keyboard_check_pressed(ord("2")))
94
        {
95
            solo_difficulty = 1;
96
            
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("Solo difficulty set to medium.");
97
        }
98
        else if (keyboard_check_pressed(ord("3")))
99
        {
100
            solo_difficulty = 2;
101
            
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("Solo difficulty set to hard.");
102
        }
103
        else if (keyboard_check_pressed(ord("4")))
104
        {
105
            solo_difficulty = -1;
106
            
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("Solo difficulty set to auto.");
107
        }
108
    }
109
    var _vol = main_vol;
110
    if (sunkus_kb_check_pressed_with_repeat(189))
111
        _vol -= (keyboard_check(vk_lshift) ? 0.5 : 0.1);
112
    if (sunkus_kb_check_pressed_with_repeat(187))
113
        _vol += (keyboard_check(vk_lshift) ? 0.5 : 0.1);
114
    if (_vol != main_vol)
115
    {
116
        main_vol = clamp01(_vol);
117
        mus_volume(track1_instance, main_vol, 0);
118
        if (oneAtATime)
119
            mus_volume(track2_instance, 0, 0);
120
        else
121
            mus_volume(track2_instance, main_vol, 0);
122
        debug_print("Song volume set to " + string(main_vol * 100) + "%");
123
    }
124
}
125
if (song_id == 4)
126
{
127
    if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
() && intro_con == 1 && keyboard_check_pressed(ord("4")))
128
        intro_con = 2;
129
}
130
if (init == 0)
131
{
132
    if (other.song_id == 4)
133
    {
134
        drums.performer.visible = false;
135
        vocals.performer.visible = false;
136
    }
137
    if (tenna_boss)
138
    {
139
        freeplay = false;
140
        replayversion = false;
141
        if (audio_is_playing(global.batmusic[1]))
142
        {
143
            trackstart = audio_sound_get_track_position(global.batmusic[1]);
144
        }
145
        else
146
        {
147
            debug_print("track start randomized");
148
            trackstart = random(82.5);
149
        }
150
        bpm = 148;
151
        notespacing = 60 / bpm;
152
        meter = notespacing * 4;
153
        chart_start = scr_ceil_to_beat(trackstart + (boss_delay / 30), bpm, 0.5);
154
        chart_end = trackstart + floor_to_multiple((turn_length - 30) / 30, meter / 2);
155
        song_id = 2;
156
        loadsong = 1;
157
        difficulty = 1;
158
        performer.sprite_index = spr_kris_guitar_ready;
159
        loop = true;
160
        with (obj_rhythmgame_chart)
161
        {
162
            target_brightness = 0.75;
163
            if (other.speed_modifier > 2)
164
                brightness = 0.75;
165
            auto_play = true;
166
            if (instrument == 1)
167
            {
168
                performer.sprite_index = spr_susie_drum_ready;
169
                performer.image_speed = 0.5;
170
            }
171
            else if (instrument == 2)
172
            {
173
                performer.sprite_index = spr_ralsei_sing_polite_closed;
174
            }
175
        }
176
        event_user(0);
177
    }
178
    init = 1;
179
}
180
if (song_id >= 0 && song_loaded == false && loadsong >= 1)
181
{
182
    scr_rhythmgame_load_song(song_id, true, true);
183
    
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("Song Loaded");
184
    if (tenna_boss)
185
    {
186
        fame_mul = 80 / maxnote;
187
        if (speed_modifier <= 2)
188
            button_alpha = 5;
189
    }
190
    notespeed *= speed_modifier;
191
    notespeed = round_to_multiple(notespeed, 30);
192
    song_loaded = true;
193
}
194
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
() && tenna_boss && keyboard_check_pressed(ord("V")))
195
{
196
    auto_play = true;
197
    song_done = true;
198
}
199
if (intro_con == -1)
200
    exit;
201
if (intro_con < 2)
202
    exit;
203
if (init == 1)
204
{
205
    if (tenna_boss)
206
    {
207
        loadsong = 3;
208
        
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("loaded tenna info");
209
        var _forceload = false;
210
        if (!audio_is_playing(global.batmusic[1]))
211
        {
212
            global.batmusic[0] = snd_init(track1_id);
213
            global.batmusic[1] = mus_loop(global.batmusic[0]);
214
            audio_sound_set_track_position(global.batmusic[1], trackstart);
215
            _forceload = true;
216
        }
217
        track1 = global.batmusic[0];
218
        track1_instance = global.batmusic[1];
219
        if (array_length(global.batmusic) <= 2 || _forceload)
220
        {
221
            
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("failsafe triggered! second stem wasn't preloaded!!!");
222
            global.batmusic[2] = snd_init(track2_id);
223
            global.batmusic[3] = mus_loop(global.batmusic[2]);
224
            audio_sound_set_track_position(global.batmusic[3], trackstart);
225
        }
226
        track2 = global.batmusic[2];
227
        track2_instance = global.batmusic[3];
228
        track1_main = track1_instance;
229
        track2_main = track2_instance;
230
        musicm.loop = true;
231
        mus_volume(track1_instance, main_vol * 0.9, 60);
232
        mus_volume(track2_instance, 0, 0);
233
        song_initialized = 1;
234
        if (v_ex("musicm"))
235
            musicm.track1_instance = track1_main;
236
    }
237
    init = 2;
238
}
239
else if (tenna_boss && init == 2)
240
{
241
    audio_sound_set_track_position(track2_instance, trackpos);
242
    init = 3;
243
}
244
if (loadsong == 1)
245
{
246
    if (tutorial >= 1 && audio_is_playing(global.currentsong[1]))
247
    {
248
        track1 = global.currentsong[0];
249
        track2 = snd_init(track2_id);
250
        trackstart = audio_sound_get_track_position(global.currentsong[1]);
251
        trackpos = trackstart;
252
    }
253
    else
254
    {
255
        track1 = snd_init(track1_id);
256
        track2 = snd_init(track2_id);
257
    }
258
    if (song_id == 0)
259
    {
260
        track1_solo = snd_init(track1_id);
261
        track2_solo = snd_init(track2_id);
262
    }
263
    loadsong = 2;
264
    playtimer = 0;
265
}
266
if (loadsong == 2)
267
{
268
    if (trackstart >= 0 || playtimer != 3)
269
        playtimer++;
270
    if (playtimer == 3 && trackstart < 0)
271
    {
272
        trackstart += (delta_time / 1000000);
273
        trackpos = trackstart;
274
        
scr_debug_print_persistent
scr_debug_print_persistent

function
scr_debug_print_persistent(arg0, arg1)
{ } function scr_debug_delete_persistent(arg0, arg1 = false) { } function scr_debug_clear_persistent() { }
("countdown", "countdown: " + string(trackstart));
275
        if (trackstart >= 0)
276
        {
277
            scr_debug_delete_persistent("countdown");
278
            trackstart = 0;
279
            trackpos = 0;
280
            playtimer = 4;
281
        }
282
    }
283
    if (playtimer == 4)
284
    {
285
        if (loop)
286
        {
287
            if (tutorial >= 1 && audio_is_playing(global.currentsong[1]))
288
            {
289
                track1_instance = global.currentsong[1];
290
                track2_instance = mus_loop(track2);
291
            }
292
            else
293
            {
294
                track1_instance = mus_loop(track1);
295
                track2_instance = mus_loop(track2);
296
            }
297
        }
298
        else
299
        {
300
            track1_instance = mus_play(track1);
301
            track2_instance = mus_play(track2);
302
            if (trackstart < 0)
303
            {
304
                snd_pause(track1_instance);
305
                snd_pause(track2_instance);
306
            }
307
        }
308
        if (song_id == 0)
309
        {
310
            track1_solo_instance = mus_play(track1_solo);
311
            track2_solo_instance = mus_play(track2_solo);
312
            if (trackstart < 0)
313
            {
314
                audio_pause_sound(track1_solo_instance);
315
                audio_pause_sound(track2_solo_instance);
316
            }
317
        }
318
        if (tutorial == 1)
319
        {
320
            mus_volume(track1_instance, main_vol, 0);
321
            mus_volume(track2_instance, 0, 0);
322
        }
323
        track1_main = track1_instance;
324
        track2_main = track2_instance;
325
    }
326
    if (playtimer == 5)
327
    {
328
        if (trackstart > 0)
329
        {
330
            if (tutorial > 0)
331
            {
332
                trackpos = audio_sound_get_track_position(track1_instance);
333
                audio_sound_set_track_position(track2_instance, trackpos);
334
            }
335
            else
336
            {
337
                audio_sound_set_track_position(track1_instance, trackstart);
338
                audio_sound_set_track_position(track2_instance, trackstart);
339
            }
340
            if (song_id == 0)
341
            {
342
                audio_sound_set_track_position(track1_solo_instance, trackstart);
343
                audio_sound_set_track_position(track2_solo_instance, trackstart);
344
            }
345
        }
346
        if (tutorial > 0)
347
        {
348
            mus_volume(track1_instance, main_vol, 0);
349
            mus_volume(track2_instance, 0, 0);
350
        }
351
        else if (!oneAtATime)
352
        {
353
            mus_volume(track1_instance, main_vol, 0);
354
            mus_volume(track2_instance, main_vol, 0);
355
        }
356
        else
357
        {
358
            mus_volume(track1_instance, 0, 0);
359
            mus_volume(track2_instance, main_vol, 0);
360
        }
361
        loadsong = 3;
362
        song_initialized = 1;
363
        if (song_id == 0)
364
        {
365
            mus_volume(track1_solo_instance, 0, 0);
366
            mus_volume(track2_solo_instance, 0, 0);
367
            if (!freeplay)
368
            {
369
                var _failures = global.flag[1096 rhythm_game_tries];
370
                if (_failures == 3)
371
                    difficulty = 3;
372
                else if (_failures == 4)
373
                    difficulty = 2;
374
                else if (_failures >= 5)
375
                    difficulty = 1;
376
            }
377
        }
378
        if (v_ex("musicm"))
379
            musicm.track1_instance = track1_main;
380
    }
381
}
382
if (song_initialized == 1 || (trackpos < 0 && playtimer == 3))
383
{
384
    if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
() && song_initialized == 1)
385
    {
386
        if (keyboard_check_pressed(ord("P")) || (show_debug && (gamepad_button_check_pressed(0, gp_start) || gamepad_button_check_pressed(1, gp_start))))
387
        {
388
            paused = !paused;
389
            if (paused)
390
            {
391
                audio_pause_sound(track1_main);
392
                audio_pause_sound(track2_main);
393
                if (song_id == 0)
394
                {
395
                    audio_pause_sound(track1_solo);
396
                    audio_pause_sound(track2_solo);
397
                }
398
            }
399
            else
400
            {
401
                audio_resume_sound(track1_main);
402
                audio_resume_sound(track2_main);
403
                if (song_id == 0)
404
                {
405
                    audio_resume_sound(track1_solo);
406
                    audio_resume_sound(track2_solo);
407
                }
408
            }
409
        }
410
    }
411
    var _truetrackpos = 0;
412
    if (trackstart < 0)
413
    {
414
        trackpos = trackstart;
415
    }
416
    else
417
    {
418
        if (lose_con == 0 && !song_done && !paused && !snd_is_playing(track1_instance) && trackpos < (track_length - 0.5))
419
        {
420
            emergency_reload();
421
            exit;
422
        }
423
        _truetrackpos = audio_sound_get_track_position(track1_main);
424
        if (muted && muted_time != _truetrackpos)
425
        {
426
            muted = false;
427
            debug_print("huh???");
428
        }
429
        var _posdiff = _truetrackpos - trackpos;
430
        if (lose_con == 0 && !paused && _posdiff == 0 && trackpos < (track_length - 0.5))
431
        {
432
            safety_timer++;
433
            if (safety_timer >= 20)
434
            {
435
                if (!safety_mode)
436
                {
437
                    safety_mode = 1;
438
                    muted = true;
439
                    muted_time = _truetrackpos;
440
                    debug_print("safety mode engaged");
441
                }
442
            }
443
        }
444
        else if (!paused && abs(_posdiff) > 0.05 && abs(_posdiff) < 0.5 && lose_con == 0 && song_id != 4 && !muted)
445
        {
446
            if (smooth_timer == 0)
447
            {
448
                smooth_timer = 6;
449
                safety_mode = true;
450
                safety_pos = trackpos;
451
                debug_print("anti-stutter triggered (" + string(round(_posdiff * 1000)) + "ms)");
452
            }
453
            else
454
            {
455
                smooth_timer--;
456
            }
457
            if (smooth_timer == 0)
458
            {
459
                debug_print("track fixed itself");
460
                safety_mode = false;
461
            }
462
        }
463
        else if (smooth_timer > 0)
464
        {
465
            safety_pos = _truetrackpos;
466
            safety_mode = false;
467
            safety_timer = 0;
468
            smooth_timer = 0;
469
            debug_print("track re-synced");
470
        }
471
        else if (safety_timer > 0 && _posdiff != 0)
472
        {
473
            safety_timer = 0;
474
        }
475
        if (safety_mode && lose_con == 0)
476
        {
477
            if (smooth_timer > 0 && !muted)
478
            {
479
                safety_pos += (delta_time / 1000000);
480
                trackpos = remap(6, 0, safety_pos, _truetrackpos, smooth_timer);
481
            }
482
            else
483
            {
484
                trackpos += ((delta_time / 1000000) * pitch);
485
            }
486
            if (loop && trackpos >= track_length)
487
                trackpos -= track_length;
488
        }
489
        else if (!loop && song_done && lose_con == 0)
490
        {
491
            if (song_id == 4)
492
                trackpos += ((delta_time / 1000000) * pitch);
493
            else
494
                trackpos += (delta_time / 1000000);
495
            if (trackpos > (track_length + (meter * 4)))
496
                trackpos -= (meter * 2);
497
        }
498
        else if (!tenna_boss && _truetrackpos == 0 && _truetrackpos < trackpos && trackpos > (track_length - 4))
499
        {
500
            trackpos = track_length;
501
        }
502
        else
503
        {
504
            trackpos = _truetrackpos;
505
        }
506
    }
507
    if (song_id == 4)
508
    {
509
        pitch = remap_clamped(12, 15.25, 1, 0.1, trackpos);
510
        audio_sound_pitch(track1_main, pitch);
511
        audio_sound_pitch(track2_main, pitch);
512
    }
513
    if (reloading)
514
    {
515
        audio_sound_set_track_position(track1_instance, remtrackpos[0]);
516
        audio_sound_set_track_position(track2_instance, remtrackpos[0]);
517
        if (song_id == 0)
518
        {
519
            audio_sound_set_track_position(track1_solo_instance, remtrackpos[0]);
520
            audio_sound_set_track_position(track2_solo_instance, remtrackpos[0]);
521
        }
522
        reloading = false;
523
    }
524
    if (pitch != 1 && lose_con == 0 && song_id != 4)
525
    {
526
        if (pitch == 0)
527
            debug_print("restoring pitch");
528
        pitch = 
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); } }
(pitch, 1, 0.025);
529
        audio_sound_pitch(track1_main, pitch);
530
        audio_sound_pitch(track2_main, pitch);
531
        if (song_id == 0)
532
        {
533
            audio_sound_pitch(track1_solo_instance, pitch);
534
            audio_sound_pitch(track2_solo_instance, pitch);
535
        }
536
    }
537
    if (song_id != 0)
538
    {
539
    }
540
    else if (solo_con == 0 && trackpos >= (timestamp[0] - 2))
541
    {
542
        if (solo_difficulty < 0)
543
        {
544
            if (fame >= 10000)
545
                solo_difficulty = 2;
546
            else if (fame >= 6000)
547
                solo_difficulty = 1;
548
            else
549
                solo_difficulty = 0;
550
            if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
551
            {
552
                if (solo_difficulty == 0)
553
                    
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("solo will be easy (" + string(fame) + "/5000 pts)");
554
                if (solo_difficulty == 1)
555
                    
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("solo will be medium (" + string(fame) + "/5000 pts)");
556
                if (solo_difficulty == 2)
557
                    
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("solo will be hard (" + string(fame) + "/10000 pts)");
558
            }
559
        }
560
        scr_rhythmgame_notechart_lead_solo(solo_difficulty);
561
        scr_rhythmgame_notechart_lead_finale();
562
        var _track_offset = timestamp[solo_difficulty] - (timestamp[0] - trackpos);
563
        if (solo_difficulty == 0)
564
            _track_offset = trackpos;
565
        if (!safety_mode || smooth_timer > 0)
566
        {
567
            audio_sound_set_track_position(track1_solo_instance, _track_offset);
568
            audio_sound_set_track_position(track2_solo_instance, _track_offset);
569
        }
570
        solo_con = 1;
571
    }
572
    else if (solo_con == 1 && trackpos >= timestamp[0])
573
    {
574
        debug_print("leapt to solo");
575
        if (solo_difficulty != 0)
576
        {
577
            if (safety_mode)
578
            {
579
                trackpos += (timestamp[solo_difficulty] - timestamp[0]);
580
            }
581
            else
582
            {
583
                trackpos = audio_sound_get_track_position(track1_solo_instance);
584
                audio_sound_set_track_position(track1_instance, trackpos);
585
                audio_sound_set_track_position(track2_instance, trackpos);
586
            }
587
        }
588
        mus_volume(track1_solo_instance, 0, 0);
589
        mus_volume(track2_solo_instance, main_vol, 0);
590
        mus_volume(track1_instance, 0, 0);
591
        mus_volume(track2_instance, 0, 0);
592
        track1_main = track1_solo_instance;
593
        track2_main = track2_solo_instance;
594
        solo_con = 2;
595
    }
596
    else if (solo_con == 2 && trackpos >= (timestamp[solo_difficulty + 1] - 2))
597
    {
598
        debug_print("preparing post-solo");
599
        var _track_offset = timestamp[3] - (timestamp[solo_difficulty + 1] - trackpos);
600
        if (!safety_mode || smooth_timer > 0)
601
        {
602
            audio_sound_set_track_position(track1_instance, _track_offset);
603
            audio_sound_set_track_position(track2_instance, _track_offset);
604
        }
605
        solo_con = 3;
606
    }
607
    else if (solo_con == 3 && trackpos >= timestamp[solo_difficulty + 1])
608
    {
609
        debug_print("solo done");
610
        if (safety_mode)
611
        {
612
            if (solo_difficulty < 3)
613
                trackpos += (timestamp[3] - timestamp[solo_difficulty + 1]);
614
        }
615
        else
616
        {
617
            trackpos = audio_sound_get_track_position(track1_instance);
618
        }
619
        mus_volume(track1_solo_instance, 0, 0);
620
        mus_volume(track2_solo_instance, 0, 0);
621
        mus_volume(track1_instance, 0, 0);
622
        mus_volume(track2_instance, main_vol, 0);
623
        track1_main = track1_instance;
624
        track2_main = track2_instance;
625
        solo_con = 4;
626
    }
627
    var timeunit = trackpos - remtrackpos[0];
628
    var averagetimeunit = ((trackpos - remtrackpos[0]) + (remtrackpos[0] - remtrackpos[1]) + (remtrackpos[1] - remtrackpos[2])) / 3;
629
    remtrackpos[4] = remtrackpos[3];
630
    remtrackpos[3] = remtrackpos[2];
631
    remtrackpos[2] = remtrackpos[1];
632
    remtrackpos[1] = remtrackpos[0];
633
    remtrackpos[0] = trackpos;
634
    var notecheckmax = -1;
635
    var notecheck = minnote;
636
    var foundnotes = 0;
637
    var _notetime = 0;
638
    while (notecheck < maxnote)
639
    {
640
        notecheckmax++;
641
        _notetime = notetime[notecheck] - trackpos;
642
        if (hardmode)
643
        {
644
            if (_notetime >= -0.2 && _notetime <= 0.12)
645
            {
646
                foundnotes = 1;
647
                targetnote[notecheckmax] = notecheck;
648
                notecheck++;
649
            }
650
            else
651
            {
652
                notecheckmax--;
653
                break;
654
            }
655
        }
656
        else if (abs(_notetime) <= 0.12)
657
        {
658
            foundnotes = 1;
659
            targetnote[notecheckmax] = notecheck;
660
            notecheck++;
661
        }
662
        else if (auto_play == 1 && _notetime < 0)
663
        {
664
            foundnotes = 1;
665
            targetnote[notecheckmax] = notecheck;
666
            notecheck++;
667
        }
668
        else
669
        {
670
            notecheckmax--;
671
            break;
672
        }
673
    }
674
    pressedtimer[0]++;
675
    pressedtimer[1]++;
676
    buffer[0]--;
677
    buffer[1]--;
678
    hold_score = 0;
679
    for (i = 0; i < 2; i++)
680
    {
681
        var checkpress, holdpress;
682
        if (i == 0)
683
        {
684
            checkpress = buttonb_p() || left_p();
685
            holdpress = buttonb_h() || left_h();
686
        }
687
        if (i == 1)
688
        {
689
            checkpress = buttonr_p() || right_p();
690
            holdpress = buttonr_h() || right_h();
691
        }
692
        if (auto_play != 0 || lose_con == 2)
693
        {
694
            checkpress = false;
695
            holdpress = false;
696
        }
697
        if (auto_play == 1)
698
        {
699
            if (hold_end[i] > 0 && trackpos < hold_end[i])
700
            {
701
                holdpress = true;
702
            }
703
            else
704
            {
705
                for (var notei = 0; notei <= notecheckmax; notei++)
706
                {
707
                    var _leniency = 0.1;
708
                    if (notetype[targetnote[notei]] == i && notealive[targetnote[notei]] == 1 && notetime[targetnote[notei]] <= (trackpos + (averagetimeunit * _leniency)))
709
                    {
710
                        checkpress = true;
711
                        holdpress = true;
712
                        break;
713
                    }
714
                }
715
            }
716
        }
717
        if (checkpress)
718
        {
719
            with (performer)
720
            {
721
                if (other.i == 0)
722
                    sprite_index = spr_kris_guitar;
723
                else
724
                    sprite_index = spr_kris_guitar_high;
725
                event_user(0);
726
            }
727
        }
728
        if (hold_end[i] > 0)
729
        {
730
            if (hold_end[i] < trackpos || !holdpress)
731
            {
732
                var _holdpos = trackpos;
733
                if (trackpos >= (hold_end[i] - (averagetimeunit * 3)))
734
                    _holdpos = max(hold_end[i], _holdpos);
735
                var chainPoints = floor(((min(hold_end[i], _holdpos) - hold_start[i]) / meter) * 4) * 10;
736
                if (_holdpos >= hold_end[i])
737
                {
738
                    score_scale = 4;
739
                    chainPoints *= 2;
740
                    note_hit_timer[i] = 4;
741
                    if (tenna_boss)
742
                    {
743
                        var _holdlength = (hold_end[i] - hold_start[i]) / (meter / 2);
744
                        
scr_tenna_add_score
scr_tenna_add_score

function
scr_tenna_add_score(arg0)
{ if (i_ex(obj_tenna_enemy_bg)) { var _multiplier = 1; var _multi_minigame_adjustment = 1; if (obj_tenna_enemy.minigameactivated) { if (obj_tenna_enemy.minigamecount >= 6) _multi_minigame_adjustment = 0.65; _multiplier = (obj_tenna_enemy.pointsmultiplierthisturn + obj_tenna_enemy.pointsmultiplier) * _multi_minigame_adjustment; obj_tenna_enemy.pointsmultiplierthisturn -= 1; if (obj_tenna_enemy.pointsmultiplierthisturn < 1) obj_tenna_enemy.pointsmultiplierthisturn = 1; } if (!i_ex(obj_tenna_zoom)) obj_tenna_enemy_bg.addscore += round(arg0 * _multiplier); else if (i_ex(obj_tenna_minigame_ui)) obj_tenna_minigame_ui.myscore += round(arg0 * _multiplier); } }
(ceil(_holdlength / 2));
745
                    }
746
                }
747
                else
748
                {
749
                    if (oneAtATime)
750
                        mus_volume(track1_main, main_vol, 0);
751
                    mus_volume(track2_main, 0, 0);
752
                    notescore[heldnote[i]] = hold_start[i] - trackpos;
753
                    if (tenna_boss)
754
                    {
755
                        var _holdlength = (trackpos - hold_start[i]) / meter;
756
                        
scr_tenna_add_score
scr_tenna_add_score

function
scr_tenna_add_score(arg0)
{ if (i_ex(obj_tenna_enemy_bg)) { var _multiplier = 1; var _multi_minigame_adjustment = 1; if (obj_tenna_enemy.minigameactivated) { if (obj_tenna_enemy.minigamecount >= 6) _multi_minigame_adjustment = 0.65; _multiplier = (obj_tenna_enemy.pointsmultiplierthisturn + obj_tenna_enemy.pointsmultiplier) * _multi_minigame_adjustment; obj_tenna_enemy.pointsmultiplierthisturn -= 1; if (obj_tenna_enemy.pointsmultiplierthisturn < 1) obj_tenna_enemy.pointsmultiplierthisturn = 1; } if (!i_ex(obj_tenna_zoom)) obj_tenna_enemy_bg.addscore += round(arg0 * _multiplier); else if (i_ex(obj_tenna_minigame_ui)) obj_tenna_minigame_ui.myscore += round(arg0 * _multiplier); } }
(round(_holdlength / 2));
757
                    }
758
                }
759
                heldnote[i] = 0;
760
                total_score += chainPoints;
761
                if (tutorial == 0)
762
                {
763
                    fame += (chainPoints * fame_mul);
764
                    total_fame += (chainPoints * fame_mul);
765
                }
766
                points += chainPoints;
767
                max_combo = max(combo, max_combo);
768
                hold_end[i] = 0;
769
            }
770
            else if (trackpos >= hold_start[i])
771
            {
772
                performer.image_index = 0;
773
                hold_score += floor(((trackpos - hold_start[i]) / meter) * 40);
774
                if (score_scale < 2.5)
775
                    score_scale += 0.4;
776
                if (note_hit_timer[i] <= 1)
777
                    note_hit_timer[i] = 3;
778
            }
779
        }
780
        if (checkpress && buffer[i] <= 0)
781
        {
782
            note_hit_timer[i] = 5;
783
            note_hit_score[i] = 0;
784
            pressedtimer[i] = 0;
785
            buffer[i] = 2;
786
        }
787
        if (lyrics_index < lyric_count && trackpos > lyric_time[lyrics_index])
788
        {
789
            current_lyric = lyrics[lyrics_index];
790
            censored_lyric = censored_lyrics[lyrics_index];
791
            lyrics_index++;
792
            update_lyrics = true;
793
        }
794
        var _firstnote = true;
795
        var _earlypunish = false;
796
        var _press_buffer = hardmode ? 0 : (room_speed / 10);
797
        if (pressedtimer[i] <= _press_buffer && foundnotes == 1)
798
        {
799
            for (var notei = 0; notei <= notecheckmax; notei++)
800
            {
801
                if (notetype[targetnote[notei]] == i && notealive[targetnote[notei]] == 1)
802
                {
803
                    var _leniency = 1.6;
804
                    var _famegain = 0;
805
                    var _noteaccuracy = notetime[targetnote[notei]] - trackpos;
806
                    if (abs(_noteaccuracy) < (averagetimeunit * _leniency))
807
                    {
808
                        notescore[targetnote[notei]] = 100 + bonus;
809
                        _famegain = 100;
810
                        great++;
811
                        if (tenna_boss)
812
                        {
813
                            score_var++;
814
                            if (score_var == 1)
815
                                
scr_tenna_add_score
scr_tenna_add_score

function
scr_tenna_add_score(arg0)
{ if (i_ex(obj_tenna_enemy_bg)) { var _multiplier = 1; var _multi_minigame_adjustment = 1; if (obj_tenna_enemy.minigameactivated) { if (obj_tenna_enemy.minigamecount >= 6) _multi_minigame_adjustment = 0.65; _multiplier = (obj_tenna_enemy.pointsmultiplierthisturn + obj_tenna_enemy.pointsmultiplier) * _multi_minigame_adjustment; obj_tenna_enemy.pointsmultiplierthisturn -= 1; if (obj_tenna_enemy.pointsmultiplierthisturn < 1) obj_tenna_enemy.pointsmultiplierthisturn = 1; } if (!i_ex(obj_tenna_zoom)) obj_tenna_enemy_bg.addscore += round(arg0 * _multiplier); else if (i_ex(obj_tenna_minigame_ui)) obj_tenna_minigame_ui.myscore += round(arg0 * _multiplier); } }
(2);
816
                            if (score_var == 2)
817
                                
scr_tenna_add_score
scr_tenna_add_score

function
scr_tenna_add_score(arg0)
{ if (i_ex(obj_tenna_enemy_bg)) { var _multiplier = 1; var _multi_minigame_adjustment = 1; if (obj_tenna_enemy.minigameactivated) { if (obj_tenna_enemy.minigamecount >= 6) _multi_minigame_adjustment = 0.65; _multiplier = (obj_tenna_enemy.pointsmultiplierthisturn + obj_tenna_enemy.pointsmultiplier) * _multi_minigame_adjustment; obj_tenna_enemy.pointsmultiplierthisturn -= 1; if (obj_tenna_enemy.pointsmultiplierthisturn < 1) obj_tenna_enemy.pointsmultiplierthisturn = 1; } if (!i_ex(obj_tenna_zoom)) obj_tenna_enemy_bg.addscore += round(arg0 * _multiplier); else if (i_ex(obj_tenna_minigame_ui)) obj_tenna_minigame_ui.myscore += round(arg0 * _multiplier); } }
(1);
818
                            if (score_var == 3)
819
                                
scr_tenna_add_score
scr_tenna_add_score

function
scr_tenna_add_score(arg0)
{ if (i_ex(obj_tenna_enemy_bg)) { var _multiplier = 1; var _multi_minigame_adjustment = 1; if (obj_tenna_enemy.minigameactivated) { if (obj_tenna_enemy.minigamecount >= 6) _multi_minigame_adjustment = 0.65; _multiplier = (obj_tenna_enemy.pointsmultiplierthisturn + obj_tenna_enemy.pointsmultiplier) * _multi_minigame_adjustment; obj_tenna_enemy.pointsmultiplierthisturn -= 1; if (obj_tenna_enemy.pointsmultiplierthisturn < 1) obj_tenna_enemy.pointsmultiplierthisturn = 1; } if (!i_ex(obj_tenna_zoom)) obj_tenna_enemy_bg.addscore += round(arg0 * _multiplier); else if (i_ex(obj_tenna_minigame_ui)) obj_tenna_minigame_ui.myscore += round(arg0 * _multiplier); } }
(1);
820
                            if (score_var == 4)
821
                                
scr_tenna_add_score
scr_tenna_add_score

function
scr_tenna_add_score(arg0)
{ if (i_ex(obj_tenna_enemy_bg)) { var _multiplier = 1; var _multi_minigame_adjustment = 1; if (obj_tenna_enemy.minigameactivated) { if (obj_tenna_enemy.minigamecount >= 6) _multi_minigame_adjustment = 0.65; _multiplier = (obj_tenna_enemy.pointsmultiplierthisturn + obj_tenna_enemy.pointsmultiplier) * _multi_minigame_adjustment; obj_tenna_enemy.pointsmultiplierthisturn -= 1; if (obj_tenna_enemy.pointsmultiplierthisturn < 1) obj_tenna_enemy.pointsmultiplierthisturn = 1; } if (!i_ex(obj_tenna_zoom)) obj_tenna_enemy_bg.addscore += round(arg0 * _multiplier); else if (i_ex(obj_tenna_minigame_ui)) obj_tenna_minigame_ui.myscore += round(arg0 * _multiplier); } }
(1);
822
                            if (score_var == 4)
823
                                score_var = 0;
824
                        }
825
                    }
826
                    else if (!hardmode || abs(_noteaccuracy) < (averagetimeunit * 2.4))
827
                    {
828
                        notescore[targetnote[notei]] = 50 + bonus;
829
                        if (fame < 5950)
830
                            _famegain = 60;
831
                        else
832
                            _famegain = 50;
833
                        good++;
834
                        if (tenna_boss)
835
                            
scr_tenna_add_score
scr_tenna_add_score

function
scr_tenna_add_score(arg0)
{ if (i_ex(obj_tenna_enemy_bg)) { var _multiplier = 1; var _multi_minigame_adjustment = 1; if (obj_tenna_enemy.minigameactivated) { if (obj_tenna_enemy.minigamecount >= 6) _multi_minigame_adjustment = 0.65; _multiplier = (obj_tenna_enemy.pointsmultiplierthisturn + obj_tenna_enemy.pointsmultiplier) * _multi_minigame_adjustment; obj_tenna_enemy.pointsmultiplierthisturn -= 1; if (obj_tenna_enemy.pointsmultiplierthisturn < 1) obj_tenna_enemy.pointsmultiplierthisturn = 1; } if (!i_ex(obj_tenna_zoom)) obj_tenna_enemy_bg.addscore += round(arg0 * _multiplier); else if (i_ex(obj_tenna_minigame_ui)) obj_tenna_minigame_ui.myscore += round(arg0 * _multiplier); } }
(1);
836
                    }
837
                    else if (hardmode && _firstnote && pressedtimer[i] == 0)
838
                    {
839
                        if (trackpos < notetime[targetnote[notei]])
840
                        {
841
                            debug_print("early miss");
842
                            if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
() && notei > 0 && notetype[targetnote[notei - 1]] == i && notealive[targetnote[notei - 1]] == 1)
843
                                debug_print("PREVIOUS NOTE STILL ALIVE DESPITE EARLY MISS");
844
                            notescore[targetnote[notei]] = 0;
845
                            notealive[targetnote[notei]] = 0;
846
                            missnotecon = 1;
847
                            miss++;
848
                            snd_play(miss_sound[irandom(1)]);
849
                        }
850
                        else
851
                        {
852
                            continue;
853
                        }
854
                    }
855
                    else
856
                    {
857
                        break;
858
                    }
859
                    total_score += notescore[targetnote[notei]];
860
                    if (missnotecon == 1)
861
                        last_note_score = -2;
862
                    else
863
                        last_note_score = notescore[targetnote[notei]];
864
                    if (tutorial == 0)
865
                    {
866
                        fame += (_famegain * fame_mul);
867
                        total_fame += (_famegain * fame_mul);
868
                    }
869
                    points += notescore[targetnote[notei]];
870
                    score_scale = min(4, score_scale + (notescore[targetnote[notei]] / 100));
871
                    if (noteanim[targetnote[notei]] > 0)
872
                    {
873
                        if (i == 1)
874
                            performer.sprite_index = spr_kris_guitar_high_hold;
875
                    }
876
                    if (notescore[targetnote[notei]] >= 40 && noteend[targetnote[notei]] > 0)
877
                    {
878
                        hold_start[i] = notetime[targetnote[notei]];
879
                        hold_end[i] = noteend[targetnote[notei]];
880
                        heldnote[i] = targetnote[notei];
881
                    }
882
                    if (notescore[targetnote[notei]] >= 40)
883
                    {
884
                        combo++;
885
                        max_combo = max(combo, max_combo);
886
                    }
887
                    notealive[targetnote[notei]] = 0;
888
                    note_hit_score[i] = notescore[targetnote[notei]];
889
                    pressedtimer[i] = (room_speed / 10) + 1;
890
                    if (oneAtATime)
891
                        mus_volume(track1_main, 0, 0);
892
                    if (trackpos >= 0)
893
                        mus_volume(track2_main, main_vol, 0);
894
                    _firstnote = false;
895
                    break;
896
                }
897
            }
898
        }
899
        else if (pressedtimer[i] == 0 && missnotecon != 1 && (hardmode || _notetime > ((_press_buffer / 30) + 0.12)))
900
        {
901
            snd_play(guitar_sound[irandom(1) + (i * 2)]);
902
        }
903
    }
904
    fame = clamp(fame, 0, max_fame);
905
    if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
906
    {
907
        if (song_initialized && !song_done && loadsong == 3)
908
        {
909
            var _skip = false;
910
            if (keyboard_check_pressed(vk_f5))
911
            {
912
                if (keyboard_check(ord("1")))
913
                    points = 10000;
914
                if (keyboard_check(ord("2")))
915
                    points = 14500;
916
                if (keyboard_check(ord("3")))
917
                    points = 18000;
918
                if (keyboard_check(ord("4")))
919
                    points = 22000;
920
                if (keyboard_check(ord("5")))
921
                    points = 25000;
922
                if (keyboard_check(ord("6")))
923
                    points = 28000;
924
                _skip = true;
925
                fame = 999999;
926
            }
927
            if (keyboard_check_pressed(vk_f6))
928
            {
929
                fame = 0;
930
                if (lose_con == 0)
931
                    lose_con = 1;
932
            }
933
            if (_skip)
934
            {
935
                total_fame = fame;
936
                trackpos = track_length;
937
                audio_stop_all();
938
                scr_rhythmgame_notechart_clear();
939
                performer.sprite_index = spr_kris_rock_2;
940
                with (drums)
941
                {
942
                    performer.sprite_index = spr_susie_drum;
943
                    scr_rhythmgame_notechart_clear();
944
                    con = -1;
945
                    fade = 1;
946
                }
947
                with (vocals)
948
                {
949
                    performer.sprite_index = spr_ralsei_rock_1;
950
                    scr_rhythmgame_notechart_clear();
951
                    scr_rhythmgame_clear_all_lyrics();
952
                }
953
            }
954
        }
955
    }
956
    if ((replayversion || song_id == 0) && song_initialized && !song_done && loadsong == 3 && lose_con == 1)
957
    {
958
        
scr_debug_print_persistent
scr_debug_print_persistent

function
scr_debug_print_persistent(arg0, arg1)
{ } function scr_debug_delete_persistent(arg0, arg1 = false) { } function scr_debug_clear_persistent() { }
("losing", "losing pitch at " + string(fade));
959
        pitch = fade;
960
        sound_pitch(track1_instance, fade);
961
        sound_pitch(track2_instance, fade);
962
        if (song_id == 0)
963
        {
964
            sound_pitch(track1_solo_instance, fade);
965
            sound_pitch(track2_solo_instance, fade);
966
        }
967
        if (fade <= 0.5 && !replayquit)
968
        {
969
            with (vocals)
970
            {
971
                performer.sprite_index = spr_ralsei_rock_surprise;
972
                performer.image_index = 1;
973
                performer.image_speed = 0;
974
            }
975
        }
976
        if (fade == 0)
977
        {
978
            sound_pause(track1_instance);
979
            sound_pause(track2_instance);
980
            if (song_id == 0)
981
            {
982
                sound_pause(track1_solo_instance);
983
                sound_pause(track2_solo_instance);
984
            }
985
            with (drums)
986
            {
987
            }
988
            with (vocals)
989
            {
990
            }
991
            lose_con = 2;
992
        }
993
    }
994
    if (tenna_boss && !song_done && (looptimer + trackpos) >= chart_end)
995
    {
996
        song_done = true;
997
        debug_print("chart done!");
998
        mus_volume(track1_instance, 1, 30);
999
        mus_volume(track2_instance, 0, 30);
1000
    }
1001
    if (loop && trackpos < remtrackpos[4] && trackpos < 2 && remtrackpos[4] > (track_length / 2))
1002
    {
1003
        if (maxnote >= 5)
1004
            last_score[0] = notescore[maxnote - 5];
1005
        if (maxnote >= 4)
1006
            last_score[1] = notescore[maxnote - 4];
1007
        if (maxnote >= 3)
1008
            last_score[2] = notescore[maxnote - 3];
1009
        if (maxnote >= 2)
1010
            last_score[3] = notescore[maxnote - 2];
1011
        if (maxnote >= 1)
1012
            last_score[4] = notescore[maxnote - 1];
1013
        debug_print("song looped");
1014
        minnote = 0;
1015
        remtrackpos[4] = -1;
1016
        remtrackpos[3] -= track_length;
1017
        remtrackpos[2] -= track_length;
1018
        remtrackpos[1] -= track_length;
1019
        remtrackpos[0] -= track_length;
1020
        looptimer = track_length;
1021
        if (tutorial != 1)
1022
        {
1023
            var _notealive = (tutorial < 5) ? 1 : 0;
1024
            for (i = 0; i < maxnote; i++)
1025
            {
1026
                if (loop_start > 0)
1027
                {
1028
                    if (notetime[i] < loop_start)
1029
                        continue;
1030
                    else
1031
                        loop_start = 0;
1032
                }
1033
                notealive[i] = _notealive;
1034
                notescore[i] = 0;
1035
            }
1036
        }
1037
        with (obj_rhythmgame_chart)
1038
            event_user(0);
1039
    }
1040
    else if (!song_done && (trackpos >= track_length || lose_con == 2))
1041
    {
1042
        if ((song_id == 0 && !freeplay) || replayversion == true)
1043
            global.flag[1118 last_minigame_points] = points;
1044
        if (fame > 0 && lose_con == 0)
1045
        {
1046
            game_won = true;
1047
            debug_print("YOU WON!!");
1048
        }
1049
        else
1050
        {
1051
            debug_print("YOU DIDN'T WIN!!");
1052
        }
1053
        song_done = true;
1054
        if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
1055
            fastforward = false;
1056
    }
1057
}
1058
with (obj_rhythmgame_chart)
1059
    trackpos = other.trackpos;