Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_cloud_render_Draw_0

(view raw script w/o annotations or w/e)
1
if (front == true)
2
    depth = obj_mainchara.depth - 20;
3
else
4
    depth = obj_rotating_tower_controller.depth + 2;
5
if (!surface_exists(surface))
6
    surface = surface_create(640 * surface_scale, 640 * surface_scale);
7
var _dark_col = 3150105;
8
var _dark2_col = 2230537;
9
var _light_col = 8138558;
10
var _dist_min = 175;
11
var _dist_max = 300;
12
var _dist = front ? _dist_min : _dist_max;
13
var _sign = front ? 1 : -1;
14
var _cnum = array_length(obj_cloud_controller.clouds);
15
while (_dist >= _dist_min && _dist <= _dist_max)
16
{
17
    var _dist_scale = (_dist - _dist_min) / (_dist_max - _dist_min);
18
    surface_set_target(surface);
19
    draw_clear_alpha(c_black, 0);
20
    var _col;
21
    if (hands)
22
    {
23
        for (var _c = 0; _c < _cnum; _c++)
24
        {
25
            var _cloud = obj_cloud_controller.clouds[_c];
26
            if (_cloud.z_depth < 0)
27
            {
28
                if (!other.front)
29
                    continue;
30
            }
31
            else if (other.front)
32
            {
33
                continue;
34
            }
35
            if (_cloud.dist != _dist)
36
                continue;
37
            var _x_offset = sin((current_time / 500) + _cloud.base_angle) * 4 * surface_scale;
38
            var _y_offset = (sin((current_time / 250) + (_cloud.base_angle * 0.05)) * 4 * surface_scale) + (surface_y_offset * surface_scale);
39
            switch (style)
40
            {
41
                case 0:
42
                    _col = 4210752;
43
                    break;
44
                case 1:
45
                    _col_factor = ((_cloud.z_depth / _dist_max) * -0.5) + 0.5;
46
                    _col = _dark2_col;
47
                    break;
48
            }
49
            if ((_cloud.__id % 6) == 0)
50
            {
51
                var _hy = _y_offset + (sin((current_time / 600) + (_cloud.base_angle * 0.05)) * 80 * surface_scale);
52
                draw_sprite_ext(spr_rising_darkness_hand, 0, (_cloud.x * surface_scale) + _x_offset, (_cloud.y * surface_scale) + _hy, 2 * surface_scale * (((_cloud.__id % 4) == 0) ? -1 : 1), 2 * surface_scale, 0, _col, 1);
53
            }
54
        }
55
    }
56
    switch (style)
57
    {
58
        case 0:
59
            _col = 16777215;
60
            break;
61
        case 1:
62
            _col_factor = ((front ? (_dist_scale * 0.5) : (-_dist_scale * 0.5)) * 0.5) + 0.5;
63
            _col = merge_color(_dark_col, _light_col, _col_factor);
64
            break;
65
    }
66
    if (!front)
67
        draw_sprite_ext(spr_rising_bg, 0, 0, (surface_y_offset + (30 * (1 - obj_cloud_controller.y_scale)) + (_dist * 0.2 * _sign)) * surface_scale, 2 * surface_scale, 2 * (surface_scale + ((1 - _dist_scale) * 0.2)), 0, _col, 1);
68
    else if (_dist == _dist_max)
69
        draw_sprite_ext(spr_rising_bg, (obj_cloud_controller.y_scale > 0) ? 1 : 0, 0, ((surface_y_offset - (110 * (1 - obj_cloud_controller.y_scale))) + (_dist * 0.3 * _sign)) * surface_scale, 2 * surface_scale, 2 * surface_scale, 0, _col, 1);
70
    for (var _c = 0; _c < _cnum; _c++)
71
    {
72
        var _cloud = obj_cloud_controller.clouds[_c];
73
        if (_cloud.z_depth < 0)
74
        {
75
            if (!other.front)
76
                continue;
77
        }
78
        else if (other.front)
79
        {
80
            continue;
81
        }
82
        if (_cloud.dist != _dist)
83
            continue;
84
        var _x_offset = sin((current_time / 500) + _cloud.base_angle) * 4 * surface_scale;
85
        var _y_offset = (sin((current_time / 250) + (_cloud.base_angle * 0.05)) * 4 * surface_scale) + (surface_y_offset * surface_scale);
86
        var _img_scale = 0.7 + ((((_cloud.z_depth / 300) * -0.5) + 0.5) * 0.4);
87
        switch (style)
88
        {
89
            case 0:
90
                _col = 16777215;
91
                break;
92
            case 1:
93
                _col_factor = ((_cloud.z_depth / _dist_max) * -0.5) + 0.5;
94
                _col = merge_color(_dark_col, _light_col, _col_factor);
95
                break;
96
        }
97
        draw_sprite_ext(spr_rising_cloudx2, _cloud.__id % 3, (_cloud.x * surface_scale) + _x_offset, (_cloud.y * surface_scale) + _y_offset, 2 * _img_scale * surface_scale, 2 * _img_scale * surface_scale, 0, _col, 1);
98
    }
99
    surface_reset_target();
100
    var _draw_scale = 1 / surface_scale;
101
    var _col_factor = 0.5 + (_dist_scale * 0.5 * _sign);
102
    if (outline)
103
    {
104
        switch (style)
105
        {
106
            case 0:
107
                _col = merge_color(_dark2_col, _dark_col, _col_factor);
108
                break;
109
            case 1:
110
                _col = merge_color(c_gray, c_gray, _col_factor);
111
                break;
112
        }
113
        draw_surface_ext(surface, 0, obj_cloud_controller.y - surface_y_offset - (_draw_scale * outline), _draw_scale, _draw_scale, 0, _col, 1);
114
        draw_surface_ext(surface, -_draw_scale * outline, obj_cloud_controller.y - surface_y_offset, _draw_scale, _draw_scale, 0, _col, 1);
115
        draw_surface_ext(surface, _draw_scale * outline, obj_cloud_controller.y - surface_y_offset, _draw_scale, _draw_scale, 0, _col, 1);
116
    }
117
    switch (style)
118
    {
119
        case 0:
120
            _col = merge_color(_dark_col, _light_col, _col_factor);
121
            break;
122
        case 1:
123
            _col = 16777215;
124
            break;
125
    }
126
    draw_surface_ext(surface, 0, obj_cloud_controller.y - surface_y_offset, _draw_scale, _draw_scale, 0, _col, 1);
127
    _dist += (front ? 125 : -125);
128
}
129
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
130
{
131
}