Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_mike_controller_Draw_0

(view raw script w/o annotations or w/e)
1
if (battle_active)
2
{
3
    if (room != room_dw_castle_tv_zone_minigame)
4
    {
5
        var sign_col2 = 8421504;
6
        if (sign_action == 2)
7
            sign_col2 = sign_col;
8
        draw_sprite_ext(
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_mike_sign"), sign_index, sign_x, cameray() + sign_y, 1, 1, 0, sign_col2, 1);
9
        sign_col2 = 8421504;
10
        if (sign_action2 == 2)
11
            sign_col2 = 255;
12
        draw_sprite_ext(
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_mike_sign"), 1, sign_x2, cameray() + sign_y2, 1, 1, 0, sign_col2, 1);
13
    }
14
    var xx = camerax();
15
    var yy = cameray();
16
    if (i_ex(obj_mike_minigame_controller))
17
    {
18
        with (obj_mike_minigame_controller)
19
        {
20
            if (phase == 2 && action == 1)
21
                yy -= 37;
22
        }
23
    }
24
    tpoff = (tp - tpy) + yy;
25
    bpoff = -bp + bpy + yy;
26
    if (intro == 1)
27
    {
28
        if (bp < (bpy - 1))
29
        {
30
            if ((bpy - bp) < 40)
31
                bp += round((bpy - bp) / 2.5);
32
            else
33
                bp += 30;
34
        }
35
        else
36
        {
37
            bp = bpy;
38
        }
39
        if (bp == bpy)
40
            intro = 0;
41
    }
42
    if (intro == 2)
43
    {
44
        if (bp > 0)
45
        {
46
            if (round((bpy - bp) / 5) > 15)
47
                bp -= round((bpy - bp) / 2.5);
48
            else
49
                bp -= 30;
50
        }
51
        else
52
        {
53
            bp = 0;
54
        }
55
    }
56
    draw_set_color(c_black);
57
    if (room == room_dw_castle_tv_zone_minigame)
58
        ossafe_fill_rectangle(xx - 10, 581 + yy, xx + 700, ((520 - bp) + yy) - 4, false);
59
    if (room != room_dw_castle_tv_zone_minigame)
60
    {
61
        ossafe_fill_rectangle(xx - 10, 481 + yy, xx + 700, ((480 - bp) + yy) - 4, false);
62
        draw_set_color(bcolor);
63
        ossafe_fill_rectangle(xx - 10, (480 - bp - 3) + yy, xx + 700, (480 - bp - 2) + yy, false);
64
    }
65
    draw_set_color(bcolor);
66
    ossafe_fill_rectangle(xx - 10, (480 - bp) + 34 + yy, xx + 700, (480 - bp) + 36 + yy, false);
67
    with (obj_mike_minigame_controller)
68
    {
69
        if (phase == 2 && action == 1)
70
        {
71
            for (var i = 0; i < 3; i++)
72
            {
73
                var alph = 0.6;
74
                if (i < plueyhealth)
75
                    alph = 1;
76
                draw_sprite_ext(spr_mike_cat_face, 0, camerax() + 320 + (50 * (i - 1)), (480 - other.bp) + 64 + yy, 2 * alph, 2 * alph, 0, c_white, alph);
77
            }
78
        }
79
    }
80
    if (room != room_dw_castle_tv_zone_minigame)
81
    {
82
        
scr_charbox_mike
scr_charbox_mike

function
scr_charbox_mike()
{ for (c = 0; c < 4; c += 1) { if (havechar[c] == 1) { if (c == 0) charcolor = hpcolor[0]; if (c == 1) charcolor = hpcolor[1]; if (c == 2) charcolor = hpcolor[2]; if (c == 3) charcolor = hpcolor[3]; gc = global.charturn; xchunk = 0; if (charpos[c] == 0 && chartotal == 3) xchunk = 0; if (charpos[c] == 1 && chartotal == 3) xchunk = 213; if (charpos[c] == 2 && chartotal == 3) xchunk = 426; if (charpos[c] == 0 && chartotal == 2) xchunk = 108; if (charpos[c] == 1 && chartotal == 2) xchunk = 322; if (charpos[c] == 0 && chartotal == 1) xchunk = 213; if (gc == charpos[c]) { if (global.myfight == 0)
scr_selectionmatrix(xx + xchunk, (480 - bp) + yy);
if (mmy[c] > -32) mmy[c] -= 2; if (mmy[c] > -24) mmy[c] -= 4; if (mmy[c] > -16) mmy[c] -= 6; if (mmy[c] > -8) mmy[c] -= 8; if (mmy[c] < -32) mmy[c] = -64; } else if (mmy[c] < -14) { mmy[c] += 15; } else { mmy[c] = 0; } btc[0] = 0; btc[1] = 0; btc[2] = 0; btc[3] = 0; btc[4] = 0; if (gc == charpos[c]) btc[global.bmenucoord[0][global.charturn]] = 1; if (gc == charpos[c]) draw_set_color(charcolor); else draw_set_color(bcolor); if (global.charselect == charpos[c] || global.charselect == 3) draw_set_color(charcolor); ossafe_fill_rectangle(xx + xchunk, (480 - bp - 3) + yy + mmy[c], xx + xchunk + 212, ((480 - bp) + yy) - 2, false); draw_set_color(c_black); ossafe_fill_rectangle(xx + xchunk + 2, (480 - bp - 1) + yy + mmy[c], xx + xchunk + 210, (480 - bp) + yy + mmy[c] + 33, false); b_offset = 480; if (global.fighting == 0) b_offset = 430; if (global.fighting == 1) b_offset = 336; if (c == 0) { draw_sprite(spr_headkris, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]); draw_sprite(
scr_84_get_sprite("spr_bnamekris"), 0, xx + 51 + xchunk, bpoff + b_offset + 3 + mmy[c]);
} if (c == 1) { draw_sprite(spr_headsusie, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]); draw_sprite(
scr_84_get_sprite("spr_bnamesusie"), 0, xx + 51 + xchunk, bpoff + b_offset + 3 + mmy[c]);
} if (c == 2) { draw_sprite(spr_headralsei, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]); draw_sprite(
scr_84_get_sprite("spr_bnameralsei"), 0, xx + 51 + xchunk, bpoff + b_offset + 3 + mmy[c]);
} if (c == 3) { draw_sprite(spr_headnoelle, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]); draw_sprite(
scr_84_get_sprite("spr_bnamenoelle"), 0, xx + 51 + xchunk, bpoff + b_offset + 3 + mmy[c]);
} draw_sprite(spr_hpname, 0, xx + 109 + xchunk, bpoff + b_offset + 11 + mmy[c]); draw_set_color(c_white); draw_set_font(global.hpfont); if ((global.hp[c + 1] / global.maxhp[c + 1]) <= 0.25) draw_set_color(c_yellow); if (global.hp[c + 1] <= 0) draw_set_color(c_red); draw_set_halign(fa_right); draw_text(xx + 160 + xchunk, ((bpoff + b_offset) - 2) + mmy[c], string_hash_to_newline(global.hp[c + 1])); ...
();
83
    }
84
    else
85
    {
86
        with (obj_mike_minigame_controller)
87
        {
88
            if (phase == 2)
89
            {
90
                var myhiscore = obj_mike_minigame_tv.hiscore[obj_mike_minigame_tv.minigame];
91
                draw_set_colour(c_white);
92
                draw_set_font(fnt_mainbig);
93
                if (action != 1)
94
                {
95
                    if (myscore > myhiscore)
96
                        draw_set_colour(merge_colour(c_white, c_yellow, clamp(0.5 + sin(current_time / 400), 0, 1)));
97
                    draw_text(32, 370, stringsetloc(
SCORE:
"SCORE: ", "obj_mike_controller_slash_Draw_0_gml_73_0"
) + string(myscore));
98
                    draw_set_colour(c_white);
99
                    draw_text(32, 400, stringsetloc(
HISCORE:
"HISCORE: ", "obj_mike_controller_slash_Draw_0_gml_75_0_b"
) + string(myhiscore));
100
                }
101
                if (action == 2)
102
                {
103
                    draw_text(32, 430, stringsetloc(
CATS:
"CATS: ", "obj_mike_controller_slash_Draw_0_gml_79_0"
) + string(instance_number(obj_gravity_ball)));
104
                    new_cat -= 0.05;
105
                    draw_set_color(c_ltgray);
106
                    draw_set_alpha(new_cat);
107
                    draw_set_font(
scr_84_get_font
scr_84_get_font

function
scr_84_get_font(arg0)
{ if (!variable_global_exists("chemg_last_get_font")) global.chemg_last_get_font = ""; if (arg0 != global.chemg_last_get_font) global.chemg_last_get_font = arg0; return ds_map_find_value(global.font_map, arg0); }
("mainbig"));
108
                    draw_text(140, 430, stringsetloc(
I was born.
"I was born.", "obj_mike_controller_slash_Draw_0_gml_84_0"
));
109
                    draw_set_alpha(1);
110
                    draw_set_font(fnt_mainbig);
111
                }
112
                var _vol = obj_mike_controller.microphone_volume / 100;
113
                if (action == 3)
114
                {
115
                    var _catheld = 0;
116
                    if (obj_mike_controller.hand_type == 2)
117
                        _catheld = 1;
118
                    var _shake = 2 * (_vol + _catheld);
119
                    var _shakex = irandom_range(-_shake, _shake);
120
                    var _shakey = irandom_range(-_shake, _shake);
121
                    var _fx = 480 + _shakex;
122
                    var _fy = 400 + _shakey;
123
                    draw_set_halign(fa_center);
124
                    draw_set_colour(c_white);
125
                    if (obj_mike_minigame_controller.fuel <= 10)
126
                        draw_set_colour(merge_colour(c_white, c_red, clamp(0.5 + (sin(current_time / 200) * 0.5), 0, 1)));
127
                    if (obj_mike_minigame_controller.fuel >= 101)
128
                        draw_set_colour(merge_colour(c_white, c_yellow, clamp(0.5 + (sin(current_time / 200) * 0.5), 0, 1)));
129
                    if (obj_mike_minigame_controller.fuel >= 151)
130
                        draw_set_colour(merge_colour(c_white, c_fuchsia, clamp(0.5 + (sin(current_time / 200) * 0.5), 0, 1)));
131
                    if (obj_mike_minigame_controller.fuel >= 201)
132
                        draw_set_colour(merge_colour(c_white, c_gray, clamp(0.5 + (sin(current_time / 200) * 0.5), 0, 1)));
133
                    draw_text(530 + _shakex, 370 + _shakey, stringsetloc(
FUEL
"FUEL", "obj_mike_controller_slash_Draw_0_gml_104_0"
));
134
                    if (_vol > 0.1)
135
                        draw_set_colour(c_blue);
136
                    else if (_catheld)
137
                        draw_set_colour(c_blue);
138
                    else
139
                        draw_set_colour(c_lime);
140
                    if (obj_mike_minigame_controller.fuel <= 10)
141
                        draw_set_colour(merge_colour(c_white, c_red, clamp(0.5 + (sin(current_time / 200) * 0.5), 0, 1)));
142
                    if (obj_mike_minigame_controller.fuel >= 101)
143
                        draw_set_colour(merge_colour(c_white, c_yellow, clamp(0.5 + (sin(current_time / 200) * 0.5), 0, 1)));
144
                    if (obj_mike_minigame_controller.fuel >= 151)
145
                        draw_set_colour(merge_colour(c_white, c_fuchsia, clamp(0.5 + (sin(current_time / 200) * 0.5), 0, 1)));
146
                    if (obj_mike_minigame_controller.fuel >= 201)
147
                        draw_set_colour(merge_colour(c_white, c_gray, clamp(0.5 + (sin(current_time / 200) * 0.5), 0, 1)));
148
                    draw_set_alpha(0.5);
149
                    if (abs(obj_mike_minigame_controller.fuel - obj_mike_minigame_controller.last_fuel) > 5)
150
                        ossafe_fill_rectangle(_fx, _fy, _fx + clamp((obj_mike_minigame_controller.last_fuel / 100) * 100, 0, 100), _fy + 25, 0);
151
                    draw_set_alpha(1);
152
                    ossafe_fill_rectangle(_fx, _fy, _fx + 100, _fy + 25, 1);
153
                    ossafe_fill_rectangle(_fx, _fy, _fx + clamp((obj_mike_minigame_controller.fuel / 100) * 100, 0, 100), _fy + 25, 0);
154
                    draw_set_halign(fa_left);
155
                }
156
                with (obj_gravity_hoop)
157
                {
158
                    var _time = 
scr_timedisp
scr_timedisp

function
scr_timedisp(arg0)
{ var minutes = floor(arg0 / 1800); var remmins = minutes % 60; var hours = (minutes - remmins) / 60; var seconds = floor((arg0 / 30) - (minutes * 60)); var hourstring = string(hours) + ":"; var minstring = string(remmins) + ":"; if (remmins < 10) minstring = "0" + minstring; var secstring = string(floor(seconds)); if (seconds < 10) secstring = "0" + secstring; var timedisp = hourstring + minstring + secstring; return timedisp; }
(min(other.countdown, 1800));
159
                    draw_set_halign(fa_center);
160
                    draw_set_colour(c_white);
161
                    if (obj_mike_minigame_controller.combo > 0 && obj_mike_minigame_controller.combo_buffer < 25)
162
                        draw_text(x - 252, 370, stringsetloc(
COMBO:
"COMBO: ", "obj_mike_controller_slash_Draw_0_gml_135_0"
) + string(obj_mike_minigame_controller.combo));
163
                    if (other.countdown > 0 && other.countdown < 150)
164
                        draw_set_colour(merge_colour(c_white, c_red, clamp(0.5 + (sin(current_time / 200) * 0.5), 0, 1)));
165
                    _str = string_copy(_time, 3, string_length(_time) + 4);
166
                    if (other.countdown <= 0)
167
                        _str = stringsetloc(
TIME'S UP!
"TIME'S UP!", "obj_mike_controller_slash_Draw_0_gml_141_0"
);
168
                    draw_text(x, 370, stringsetloc(
TIME
"TIME", "obj_mike_controller_slash_Draw_0_gml_143_0"
));
169
                    draw_text(x, 400, string(_str));
170
                    draw_set_halign(fa_left);
171
                }
172
            }
173
        }
174
    }
175
    if (instance_number(obj_heart) == 1 && !obj_mike_attack_controller.talking)
176
    {
177
        if (type == 8 || type == 9)
178
        {
179
            draw_set_colour(merge_colour(c_lime, c_black, 0.5));
180
            d_line(obj_heart.x + 10, 190 - line_height, obj_heart.x + 10, 190 + line_height);
181
            line_height = lerp(line_height, 110, 0.5);
182
        }
183
        if (type == 3 || type == 4 || type == 8 || type == 9)
184
        {
185
            draw_set_colour(merge_colour(c_lime, c_black, 0.5));
186
            var line_x = ((line_width / 36) + (camerax() + (camerawidth() / 2))) - line_width;
187
            var line_s = line_width / 18;
188
            line_y[0] = line_ypos + (cameray() + (cameraheight() / 2));
189
            line_y[35] = line_ypos + (cameray() + (cameraheight() / 2));
190
            if (type < 8)
191
            {
192
                for (var i = 1; i < 36; i++)
193
                {
194
                    if (i < 35)
195
                        line_y[i] = line_ypos + (cameray() + (cameraheight() / 2)) + clamp(sin(i + (current_time * -line_side)) * floor(microphone_volume) * 0.1, -16, 16);
196
                    d_line(line_x + ((i - 1) * line_s), line_y[i - 1], line_x + (i * line_s), line_y[i]);
197
                }
198
                draw_sprite_ext(spr_mike_littlearrow, 0, x + ((size1 + 3) * line_side), y, line_side, 1, 0, c_lime, 1);
199
            }
200
            if (type == 9)
201
                draw_sprite_ext(spr_mike_littlearrow, 0, x + max(0, line_side), y + ((size1 + 3) * line_side), 1, 1, 90 + (max(0, line_side) * 180), c_lime, 1);
202
            draw_set_colour(c_black);
203
            ossafe_fill_rectangle(x - size1 - 1, y - size1 - 1, x + size1, y + size1, 0);
204
        }
205
        if (type < 5 || type == 8 || type == 9)
206
        {
207
            draw_set_colour(c_lime);
208
            ossafe_fill_rectangle(x - size1 - 1, y - size1 - 1, x + size1, y + size1, 1);
209
            ossafe_fill_rectangle(x - size1 - 2, y - size1 - 2, x + size1 + 1, y + size1 + 1, 1);
210
            if ((type == 1 || type == 2) && wing_angle1 != 270)
211
            {
212
                d_line_width(x - size1 - 3, y - size1 - 2, (x - size1 - 3) + lengthdir_x(size1 * 2, wing_angle1), (y - size1 - 2) + lengthdir_y(size1 * 2, wing_angle1), 2);
213
                d_line_width(x + size1 + 1, y - size1 - 2, (x + size1 + 1) - lengthdir_x(size1 * 2, wing_angle1), (y - size1 - 2) + lengthdir_y(size1 * 2, wing_angle1), 2);
214
            }
215
        }
216
        if (type == 5 || type == 15)
217
        {
218
            var center_x = x - 1;
219
            var center_y = y - 1;
220
            if (os_type == os_switch)
221
                center_x++;
222
            for (var i = 0; i < 35; i++)
223
            {
224
                var mydir = current_time / 300;
225
                var dir_distance = point_distance(new_dir, 0, dir, 0) / 10;
226
                var circle_x = center_x + lengthdir_x(max(16, size1) + (sin(i + (current_time / 30)) * dir_distance), mydir + ((i / 36) * 360));
227
                var circle_y = center_y + lengthdir_y(max(16, size1) + (sin(i + (current_time / 30)) * dir_distance), mydir + ((i / 36) * 360));
228
                var circle_x2 = center_x + lengthdir_x(max(16, size1) + (sin((i - 1) + (current_time / 30)) * dir_distance), mydir + (((i - 1) / 36) * 360));
229
                var circle_y2 = center_y + lengthdir_y(max(16, size1) + (sin((i - 1) + (current_time / 30)) * dir_distance), mydir + (((i - 1) / 36) * 360));
230
                draw_set_colour(c_lime);
231
                if (i == 0)
232
                {
233
                    n = 34;
234
                    circle_x2 = center_x + lengthdir_x(max(16, size1) + (sin(n + (current_time / 30)) * dir_distance), mydir + ((n / 36) * 360));
235
                    circle_y2 = center_y + lengthdir_y(max(16, size1) + (sin(n + (current_time / 30)) * dir_distance), mydir + ((n / 36) * 360));
236
                }
237
                d_line_width(circle_x, circle_y, circle_x2, circle_y2, 2);
238
            }
239
        }
240
        size1 += ((size2 - size1) * 0.25);
241
        size2 += ((size3 - size2) * 0.25);
242
        size1 = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(size1, size2, 0.01);
243
        size2 = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(size2, size3, 0.01);
244
    }
245
    if (type == 15)
246
    {
247
        var bottomY = 326;
248
        var _phase = x / 18;
249
        yOffset = sin(_phase) * 4;
250
        y += yOffset;
251
        for (var ii = -1; ii <= 1; ii += 2)
252
        {
253
            xx = x + (sin(_phase) * -32) + (32 * ii);
254
            yy = bottomY + min(0, cos(_phase) * 16);
255
            draw_set_colour(c_lime);
256
            for (var i = 1; i < (point_distance(xx, yy, x, y) / 16); i++)
257
            {
258
                if (point_distance(xx + lengthdir_x(i * 16, point_direction(xx, yy, x, y)), yy + lengthdir_y(i * 16, point_direction(xx, yy, x, y)), x, y) > 32)
259
                    d_circle(xx + irandom_range(1, -1) + lengthdir_x(i * 16, point_direction(xx, yy, x, y)), yy + irandom_range(1, -1) + lengthdir_y(i * 16, point_direction(xx, yy, x, y)), 2, 1);
260
            }
261
            _phase = (x + (32 * ii)) / 20;
262
            draw_sprite_ext(spr_mike_shoe, 0, xx, yy, ii, 1, sin(_phase) * 5 * ii, c_white, 1);
263
        }
264
    }
265
    if (!obj_mike_attack_controller.talking)
266
    {
267
        if (vis)
268
        {
269
            with (obj_heart)
270
                draw_self();
271
        }
272
    }
273
}