Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_credits_ch5_audio_Create_0

(view raw script w/o annotations or w/e)
1
paused = false;
2
persistent = 1;
3
_active = true;
4
_timer = 0;
5
_time_stamp_index = 0;
6
_time_stamps = [3.75, 7.51, 10.63, 14.95, 18.63, 22.36, 26.2, 30.07, 33.83, 35.83, 38.56, 41, 44.86, 46.86, 48.37, 52.21, 55.83, 60.26, 64.26, 68.26, 72.14, 75.98, 80.4, 85.45, 88.58];
7
snd_free_all();
8
song0 = snd_init("ch5_credits.ogg");
9
song1 = mus_play(song0);
10
_listeners = [];
11
12
get_timestamp = function()
13
{
14
    return _time_stamps[_time_stamp_index];
15
};
16
17
add_event_listener = function(arg0)
18
{
19
    _listeners[array_length(_listeners)] = arg0;
20
};
21
22
remove_event_listener = function(arg0)
23
{
24
    var listener_count = array_length(_listeners);
25
    var adjusted_list = [];
26
    for (var i = 0; i < listener_count; i++)
27
    {
28
        if (_listeners[i] == arg0)
29
            continue;
30
        adjusted_list[array_length(adjusted_list)] = _listeners[i];
31
    }
32
    _listeners = adjusted_list;
33
};
34
35
emit_event = function(arg0)
36
{
37
    if (arg0 == "timestamp_changed")
38
    {
39
        var listener_count = array_length(_listeners);
40
        for (var i = 0; i < listener_count; i++)
41
        {
42
            with (_listeners[i])
43
                emit_event("timestamp_changed");
44
        }
45
    }
46
    else if (arg0 == "credits_finished")
47
    {
48
        clean_up();
49
    }
50
};
51
52
clean_up = function()
53
{
54
    persistent = 0;
55
    instance_destroy();
56
};