Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_dw_tv_funometer_Draw_0

(view raw script w/o annotations or w/e)
1
functionalfun = lerp(functionalfun, fun, funspeed);
2
functionalfun = clamp01(functionalfun);
3
var ver = 1;
4
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
5
{
6
    if (keyboard_check(ord("K")))
7
        ver = 0;
8
    if (keyboard_check_pressed(ord("B")))
9
        hope = !hope;
10
}
11
if (hope)
12
{
13
    hope_anim += 1;
14
    if (hope_flower_active)
15
        hope_flower_anim = 
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); } }
(hope_flower_anim, 34, 1);
16
}
17
var funometersprite = 1218;
18
if (ver == 1)
19
    funometersprite = 
scr_84_get_sprite
scr_84_get_sprite

function
scr_84_get_sprite(arg0)
{ return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_dw_tv_funometer_base_2x");
20
if (cracked)
21
    draw_sprite_ext(funometersprite, 2, x, y, 1, 1, image_angle, image_blend, image_alpha);
22
else if (hope)
23
    draw_sprite_ext(spr_hopeometer_bar, hope_anim, x, y, 2, 2, image_angle, image_blend, image_alpha);
24
else
25
    draw_sprite_ext(funometersprite, 0, x, y, 1, 1, image_angle, image_blend, image_alpha);
26
if (cracked)
27
{
28
    draw_sprite_ext(funometersprite, 3, x, y, 1, 1, image_angle, image_blend, image_alpha);
29
}
30
else if (hope)
31
{
32
    draw_sprite_ext(spr_hopeometer_hope, hope_anim, x - 14, y + 170, image_xscale * 2, image_yscale * 2, image_angle, image_blend, image_alpha);
33
    draw_sprite_ext(spr_hopeometer_flowers, hope_flower_anim, x - 14, y + 170, 2, 2, image_angle, image_blend, image_alpha);
34
}
35
else
36
{
37
    draw_sprite_ext(funometersprite, 1, x, y, 1, 1, image_angle, image_blend, image_alpha);
38
}
39
var intensity = 
scr_inverselerp
scr_inverselerp

function inverselerp(arg0, arg1, arg2) { if (arg1 == arg0) return 0; return (arg2 - arg0) / (arg1 - arg0); } function
scr_inverselerp(arg0, arg1, arg2)
{ if (arg1 == arg0) return 0; return (arg2 - arg0) / (arg1 - arg0); }
(empty, full, functionalfun);
40
intensity = clamp01(intensity);
41
var amount = lerp(0.2, 0.85, intensity) * sprite_height;
42
var slide_amount = round_to_multiple(lerp(0.65, 0, intensity) * sprite_height, 2);
43
var _sine = sin(siner / 10);
44
var _siner = sin(siner / 15);
45
var meter_color = 16777215;
46
if (intensity <= 0.2)
47
    hue = remap_clamped(0.08, 0.2, 1/3, 0, intensity);
48
else
49
    hue = 0;
50
if (intensity >= 0.9)
51
    rainbow = round_to_multiple(scr_loop_ext(rainbow + remap_clamped(0.9, 1, 0, 0.1, intensity), -0.5, 0.5), 1/30);
52
if (intensity < 0.9 && rainbow != 0)
53
    rainbow = 
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); } }
(rainbow, 0, 0.05);
54
var alt_sprindex = 2217;
55
if (cracked)
56
{
57
    var _offset = 3;
58
    var _offset_y = 4;
59
    if (ver == 0)
60
        draw_sprite_ext(sprite_index, 4, x, y, image_xscale, image_yscale, image_angle, c_white, image_alpha);
61
    if (ver == 1)
62
        draw_sprite_ext(alt_sprindex, 4, x + _offset, y + _offset_y, image_xscale * 2, image_yscale * 2, image_angle, c_white, image_alpha);
63
    exit;
64
}
65
else
66
{
67
    var _barx = lengthdir_x(slide_amount, image_angle - 90);
68
    var _bary = lengthdir_y(slide_amount, image_angle - 90);
69
    var _offset = 4;
70
    var _offset_y = 4;
71
    if (hope)
72
    {
73
        _offset = 23;
74
        _offset_y = 22;
75
    }
76
    if (ver == 0)
77
        draw_sprite_ext(sprite_index, 3, x, y, image_xscale, image_yscale, image_angle, c_white, image_alpha);
78
    if (ver == 1)
79
        draw_sprite_ext(alt_sprindex, 3, x + _offset, y + _offset_y, image_xscale * 2, image_yscale * 2, image_angle, c_white, image_alpha);
80
    shader_set(shd_rgb_yiq_shift);
81
    shader_set_uniform_f(shader_get_uniform(shd_rgb_yiq_shift, "shift"), (hue + rainbow) * 2 * pi);
82
    if (ver == 0)
83
        draw_sprite_ext(sprite_index, 2, x, y, image_xscale, image_yscale, image_angle, c_white, image_alpha);
84
    if (ver == 1)
85
        draw_sprite_ext(alt_sprindex, 2, x + _offset, y + _offset_y, image_xscale * 2, image_yscale * 2, image_angle, c_white, image_alpha);
86
    if (ver == 0)
87
        draw_sprite_part_ext_rot(4915, timer, 0, 0, sprite_width, amount, x + _barx, y + _bary, image_xscale, image_yscale, image_angle, meter_color, image_alpha);
88
    if (ver == 1)
89
        draw_sprite_part_ext_rot(85, timer, 0, 0, sprite_width, amount, x + _barx + _offset, y + _bary + _offset_y, image_xscale * 2, image_yscale * 2, image_angle, meter_color, image_alpha);
90
    if (ver == 0)
91
        draw_sprite_ext(sprite_index, 1, x, y, image_xscale, image_yscale, image_angle, c_white, image_alpha);
92
    if (ver == 1)
93
        draw_sprite_ext(alt_sprindex, 1, x + _offset, y + _offset_y, image_xscale * 2, image_yscale * 2, image_angle, c_white, image_alpha);
94
    shader_reset();
95
    if (ver == 0)
96
        draw_sprite_ext(sprite_index, 0, x, y, image_xscale, image_yscale, image_angle, c_white, image_alpha);
97
    if (ver == 1)
98
        draw_sprite_ext(alt_sprindex, 0, x + _offset, y + _offset_y, image_xscale * 2, image_yscale * 2, image_angle, c_white, image_alpha);
99
}
100
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
101
{
102
    if (keyboard_check(ord("1")))
103
        fun = empty;
104
    if (keyboard_check(ord("2")))
105
        fun = half;
106
    if (keyboard_check(ord("3")))
107
        fun = full;
108
}
109
if (intensity >= 0.9)
110
{
111
    if (shakecon <= 0)
112
    {
113
        xstart = x;
114
        ystart = y;
115
        shakecon = 1;
116
    }
117
    var _force = remap_clamped(0.9, 1, 0, 1, intensity);
118
    var _dir = random_range(-180, 180);
119
    var _len = random_range(0, 2) * _force;
120
    var _v2 = 
scr_get_sprite_point
scr_get_sprite_point

function
scr_get_sprite_point(arg0 = -4, arg1 = 0.5, arg2 = 0.5, arg3 = true)
{ var __v2 = new Vector2(0, 0); if (arg0 != -4) { with (arg0) { __v2.x = (x - sprite_xoffset) + (sprite_width * arg1); __v2.y = (y - sprite_yoffset) + (sprite_height * arg2); if (arg3) __v2 = scr_rotatevector_around(__v2, new Vector2(x, y), image_angle); } } return __v2; } function scr_get_sprite_point_x(arg0, arg1 = 0.5, arg2 = true) { return
scr_get_sprite_point(arg0, arg1, 0.5, arg2).x;
} function scr_get_sprite_point_y(arg0, arg1 = 0.5, arg2 = true) { return
scr_get_sprite_point(arg0, 0.5, arg1, arg2).y;
}
(id);
121
    x = xstart;
122
    y = ystart;
123
    direction = 0;
124
    
scr_rotatearoundpoint
scr_rotatearoundpoint

function
scr_rotatearoundpoint(arg0, arg1, arg2)
{
scr_orbitaroundpoint(arg0, arg1, arg2);
direction += arg2; }
(_v2.x, _v2.y, random_range(-2, 2) * _force);
125
    image_angle = direction;
126
    x += lengthdir_x(_len, _dir);
127
    y += lengthdir_y(_len, _dir);
128
}
129
if (intensity < 0.9 && shakecon > 0)
130
{
131
    x = xstart;
132
    y = ystart;
133
    image_angle = 0;
134
    shakecon = 0;
135
}
136
siner += sqr(intensity * 4);
137
timer += remap_clamped(0.08, 0.2, 0.2, 1, intensity);