Deltarune (Chapter 4) script viewer

← back to main script listing

gml_GlobalScript_scr_cutscene_saveload_extra

(view raw script w/o annotations or w/e)
1
function scr_cutscene_save_objects()
2
{
3
    if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
4
    {
5
        with (obj_cutscene_master)
6
        {
7
            var _startslot = 0;
8
            for (var i = 0; i < 10; i++)
9
            {
10
                if (save_object[i] == 99999999 || save_object[i] == -4 || is_undefined(save_object[i]))
11
                {
12
                    show_debug_message("we breakin out of here");
13
                    break;
14
                }
15
                else
16
                {
17
                    _startslot++;
18
                }
19
            }
20
            for (var i = 0; i < argument_count; i++)
21
            {
22
                if ((_startslot + i) >= 10)
23
                {
24
                    
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { scr_debug_clear_persistent(); }
("Cutscene object limit reached.");
25
                    break;
26
                }
27
                else
28
                {
29
                    save_object[_startslot + i] = argument[i];
30
                }
31
            }
32
        }
33
    }
34
}
35
36
function scr_cutscene_save_song(arg0 = false)
37
{
38
    with (obj_cutscene_master)
39
    {
40
        save_mus = true;
41
        if (arg0)
42
        {
43
            if (v_ex("save_mus_pos") && save_mus_pos >= 0)
44
                exit;
45
            else
46
                save_mus_pos = 0;
47
        }
48
        else
49
        {
50
            save_mus_pos = -1;
51
        }
52
    }
53
}
54
55
function scr_cutscene_save_music()
56
{
57
    if (!v_ex("save_mus") || save_mus == false)
58
        exit;
59
    if (global.currentsong[1] == -4)
60
    {
61
        save_mus_track = -4;
62
        save_mus_playing = false;
63
        save_mus_vol = 1;
64
        save_mus_pitch = 1;
65
        save_mus_pos = -1;
66
    }
67
    else
68
    {
69
        save_mus_track = global.currentsong[0];
70
        save_mus_playing = snd_is_playing(global.currentsong[1]);
71
        save_mus_pitch = audio_sound_get_pitch(global.currentsong[1]);
72
        save_mus_vol = audio_sound_get_gain(global.currentsong[1]);
73
        if (v_ex("save_mus_pos") && save_mus_pos >= 0)
74
            save_mus_pos = audio_sound_get_track_position(global.currentsong[1]);
75
        else
76
            save_mus_pos = -1;
77
    }
78
}
79
80
function scr_cutscene_load_music()
81
{
82
    if (!v_ex("save_mus") || save_mus == false)
83
        exit;
84
    if (global.currentsong[0] != save_mus_track)
85
    {
86
        if (global.currentsong[0] != -4)
87
            snd_stop(global.currentsong[1]);
88
        if (save_mus_track != -4)
89
        {
90
            global.currentsong[0] = snd_init(save_mus_track);
91
            global.currentsong[1] = mus_loop(global.currentsong[1]);
92
        }
93
        else
94
        {
95
            global.currentsong[0] = -4;
96
            global.currentsong[1] = -4;
97
        }
98
    }
99
    if (save_mus_track != -4)
100
    {
101
        snd_pitch(global.currentsong[1], save_mus_pitch);
102
        snd_volume(global.currentsong[1], save_mus_vol, 0);
103
        if (save_mus_pos >= 0)
104
            audio_sound_set_track_position(global.currentsong[1], save_mus_pos);
105
        if (snd_is_playing(global.currentsong[1]) != save_mus_playing)
106
        {
107
            if (save_mus_playing)
108
                audio_resume_sound(global.cuurrentsong[1]);
109
            else
110
                snd_pause(global.currentsong[1]);
111
        }
112
    }
113
}