Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_date_ui_Draw_0

(view raw script w/o annotations or w/e)
1
if (!i_ex(obj_pink_enemy))
2
    exit;
3
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));
}
("main");
4
draw_set_alpha(1);
5
draw_set_color(c_white);
6
var _x = camerax();
7
var _y = cameray();
8
if (con == 1)
9
{
10
    timer++;
11
    _x = camerax() + xx;
12
    xx = lerp(300, 0, timer / 30);
13
    if (timer >= 30)
14
    {
15
        con = 2;
16
        timer = 0;
17
    }
18
}
19
if (con > 0)
20
{
21
    _x = camerax() + xx;
22
    var _weather_angle = 0;
23
    var _weather_x = 0;
24
    var _weather_y = 0;
25
    var _sundstring = stringsetloc(
SUND
"SUND", "obj_date_ui_slash_Draw_0_gml_35_0"
);
26
    var _reelitinstring = stringsetloc(
REEL IT IN!
"REEL IT IN!", "obj_date_ui_slash_Draw_0_gml_36_0"
);
27
    var _populationstring = stringsetloc(
POPULATION
"POPULATION", "obj_date_ui_slash_Draw_0_gml_37_0"
);
28
    var _crimestring = stringsetloc(
CRIME
"CRIME", "obj_date_ui_slash_Draw_0_gml_38_0"
);
29
    if (weatherkick_con == 1)
30
    {
31
        weatherkick_timer++;
32
        if (weatherkick_timer > 0)
33
            _weather_x = lerp(0, -800, weatherkick_timer / 40);
34
        if (weatherkick_timer > 0)
35
            _weather_y = lerp(0, -800, weatherkick_timer / 40);
36
        if (weatherkick_timer > 0)
37
            _weather_angle = lerp(0, -100, weatherkick_timer / 40);
38
        if (weatherkick_timer == 40)
39
            weatherkick_con = 2;
40
    }
41
    if (weatherkick_con != 2)
42
    {
43
        draw_text_ext_transformed(_x + 500 + _weather_x, _y + 232 + _weather_y, _sundstring, 9999, 9999, 1, 1, _weather_angle);
44
        draw_sprite_ext(spr_date_sun, 0, _x + 480 + _weather_x, _y + 240 + _weather_y, 1, 1, weatherangle + _weather_angle, c_white, 1);
45
        weatherangletimer++;
46
        weatherangle = sin(weatherangletimer * 0.02) * 100;
47
    }
48
    draw_set_halign(fa_center);
49
    draw_text_ext_transformed(_x + 493, _y + 20, _reelitinstring, 9999, 9999, 1, 1, 0);
50
    d_rectangle(_x + 468, _y + 40, _x + 512, _y + 50, true);
51
    reeltimer++;
52
    reelsize = 65 + (sin(reeltimer * 0.1) * 40);
53
    draw_sprite_part_ext(spr_date_reel, 0, 0, 0, reelsize, 30, _x + 469, _y + 40, 0.4, 0.36, c_white, 1);
54
    draw_set_halign(fa_left);
55
    var _pop_angle = 0;
56
    var _pop_x = 0;
57
    var _pop_y = 0;
58
    if (populationkick_con == 1)
59
    {
60
        populationkick_timer++;
61
        if (populationkick_timer > 0)
62
            _pop_x = lerp(0, -800, populationkick_timer / 40);
63
        if (populationkick_timer > 0)
64
            _pop_y = lerp(0, -800, populationkick_timer / 40);
65
        if (populationkick_timer > 0)
66
            _pop_angle = lerp(0, -100, populationkick_timer / 40);
67
        if (populationkick_timer == 40)
68
            populationkick_con = 2;
69
    }
70
    if (populationkick_con != 2)
71
    {
72
        draw_text_ext_transformed(_x + 440 + _pop_x, _y + 61 + _pop_y, _populationstring, 9999, 9999, 1, 1, _pop_angle);
73
        d_rectangle(_x + _pop_x + 450, _y + _pop_y + 80, _x + _pop_x + 484, _y + _pop_y + 114, true);
74
        var _popu_rep = 0;
75
        repeat (5)
76
        {
77
            d_line_width_color(_x + _pop_x + 440 + populationx[_popu_rep], _y + 61 + _pop_y + populationy[_popu_rep], _x + 440 + _pop_x + populationx2[_popu_rep], _y + 61 + _pop_y + populationy2[_popu_rep], 1, 4235519, 4235519);
78
            populationx[_popu_rep] -= 1;
79
            populationx2[_popu_rep] -= 1;
80
            if (populationx[_popu_rep] < 10)
81
            {
82
                populationx[_popu_rep] += 29;
83
                populationx2[_popu_rep] += 29;
84
                if (_popu_rep == 0)
85
                    populationy[_popu_rep] = populationy2[4];
86
                else
87
                    populationy[_popu_rep] = populationy2[_popu_rep - 1];
88
                populationy2[_popu_rep] = 24 + irandom(26);
89
            }
90
            _popu_rep++;
91
        }
92
    }
93
    draw_set_halign(fa_right);
94
    d_rectangle(_x + 480, _y + 270, _x + 520, _y + 310, true);
95
    if (global.lang == "ja")
96
        draw_text_ext(_x + 476, _y + 281, _crimestring, 16, 30);
97
    else
98
        draw_text_ext_transformed(_x + 475, _y + 296, _crimestring, 9999, 9999, 1, 1, 0);
99
    draw_sprite_ext(spr_date_population, 0, _x + 500, _y + 290, population_scale, population_scale, 0, c_white, 1);
100
    if (con != 3)
101
        timer += random(3);
102
    population_scale = 1.8 + (sin(timer * 1) * 0.1);
103
    draw_set_halign(fa_left);
104
    dogtimer++;
105
    if (dogtimer == 1)
106
    {
107
        var _angle = irandom(360);
108
        dogalpha = 1;
109
        dogx = x + lengthdir_x(40, _angle);
110
        dogy = y + lengthdir_y(40, _angle);
111
        dogtimer = -30;
112
        doglen = 5 + random(4);
113
        dogangle = irandom(360);
114
    }
115
    if (dogalpha > 0)
116
        dogalpha -= 0.1;
117
    draw_sprite_ext(spr_radar_dog, 0, _x + 600 + lengthdir_x(doglen, dogangle), _y + 280 + lengthdir_y(doglen, dogangle), 0.5, 0.5, 0, c_white, dogalpha);
118
    radarangle += 6;
119
    d_circle(_x + 600, _y + 280, 16, true);
120
    d_line_color(_x + 600, _y + 280, _x + 600 + lengthdir_x(16, radarangle), _y + 280 + lengthdir_y(16, radarangle), 65280, 65280);
121
    if (con == 2 && !i_ex(obj_date_controller))
122
    {
123
        inst = instance_create_depth(_x + 600, _y + 280, depth + 1, obj_afterimage_line);
124
        inst.x2 = _x + 600 + lengthdir_x(16, radarangle);
125
        inst.y2 = _y + 280 + lengthdir_y(16, radarangle);
126
    }
127
}
128
if (con == 3)
129
{
130
    timer++;
131
    with (obj_afterimage_line)
132
        image_alpha -= 0.2;
133
    _x = camerax() + xx;
134
    xx = lerp(0, 300, timer / 30);
135
    if (timer >= 30)
136
    {
137
        con = 0;
138
        timer = 0;
139
    }
140
}
141
if (obj_pink_enemy.doki > current)
142
{
143
    current++;
144
    flashsiner = 1;
145
}
146
if (obj_pink_enemy.doki < current)
147
    current--;
148
if (show_doki_bar == true)
149
    doki_x = lerp(doki_x, 0, 0.3);
150
if (i_ex(obj_date_controller))
151
    depth = obj_date_controller.depth + 1;
152
else
153
    depth = 86;
154
var doki = current;
155
var _shakex = 0;
156
if (doki == dokimax)
157
    _shakex = -2 + random(4);
158
var _shakey = 0;
159
if (doki == dokimax)
160
    _shakey = -2 + random(4);
161
if ((i_ex(obj_pink_enemy) && obj_pink_enemy.datecount == 0) || i_ex(obj_date_ui))
162
{
163
    _shakex = 0;
164
    _shakey = 0;
165
}
166
if (i_ex(obj_pink_enemy) && obj_pink_enemy.idlesprite == spr_mew_pushing)
167
    _shakex = sin(obj_pink_enemy.siner * 1) * 5;
168
if (dokishaketimer > 0)
169
{
170
    dokishaketimer--;
171
    _shakex = -2 + random(4);
172
}
173
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));
}
("main");
174
draw_set_halign(fa_left);
175
if (
scr_debug
scr_debug

function
scr_debug()
{ return global.debug == 1; }
())
176
{
177
    draw_text_color(camerax() + 10, 2, "[PRESS F1 FOR MAX DOKI]", c_white, c_white, c_white, c_white, 1);
178
    draw_text_color(camerax() + 10, 15, "[PRESS F7 FOR MAX TP]", c_white, c_white, c_white, c_white, 1);
179
    draw_text(camerax() + 10, cameray() + 28, "[PRESS I TO SKIP PHASE]");
180
    if (i_ex(obj_pink_enemy))
181
        draw_text(camerax() + 10, cameray() + 41, "PHASE: " + string(obj_pink_enemy.datecount + 1));
182
}
183
draw_set_halign(fa_center);
184
draw_text_color(608 + doki_x + _shakex, 30, stringsetloc(
DOKI
"DOKI", "obj_date_ui_slash_Draw_0_gml_195_0"
), c_white, c_white, c_white, c_white, 1);
185
if (i_ex(obj_pink_enemy))
186
    draw_text_color(608 + doki_x + _shakex, 47, string(obj_pink_enemy.doki) + "/" + string(dokimax), c_white, c_white, c_white, c_white, 1);
187
if (!surface_exists(healthbar_surf))
188
    healthbar_surf = surface_create(96, 250);
189
surface_set_target(healthbar_surf);
190
draw_clear_alpha(c_white, 0);
191
draw_sprite(spr_dokibar, 1, 0, 0);
192
draw_set_color(medpink);
193
d_rectangle(3, sprite_height - 1, sprite_width - 1, sprite_height - ((doki / dokimax) * sprite_height), false);
194
draw_set_color(c_white);
195
if (flashsiner > 0)
196
{
197
    draw_set_alpha(flashsiner);
198
    if (obj_pink_enemy.datecount == 3 && obj_pink_enemy.explosioncon == 0)
199
    {
200
    }
201
    else
202
    {
203
        d_rectangle_color(3, sprite_height - 1, sprite_width - 1, sprite_height - ((doki / dokimax) * sprite_height), 16777215, 16777215, 16777215, 16777215, false);
204
    }
205
    flashsiner--;
206
    draw_set_alpha(1);
207
}
208
if (doki == dokimax)
209
{
210
    tsiner++;
211
    draw_set_alpha(0.5 + (sin(tsiner * 0.2) * 0.5));
212
    d_rectangle_color(3, sprite_height - 1, sprite_width - 1, sprite_height - ((doki / dokimax) * sprite_height), 16777215, 16777215, 16777215, 16777215, false);
213
    draw_set_alpha(1);
214
}
215
if (obj_pink_enemy.doki > 0)
216
    draw_sprite(spr_tensionmarker, 0, 3, sprite_height - ((doki / dokimax) * sprite_height));
217
draw_sprite(spr_dokibar, 0, 0, 0);
218
gpu_set_blendmode(bm_subtract);
219
draw_sprite_ext(spr_tensionbar_cutout, 0, 0, 0, 1, 1, 0, c_white, 1);
220
gpu_set_blendmode(bm_normal);
221
surface_reset_target();
222
draw_surface(healthbar_surf, x + 125 + _shakex + doki_x, (y + _shakey) - 68);
223
if (electricity_con == 1 && !i_ex(obj_date_controller))
224
{
225
    draw_sprite_ext(spr_pink_electricity, electricity_timer, x + 110 + _shakex + doki_x, (y + _shakey) - 72, 1, 1.8, 0, c_white, 1);
226
    draw_sprite_ext(spr_pink_electricity, electricity_timer + 2, x + 110 + _shakex + doki_x, y + _shakey + 20, 1, 1.8, 0, c_white, 1);
227
    electricity_timer++;
228
    if (electricity_timer == 1)
229
    {
230
        snd_loop(snd_electroshock_loop);
231
        snd_volume(snd_electroshock_loop, 0.1, 0);
232
    }
233
    if (electricity_timer == 30)
234
    {
235
        snd_stop(snd_electroshock_loop);
236
        electricity_timer = 0;
237
        electricity_con = 0;
238
    }
239
}
240
else
241
{
242
    snd_stop(snd_electroshock_loop);
243
}
244
draw_set_color(c_white);
245
draw_set_halign(fa_left);
246
draw_set_alpha(1);