Deltarune (Chapter 3) 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
                    break;
12
                else
13
                    _startslot++;
14
            }
15
            for (var i = 0; i < argument_count; i++)
16
            {
17
                if ((_startslot + i) >= 10)
18
                {
19
                    
scr_debug_print
scr_debug_print

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

function
c_saveload(arg0)
{ if (
scr_debug())
{
c_cmd("saveload", arg0, 0, 0, 0);
if (arg0 == "save") { with (obj_cutscene_master) { if (loadedState == 1) { loadedState = 0;
scr_cutscene_master_commands_initialize();
} } } } }
("save");
114
}
115
116
function c_saveload_l()
117
{
118
    if (argument_count == 0 || argument[0] == true)
119
        
c_saveload
c_saveload

function
c_saveload(arg0)
{ if (
scr_debug())
{
c_cmd("saveload", arg0, 0, 0, 0);
if (arg0 == "save") { with (obj_cutscene_master) { if (loadedState == 1) { loadedState = 0;
scr_cutscene_master_commands_initialize();
} } } } }
("load");
120
}