Deltarune (Chapter 5) script viewer

← back to main script listing

gml_GlobalScript_scr_plat_misc

(view raw script w/o annotations or w/e)
1
function scr_plat_makecoins(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 = depth + 1, arg8 = false, arg9 = false, arg10 = 0)
2
{
3
    var _no_big = false;
4
    if (arg2 < 0 || arg8)
5
    {
6
        arg2 = abs(arg2);
7
        _no_big = true;
8
    }
9
    for (var _collect_cooldown = 9; arg2 > 0; _collect_cooldown += 2)
10
    {
11
        var _thisvalue = 0;
12
        if (arg2 >= 5 && !_no_big)
13
        {
14
            arg2 -= 5;
15
            _thisvalue = 5;
16
        }
17
        else
18
        {
19
            arg2 -= 1;
20
            _thisvalue = 1;
21
        }
22
        with (instance_create_depth(arg0, arg1, arg7, obj_plat_coin))
23
        {
24
            speed = random_range(arg5 - arg6, arg5 + arg6) * 1.5;
25
            direction = random_range(arg3 - arg4, arg3 + arg4);
26
            gravity = 0.3;
27
            friction = 0.15;
28
            is_pink = arg8;
29
            coinvalue = _thisvalue;
30
            windimmune = true;
31
            collect_cooldown = _collect_cooldown / 2;
32
            homingtimer = -((_collect_cooldown / 2) - 9);
33
            if (arg10 > 0)
34
                homing_timer = arg10;
35
            if (arg9)
36
                image_xscale = 2 * (other.image_xscale / other.image_yscale);
37
            else
38
                image_xscale = 2;
39
        }
40
    }
41
}
42
43
function scr_prepare_parallax_draw(arg0, arg1)
44
{
45
    if (arg0 != 0)
46
    {
47
        _parallax_draw_set = true;
48
        var __pd = arg0;
49
        _p_x = x;
50
        _p_y = y;
51
        _p_a = image_alpha;
52
        _p_d = depth;
53
        _p_i = image_blend;
54
        _p_xs = image_xscale;
55
        _p_ys = image_yscale;
56
        var cx = 0;
57
        var cy = 0;
58
        if (instance_exists(obj_plat_camera))
59
        {
60
            cx = obj_plat_camera.x;
61
            cy = obj_plat_camera.y;
62
        }
63
        else
64
        {
65
            cx = camerax() + (0.5 * camerawidth());
66
            cy = cameray() + (0.5 * cameraheight());
67
        }
68
        arg0 = 1 - arg0;
69
        var realdepth = 1 - (arg0 * arg0);
70
        x = floor(lerp(x, cx, lerp(0, arg1, realdepth)));
71
        y = floor(lerp(y, cy, lerp(0, arg1, realdepth)));
72
        depth += lerp(0, 1000, realdepth);
73
        if (__pd > 0.1)
74
        {
75
            var fc = 
scr_get_sunset_fade_color
scr_get_sunset_fade_color

function
scr_get_sunset_fade_color()
{ with (obj_parallax_cliffs) return get_fadecolor(); with (obj_parallax_castle_top) return get_fadecolor(); return 0; }
();
76
            image_blend = merge_color(merge_color(image_blend, fc, 0.2), fc, clamp01(realdepth) * 0.5);
77
        }
78
        else if (__pd < -0.1)
79
        {
80
            image_alpha = 0.8 + __pd;
81
        }
82
        image_xscale = lerp(image_xscale, image_xscale * (1 - arg1), realdepth);
83
        image_yscale = lerp(image_yscale, image_yscale * (1 - arg1), realdepth);
84
    }
85
}
86
87
function scr_reset_parallax_draw()
88
{
89
    if (variable_instance_exists(id, "_parallax_draw_set") && _parallax_draw_set)
90
    {
91
        _parallax_draw_set = false;
92
        x = _p_x;
93
        y = _p_y;
94
        depth = _p_d;
95
        image_blend = _p_i;
96
        image_xscale = _p_xs;
97
        image_yscale = _p_ys;
98
        image_alpha = _p_a;
99
    }
100
}
101
102
function scr_plat_cool_zoom()
103
{
104
    var speedlines = instance_create(camerax(), cameray(), obj_fx_speedlines);
105
    speedlines.depth = 1499;
106
    
scr_plat_hitstop_global
scr_plat_hitstop_global

function
scr_plat_hitstop_global(arg0)
{ with (obj_plat_game) hitstop = max(arg0, hitstop); }
(10);
107
    with (speedlines)
108
    {
109
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("image_alpha", 1, 0, 15);
110
        
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ var _doom = instance_create_depth(0, 0, 0, obj_doom); with (_doom) { alarm[0] target = arg0; } return _doom; }
(self, 15);
111
    }
112
}
113
114
function scr_plat_marker_fancy_greyscale_draw()
115
{
116
    if (!variable_instance_exists(id, "__grayscalefade"))
117
    {
118
        __grayscalefade = shader_get_uniform(shd_grayscale_fade, "fade");
119
        if (!variable_instance_exists(id, "__grayscale_lerp"))
120
            __grayscale_lerp = 0;
121
    }
122
    shader_replace_simple_set_hook(10);
123
    shader_set_uniform_f(__grayscalefade, __grayscale_lerp);
124
    draw_self();
125
    shader_replace_simple_reset_hook();
126
}
127
128
function scr_plat_draw_dizzy_effects(arg0, arg1)
129
{
130
    if (!variable_instance_exists(id, "_dizzy_timer"))
131
        _dizzy_timer = 0;
132
    if (!global.pause_plat)
133
        _dizzy_timer++;
134
    var xx = x;
135
    var yy = y - (0.5 * sprite_height);
136
    var drawtimers = [];
137
    for (var i = 0; i < arg0; i++)
138
    {
139
        var tt = degtorad((_dizzy_timer * 6) + ((i * 360) / arg1)) % (2 * pi);
140
        if (array_length(drawtimers) == 0)
141
        {
142
            array_push(drawtimers, tt);
143
        }
144
        else
145
        {
146
            var added = false;
147
            for (var ii = 0; ii < array_length(drawtimers); ii++)
148
            {
149
                if (abs(pi - tt) < abs(pi - drawtimers[ii]))
150
                {
151
                    added = true;
152
                    array_insert(drawtimers, ii, tt);
153
                    break;
154
                }
155
            }
156
            if (!added)
157
                array_push(drawtimers, tt);
158
        }
159
    }
160
    for (var i = 0; i < array_length(drawtimers); i++)
161
    {
162
        var xxx = sin(drawtimers[i]) * 40;
163
        var yyy = (cos(drawtimers[i] * 3) * 4) + (cos(drawtimers[i]) * 10);
164
        draw_sprite_ext(spr_weathervane_flower, 0, xx + xxx, yy + yyy, 2, 2, sin(_dizzy_timer * 0.1) * 8, merge_color(c_white, c_gray, 0.5 - (0.5 * cos(drawtimers[i]))), 1);
165
    }
166
}
167
168
function scr_gamepad_get_left_axis()
169
{
170
    var _angle = -1;
171
    var gc = 1644;
172
    if (instance_exists(gc) && gc.gamepad_active)
173
    {
174
        var gpid = obj_gamecontroller.gamepad_id;
175
        var haxis = gamepad_axis_value(gpid, gp_axislh);
176
        var vaxis = gamepad_axis_value(gpid, gp_axislv);
177
        if (instance_exists(obj_time) && point_distance(0, 0, haxis, vaxis) >= obj_time.axis_value)
178
            _angle = point_direction(0, 0, haxis, vaxis);
179
    }
180
    debug_print_persistent("ang", string(_angle));
181
    return _angle;
182
}