Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_church_old_man_ripple_effect_backup_Draw_0

(view raw script w/o annotations or w/e)
1
active = true;
2
var _ripplecount = ripplecount;
3
if (type == 1)
4
    _ripplecount = 1;
5
else if (type == 0)
6
    _ripplecount += 2;
7
else if (type == 2)
8
    _ripplecount = 1;
9
if (type == 2)
10
    subrings = 3;
11
if (active)
12
{
13
    draw_set_color(color);
14
    var _itv = 0;
15
    var _max_radius = 400;
16
    if (type == 1)
17
        _max_radius = 520;
18
    if (type == 2)
19
        _max_radius = 100;
20
    var _life = 40;
21
    if (type == 2)
22
        _life = 60;
23
    var _pow = 2;
24
    var _thickness = (type == 1) ? 1 : 1;
25
    var _ringcount = 0;
26
    if (type == 1)
27
    {
28
        var _faux_timer = timer;
29
        var _interval = 2;
30
        var _subsize = 1;
31
        if (timer > _life)
32
            timer = _life + (timer % _interval);
33
        var _radius = 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(_faux_timer / _life, 4) * _max_radius;
34
        var _submax = min(1, 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(timer / _life, 4)) * _max_radius;
35
        var _col_index = 0;
36
        draw_set_color(merge_color(color, c_black, _col_index / 3));
37
        d_circle(x, y, _radius, false);
38
        _faux_timer -= _subsize;
39
        while (_faux_timer > 0)
40
        {
41
            _radius = 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(clamp01(_faux_timer / _life), 4) * _max_radius;
42
            if (_radius < (_submax + 100))
43
            {
44
            }
45
            _col_index++;
46
            if (_col_index > 3)
47
                _col_index = 0;
48
            var _col = merge_color(color, c_black, _col_index / 3);
49
            draw_set_color(merge_color(_col, c_black, clamp01(((_radius / _max_radius) * 8) - 7)));
50
            d_circle(x, y, _radius, false);
51
            if (_col_index == 3)
52
            {
53
                _faux_timer -= _interval;
54
                if (_faux_timer <= 0 && looping && deltatime > 1)
55
                {
56
                    looping = false;
57
                    end_timer = _faux_timer;
58
                    debug_print("end timer declared");
59
                }
60
                if (!looping && _faux_timer <= end_timer)
61
                    break;
62
            }
63
            else
64
            {
65
                _faux_timer -= _subsize;
66
            }
67
        }
68
    }
69
    else
70
    {
71
        for (var i = 0; i < _ripplecount; i++)
72
        {
73
            _ringcount++;
74
            var _radius = 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(clamp01(inverselerp(i * _itv, (i * _itv) + _life + (i * 30), timer)), 4) * _max_radius;
75
            var _col = merge_color(color, c_black, clamp01(((_radius / _max_radius) * 8) - 7));
76
            draw_set_color(_col);
77
            var _oradius = _radius;
78
            d_circle(x, y, _radius, false);
79
            var _subradius = _radius;
80
            if ((timer - 2) < 0)
81
                break;
82
            var _prog = 1;
83
            for (var ii = 1; ii < subrings; ii++)
84
            {
85
                _col = merge_color(color, c_black, ii / subrings);
86
                _prog = 
scr_ease_in
scr_ease_in

function
scr_ease_in(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_in_bounce(arg0, 0, 1, 1); case -2: return ease_in_elastic(arg0, 0, 1, 1); case -1: var _s = 1.70158; return arg0 * arg0 * (((_s + 1) * arg0) - _s); case 0: return arg0; case 1: return -cos(arg0 * 1.5707963267948966) + 1; case 6: return power(2, 10 * (arg0 - 1)); case 7: return -(sqrt(1 - sqr(arg0)) - 1); default: return power(arg0, arg1); } }
(clamp01(_radius / _max_radius), 2);
87
                draw_set_color(merge_color(_col, c_black, clamp01(((_radius / _max_radius) * 8) - 7)));
88
                if (type == 1)
89
                    _subradius -= (20 + (20 * _prog));
90
                if (type == 2)
91
                    _subradius -= 6;
92
                else
93
                    _subradius -= 10;
94
                if (_subradius > 0)
95
                    d_circle(x, y, _subradius, false);
96
            }
97
            draw_set_color(c_black);
98
            if (type == 0)
99
                _subradius = _subradius - 10;
100
            else if (type == 2)
101
                _subradius = _subradius - 4;
102
            else
103
                _subradius -= 16;
104
            d_circle(x, y, _subradius, false);
105
        }
106
    }
107
    timer += deltatime;
108
    if (type == 1 && !looping)
109
    {
110
        end_timer += deltatime;
111
        
scr_debug_print_persistent
scr_debug_print_persistent

function
scr_debug_print_persistent(arg0, arg1)
{ } function debug_print_persistent(arg0, arg1) { } function scr_debug_delete_persistent(arg0, arg1 = false) { } function scr_debug_clear_persistent() { }
("endtimer", string(end_timer));
112
        if (end_timer >= _life)
113
        {
114
            active = false;
115
            instance_destroy();
116
            scr_debug_delete_persistent("endtimer");
117
        }
118
    }
119
    if (type != 1 && (timer - _thickness) >= ((_itv * _ripplecount) + (_life * _ripplecount)))
120
    {
121
        timer = 0;
122
        active = false;
123
        instance_destroy();
124
    }
125
}
126
draw_set_blend_mode(bm_normal);
127
draw_set_alpha(1);
128
draw_set_color(c_white);