Deltarune (Chapter 5) script viewer

← back to main script listing

gml_GlobalScript_scr_rhythmgame_beatcheck

(view raw script w/o annotations or w/e)
1
function 
scr_rhythmgame_beatcheck
scr_rhythmgame_beatcheck

function
scr_rhythmgame_beatcheck(arg0 = false)
{ var _update = 0; if (signature_count > 1) { if (signature_index < (signature_count - 1) && trackpos > signature_time[signature_index + 1]) { signature_index++; _update += 1; signature = signature_change[signature_index]; beatstart = signature_time[signature_index]; } else if (arg0 && signature_index > 0 && trackpos < signature_time[signature_index]) { signature_index--; signature = signature_change[signature_index]; beatstart = max(bpm_time[bpm_index], signature_time[signature_index]); } } if (bpm_count > 1) { if (bpm_index < (bpm_count - 1) && trackpos > bpm_time[bpm_index + 1]) { bpm_index++; _update += 2; bpm = bpm_change[bpm_index]; notespacing = 60 / bpm; meter = notespacing * signature; beatstart = bpm_time[bpm_index]; } else if (arg0 && bpm_index > 0 && trackpos < bpm_time[bpm_index]) { bpm_index--; bpm = bpm_change[bpm_index]; notespacing = 60 / bpm; meter = notespacing * signature; beatstart = max(bpm_time[bpm_index], signature_time[signature_index]); } } if (_update > 0) { with (obj_rhythmgame_chart) { if (_update != 2) { signature = other.signature; signature_index = other.signature_index; if (confidence < 1) conf_decay = 10; } if (_update >= 2) { bpm_index = other.bpm_index; bpm = other.bpm; notespacing = other.notespacing; } } with (obj_music_event_manager) { time_offset = max(other.bpm_time[other.bpm_index], other.signature_time[other.signature_index]); bpm = other.bpm; signature = other.signature; } } }
(arg0 = false)
2
{
3
    var _update = 0;
4
    if (signature_count > 1)
5
    {
6
        if (signature_index < (signature_count - 1) && trackpos > signature_time[signature_index + 1])
7
        {
8
            signature_index++;
9
            _update += 1;
10
            signature = signature_change[signature_index];
11
            beatstart = signature_time[signature_index];
12
        }
13
        else if (arg0 && signature_index > 0 && trackpos < signature_time[signature_index])
14
        {
15
            signature_index--;
16
            signature = signature_change[signature_index];
17
            beatstart = max(bpm_time[bpm_index], signature_time[signature_index]);
18
        }
19
    }
20
    if (bpm_count > 1)
21
    {
22
        if (bpm_index < (bpm_count - 1) && trackpos > bpm_time[bpm_index + 1])
23
        {
24
            bpm_index++;
25
            _update += 2;
26
            bpm = bpm_change[bpm_index];
27
            notespacing = 60 / bpm;
28
            meter = notespacing * signature;
29
            beatstart = bpm_time[bpm_index];
30
        }
31
        else if (arg0 && bpm_index > 0 && trackpos < bpm_time[bpm_index])
32
        {
33
            bpm_index--;
34
            bpm = bpm_change[bpm_index];
35
            notespacing = 60 / bpm;
36
            meter = notespacing * signature;
37
            beatstart = max(bpm_time[bpm_index], signature_time[signature_index]);
38
        }
39
    }
40
    if (_update > 0)
41
    {
42
        with (obj_rhythmgame_chart)
43
        {
44
            if (_update != 2)
45
            {
46
                signature = other.signature;
47
                signature_index = other.signature_index;
48
                if (confidence < 1)
49
                    conf_decay = 10;
50
            }
51
            if (_update >= 2)
52
            {
53
                bpm_index = other.bpm_index;
54
                bpm = other.bpm;
55
                notespacing = other.notespacing;
56
            }
57
        }
58
        with (obj_music_event_manager)
59
        {
60
            time_offset = max(other.bpm_time[other.bpm_index], other.signature_time[other.signature_index]);
61
            bpm = other.bpm;
62
            signature = other.signature;
63
        }
64
    }
65
}