Deltarune (Chapter 3) script viewer

← back to main script listing

gml_GlobalScript_scr_rhythmgame_song_load

(view raw script w/o annotations or w/e)
1
function scr_rhythmgame_load_song(arg0 = 0, arg1 = true, arg2 = true, arg3 = false)
2
{
3
    if (song_loaded && !arg3)
4
        scr_rhythmgame_song_reset();
5
    song_id = arg0;
6
    notetime[0] = 0;
7
    notespeed = 150;
8
    loop = false;
9
    
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("trying to load");
10
    if (arg0 == 0)
11
    {
12
        track1_id = "ch3_karaoke_no_guitar.ogg";
13
        track2_id = "ch3_karaoke_full.ogg";
14
        oneAtATime = true;
15
        dynamic_solo = true;
16
        bpm = 230;
17
        startoffset = 0;
18
        track_length = 174.26;
19
        notespacing = 60 / bpm;
20
        meter = notespacing * 4;
21
        if ((
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
() && arg3) || (v_ex("debugsong") && debugsong))
22
            trackstart = scr_round_to_beat(14.5, bpm);
23
        else
24
            trackstart = 0;
25
        timestamp[0] = scr_round_to_beat(37.56, bpm, 1) - notespacing;
26
        timestamp[1] = scr_round_to_beat(58.43, bpm, 1) - notespacing;
27
        timestamp[2] = scr_round_to_beat(79.3, bpm, 1) - notespacing;
28
        timestamp[3] = scr_round_to_beat(100.17, bpm, 1) - notespacing;
29
        
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("Loading main song");
30
    }
31
    else if (arg0 == 1)
32
    {
33
        track1_id = "ch3-practice_song_noguit.ogg";
34
        track2_id = "ch3-practice_song_combined.ogg";
35
        oneAtATime = true;
36
        bpm = 75;
37
        startoffset = 0;
38
        track_length = 24;
39
        trackstart = 0;
40
        notespeed = 90;
41
        
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("Loading practice song");
42
    }
43
    else if (arg0 == 2)
44
    {
45
        track1_id = "tenna_battle.ogg";
46
        track2_id = "tenna_battle_guitar.ogg";
47
        
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("Loading tenna_battle");
48
        oneAtATime = false;
49
        track_length = 165.405;
50
        bpm = 148;
51
        notespeed = 120;
52
        notespacing = 60 / bpm;
53
        meter = notespacing * 4;
54
        if (i_ex(obj_rhythmgame))
55
        {
56
            if (obj_rhythmgame.tenna_boss)
57
                loop = true;
58
            else
59
                trackstart = 0 - (meter * 1);
60
        }
61
    }
62
    else if (arg0 == 3)
63
    {
64
        track1_id = "ch3_tvtime.ogg";
65
        track2_id = "ch3_tvtime_guitar.ogg";
66
        
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("Tutorial time!");
67
        trackstart = 0;
68
        oneAtATime = true;
69
        track_length = 32.842;
70
        bpm = 190;
71
        loop = true;
72
        notespacing = 60 / bpm;
73
        meter = notespacing * 4;
74
        trackstart = 0 - meter;
75
    }
76
    else if (arg0 == 4)
77
    {
78
        track1_id = "board4_rhythm.ogg";
79
        track2_id = "board4_rhythm.ogg";
80
        
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("Loading very good board 4 song");
81
        trackstart = (room == room_dw_rhythm || arg3) ? 8 : 0;
82
        oneAtATime = true;
83
        track_length = 15.265;
84
        notespeed = 30;
85
        bpm = 60;
86
    }
87
    else if (arg0 == 5)
88
    {
89
        track1_id = "rudebuster_boss.ogg";
90
        track2_id = "rudebuster_boss.ogg";
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() { }
("Time to get FUNKY");
92
        trackstart = 0;
93
        oneAtATime = true;
94
        track_length = 143.384;
95
        bpm = 140;
96
    }
97
    else if (arg0 == 6)
98
    {
99
        track1_id = "battle_vapor.ogg";
100
        track2_id = "battle_vapor.ogg";
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() { }
("Loading battle_vapor");
102
        trackstart = 7;
103
        oneAtATime = true;
104
        bpm = 200;
105
    }
106
    else if (arg0 == 7)
107
    {
108
        track1_id = "tenna_battle_old.ogg";
109
        track2_id = "tenna_battle_old.ogg";
110
        
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("Loading tenna_battle_old");
111
        trackstart = 0;
112
        oneAtATime = true;
113
        track_length = 127.92;
114
        bpm = 148;
115
        notespeed = 120;
116
    }
117
    if (arg3)
118
    {
119
        notespacing = 60 / bpm;
120
        meter = notespacing * 4;
121
    }
122
    else if (arg0 >= 0)
123
    {
124
        
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { }
("loading da other stuff");
125
        notespacing = 60 / bpm;
126
        meter = notespacing * 4;
127
        scr_rhythmgame_notechart_lead(arg0);
128
        if (tutorial > 0)
129
            scr_rhythmgame_toggle_notes(false);
130
        musicm.bpm = bpm;
131
        musicm.beat_offset += bpm / 2;
132
        if (arg1)
133
        {
134
            with (drums)
135
            {
136
                scr_rhythmgame_notechart_drums(arg0);
137
                bpm = other.bpm;
138
                notespacing = other.notespacing;
139
                meter = other.meter;
140
                loop = other.loop;
141
            }
142
        }
143
        if (arg2)
144
        {
145
            with (vocals)
146
            {
147
                scr_rhythmgame_notechart_vocals(arg0);
148
                bpm = other.bpm;
149
                notespacing = other.notespacing;
150
                meter = other.meter;
151
                loop = other.loop;
152
                if (i_ex(obj_rhythmgame) && obj_rhythmgame.tenna_boss)
153
                {
154
                    if (maxnote == 0 || chart_start > notetime[0] || (chart_start + (meter * 2)) < notetime[0])
155
                        performer.sprite_index = spr_ralsei_sing_clap;
156
                }
157
            }
158
        }
159
        scr_rhythmgame_load_events(arg0);
160
    }
161
}
162
163
function scr_rhythmgame_song_reset()
164
{
165
    timestamp = [];
166
    timestamp[0] = 0;
167
    dynamic_solo = false;
168
    track1_id = 0;
169
    track2_id = 0;
170
    song_id = -1;
171
    oneAtATime = false;
172
    bpm = 230;
173
    notespacing = 60 / bpm;
174
    meter = notespacing * 4;
175
}
176
177
function scr_rhythmgame_load_events(arg0)
178
{
179
    if (arg0 == 0)
180
    {
181
        with (drums)
182
        {
183
            scr_music_event_add_instance(performer, 16.7 - (meter * 6), "sprite_index", spr_susie_drum_ready, true);
184
            scr_music_event_add_instance(other.performer, 16.7 - (meter * 5.75), "sprite_index", spr_kris_guitar_ready, true);
185
            scr_music_event_add_instance(other.vocals.performer, 16.7 - (meter * 5.5), "sprite_index", spr_ralsei_sing_polite_closed, true);
186
            scr_music_event_add(16.7 - (meter * 5), "target_brightness", 0.75);
187
            scr_music_event_add_instance(other.vocals, 16.7 - (meter * 5), "target_brightness", 0.75);
188
            scr_music_event_add(16.7 - (meter * 4), "mash_hit", 1, true, 16);
189
            scr_music_event_add_instance(other.vocals.performer, 16.7 - (meter * 4), "sprite_index", spr_ralsei_rock_shock, true);
190
            if (!other.spooked && global.plot < 150 && global.flag[1096 rhythm_game_tries] == 0)
191
            {
192
                scr_music_event_add_instance(other.vocals.performer, 16.7 - (meter * 4), "shakeamt", 10, true);
193
                other.spooked = true;
194
            }
195
            scr_music_event_add(16.939999999999998 - (meter * 4), "con", 0, true);
196
            scr_music_event_add(18.7 - (meter * 4), "fade", 0.98, false);
197
            scr_music_event_add_instance(other.vocals.performer, 38, "sprite_index", spr_ralsei_sing_clap, true, 1);
198
            scr_music_event_add(39, "con", -1, true);
199
            scr_music_event_add(39.12, "mash_hit", 2, true, 16);
200
            scr_music_event_add(39.24, "mash_hit", 0, true, 16);
201
            scr_music_event_add(39.36, "mash_hit", 0, true, 16);
202
            scr_music_event_add(39.48, "mash_hit", 1, true, 16);
203
            scr_music_event_add(39.72, "con", 1, true);
204
            scr_music_event_add(98.09 - meter, "con", 5, true);
205
            scr_music_event_add_instance(other, 134.5, "smooth", 1, true);
206
            scr_music_event_add_instance(other.vocals.performer, 134.5, "sprite_index", spr_ralsei_sing_clap, true, 1);
207
            scr_music_event_add_instance(other, 149.75, "smooth", 0, true);
208
        }
209
    }
210
    else if (arg0 == 1)
211
    {
212
        with (drums)
213
        {
214
            auto_play = true;
215
            performer.image_speed = 0.25;
216
            other.spooked = true;
217
            scr_music_event_add_instance(performer, trackstart + (meter * 0.5), "sprite_index", spr_susie_drumsticks, true);
218
            scr_music_event_add_instance(performer, trackstart + (meter * 0.5), "image_index", 1, true);
219
            scr_music_event_add_instance(other.performer, trackstart + (meter * 1.5), "sprite_index", spr_kris_guitar_ready, true);
220
            scr_music_event_add_instance(other.vocals.performer, trackstart + (meter * 1), "sprite_index", spr_ralsei_sing_clap, true, 1);
221
            scr_music_event_add(trackstart + (meter * 2), "fade", 1, false);
222
            scr_music_event_add_instance(performer, 11, "sprite_index", spr_susie_drumsticks_2, true);
223
            scr_music_event_add_instance(performer, 14.3, "image_speed", 1, true);
224
            scr_music_event_add_instance(other.vocals.performer, 14.3, "sprite_index", spr_ralsei_rock_shock, true);
225
            scr_music_event_add_instance(other.vocals.performer, 14.3, "shakeamt", 10, true);
226
            scr_music_event_add(14.3, "auto_play", false, true);
227
            scr_music_event_add(14.3, "con", 7, true);
228
            scr_music_event_add(20.3, "fade", 0.98, false);
229
            scr_music_event_add(22.6, "mash_hit", false, true);
230
            scr_music_event_add(22.6, "con", -1, true);
231
            scr_music_event_add_instance(performer, 23.5, "sprite_index", spr_susie_drum_ready, true);
232
            scr_music_event_add_instance(performer, 24, "sprite_index", spr_susie_drum, true);
233
        }
234
    }
235
    else if (arg0 == 2)
236
    {
237
        drums.auto_play = 1;
238
        if (chart_start <= 158.92 && chart_end >= 158.92)
239
        {
240
            with (vocals.performer)
241
            {
242
                scr_music_event_add(158.92, "mid", 4559, true);
243
                scr_music_event_add(158.92, "idle", 450, true);
244
                scr_music_event_add(158.92, "animspeed", 2, true);
245
                scr_music_event_add(158.92, "sprite_index", spr_ralsei_sing_rude, true);
246
                scr_music_event_add(162.16, "sprite_index", spr_ralsei_sing_cuss, true);
247
                scr_music_event_add(162.16, "shakeamt", 10, true);
248
                scr_music_event_add(162.16, "animspeed", 1, true);
249
                scr_music_event_add(165.4, "mid", 914, true);
250
                scr_music_event_add(165.4, "idle", 3513, true);
251
                scr_music_event_add(165.4, "sprite_index", spr_ralsei_sing_clap, true);
252
            }
253
        }
254
    }
255
    else if (arg0 == 4)
256
    {
257
        scr_music_event_add_instance(other.performer, trackstart + (meter * 1.5), "sprite_index", spr_kris_guitar_ready, true);
258
    }
259
    else
260
    {
261
        drums.auto_play = true;
262
        scr_music_event_add_instance(drums.performer, trackstart + (meter * 0.5), "sprite_index", spr_susie_drum_ready, true);
263
        scr_music_event_add_instance(other.performer, trackstart + (meter * 1.5), "sprite_index", spr_kris_guitar_ready, true);
264
        scr_music_event_add_instance(vocals.performer, trackstart + (meter * 1), "sprite_index", spr_ralsei_sing_clap, true, 1);
265
    }
266
    scr_music_beat_event_instance(obj_rhythmgame, "beat", true, true);
267
}
268
269
function scr_rhythmgame_toggle_notes(arg0, arg1 = true)
270
{
271
    if (arg0)
272
    {
273
        var _startpoint = scr_ceil_to_beat(trackpos + (meter * 1.5), bpm, 0.25);
274
        if (_startpoint > track_length)
275
            loop_start = _startpoint - track_length;
276
        for (i = 0; i < maxnote; i++)
277
        {
278
            if (notetime[i] < _startpoint)
279
            {
280
                continue;
281
            }
282
            else
283
            {
284
                notescore[i] = 0;
285
                notealive[i] = 1;
286
            }
287
        }
288
    }
289
    else
290
    {
291
        for (i = 0; i < maxnote; i++)
292
        {
293
            notescore[i] = arg1 ? 40 : 0;
294
            notealive[i] = 0;
295
        }
296
    }
297
}