Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_sprhighlight_tester_Step_0

(view raw script w/o annotations or w/e)
1
if (init == false && i_ex(obj_caterpillarchara))
2
{
3
    var _highlight = 
scr_sprhighlight
scr_sprhighlight

function
scr_sprhighlight(arg0, arg1 = -1, arg2 = false)
{ var __highlight = instance_create(arg0.x, arg0.y, obj_sprhighlight); __highlight.target = arg0; __highlight.outline_only = arg2; if (arg1 == -1) __highlight.image_blend =
scr_get_outline_color(arg0);
else __highlight.image_blend = arg1; return __highlight; }
(1049);
4
    _highlight.darkness = 1;
5
    var _shadow = instance_create(x, y, obj_floorshadow);
6
    _shadow.target = 1049;
7
    _shadow.image_alpha = 0;
8
    _shadow.name = "kris";
9
    with (obj_caterpillarchara)
10
    {
11
        _shadow = instance_create(x, y, obj_floorshadow);
12
        _shadow.target = id;
13
        _shadow.name = name;
14
        _shadow.image_alpha = 0;
15
        _highlight = 
scr_sprhighlight
scr_sprhighlight

function
scr_sprhighlight(arg0, arg1 = -1, arg2 = false)
{ var __highlight = instance_create(arg0.x, arg0.y, obj_sprhighlight); __highlight.target = arg0; __highlight.outline_only = arg2; if (arg1 == -1) __highlight.image_blend =
scr_get_outline_color(arg0);
else __highlight.image_blend = arg1; return __highlight; }
(id);
16
        _highlight.darkness = 1;
17
    }
18
    global.currentsong[0] = snd_init("church_hymn.ogg");
19
    global.currentsong[1] = mus_loop(global.currentsong[0]);
20
    mus_volume(global.currentsong[1], 1, 0);
21
    init = true;
22
}
23
if (keyboard_check(vk_lcontrol))
24
{
25
    if (up_p())
26
    {
27
        with (obj_sprhighlight)
28
            yoffset -= 2;
29
    }
30
    if (down_p())
31
    {
32
        with (obj_sprhighlight)
33
            yoffset += 2;
34
    }
35
    if (left_p())
36
    {
37
        with (obj_sprhighlight)
38
            xoffset -= 2;
39
    }
40
    if (right_p())
41
    {
42
        with (obj_sprhighlight)
43
            xoffset += 2;
44
    }
45
}
46
var _vpress = keyboard_check_pressed(ord("V"));
47
if (_vpress)
48
{
49
    lerp_target = 1 - lerp_target;
50
    if (keyboard_check(vk_lshift))
51
        lerper = lerp_target;
52
}
53
if (lerper != lerp_target || _vpress)
54
{
55
    lerper = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(lerper, lerp_target, 0.05);
56
    strength = 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(lerper, 2);
57
    with (obj_sprhighlight)
58
    {
59
        strength = other.strength;
60
        image_alpha = other.strength;
61
    }
62
    if (palette == 1)
63
    {
64
        with (obj_floorshadow)
65
        {
66
            stretch = 1 + (other.strength * 2);
67
            image_alpha = other.strength;
68
        }
69
        mus_volume(global.currentsong[1], strength, 0);
70
    }
71
}
72
if (keyboard_check_pressed(ord("N")))
73
{
74
    palette++;
75
    if (palette == 2)
76
        palette = 0;
77
    if (palette == 0)
78
    {
79
        tint = 4210752;
80
        with (obj_sprhighlight)
81
        {
82
            image_blend = 
scr_get_outline_color
scr_get_outline_color

function
scr_get_outline_color(arg0, arg1 = 8421504, arg2 = 1)
{ var col = arg1; var krcol = 15245824; var sucol = 13138410; var racol = 1959605; var gercol = 2533989; var nocol = 12320748; if (arg2 == 2) { col = 12736850; krcol = 13462088; sucol = 10305336; racol = 13265482; gercol = 12736850; nocol = 12736850; } if (arg0.object_index == obj_mainchara) col = krcol; if (arg0.object_index == obj_caterpillarchara) { if (arg0.name == "susie") col = sucol; else if (arg0.name == "ralsei") col = racol; else if (arg0.name == "noelle") col = nocol; else return 8421504; } if (object_get_parent(arg0.object_index) == 1276) { if (arg0.object_index == obj_herokris) col = krcol; else if (arg0.object_index == obj_herosusie) col = sucol; else if (arg0.object_index == obj_heroralsei) col = racol; else if (arg0.object_index == obj_heronoelle) col = nocol; } if (arg0.object_index == obj_actor) { if (arg0.name == "kris") col = krcol; if (arg0.name == "susie") col = sucol; if (arg0.name == "ralsei") col = racol; if (arg0.name == "noelle") col = nocol; if (arg0.name == "gerson") col = gercol; } if (room == room_dw_church_darkmaze) { with (obj_dw_church_darkmaze) { if (arg0 == germark) col = gercol; if (arg0 == gerson) col = gercol; if (arg0 == sumark) col = sucol; if (arg0 == ramark) col = racol; } } if (room == room_dw_church_intro_gerson) { with (obj_dw_church_intro_gerson) { if (arg0 == gerson) col = gercol; } } return col; }
(target);
83
            darkness_tint = other.tint;
84
        }
85
        with (obj_floorshadow)
86
            image_alpha = 0;
87
    }
88
    else if (palette == 1)
89
    {
90
        tint = 16726314;
91
        with (obj_sprhighlight)
92
        {
93
            image_blend = #42D0FF;
94
            darkness_tint = other.tint;
95
        }
96
        with (obj_floorshadow)
97
            image_alpha = other.strength;
98
    }
99
}