Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_tensionbar_Draw_0

(view raw script w/o annotations or w/e)
1
if (global.chapter == 4 && (instance_exists(obj_jackenstein_enemy) || instance_exists(obj_sound_of_justice_enemy) || instance_exists(obj_titan_enemy) || instance_exists(obj_titan_spawn_enemy)))
2
    bluebar = true;
3
if (!surface_exists(healthbar_surf))
4
    healthbar_surf = surface_create(96, 250);
5
surface_set_target(healthbar_surf);
6
draw_clear_alpha(c_white, 0);
7
yy = __view_get(e__VW.YView, 0);
8
y = yy + 40;
9
if (bluebar == true)
10
    draw_sprite(spr_tensionbar, 2, 0, 0);
11
if (bluebar == false)
12
    draw_sprite(spr_tensionbar, 1, 0, 0);
13
if (abs(apparent - global.tension) < 20)
14
    apparent = global.tension;
15
if (apparent < global.tension)
16
    apparent += 20;
17
if (apparent > global.tension)
18
    apparent -= 20;
19
if (apparent != current)
20
{
21
    changetimer += 1;
22
    if (changetimer > 15)
23
    {
24
        if ((apparent - current) > 0)
25
            current += 2;
26
        if ((apparent - current) > 10)
27
            current += 2;
28
        if ((apparent - current) > 25)
29
            current += 3;
30
        if ((apparent - current) > 50)
31
            current += 4;
32
        if ((apparent - current) > 100)
33
            current += 5;
34
        if ((apparent - current) < 0)
35
            current -= 2;
36
        if ((apparent - current) < -10)
37
            current -= 2;
38
        if ((apparent - current) < -25)
39
            current -= 3;
40
        if ((apparent - current) < -50)
41
            current -= 4;
42
        if ((apparent - current) < -100)
43
            current -= 5;
44
        if (abs(apparent - current) < 3)
45
            current = apparent;
46
    }
47
}
48
if (current > 0)
49
{
50
    if (apparent < current)
51
    {
52
        if (bluebar == true)
53
            draw_set_color(c_blue);
54
        else
55
            draw_set_color(c_red);
56
        ossafe_fill_rectangle(3, (0 + sprite_height) - 1, (0 + sprite_width) - 1, (0 + sprite_height) - ((current / global.maxtension) * sprite_height), false);
57
        if (bluebar == true)
58
            draw_set_color(c_lightblue);
59
        else
60
            draw_set_color(c_orange);
61
        ossafe_fill_rectangle(3, (0 + sprite_height) - 1, (0 + sprite_width) - 1, (0 + sprite_height) - ((apparent / global.maxtension) * sprite_height), false);
62
    }
63
    if (apparent > current)
64
    {
65
        draw_set_color(c_white);
66
        ossafe_fill_rectangle(3, (0 + sprite_height) - 1, (0 + sprite_width) - 1, (0 + sprite_height) - ((apparent / global.maxtension) * sprite_height), false);
67
        if (bluebar == true)
68
            draw_set_color(c_lightblue);
69
        else
70
            draw_set_color(c_orange);
71
        if (maxed == 1)
72
        {
73
            if (bluebar == true)
74
                draw_set_color(merge_color(c_teal, c_lightblue, 0.5));
75
            else
76
                draw_set_color(merge_color(c_yellow, c_orange, 0.5));
77
        }
78
        ossafe_fill_rectangle(3, (0 + sprite_height) - 1, (0 + sprite_width) - 1, (0 + sprite_height) - ((current / global.maxtension) * sprite_height), false);
79
    }
80
    if (apparent == current)
81
    {
82
        if (bluebar == true)
83
            draw_set_color(c_lightblue);
84
        else
85
            draw_set_color(c_orange);
86
        if (maxed == 1)
87
        {
88
            if (bluebar == true)
89
                draw_set_color(merge_color(c_teal, c_lightblue, 0.5));
90
            else
91
                draw_set_color(merge_color(c_yellow, c_orange, 0.5));
92
        }
93
        ossafe_fill_rectangle(3, (0 + sprite_height) - 1, (0 + sprite_width) - 1, (0 + sprite_height) - ((current / global.maxtension) * sprite_height), false);
94
    }
95
}
96
shit = 0;
97
try
98
{
99
    if (global.tensionselect >= 0)
100
        shit = 1;
101
}
102
catch (_ex)
103
{
104
    shit = 2;
105
}
106
if (shit == 2)
107
    snd_play(snd_splat);
108
if (global.chapter == 4 && i_ex(obj_sound_of_justice_enemy) && obj_sound_of_justice_enemy.endingcon > 0)
109
{
110
    tsiner = 0;
111
}
112
else if (global.tensionselect > 0)
113
{
114
    tsiner += 1;
115
    draw_set_color(c_white);
116
    draw_set_alpha(abs(sin(tsiner / 8) * 0.5) + 0.2);
117
    theight = (0 + sprite_height) - ((current / global.maxtension) * sprite_height);
118
    theight2 = theight + ((global.tensionselect / global.maxtension) * sprite_height);
119
    if (theight2 > ((0 + sprite_height) - 1))
120
    {
121
        theight2 = (0 + sprite_height) - 1;
122
        draw_set_color(c_dkgray);
123
        draw_set_alpha(0.7);
124
    }
125
    ossafe_fill_rectangle(3, theight2, (0 + sprite_width) - 1, theight, false);
126
    draw_set_alpha(1);
127
}
128
if (apparent > 20 && apparent < global.maxtension)
129
    draw_sprite(spr_tensionmarker, 0, 3, (0 + sprite_height) - ((current / global.maxtension) * sprite_height));
130
draw_sprite(spr_tensionbar, 0, 0, 0);
131
gpu_set_blendmode(bm_subtract);
132
draw_sprite_ext(spr_tensionbar_cutout, 0, 0, 0, 1, 1, 0, c_white, 1);
133
gpu_set_blendmode(bm_normal);
134
surface_reset_target();
135
draw_surface(healthbar_surf, x, y);
136
draw_sprite(spr_tplogo, 0, x - 30, y + 30);
137
draw_set_color(c_white);
138
scr_84_set_draw_font
scr_84_set_draw_font

function
scr_84_set_draw_font(arg0)
{ global.chemg_font = arg0; draw_set_font(
scr_84_get_font(arg0));
}
("mainbig");
139
flashsiner += 1;
140
tamt = floor((apparent / global.maxtension) * 100);
141
maxed = 0;
142
if (tamt < 100)
143
{
144
    draw_text(x - 30, y + 70, string_hash_to_newline(string(floor((apparent / global.maxtension) * 100))));
145
    draw_text(x - 25, y + 95, string_hash_to_newline(stringsetloc(
Close Message
"%", "obj_tensionbar_slash_Draw_0_gml_18_0"
)));
146
}
147
if (tamt >= 100)
148
{
149
    maxed = 1;
150
    draw_set_color(c_yellow);
151
    draw_text(x - 28, y + 70, string_hash_to_newline(stringsetloc(
M
"M", "obj_tensionbar_slash_Draw_0_gml_25_0"
)));
152
    draw_text(x - 24, y + 90, string_hash_to_newline(stringsetloc(
A
"A", "obj_tensionbar_slash_Draw_0_gml_26_0"
)));
153
    draw_text(x - 20, y + 110, string_hash_to_newline(stringsetloc(
X
"X", "obj_tensionbar_slash_Draw_0_gml_27_0"
)));
154
}
155
156
enum e__VW
157
{
158
    XView,
159
    YView,
160
    WView,
161
    HView,
162
    Angle,
163
    HBorder,
164
    VBorder,
165
    HSpeed,
166
    VSpeed,
167
    Object,
168
    Visible,
169
    XPort,
170
    YPort,
171
    WPort,
172
    HPort,
173
    Camera,
174
    SurfaceID
175
}