Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_board_screen_Draw_0

(view raw script w/o annotations or w/e)
1
if (drawcrt && view_current == myview)
2
{
3
    if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
4
    {
5
        if (keyboard_check_pressed(vk_backspace) || gamepad_button_check_pressed(0, gp_shoulderl))
6
        {
7
        }
8
    }
9
    draw_set_alpha(1);
10
    if (screenheight != surface_get_height(crt_surface))
11
    {
12
        surface_free(crt_surface);
13
        surface_free(screen_surface);
14
    }
15
    if (!surface_exists(crt_surface))
16
        crt_surface = surface_create(screenwidth, screenheight);
17
    if (!surface_exists(screen_surface))
18
        screen_surface = surface_create(screenwidth, screenheight);
19
    surface_copy_part(screen_surface, 0, 0, application_surface, x - camerax(), y - cameray(), screenwidth, screenheight);
20
    var drawgray = true;
21
    if (i_ex(obj_quizsequence) || i_ex(obj_board_writer))
22
        drawgray = false;
23
    if (drawgray == true)
24
    {
25
        with (obj_board_grayregion)
26
        {
27
            surface_set_target(other.screen_surface);
28
            gpu_set_blendmode_ext_sepalpha(bm_src_alpha, bm_inv_src_alpha, bm_one, bm_inv_src_alpha);
29
            shader_set(shd_grayscalesand);
30
            shader_set_uniform_f(shader_get_uniform(shd_grayscalesand, "sand1"), 255, 236, 189);
31
            shader_set_uniform_f(shader_get_uniform(shd_grayscalesand, "sand2"), 255, 215, 140);
32
            shader_set_uniform_f(shader_get_uniform(shd_grayscalesand, "sand3"), 151, 183, 255);
33
            shader_set_uniform_f(shader_get_uniform(shd_grayscalesand, "sand4"), 177, 193, 227);
34
            shader_set_uniform_f(shader_get_uniform(shd_grayscalesand, "sandcol"), 0.82, 0.82, 0.82);
35
            draw_surface_part(application_surface, x - camerax(), y - cameray(), sprite_width, sprite_height, x - other.screenleft, y - other.screentop);
36
            shader_reset();
37
            gpu_set_blendmode(bm_normal);
38
            surface_reset_target();
39
        }
40
    }
41
    crttimer = (crttimer + 0.5) % 3;
42
    var _vig = crt_glitch ? (0.2 + random(clamp(crt_glitch / 200, 0, 0.1))) : 0.2;
43
    var _vigint = power(1.5, 1.5 - _vig) * 18;
44
    var _chrom_scale = crt_glitch ? (irandom_range(-4, 4) * clamp(crt_glitch / 5, 1, 5)) : chromStrength;
45
    if (_chrom_scale == 0)
46
        _chrom_scale = 1;
47
    var _filteramount = 0.1 + min(crt_glitch / 100, 0.1);
48
    shader_set(shd_crt);
49
    shader_set_uniform_f(shader_get_uniform(shd_crt, "texel"), 1 / screenwidth, 1 / screenheight);
50
    shader_set_uniform_f(shader_get_uniform(shd_crt, "vignette_scale"), _vig);
51
    shader_set_uniform_f(shader_get_uniform(shd_crt, "vignette_intensity"), _vigint);
52
    shader_set_uniform_f(shader_get_uniform(shd_crt, "chromatic_scale"), _chrom_scale);
53
    shader_set_uniform_f(shader_get_uniform(shd_crt, "filter_amount"), _filteramount);
54
    shader_set_uniform_f(shader_get_uniform(shd_crt, "time"), crttimer);
55
    var _dx = crt_glitch ? (random_range(-1, 1) * clamp(crt_glitch / crt_glitchstrength, 0, 3)) : 0;
56
    var _dy = crt_glitch ? (random_range(-1, 1) * clamp(crt_glitch / crt_glitchstrength, 0, 3)) : 0;
57
    surface_set_target(crt_surface);
58
    draw_clear_alpha(c_black, 1);
59
    draw_surface_stretched(screen_surface, min(0, _dx), min(0, _dy), screenwidth + abs(_dx), screenheight + abs(_dy));
60
    surface_reset_target();
61
    shader_reset();
62
    draw_surface(crt_surface, screenleft, screentop);
63
    crt_glitch--;
64
    if (crt_glitch < 0)
65
        crt_glitch = 0;
66
}