Deltarune script viewer

← back to main script listing

gml_GlobalScript_scr_drawpart_crop

(view raw script w/o annotations or w/e)
1
function scr_drawpart_crop
scr_drawpart_crop

function scr_drawpart_crop(arg0, arg1, arg2, arg3) { var _true_xanchor = x - abs(sprite_xoffset); var _true_yanchor = y - abs(sprite_yoffset); if (_true_xanchor > arg0 && (_true_xanchor + sprite_width) < arg2 && _true_yanchor > arg1 && (_true_yanchor + sprite_height) < arg3) { draw_self(); exit; } var _leftcrop = clamp(arg0 - _true_xanchor, 0, abs(sprite_width)); var _topcrop = clamp(arg1 - _true_yanchor, 0, abs(sprite_height)); var _rightcrop = clamp(arg2 - _true_xanchor, 0, abs(sprite_width)); var _bottomcrop = clamp(arg3 - _true_yanchor, 0, abs(sprite_height)); draw_sprite_part_ext(sprite_index, image_index, _leftcrop, _topcrop, _rightcrop, _bottomcrop, (x - sprite_xoffset) + _leftcrop, (y - sprite_yoffset) + _topcrop, image_xscale, image_yscale, image_blend, image_alpha); }
(arg0, arg1, arg2, arg3)
2
{
3
    var _true_xanchor = x - abs(sprite_xoffset);
4
    var _true_yanchor = y - abs(sprite_yoffset);
5
    if (_true_xanchor > arg0 && (_true_xanchor + sprite_width) < arg2 && _true_yanchor > arg1 && (_true_yanchor + sprite_height) < arg3)
6
    {
7
        draw_self();
8
        exit;
9
    }
10
    var _leftcrop = clamp(arg0 - _true_xanchor, 0, abs(sprite_width));
11
    var _topcrop = clamp(arg1 - _true_yanchor, 0, abs(sprite_height));
12
    var _rightcrop = clamp(arg2 - _true_xanchor, 0, abs(sprite_width));
13
    var _bottomcrop = clamp(arg3 - _true_yanchor, 0, abs(sprite_height));
14
    draw_sprite_part_ext(sprite_index, image_index, _leftcrop, _topcrop, _rightcrop, _bottomcrop, (x - sprite_xoffset) + _leftcrop, (y - sprite_yoffset) + _topcrop, image_xscale, image_yscale, image_blend, image_alpha);
15
}