Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript__effect_blend_script

(view raw script w/o annotations or w/e)
1
function _effect_blend() constructor //gml_Script__effect_blend
2
{
3
    g_Blend = 1
4
    surf_blend = -1
5
    surf_width = 1
6
    surf_height = 1
7
    clonedcam = -1
8
    tempcam = -1
9
    function anon__effect_blend_gml_GlobalScript__effect_blend_script_159__effect_blend_gml_GlobalScript__effect_blend_script() //gml_Script_anon__effect_blend_gml_GlobalScript__effect_blend_script_159__effect_blend_gml_GlobalScript__effect_blend_script
10
    {
11
        if (clonedcam == -1)
12
            clonedcam = camera_create()
13
        var currcam = camera_get_active()
14
        camera_copy_transforms(clonedcam, currcam)
15
    }
16
17
    function anon__effect_blend_gml_GlobalScript__effect_blend_script_335__effect_blend_gml_GlobalScript__effect_blend_script() //gml_Script_anon__effect_blend_gml_GlobalScript__effect_blend_script_335__effect_blend_gml_GlobalScript__effect_blend_script
18
    {
19
        if surface_exists(surf_blend)
20
        {
21
            surface_free(surf_blend)
22
            surf_blend = -1
23
        }
24
        if (tempcam != -1)
25
        {
26
            camera_destroy(tempcam)
27
            tempcam = -1
28
        }
29
        if (clonedcam != -1)
30
        {
31
            camera_destroy(clonedcam)
32
            clonedcam = -1
33
        }
34
    }
35
36
    function anon__effect_blend_gml_GlobalScript__effect_blend_script_662__effect_blend_gml_GlobalScript__effect_blend_script() //gml_Script_anon__effect_blend_gml_GlobalScript__effect_blend_script_662__effect_blend_gml_GlobalScript__effect_blend_script
37
    {
38
        self.cleanup()
39
    }
40
41
    function anon__effect_blend_gml_GlobalScript__effect_blend_script_708__effect_blend_gml_GlobalScript__effect_blend_script() //gml_Script_anon__effect_blend_gml_GlobalScript__effect_blend_script_708__effect_blend_gml_GlobalScript__effect_blend_script
42
    {
43
        if (event_type != 8 || event_number != 0)
44
            return;
45
        if (!gmAffectsSingleLayerOnly)
46
            return;
47
        var _draw_surface = surface_get_target()
48
        var _draw_width = surface_get_width(_draw_surface)
49
        var _draw_height = surface_get_height(_draw_surface)
50
        if (!surface_exists(surf_blend))
51
            surf_blend = surface_create(_draw_width, _draw_height)
52
        else if (surf_width != _draw_width || surf_height != _draw_height)
53
            surface_resize(surf_blend, _draw_width, _draw_height)
54
        surf_width = _draw_width
55
        surf_height = _draw_height
56
        self.CloneCurrCam()
57
        surface_set_target(surf_blend)
58
        draw_clear_alpha(c_black, 0)
59
        camera_apply(clonedcam)
60
    }
61
62
    function anon__effect_blend_gml_GlobalScript__effect_blend_script_1530__effect_blend_gml_GlobalScript__effect_blend_script() //gml_Script_anon__effect_blend_gml_GlobalScript__effect_blend_script_1530__effect_blend_gml_GlobalScript__effect_blend_script
63
    {
64
        if (event_type != 8 || event_number != 0)
65
            return;
66
        if (!gmAffectsSingleLayerOnly)
67
            return;
68
        surface_reset_target()
69
        if (tempcam == -1)
70
            tempcam = camera_create_view(0, 0, surf_width, surf_height)
71
        else
72
            camera_set_view_size(tempcam, surf_width, surf_height)
73
        camera_apply(tempcam)
74
        gpu_push_state()
75
        gpu_set_blendmode(g_Blend)
76
        draw_surface(surf_blend, 0, 0)
77
        gpu_pop_state()
78
        camera_apply(clonedcam)
79
    }
80
81
}