Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_custom_particle_system_Create_0

(view raw script w/o annotations or w/e)
1
particle_data = [];
2
particle_system_lifetime = -1;
3
auto_cleanup = false;
4
blend_mode = 0;
5
shader = 0;
6
u1_forceColor = shader_get_uniform(shd_forcecolour, "forceColour");
7
u2_grayscalefade = shader_get_uniform(shd_grayscale_fade, "fade");
8
shader2_greyscale_fade = 0;
9
skip_fusuma = false;
10
frames_between_emissions = 0;
11
particles_per_emission = 1;
12
emission_timer = 0;
13
default_particle_data = 
14
{
15
    sprite_index: spr_pxwhite,
16
    hspeed: 0,
17
    vspeed: 0,
18
    gravity: 0,
19
    friction: 0,
20
    image_xscale: 2,
21
    image_yscale: 2,
22
    lifetime: 30,
23
    image_index: 0,
24
    image_angle: 0,
25
    image_speed: 0,
26
    image_blend: c_white,
27
    image_alpha: 1,
28
    fadeout_speed: 0,
29
    animation_mode: false,
30
    custom_data: 0
31
};
32
struct_variables = variable_struct_get_names(default_particle_data);
33
variable_array_length = array_length(struct_variables);
34
35
particle_step_func = function(arg0)
36
{
37
};
38
39
struct_init_map = ds_map_create();
40
41
emit = function(arg0 = undefined, arg1 = false)
42
{
43
    if (arg0 == undefined)
44
    {
45
        arg0 = default_particle_data;
46
    }
47
    else if (!ds_map_exists(struct_init_map, arg0))
48
    {
49
        if (!arg1)
50
            ds_map_add(struct_init_map, arg0, true);
51
        var names = array_length(struct_variables);
52
        for (var i = 0; i < names; i++)
53
        {
54
            if (!variable_struct_exists(arg0, struct_variables[i]))
55
                variable_struct_set(arg0, struct_variables[i], variable_struct_get(default_particle_data, struct_variables[i]));
56
        }
57
    }
58
    var new_data = 
59
    {
60
        timer: 0,
61
        x: x,
62
        y: y
63
    };
64
    var svar = array_length(struct_variables);
65
    for (var i = 0; i < svar; i++)
66
        variable_struct_set(new_data, struct_variables[i], variable_struct_get(arg0, struct_variables[i]));
67
    if (variable_struct_exists(arg0, "x_offset"))
68
        new_data.x += arg0.x_offset;
69
    if (variable_struct_exists(arg0, "y_offset"))
70
        new_data.y += arg0.y_offset;
71
    array_push(particle_data, new_data);
72
};