Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_castlereflect_manager_Create_0

(view raw script w/o annotations or w/e)
1
sprite_offsets = ds_map_create();
2
sprite_subs = ds_map_create();
3
cachelist = ds_list_create();
4
castlereflects = ds_list_create();
5
surf = -4;
6
precreate_surf = -4;
7
masking_surf = -4;
8
surface_uvs = -4;
9
this_frame_objects = ds_list_create();
10
11
refresh_masking_surf = function()
12
{
13
    if (surface_exists(masking_surf))
14
        surface_free(masking_surf);
15
};
16
17
add_sprite_offset = function(arg0, arg1, arg2, arg3 = 0)
18
{
19
    if (ds_map_exists(sprite_offsets, arg0))
20
        ds_map_set(sprite_offsets, arg0, [arg1, arg2, arg3]);
21
    else
22
        ds_map_add(sprite_offsets, arg0, [arg1, arg2, arg3]);
23
};
24
25
substitute_sprite = function(arg0, arg1)
26
{
27
    if (ds_map_exists(sprite_subs, arg0))
28
        ds_map_set(sprite_subs, arg0, arg1);
29
    else
30
        ds_map_add(sprite_subs, arg0, arg1);
31
};
32
33
bound_left = 0;
34
bound_right = 0;
35
bound_top = 0;
36
bound_bottom = 0;
37
num_reflects = 0;
38
render_queue = ds_priority_create();
39
40
sort_reflectable_objects = function(arg0)
41
{
42
    var i = 0;
43
    with (arg0)
44
    {
45
        if (image_alpha <= 0 || !visible)
46
            continue;
47
        if ((bbox_right + 40) > other.bound_left && (bbox_left - 40) < other.bound_right && (bbox_top - 40) < other.bound_bottom && (bbox_bottom + 40) > other.bound_top)
48
        {
49
            if (variable_instance_exists(id, "refl_idx"))
50
                i = -refl_idx;
51
            ds_priority_add(other.render_queue, id, (depth * 1000) + i);
52
        }
53
        i++;
54
    }
55
};
56
57
reflectable_objects = [1198, 1660, 1389, 775, 1559, 512, 171, 373, 954, 1611, 1058, 309, 152];
58
shadow_falloff = 160;
59
depth = 20000;
60
u_uvs = shader_get_uniform(shd_castlereflect, "uvs");
61
u_falloff = shader_get_uniform(shd_castlereflect, "shadowheight");
62
u_y = shader_get_uniform(shd_castlereflect, "pos_y");
63
_cx = 0;
64
_cy = 0;
65
66
add_reflection = function(arg0)
67
{
68
    if (arg0 == -4)
69
        exit;
70
    array_push(reflectable_objects, arg0);
71
};