Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_ch3_couch_video_Draw_0

(view raw script w/o annotations or w/e)
1
var _video_data = video_draw();
2
var _video_status = _video_data[0];
3
if (_video_status == 0)
4
{
5
    switch (video_get_format())
6
    {
7
        case 0:
8
            draw_surface(_video_data[1], 0, 0);
9
            break;
10
        case 1:
11
            var _surf = _video_data[1];
12
            var _chromasurf = _video_data[2];
13
            if (surface_exists(_surf) && surface_exists(_chromasurf))
14
            {
15
                shader_set(shd_video_yuv);
16
                var _tex_id = surface_get_texture(_surf);
17
                var _chroma_tex_id = surface_get_texture(_chromasurf);
18
                texture_set_stage(videochromasampler, _chroma_tex_id);
19
                gpu_set_texfilter(false);
20
                var sw = surface_get_width(application_surface);
21
                var sh = surface_get_height(application_surface);
22
                draw_primitive_begin_texture(pr_trianglestrip, _tex_id);
23
                draw_vertex_texture(0, 0, 0, 0);
24
                draw_vertex_texture(sw, 0, 1, 0);
25
                draw_vertex_texture(0, sh, 0, 1);
26
                draw_vertex_texture(sw, sh, 1, 1);
27
                draw_primitive_end();
28
                gpu_set_texfilter(true);
29
                shader_reset();
30
            }
31
            break;
32
    }
33
    if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
34
    {
35
        if (keyboard_check_pressed(vk_space))
36
        {
37
            var _status = video_get_status();
38
            if (_status == 2)
39
                video_pause();
40
            else if (_status == 3)
41
                video_resume();
42
        }
43
    }
44
    if (scr_is_switch_os())
45
    {
46
        video_position += 1;
47
    }
48
    else
49
    {
50
        target_duration = video_get_duration() - 150;
51
        video_position = video_get_position();
52
    }
53
    if (video_position >= target_duration)
54
    {
55
        if (!i_ex(obj_ch3_couch_video_screenshot))
56
        {
57
            var _screenshot = instance_create(0, 0, obj_ch3_couch_video_screenshot);
58
            _screenshot.depth = depth - 10;
59
        }
60
    }
61
    if (text_index > (array_length_1d(text_list) - 1))
62
        exit;
63
    var _duration = video_get_duration() / 1000;
64
    var track_position = video_get_position() / 1000;
65
    var track_progress = track_position / _duration;
66
    if (track_progress >= text_list[text_index].time_end)
67
    {
68
        text_index++;
69
        if (text_index > (array_length_1d(text_list) - 1))
70
            exit;
71
    }
72
    if (track_progress >= text_list[text_index].time_start && track_progress < text_list[text_index].time_end)
73
    {
74
        if (text_index == house_index)
75
        {
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));
}
("main");
77
            draw_set_halign(fa_center);
78
            draw_set_color(c_black);
79
            draw_text(camerax() + (view_wport[0] / 4) + 2, cameray() + 40 + 2, text_list[text_index].caption_text);
80
            draw_text(camerax() + (view_wport[0] / 4) + 4, cameray() + 40 + 4, text_list[text_index].caption_text);
81
            draw_set_color(c_yellow);
82
            draw_text_outline(camerax() + (view_wport[0] / 4), cameray() + 40, text_list[text_index].caption_text, 8388608);
83
            draw_set_color(c_white);
84
            draw_set_halign(fa_left);
85
        }
86
        else
87
        {
88
            
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");
89
            draw_set_halign(fa_center);
90
            draw_set_color(c_black);
91
            draw_text(camerax() + (view_wport[0] / 2) + 2, ((cameray() + view_hport[0]) - 60) + 2, text_list[text_index].caption_text);
92
            draw_text(camerax() + (view_wport[0] / 2) + 4, ((cameray() + view_hport[0]) - 60) + 4, text_list[text_index].caption_text);
93
            draw_set_color(c_yellow);
94
            draw_text_outline(camerax() + (view_wport[0] / 2), (cameray() + view_hport[0]) - 60, text_list[text_index].caption_text, 8388608);
95
            draw_set_color(c_white);
96
            draw_set_halign(fa_left);
97
        }
98
    }
99
}
100
gpu_set_texfilter(false);