Deltarune (Chapter 5) script viewer

← back to main script listing

gml_GlobalScript_draw_shadowcast

(view raw script w/o annotations or w/e)
1
function draw_shadowcast(arg0, arg1, arg2 = 0, arg3 = 1, arg4 = false, arg5 = 1, arg6 = false, arg7, arg8 = 0)
2
{
3
    if (arg0 == 0 || image_yscale == 0)
4
        exit;
5
    if (sprite_index == -4)
6
        exit;
7
    var _sx = x - camera_get_view_x(view_camera[0]);
8
    var _sy = y - camera_get_view_y(view_camera[0]);
9
    var _spritedata = undefined;
10
    if (array_length(arg7) > sprite_index)
11
        _spritedata = arg7[sprite_index];
12
    if (_spritedata == undefined || _spritedata == 0)
13
    {
14
        _spritedata = sprite_get_info(sprite_index);
15
        array_set(arg7, sprite_index, _spritedata);
16
    }
17
    var _frame = _spritedata.frames[scr_loop(floor(image_index), image_number)];
18
    var _width = _frame.w * image_xscale * arg5;
19
    var _yy = ((arg4 ? _sy : y) - sprite_yoffset) * arg5;
20
    var _height = _frame.h / abs(arg0);
21
    var _bottom = _yy + _height + arg2 + (_frame.y_offset * abs(arg0));
22
    var _top = _bottom - (_height * arg0);
23
    var _xx = (((arg4 ? _sx : x) - sprite_xoffset) + (_frame.x_offset * image_xscale)) * arg5;
24
    _top = floor(_top) - arg8;
25
    _bottom = floor(_bottom) - arg8;
26
    if (arg6)
27
        arg1 = floor(lengthdir_x(floor(_height / sin(degtorad(arg1))), arg1));
28
    draw_sprite_pos(sprite_index, image_index, _xx + arg1, _top, _xx + arg1 + _width, _top, _xx + _width, _bottom, _xx, _bottom, arg3);
29
}