Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_fancy_ripples_Draw_0

(view raw script w/o annotations or w/e)
1
if (visible)
2
{
3
    var _cx = camerax();
4
    var _cy = cameray();
5
    if (!surface_exists(surf_ripples))
6
        surf_ripples = surface_create(640, 480);
7
    var _delcount = 0;
8
    shader_set(shd_ripple);
9
    surface_set_target(surf_ripples);
10
    draw_clear_alpha(c_black, 0);
11
    var _ripplecount = array_length(ripples);
12
    for (var i = 0; i < _ripplecount; i++)
13
    {
14
        var _thisripple = ripples[i];
15
        _thisripple.life = max(0, _thisripple.life - 1);
16
        _thisripple.x += _thisripple.hsp;
17
        _thisripple.y += _thisripple.vsp;
18
        if (_thisripple.hsp > 0)
19
            _thisripple.hsp = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(_thisripple.hsp, 0, _thisripple.fric);
20
        if (_thisripple.vsp > 0)
21
            _thisripple.vsp = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(_thisripple.vsp, 0, _thisripple.fric);
22
        var _xx = _thisripple.x - _cx;
23
        var _yy = _thisripple.y - _cy;
24
        _thisripple.rad = lerp(_thisripple.radstart, _thisripple.radmax, animcurve_channel_evaluate(curves[_thisripple.curve], 1 - (_thisripple.life / _thisripple.lifemax)));
25
        if (_thisripple.rad > 0)
26
        {
27
            shader_set_uniform_f(u_center, _xx, _yy);
28
            shader_set_uniform_f(u_rad, _thisripple.rad, _thisripple.radmax, _thisripple.thickness);
29
            draw_set_colour(_thisripple.col);
30
            var _rad = _thisripple.rad;
31
            ossafe_fill_rectangle(_xx - _rad, _yy - _rad, _xx + _rad, _yy + _rad, false);
32
            if (_thisripple.life == 0)
33
            {
34
                _delcount++;
35
                _thisripple = undefined;
36
            }
37
        }
38
    }
39
    surface_reset_target();
40
    shader_reset();
41
    repeat (_delcount)
42
        array_delete(ripples, 0, 1);
43
    draw_surface_ext(surf_ripples, _cx, _cy, image_xscale, image_yscale, image_angle, image_blend, image_alpha);
44
}