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