Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_board_controller_Draw_0

(view raw script w/o annotations or w/e)
1
with (obj_gameshow_swordroute)
2
    event_user(0);
3
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
() && view_current == 0)
4
{
5
    if (keyboard_check_pressed(vk_backspace) || gamepad_button_check_pressed(0, gp_shoulderl))
6
        drawcrt = !drawcrt;
7
}
8
if (drawcrt)
9
{
10
    draw_set_alpha(1);
11
    var screenleft = 128;
12
    var screentop = i_ex(obj_gameshow_swordroute) ? 32 : 64;
13
    var screenwidth = 384;
14
    var screenheight = 256 + (i_ex(obj_gameshow_swordroute) * 32);
15
    if (room == room_dw_b3bstest)
16
    {
17
        screenleft = 128;
18
        screentop = 64;
19
        screenwidth = 384;
20
        screenheight = 160;
21
    }
22
    if (room == room_dw_b3bstest_big)
23
    {
24
        screenleft = 64;
25
        screentop = 64;
26
        screenwidth = 512;
27
        screenheight = 256;
28
    }
29
    with (obj_b3bs_console)
30
    {
31
        screenleft = gscreenx;
32
        screentop = gscreeny;
33
        screenwidth = gscreenw;
34
        screenheight = gscreenh;
35
    }
36
    if (screenheight != surface_get_height(crt_surface))
37
    {
38
        surface_free(crt_surface);
39
        surface_free(screen_surface);
40
    }
41
    if (!surface_exists(crt_surface))
42
        crt_surface = surface_create(screenwidth, screenheight);
43
    if (!surface_exists(screen_surface))
44
        screen_surface = surface_create(screenwidth, screenheight);
45
    surface_copy_part(screen_surface, 0, 0, application_surface, screenleft, screentop, screenwidth, screenheight);
46
    var drawgray = true;
47
    if (i_ex(obj_quizsequence) || i_ex(obj_board_writer))
48
        drawgray = false;
49
    var _photo_mode = 0;
50
    if (global.is_console)
51
        _photo_mode = 2;
52
    if (drawgray == true)
53
    {
54
        with (obj_board_grayregion)
55
        {
56
            surface_set_target(other.screen_surface);
57
            gpu_set_blendmode_ext_sepalpha(bm_src_alpha, bm_inv_src_alpha, bm_one, bm_inv_src_alpha);
58
            if (_photo_mode == 2)
59
            {
60
                pal_swap_set_ext(1193, 1, other.swapper, false);
61
            }
62
            else
63
            {
64
                shader_set(shd_grayscalesand);
65
                shader_set_uniform_f(shader_get_uniform(shd_grayscalesand, "sand1"), 255, 236, 189);
66
                shader_set_uniform_f(shader_get_uniform(shd_grayscalesand, "sand2"), 255, 215, 140);
67
                shader_set_uniform_f(shader_get_uniform(shd_grayscalesand, "sand3"), 151, 183, 255);
68
                shader_set_uniform_f(shader_get_uniform(shd_grayscalesand, "sand4"), 177, 193, 227);
69
                shader_set_uniform_f(shader_get_uniform(shd_grayscalesand, "sandcol"), 0.82, 0.82, 0.82);
70
            }
71
            draw_surface_part(application_surface, x, y, sprite_width, sprite_height, x - screenleft, y - screentop);
72
            if (_photo_mode == 2)
73
                pal_swap_reset();
74
            else
75
                shader_reset();
76
            gpu_set_blendmode(bm_normal);
77
            surface_reset_target();
78
        }
79
    }
80
    crttimer = (crttimer + 0.5) % 3;
81
    var _vig = crt_glitch ? (0.2 + random(clamp(crt_glitch / 200, 0, 0.1))) : 0.2;
82
    var _vigint = power(1.5, 1.5 - _vig) * 18;
83
    var _chrom_scale = crt_glitch ? (irandom_range(-4, 4) * clamp(crt_glitch / 5, 1, 5)) : chromStrength;
84
    if (_chrom_scale == 0)
85
        _chrom_scale = 1;
86
    var _filteramount = 0.1 + min(crt_glitch / 100, 0.1);
87
    shader_set(shd_crt);
88
    shader_set_uniform_f(shader_get_uniform(shd_crt, "texel"), 1 / screenwidth, 1 / screenheight);
89
    shader_set_uniform_f(shader_get_uniform(shd_crt, "vignette_scale"), _vig);
90
    shader_set_uniform_f(shader_get_uniform(shd_crt, "vignette_intensity"), _vigint);
91
    shader_set_uniform_f(shader_get_uniform(shd_crt, "chromatic_scale"), _chrom_scale);
92
    shader_set_uniform_f(shader_get_uniform(shd_crt, "filter_amount"), _filteramount);
93
    shader_set_uniform_f(shader_get_uniform(shd_crt, "time"), crttimer);
94
    var _dx = crt_glitch ? (random_range(-1, 1) * clamp(crt_glitch / crt_glitchstrength, 0, 3)) : 0;
95
    var _dy = crt_glitch ? (random_range(-1, 1) * clamp(crt_glitch / crt_glitchstrength, 0, 3)) : 0;
96
    surface_set_target(crt_surface);
97
    draw_clear_alpha(c_black, 1);
98
    draw_surface_stretched(screen_surface, min(0, _dx), min(0, _dy), screenwidth + abs(_dx), screenheight + abs(_dy));
99
    surface_reset_target();
100
    shader_reset();
101
    draw_surface(crt_surface, screenleft, screentop);
102
    if (room == room_board_2)
103
    {
104
        if (i_ex(bosstree))
105
        {
106
            if (bosstree.active)
107
            {
108
                with (bosstree)
109
                {
110
                    bossblush = lerp(bossblush, 1.1, 0.25);
111
                    if (instance_exists(obj_board_grayregion) && !instance_exists(obj_board_playercamera))
112
                    {
113
                        if (place_meeting(x, y, obj_board_grayregion))
114
                            draw_sprite_ext(sprite_index, image_index, x, y, 2, 2, 0, image_blend, bossblush);
115
                    }
116
                    else
117
                    {
118
                        bossblush = 0;
119
                    }
120
                }
121
            }
122
        }
123
    }
124
    if (room == room_board_3)
125
    {
126
        if (i_ex(obj_b3cactusflirt) && i_ex(obj_board_grayregion))
127
        {
128
            if (obj_b3cactusflirt.active)
129
            {
130
                with (obj_b3cactusflirt)
131
                {
132
                    if (place_meeting(x, y, obj_board_grayregion))
133
                    {
134
                        blushamt = lerp(blushamt, 1, 0.2);
135
                        draw_sprite_ext(sprite_index, 1, x - 1, y, 2, 2, 0, c_white, blushamt / 5);
136
                        draw_sprite_ext(sprite_index, 1, x + 1, y, 2, 2, 0, c_white, blushamt / 5);
137
                        draw_sprite_ext(sprite_index, 1, x, y + 1, 2, 2, 0, c_white, blushamt / 5);
138
                        draw_sprite_ext(sprite_index, 1, x, y - 1, 2, 2, 0, c_white, blushamt / 5);
139
                        draw_sprite_ext(sprite_index, 1, x, y, 2, 2, 0, c_white, blushamt);
140
                    }
141
                }
142
            }
143
        }
144
    }
145
    if (crt_glitch > 0)
146
        crt_glitch--;
147
}
148
if (grid_reset == true)
149
{
150
    grid_reset = false;
151
    mp_grid_destroy(global.grid);
152
    grid_init = 0;
153
    global.cell_size = 32;
154
    global.grid_width = room_width / global.cell_size;
155
    global.grid_height = room_height / global.cell_size;
156
    global.grid = mp_grid_create(0, 0, global.grid_width, global.grid_height, global.cell_size, global.cell_size);
157
}
158
if (grid_init == 0)
159
{
160
    grid_init = 1;
161
    for (var xx = 0; xx < global.grid_width; xx++)
162
    {
163
        for (var yy = 0; yy < global.grid_height; yy++)
164
        {
165
            var inst = instance_place(xx * global.cell_size, yy * global.cell_size, obj_board_solid);
166
            if (inst == -4)
167
                inst = instance_place(xx * global.cell_size, yy * global.cell_size, obj_board_blockpath);
168
            if (inst != -4)
169
                mp_grid_add_cell(global.grid, xx, yy);
170
        }
171
    }
172
}
173
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
174
{
175
    if (pathfind_debug)
176
    {
177
        draw_set_alpha(0.3);
178
        if (keyboard_check(ord("H")))
179
        {
180
            draw_set_alpha(1);
181
            ossafe_fill_rectangle(camerax(), cameray(), 640, 480, 0);
182
        }
183
        mp_grid_draw(global.grid);
184
        draw_set_alpha(1);
185
    }
186
}