Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_minigame_quit_ui_Draw_0

(view raw script w/o annotations or w/e)
1
if (i_ex(obj_gameover_minigame) || i_ex(obj_minigame_evaluation))
2
    exit;
3
if (canceltimer >= canceltime)
4
{
5
    if (canceltimer == 30 && (!quit || global.chapter > 3))
6
        instance_create_depth(camerax(), cameray(), depth - 10, obj_gameover_minigame_ch4);
7
    if (canceltimer >= retrytime)
8
    {
9
        var _menu_string = [];
10
        _menu_string[0] = stringsetloc(
Retry
"Retry", "obj_minigame_quit_ui_slash_Draw_0_gml_16_0"
);
11
        _menu_string[1] = stringsetloc(
Quit
"Quit", "obj_minigame_quit_ui_slash_Draw_0_gml_17_0"
);
12
        if (con == 0)
13
        {
14
            draw_set_color(c_white);
15
            
scr_84_set_draw_font
scr_84_set_draw_font

function
scr_84_set_draw_font(arg0)
{ global.chemg_font = arg0; draw_set_font(
scr_84_get_font(arg0));
}
("main");
16
            selection = scr_simple_menu_transformed(selection, camerax() + 300, cameray() + 200, 32, _menu_string, 2, 2, 65535);
17
            if (button1_p())
18
            {
19
                snd_play(snd_badexplosion);
20
                
scr_fadeout
scr_fadeout

function
scr_fadeout(arg0)
{ __fadeouter = instance_create(camerax() - 200, cameray() - 200, obj_fadeout); __fadeouter.fadespeed = 1 / arg0; __fadeouter.depth = 3; return __fadeouter; }
(30);
21
                con = 1;
22
            }
23
        }
24
        else if (con == 1)
25
        {
26
            canceltimer++;
27
            if (canceltimer >= (retrytime + 32))
28
            {
29
                if (selection == 0)
30
                {
31
                    room_goto(room_dw_rhythm_countdown);
32
                }
33
                else if (selection == 1)
34
                {
35
                    snd_free_all();
36
                    inst = instance_create(0, 0, obj_persistentfadein);
37
                    global.entrance = global.band_song;
38
                    if (global.entrance == 0)
39
                        global.entrance = 3;
40
                    global.interact = 3;
41
                    global.facing = 0;
42
                    print_message("entrance = " + string(global.band_song));
43
                    room_goto(room_dw_castle_tv_rhythm);
44
                }
45
            }
46
        }
47
    }
48
    else
49
    {
50
        canceltimer++;
51
    }
52
    exit;
53
}
54
if (button3_h())
55
{
56
    canceltimer++;
57
    if (canceltimer >= canceltime)
58
        quit = true;
59
}
60
else
61
{
62
    canceltimer = 0;
63
}
64
if (appear)
65
{
66
    if (instructionLerp < 1)
67
        instructionLerp += 0.1;
68
}
69
if (!appear)
70
    instructionLerp -= 0.1;
71
var _easedLerp = 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(instructionLerp, 3);
72
var _ja = global.lang == "ja";
73
var _space = _ja ? "" : "    ";
74
quistring = stringsetsubloc("Hold ~1 : Quit", 
scr_get_input_name
scr_get_input_name

function
scr_get_input_name(arg0)
{ var _control = "[?]"; if (global.is_console || obj_gamecontroller.gamepad_active) { _control = global.input_g[arg0]; if (_control == gp_padr) return "\\*D "; if (_control == gp_padl) return "\\*A "; if (_control == gp_padu) return "\\*W "; if (_control == gp_padd) return "\\*S "; if (_control == global.button0) return "\\*Z "; if (_control == global.button1) return "\\*X "; if (_control == global.button2) return "\\*C "; } var left_bracket = (global.lang == "en") ? "[" : "["; var right_bracket = (global.lang == "en") ? "]" : "]"; _control = left_bracket + global.asc_def[global.input_k[arg0]] + right_bracket; if (!is_string(_control)) _control = "[?]"; else return _control; }
(6), "obj_minigame_quit_ui_slash_Draw_0_gml_18_0");
75
quistring2 = stringsetsubloc("Hold ~1 : Quit", _space, "obj_minigame_quit_ui_slash_Draw_0_gml_18_0");
76
scr_84_set_draw_font
scr_84_set_draw_font

function
scr_84_set_draw_font(arg0)
{ global.chemg_font = arg0; draw_set_font(
scr_84_get_font(arg0));
}
("mainbig");
77
draw_set_color(c_white);
78
draw_set_halign(fa_right);
79
var space = 28;
80
var yloc = 380;
81
var butoffset = 4;
82
var reddening = canceltimer / (canceltime * 1.2);
83
reddening = clamp(reddening, 0, 1);
84
var redcol = merge_color(c_white, c_red, reddening);
85
var a = 2;
86
var xx = 0;
87
var yy = 0;
88
var scale = 1;
89
var _alpha = 1;
90
if (room == room_dw_rhythm)
91
    xx = -210;
92
if (global.is_console || obj_gamecontroller.gamepad_active)
93
{
94
    draw_set_alpha(1);
95
    draw_set_colour(redcol);
96
    draw_text_transformed_outline((camerax() + xx + 720) - (_easedLerp * 100), cameray() + yloc + yy + (space * a), quistring2, scale, 1, 0);
97
    var xSpr = 
scr_getbuttonsprite
scr_getbuttonsprite

function
scr_getbuttonsprite(arg0, arg1)
{ var control = arg0; var isString = arg1; var button = noone; var is_dualshock = os_type == os_ps4 || global.gamepad_type == "Sony DualShock 4"; var is_dualsense = os_type == os_ps5 || global.gamepad_type == "DualSense Wireless Controller"; var button_sprite = button_questionmark; var invert = is_dualshock && (global.typer == 50 || global.typer == 70 || global.typer == 71); if (isString) { if (control == "A") { button_sprite = button_xbox_left; if (scr_is_switch_os()) { button_sprite = button_switch_left_0; } else if (is_dualshock || is_dualsense) { button_sprite = invert ? button_ps4_dpad_left_dark : button_ps4_dpad_left; if (is_dualsense) button_sprite = invert ? button_ps4_dpad_left_dark : button_ps5_dpad_left; } return button_sprite; } if (control == "D") { button_sprite = button_xbox_right; if (scr_is_switch_os()) { button_sprite = button_switch_right_0; } else if (is_dualshock || is_dualsense) { button_sprite = invert ? button_ps4_dpad_right_dark : button_ps4_dpad_right; if (is_dualsense) button_sprite = invert ? button_ps4_dpad_right_dark : button_ps5_dpad_right; } return button_sprite; } if (control == "W") { button_sprite = button_xbox_up; if (scr_is_switch_os()) { button_sprite = button_switch_up_0; } else if (is_dualshock || is_dualsense) { button_sprite = invert ? button_ps4_dpad_up_dark : button_ps4_dpad_up; if (is_dualsense) button_sprite = invert ? button_ps4_dpad_up_dark : button_ps5_dpad_up; } return button_sprite; } if (control == "S") { button_sprite = button_xbox_down; if (scr_is_switch_os()) { button_sprite = button_switch_down_0; } else if (is_dualshock || is_dualsense) { button_sprite = invert ? button_ps4_dpad_down_dark : button_ps4_dpad_down; if (is_dualsense) button_sprite = invert ? button_ps4_dpad_down_dark : button_ps5_dpad_down; } return button_sprite; } if (control == "l") { button_sprite = button_xbox_left_bumper; if (is_dualshock || is_dualsense) { button_sprite = button_ps4_l1; if (is_dualsense) button_sprite = button_ps5_l1; } if (scr_is_switch_os()) button_sprite = button_switch_l_0; return button_sprite; } if (control == "L") { button_sprite = button_xbox_left_trigger; if (is_dualshock || is_dualsense) { button_sprite = button_ps4_l2; if (is_dualsense) button_sprite = button_ps5_l2; } if (scr_is_switch_os()) button_sprite = button_switch_zl_0; return button_sprite; } if (control == "r") { button_sprite = button_xbox_right_bumper; if (is_dualshock || is_dualsense) ...
(global.input_g[6], false);
98
    var butxpos = (camerax() + 720) - (_easedLerp * 100) - string_width(" " + quistring2);
99
    if (_ja)
100
        butxpos -= ((sprite_get_width(xSpr) * 2) - 10);
101
    var butxoff = butxpos;
102
    if (!_ja)
103
    {
104
        butxoff += string_width(" Hold ");
105
        butxpos += 4;
106
    }
107
    draw_sprite_ext(xSpr, 0, butxoff + xx, cameray() + yloc + (space * a) + butoffset + yy, 2, 2, 0, redcol, _alpha);
108
    if (canceltimer == canceltime)
109
        draw_sprite_ext(spr_quiz_hud_timer, 0, (butxpos - 32) + xx, cameray() + yloc + (space * a) + 4 + yy, 2, 2, 0, redcol, canceltimer / 8);
110
    else
111
        draw_sprite_ext(spr_quiz_hud_timer, 28 - ((canceltimer / canceltime) * 29), (butxpos - 32) + xx, cameray() + yloc + (space * a) + 4 + yy, 2, 2, 0, redcol, canceltimer / 8);
112
    draw_set_color(c_white);
113
}
114
else
115
{
116
    draw_set_colour(redcol);
117
    draw_text_transformed_outline((camerax() + xx + 720) - (_easedLerp * 100), cameray() + yloc + yy + (space * a), quistring, scale, 1, 0);
118
    if (canceltimer == canceltime)
119
        draw_sprite_ext(spr_quiz_hud_timer, 0, (camerax() + xx + 720) - (_easedLerp * 100) - round(string_width(quistring)) - 28 - 8, cameray() + yloc + (space * a) + 3 + yy, 2, 2, 0, redcol, canceltimer / 8);
120
    else
121
        draw_sprite_ext(spr_quiz_hud_timer, 28 - ((canceltimer / canceltime) * 29), (camerax() + xx + 720) - (_easedLerp * 100) - round(string_width(quistring)) - 28 - 8, cameray() + yloc + (space * a) + 3 + yy, 2, 2, 0, redcol, canceltimer / 8);
122
    draw_set_color(c_white);
123
}
124
draw_set_halign(fa_left);