Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_draw_sprite_clip_ext

(view raw script w/o annotations or w/e)
1
function draw_sprite_clip_ext(argument0, argument1, argument2, argument3, argument4, argument5, argument6, argument7, argument8, argument9, argument10, argument11) //gml_Script_draw_sprite_clip_ext
2
{
3
    var s = argument0
4
    var sw = sprite_get_width(s)
5
    var sh = sprite_get_height(s)
6
    var sx = sprite_get_xoffset(s)
7
    var sy = sprite_get_yoffset(s)
8
    var si = argument1
9
    var _x = argument2
10
    var _y = argument3
11
    var mx = argument4
12
    var my = argument5
13
    var sc = argument6
14
    var sa = argument7
15
    var cx1 = argument8
16
    var cy1 = argument9
17
    var cx2 = cx1 + argument10
18
    var cy2 = cy1 + argument11
19
    var bx1 = _x - sprite_get_xoffset(s) * mx
20
    var by1 = _y - sprite_get_yoffset(s) * my
21
    var bx2 = bx1 + sprite_get_width(s) * mx
22
    var by2 = by1 + sprite_get_height(s) * my
23
    switch rectangle_in_rectangle(bx1, by1, bx2, by2, cx1, cy1, cx2, cy2)
24
    {
25
        case 1:
26
            draw_sprite_ext(s, si, _x, _y, mx, my, 0, sc, sa)
27
            return true;
28
        case 2:
29
            if (mx == 0 || my == 0)
30
                return true;
31
            var lx1 = (max(0, (cx1 - bx1))) / mx
32
            var ly1 = (max(0, (cy1 - by1))) / my
33
            var lx2 = sw + (min(0, (cx2 - bx2))) / mx
34
            var ly2 = sh + (min(0, (cy2 - by2))) / my
35
            draw_sprite_part_ext(s, si, lx1, ly1, (lx2 - lx1), (ly2 - ly1), (_x + (lx1 - sx) * mx), (_y + (ly1 - sy) * my), mx, my, sc, sa)
36
            return true;
37
    }
38
39
    return false;
40
}