Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_sprhighlight_Draw_0

(view raw script w/o annotations or w/e)
1
if (!i_ex(target))
2
    exit;
3
if (!target.visible)
4
    exit;
5
if (abs(target.sprite_width) < 1 || abs(target.sprite_height) < 1)
6
    exit;
7
x = target.x - target.sprite_xoffset;
8
y = target.y - target.sprite_yoffset;
9
sprite_index = target.sprite_index;
10
image_index = target.image_index;
11
image_angle = target.image_angle;
12
image_xscale = target.image_xscale;
13
image_yscale = target.image_yscale;
14
var _target_width = abs(target.sprite_width);
15
var _target_height = abs(target.sprite_height);
16
var _xsign = sign(target.image_xscale);
17
var _ysign = sign(target.image_yscale);
18
var _xscale = abs(fixed_size ? 1 : image_xscale);
19
var _yscale = abs(fixed_size ? 1 : image_yscale);
20
var _xoff = xoffset * max(min_size, _xscale) * strength;
21
var _yoff = yoffset * max(min_size, _yscale) * strength;
22
if (!outline_only)
23
{
24
    with (target)
25
        draw_self();
26
}
27
if (darkness > 0)
28
{
29
    d3d_set_fog(true, merge_color(c_white, darkness_tint, image_alpha), 0, 1);
30
    gpu_set_alphatestenable(true);
31
    gpu_set_blendmode_ext(bm_zero, bm_src_color);
32
    if (target)
33
        draw_sprite_ext(sprite_index, image_index, x + sprite_xoffset, y + sprite_yoffset, image_xscale, image_yscale, image_angle, c_white, 1);
34
    gpu_set_blendmode(bm_normal);
35
    gpu_set_alphatestenable(false);
36
}
37
if (!surface_exists(sprite_surf))
38
    sprite_surf = surface_create(_target_width, _target_height);
39
if (width != _target_width || height != _target_height)
40
{
41
    width = _target_width;
42
    height = _target_height;
43
    surface_resize(sprite_surf, width, height);
44
}
45
surface_set_target(sprite_surf);
46
draw_clear_alpha(c_black, 0);
47
d3d_set_fog(true, image_blend, 0, 1);
48
draw_sprite_ext(sprite_index, image_index, target.sprite_xoffset * _xsign, target.sprite_yoffset * _ysign, abs(image_xscale), abs(image_yscale), 0, c_black, 1);
49
d3d_set_fog(false, c_black, 0, 1);
50
gpu_set_blendmode(bm_subtract);
51
if (image_angle == 0)
52
{
53
    draw_sprite_ext(sprite_index, image_index, (target.sprite_xoffset + _xoff) * _xsign, (target.sprite_yoffset + _yoff) * _ysign, abs(image_xscale), abs(image_yscale), 0, c_black, 1);
54
}
55
else
56
{
57
    var _offset_dir = point_direction(0, 0, _xoff, _yoff);
58
    var _offset_len = point_distance(0, 0, _xoff, _yoff);
59
    var _xdir = _xsign * (target.sprite_xoffset + lengthdir_x(_offset_len, _offset_dir - image_angle));
60
    var _ydir = _ysign * (target.sprite_yoffset + lengthdir_y(_offset_len, _offset_dir - image_angle));
61
    draw_sprite_ext(sprite_index, image_index, _xdir, _ydir, abs(image_xscale), abs(image_yscale), 0, c_black, 1);
62
}
63
gpu_set_blendmode(bm_normal);
64
surface_reset_target();
65
if (image_angle != 0)
66
{
67
    var _newx = 
scr_orbitx
scr_orbitx

function
scr_orbitx(arg0, arg1, arg2, arg3, arg4)
{ if (arg4 == 0) return arg2; var __theta = point_direction(arg0, arg1, arg2, arg3); var __radius = point_distance(arg0, arg1, arg2, arg3); __theta += arg4; return arg0 + lengthdir_x(__radius, __theta); }
(target.x, target.y, x, y, image_angle);
68
    var _newy = 
scr_orbity
scr_orbity

function
scr_orbity(arg0, arg1, arg2, arg3, arg4)
{ if (arg4 == 0) return arg3; var __theta = point_direction(arg0, arg1, arg2, arg3); var __radius = point_distance(arg0, arg1, arg2, arg3); __theta += arg4; return arg1 + lengthdir_y(__radius, __theta); }
(target.x, target.y, x, y, image_angle);
69
    draw_surface_ext(sprite_surf, _newx, _newy, _xsign, _ysign, image_angle, c_white, image_alpha);
70
}
71
else
72
{
73
    draw_surface_ext(sprite_surf, x, y, _xsign, _ysign, image_angle, c_white, image_alpha);
74
}