Deltarune (Chapter Select) script viewer

← back to main script listing

gml_Object_obj_CHAPTER_SELECT_old_Create_0

(view raw script w/o annotations or w/e)
1
global.is_console = os_type == os_switch || os_type == os_ps4 || os_type == os_ps5;
2
global.savedata_async_id = -1;
3
global.savedata_async_load = false;
4
global.savedata_error = false;
5
global.savedata_debuginfo = "";
6
global.savedata_pause = false;
7
isfullscreen = 0;
8
init_loaded = false;
9
window_set_caption("DELTARUNE Chapter 1&2");
10
if (!global.is_console)
11
    window_enable_borderless_fullscreen(true);
12
global.launcher = true;
13
var launch_data = 
scr_init_launch_parameters
scr_init_launch_parameters

function
scr_init_launch_parameters()
{ var param_data = new launch_parameters(); var p_num = parameter_count(); if (p_num > 0) { for (var i = 0; i < p_num; i += 1) { var param = parameter_string(i + 1); if (param == "launcher") { param_data.is_launcher = true; } else if (string_pos("switch_", param) != 0) { var param_parts = string_split(param, "_"); param_data.switch_id = real(param_parts[1]); } else if (string_pos("returning_", param) != 0) { var param_parts = string_split(param, "_"); param_data.returning = real(param_parts[1]); } } } return param_data; } function launch_parameters() constructor { is_launcher = true; switch_id = -1; returning = 0; } function get_chapter_switch_parameters() { var launch_data = new launch_parameters(); if (scr_is_switch_os() && variable_global_exists("switchlogin")) launch_data.switch_id = global.switchlogin; var parameters = []; parameters[0] = "launcher"; parameters[1] = "switch_" + string(launch_data.switch_id); parameters[2] = "returning_" + string(launch_data.returning); var param_formatted = ""; for (var i = 0; i < array_length(parameters); i++) param_formatted += (" " + string(parameters[i])); return param_formatted; } function is_original_launcher(arg0) { return arg0.returning == 0; }
();
14
var isoriginallauncher = is_original_launcher(launch_data);
15
if (os_type == os_switch && !variable_global_exists("switchlogin"))
16
{
17
    global.switchlogin = launch_data.switch_id;
18
    while (global.switchlogin < 0)
19
        global.switchlogin = switch_accounts_select_account(true, false, false);
20
    if (!switch_accounts_is_user_open(global.switchlogin))
21
        switch_accounts_open_user(global.switchlogin);
22
}
23
display_height = display_get_height();
24
display_width = display_get_width();
25
window_size_multiplier = 1;
26
for (var _ww = 2; _ww < 6; _ww += 1)
27
{
28
    if (display_width > (640 * _ww) && display_height > (480 * _ww))
29
        window_size_multiplier = _ww;
30
}
31
if (!window_get_fullscreen())
32
{
33
    if (window_size_multiplier > 1 && isoriginallauncher)
34
    {
35
        window_set_size(640 * window_size_multiplier, 480 * window_size_multiplier);
36
        alarm[0]
 = 1;
gml_Object_obj_CHAPTER_SELECT_old_Alarm_0.gml

window_center();
37
    }
38
}
39
if (global.is_console)
40
{
41
    application_surface_enable(true);
42
    application_surface_draw_enable(false);
43
}
44
global.debug = 0;
45
var _locale = os_get_language();
46
var _lang = (substr(_locale, 1, 2) != "ja") ? "en" : "ja";
47
global.lang = _lang;
48
if (ossafe_file_exists("true_config.ini"))
49
{
50
    ossafe_ini_open("true_config.ini");
51
    global.lang = ini_read_string("LANG", "LANG", _lang);
52
    ossafe_ini_close();
53
}
54
text_font = 2;
55
con = "init";
56
file_found = false;
57
highestUncompletedChapter = 0;
58
highestCompletedChapter = 0;
59
my_stringset = "0";
60
yes = "Yes";
61
no = "No";
62
mpos = 0;
63
chapterselectinit = 0;
64
timer = 0;
65
drawcolor = c_black;
66
yy = room_height / 2;
67
xx = room_width / 2;
68
fademax = 10;
69
fade = fademax;
70
chaptertoload = 0;
71
chaptertoload_temp = 0;
72
console = os_type == os_switch || os_type == os_ps4;
73
latestAvailableChapter = 2;
74
chapname[0] = " - - ";
75
chapname[1] = "The Beginning";
76
chapname[2] = "A Cyber's World";
77
chapname[3] = " - - ";
78
chapname[4] = " - - ";
79
chapname[5] = " - - ";
80
chapname[6] = " - - ";
81
chapname[7] = " - - ";
82
roominit = 0;
83
scale = 1;
84
fadeout = 1;
85
xscale = 1;
86
yscale = 1;
87
spr_aftereffect = 0;
88
confirm_choice_index = 0;
89
move_noise = false;
90
select_noise = false;
91
old_savedata_check = false;
92
global.versionno = "v2";
93
version_text = global.versionno + " ";
94
version_text_alpha = 0;
95
loop = -4;
96
for (i = 0; i < 10; i += 1)
97
{
98
    global.input_pressed[i] = 0;
99
    global.input_held[i] = 0;
100
    global.input_released[i] = 0;
101
}
102
if (global.is_console)
103
{
104
    if (os_type == os_switch)
105
    {
106
        switch_controller_support_set_defaults();
107
        switch_controller_support_set_singleplayer_only(true);
108
        switch_controller_set_supported_styles(7);
109
    }
110
    if (os_type == os_ps4)
111
        ps4_touchpad_mouse_enable(false);
112
    ossafe_savedata_load();
113
}
114
else
115
{
116
    _locale = os_get_language();
117
    _lang = (substr(_locale, 1, 2) != "ja") ? "en" : "ja";
118
    global.lang = _lang;
119
    if (ossafe_file_exists("true_config.ini"))
120
    {
121
        ossafe_ini_open("true_config.ini");
122
        global.lang = ini_read_string("LANG", "LANG", _lang);
123
        if (isoriginallauncher)
124
        {
125
            var is_fullscreen = ini_read_real("SCREEN", "FULLSCREEN", 0) || window_get_fullscreen();
126
            window_set_fullscreen(is_fullscreen);
127
        }
128
        ossafe_ini_close();
129
    }
130
    text_font = (global.lang == "en") ? 2 : 1;
131
    yes = (global.lang == "en") ? "Yes" : "はい";
132
    no = (global.lang == "en") ? "No" : "いいえ";
133
    chapname[1] = (global.lang == "en") ? "The Beginning" : "はじまり";
134
    chapname[2] = (global.lang == "en") ? "A Cyber's World" : "サイバーワールド";
135
    
scr_controls_default
scr_controls_default

function
scr_controls_default()
{ global.button0 = gp_face1; global.button1 = gp_face2; global.button2 = gp_face4; if (os_type == os_ps4 || os_type == os_ps5) { var os_map = os_get_info(); var ps4_confirm_button = undefined; if (os_map != -1) { var mapsize = ds_map_size(os_map); var key = ds_map_find_first(os_map); for (var i = 0; i < (mapsize - 1); i++) { if (key == "enter_button_assign") ps4_confirm_button = ds_map_find_value(os_map, key); else key = ds_map_find_next(os_map, key); } ds_map_destroy(os_map); } if (ps4_confirm_button == 0) { global.button0 = gp_face2; global.button1 = gp_face1; } else { global.button0 = gp_face1; global.button1 = gp_face2; } global.button2 = gp_face4; } else if (scr_is_switch_os()) { global.button0 = gp_face2; global.button1 = gp_face1; global.button2 = gp_face4; } global.default_button0 = global.button0; global.default_button1 = global.button1; global.default_button2 = global.button2; global.input_k[0] = vk_down; global.input_k[1] = vk_right; global.input_k[2] = vk_up; global.input_k[3] = vk_left; global.input_k[4] = ord("Z"); global.input_k[5] = ord("X"); global.input_k[6] = ord("C"); global.input_k[7] = vk_enter; global.input_k[8] = vk_shift; global.input_k[9] = vk_control; global.input_g[0] = gp_padd; global.input_g[1] = gp_padr; global.input_g[2] = gp_padu; global.input_g[3] = gp_padl; global.input_g[4] = global.button0; global.input_g[5] = global.button1; global.input_g[6] = global.button2; global.input_g[7] = 999; global.input_g[8] = 999; global.input_g[9] = 999; with (obj_gamecontroller) gamepad_shoulderlb_reassign = 0; }
();
136
    audio_group_load(0);
137
    init_loaded = true;
138
}