Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_dw_fcastle_cafe_Draw_0

related scripts: Create_0Draw_0 Other_11Other_12Other_13Other_15Step_0Step_1Step_2

(view raw script w/o annotations or w/e)
1
if (view_current != 0)
2
    exit;
3
var cam = scr_getcam();
4
var _cx = camerax();
5
var _cy = cameray();
6
if (menu)
7
{
8
    fadecaterpillars(0);
9
    var maxnum = 6;
10
    var mx = _cx + 350;
11
    var my = _cy + 119;
12
    var space = 32;
13
    var newpage = false;
14
    var update = false;
15
    if (!menuinit)
16
    {
17
        camstart = scr_getcam();
18
        cammove = 0;
19
        remmpos = mpos;
20
        if (mpos > maxnum)
21
            page = floor(mpos / maxnum);
22
        setTable(menuOptions[mpos].cutscene);
23
        menuinit = 1;
24
    }
25
    var resetcamtime = 15;
26
    cammove = clamp(cammove + 1, 0, resetcamtime);
27
    var camtarg = findspriteinfo(spr_debug_cameraregionpreview, undefined, #BDFF16);
28
    var targ = 
29
    {
30
        x: round(lerp_inout_circ(_cx, camtarg.x, cammove / resetcamtime)),
31
        y: round(lerp_inout_circ(_cy, camtarg.y, cammove / resetcamtime))
32
    };
33
    camera_setxy(targ.x, targ.y);
34
    var menuLength = array_length(menuOptions);
35
    var pagecount = ceil(menuLength / maxnum);
36
    if (menu == 1)
37
    {
38
        if (left_p())
39
        {
40
            page--;
41
            newpage = true;
42
        }
43
        if (right_p())
44
        {
45
            page++;
46
            newpage = true;
47
        }
48
        if (down_p())
49
        {
50
            mpos++;
51
            update = true;
52
        }
53
        if (up_p())
54
        {
55
            mpos--;
56
            update = true;
57
        }
58
    }
59
    if (page > (pagecount - 1))
60
    {
61
        page = 0;
62
        newpage = true;
63
    }
64
    if (page < 0)
65
    {
66
        page = pagecount - 1;
67
        newpage = true;
68
    }
69
    if (newpage && pagecount > 1)
70
    {
71
        mpos = page * maxnum;
72
        update = true;
73
    }
74
    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"));
75
    draw_set_halign(fa_left);
76
    draw_set_valign(fa_top);
77
    var dboxbord = 16;
78
    var boxwid = 260;
79
    if (global.lang == "ja")
80
    {
81
        boxwid = 304;
82
        mx -= 22;
83
    }
84
    var linecount = min(menuLength, maxnum);
85
    var bonbot = 0;
86
    if (pagecount > 1)
87
        bonbot = 30;
88
    var prog = cammove / resetcamtime;
89
    var flyoff = lerp_inout_cubic(80, 0, prog);
90
    var _my = my + flyoff;
91
    
scr_darkbox_black
scr_darkbox_black

function
scr_darkbox_black(arg0, arg1, arg2, arg3)
{ draw_set_color(c_black); d_rectangle(arg0 + 20, arg1 + 20, arg2 - 20, arg3 - 20, false);
scr_darkbox(arg0, arg1, arg2, arg3);
draw_set_color(-1); }
((mx - 36 - dboxbord) + 14, _my - 8 - dboxbord - 83, ((mx + boxwid) - 14) + dboxbord, my + (space * 2) + maxnum + dboxbord + bonbot);
92
    var fltextbox = stringsetsubloc(
Flower Tea Time!\nF$: $Argument №11
"Flower Tea Time!\nF$: $~1", string(global.flag[1411]), "obj_dw_fcastle_cafe_slash_Draw_0_gml_99_0"
);
93
    var allseen = true;
94
    for (var i = 0; i < menuLength; i++)
95
    {
96
        if (menuOptions[i].watched == false)
97
            allseen = false;
98
    }
99
    var set = 0;
100
    var haveall = !(27 - menuLength);
101
    if (allseen)
102
    {
103
        set = 1;
104
        fltextbox = stringsetloc(
Make more friends,\nhave more breaks?
"Make more friends,\nhave more breaks?", "obj_dw_fcastle_cafe_slash_Draw_0_gml_109_0"
);
105
    }
106
    if (haveall && allseen)
107
    {
108
        set = 2;
109
        fltextbox = stringsetloc(
Everyone is\nfully relaxed!
"Everyone is\nfully relaxed!", "obj_dw_fcastle_cafe_slash_Draw_0_gml_115_0"
);
110
    }
111
    if (global.lang == "ja")
112
    {
113
        var _posx = mx - 16;
114
        var _posy = _my - 88;
115
        if (set == 1)
116
        {
117
            _posx = (mx - 16) + 52;
118
            _posy = (_my - 88) + 1;
119
        }
120
        if (set == 2)
121
        {
122
            _posx = ((mx - 16) + 52) - 20 - 8 - 10;
123
            _posy = (_my - 88) + 1 + 18;
124
        }
125
        draw_text(_posx, _posy, fltextbox);
126
    }
127
    else
128
    {
129
        draw_text(mx, (_my - 101) + 13, fltextbox);
130
    }
131
    
scr_darkbox_black
scr_darkbox_black

function
scr_darkbox_black(arg0, arg1, arg2, arg3)
{ draw_set_color(c_black); d_rectangle(arg0 + 20, arg1 + 20, arg2 - 20, arg3 - 20, false);
scr_darkbox(arg0, arg1, arg2, arg3);
draw_set_color(-1); }
(mx - 36 - dboxbord, my - 8 - dboxbord, mx + boxwid + dboxbord, my + (space * linecount) + maxnum + dboxbord + bonbot);
132
    mencount = 0;
133
    for (var i = 0; i < maxnum; i++)
134
    {
135
        if ((i + (page * maxnum)) < menuLength)
136
        {
137
            var thisMenuOpt = menuOptions[i + (page * maxnum)];
138
            var col = 16777215;
139
            var col2 = 16777215;
140
            if (thisMenuOpt.bought == false)
141
            {
142
                col2 = 8087653;
143
                col = col2;
144
            }
145
            if ((i + (page * maxnum)) == mpos)
146
            {
147
                col = 65535;
148
                col2 = merge_color(col2, c_yellow, 0.25);
149
            }
150
            if (!thisMenuOpt.watched)
151
            {
152
                col = 16777215;
153
                col2 = 65535;
154
                if ((i + (page * maxnum)) == mpos)
155
                    col2 = merge_color(c_white, c_yellow, 0.25);
156
            }
157
            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"));
158
            if (global.lang == "ja")
159
            {
160
                var drawfancy = true;
161
                if (drawfancy)
162
                {
163
                    var x1 = mx + 40 + 4;
164
                    draw_set_halign(fa_center);
165
                    draw_text_color(x1, my + (space * i), thisMenuOpt.name1, col, col, col2, col2, 1);
166
                    var x2 = mx + 116 + 2;
167
                    if (thisMenuOpt.name2 != "")
168
                        draw_text_color(x2, my + (space * i), nameAnd, col, col, col2, col2, 1);
169
                    var x3 = mx + 94 + 106 + 6;
170
                    draw_text_color(x3, my + (space * i), thisMenuOpt.name2, col, col, col2, col2, 1);
171
                    draw_set_halign(fa_left);
172
                }
173
                else
174
                {
175
                    draw_text_color(mx - 10, my + (space * i), thisMenuOpt.desc, col, col, col2, col2, 1);
176
                }
177
            }
178
            else
179
            {
180
                draw_text_color(mx, my + (space * i), thisMenuOpt.desc, col, col, col2, col2, 1);
181
            }
182
            var str = stringsetloc(
NEW
"NEW", "obj_dw_fcastle_cafe_slash_Draw_0_gml_153_0"
);
183
            if (!thisMenuOpt.watched)
184
            {
185
                var c = 
186
                {
187
                    a: 16777215,
188
                    b: 65535
189
                };
190
                if ((i + (page * maxnum)) == mpos)
191
                {
192
                    c.a = -1;
193
                    c.b = 7536639;
194
                }
195
                draw_set_halign(fa_right);
196
                if (global.lang == "ja")
197
                    draw_text_transformed_color((((mx + boxwid) - 11) + 8 + 2) - 2, my + (space * i) + 8, str, 0.5, 0.5, 0, c.a, c.a, c.b, c.b, 1);
198
                else
199
                    draw_text_color((mx + boxwid) - 11, my + (space * i), str, c.a, c.a, c.b, c.b, 1);
200
                draw_set_halign(fa_left);
201
            }
202
            draw_set_halign(fa_left);
203
            mencount++;
204
        }
205
    }
206
    draw_set_color(c_white);
207
    if (mpos < (page * maxnum))
208
    {
209
        mpos = ((page * maxnum) + mencount) - 1;
210
        update = true;
211
    }
212
    if (mpos > (((page * maxnum) + mencount) - 1))
213
    {
214
        mpos = page * maxnum;
215
        update = true;
216
    }
217
    var gray = 8087653;
218
    var thismpos = mpos - (page * maxnum);
219
    if (thismpos >= mencount)
220
        thismpos = 0;
221
    if (menu == 1)
222
    {
223
        var off = 0;
224
        if (global.lang == "ja")
225
            off = -8;
226
        draw_sprite_ext(spr_heart, 0, (mx - 22) + off, my + (space * (mpos - (page * maxnum))) + 8, 1, 1, 0, c_white, 1);
227
    }
228
    if (pagecount > 1)
229
    {
230
        draw_set_font(fnt_mainbig);
231
        var numspace = 24;
232
        var totalnumberwidth = (pagecount * (numspace / 2)) + ((pagecount - 1) * (numspace / 2));
233
        var actualboxwid = boxwid + 41;
234
        var boxl = mx - 38;
235
        var truex = (boxl + (actualboxwid / 2)) - (totalnumberwidth / 2);
236
        var thisy = my + (space * maxnum) + 8;
237
        for (var i = 0; i < pagecount; i++)
238
        {
239
            var thisx = truex + (i * numspace);
240
            draw_set_color(gray);
241
            if (i == page)
242
                draw_set_color(c_white);
243
            draw_text(thisx - 3, thisy - 9, string(i + 1));
244
            var coll = 16777215;
245
            var colr = 16777215;
246
            if (menu == 1)
247
            {
248
                coll = merge_color(gray, c_white, left_h());
249
                colr = merge_color(gray, c_white, right_h());
250
            }
251
            if (i == 0)
252
                draw_sprite_ext(spr_ui_arrow_left, 0, thisx - 18, thisy + 8, 1, 1, 0, coll, 1);
253
            if (i == (pagecount - 1))
254
                draw_sprite_ext(spr_ui_arrow_left, 0, thisx + 24, thisy + 8, -1, 1, 0, colr, 1);
255
            if (!instance_exists(obj_choicer_neo))
256
            {
257
                if (i == 0)
258
                {
259
                    if (left_p())
260
                    {
261
                        with (instance_create(thisx - 18, thisy + 8, obj_afterimage))
262
                        {
263
                            sprite_index = spr_ui_arrow_left;
264
                            image_xscale = 1;
265
                            hspeed = -3;
266
                            friction = 0.4;
267
                            fadeSpeed = 0.16666666666666666;
268
                        }
269
                    }
270
                }
271
                if (i == (pagecount - 1))
272
                {
273
                    if (right_p())
274
                    {
275
                        with (instance_create(thisx + 24, thisy + 8, obj_afterimage))
276
                        {
277
                            sprite_index = spr_ui_arrow_left;
278
                            image_xscale = -1;
279
                            hspeed = 3;
280
                            friction = 0.4;
281
                            fadeSpeed = 0.16666666666666666;
282
                        }
283
                    }
284
                }
285
            }
286
        }
287
        draw_set_color(-1);
288
        draw_set_halign(-1);
289
    }
290
    if (menu == 1)
291
    {
292
        if (button1_p())
293
        {
294
            menu = 0;
295
            with (tableselect)
296
                myinteract = 0;
297
            if (mpos == 0)
298
            {
299
                cutscene = 0;
300
                resetcamera = true;
301
                resetcameratimer = 0;
302
                global.interact = 0;
303
            }
304
            else
305
            {
306
                var opt1 = stringsetloc(
Break
"Break", "obj_dw_fcastle_cafe_slash_Draw_0_gml_242_0"
);
307
                var opt2 = stringsetloc(
Do not
"Do not", "obj_dw_fcastle_cafe_slash_Draw_0_gml_243_0"
);
308
                var bought = menuOptions[mpos].bought;
309
                if (bought == 0)
310
                {
311
                    choice = 0;
312
                    menu = 2;
313
                    var cost = menuOptions[mpos].cost;
314
                    
scr_speaker
scr_speaker

function
scr_speaker(arg0)
{ _speaker = arg0; global.typer = 5; if (global.darkzone == 1) global.typer = 6; if (global.fighting == 1) global.typer = 4; global.fc = 0; global.fe = 0; if (_speaker == "silent" && global.darkzone == 0) global.typer = 2; if (_speaker == "silent" && global.darkzone == 1) global.typer = 36; if (_speaker == "balloon" || _speaker == "enemy") global.typer = 50; if (_speaker == "sans") { global.typer = 14; global.fc = 6; } if (_speaker == "undyne" || _speaker == "und") { global.typer = 17; global.fc = 9; } if (_speaker == "temmie" || _speaker == "tem") global.typer = 21; if (_speaker == "jevil") global.typer = 35; if (_speaker == "catti") global.fc = 13; if (_speaker == "jockington" || _speaker == "joc") global.fc = 14; if (_speaker == "catty" || _speaker == "caddy") global.fc = 16; if (_speaker == "bratty" || _speaker == "bra") global.fc = 17; if (_speaker == "rouxls" || _speaker == "rou") global.fc = 18; if (_speaker == "burgerpants" || _speaker == "bur") global.fc = 19; if (_speaker == "spamton") { if (global.fighting == 0) global.typer = 66; else global.typer = 68; } if (_speaker == "sneo") global.typer = 67; if (_speaker == "susie" || _speaker == "sus") { global.fc = 1; global.typer = 10; if (global.darkzone == 1) { global.typer = 30; if (global.fighting == 1) global.typer = 47; } } if (_speaker == "ralsei" || _speaker == "ral") { global.fc = 2; global.typer = 31; if (global.fighting == 1) global.typer = 45; if (global.flag[30 ralsei_hat_state] == 1) global.typer = 6; } if (_speaker == "noelle" || _speaker == "noe") { global.fc = 3; if (global.darkzone == 0) global.typer = 12; else global.typer = 56; if (global.fighting == 1) global.typer = 59; } if (_speaker == "toriel" || _speaker == "tor") { global.fc = 4; global.typer = 7; } if (_speaker == "asgore" || _speaker == "asg") { global.fc = 10; global.typer = 18; if (global.darkzone == 1) global.typer = 89; } if (_speaker == "king" || _speaker == "kin") { global.fc = 20; global.typer = 33; if (global.chapter == 1) { if (global.plot < 235) global.typer = 36; ...
("no_name");
315
                    msgsetsubloc(0, 
* Take a break for Argument №11 Flowery Dollars?Wait for input
"* Take a break for ~1 Flowery Dollars?/", cost, "obj_dw_fcastle_cafe_slash_Draw_0_gml_251_0"
);
316
                    
scr_readychoicer
scr_readychoicer

function
scr_readychoicer(arg0 = "", arg1 = "", arg2 = "", arg3 = "", arg4 = -1, arg5 = -1)
{ global.msc = -99; global.choice = -1; global.choicemsg = [arg0, arg1, arg2, arg3]; var count = 2; if (arg2 != "") count++; if (arg3 != "") count++; var chooseString = "\\C" + string(count); if (arg4 == -1 && instance_exists(obj_cutscene_master)) arg4 = true; if (arg5) { if (arg4)
c_msgset(0, chooseString);
else msgset(0, chooseString); } else if (arg4) {
c_msgnext(chooseString);
} else { msgnext(chooseString); } }
(opt1, opt2);
317
                    d_make();
318
                }
319
                else
320
                {
321
                    choice = 0;
322
                    menu = 2;
323
                    menuOptions[mpos].cost = 0;
324
                    
scr_speaker
scr_speaker

function
scr_speaker(arg0)
{ _speaker = arg0; global.typer = 5; if (global.darkzone == 1) global.typer = 6; if (global.fighting == 1) global.typer = 4; global.fc = 0; global.fe = 0; if (_speaker == "silent" && global.darkzone == 0) global.typer = 2; if (_speaker == "silent" && global.darkzone == 1) global.typer = 36; if (_speaker == "balloon" || _speaker == "enemy") global.typer = 50; if (_speaker == "sans") { global.typer = 14; global.fc = 6; } if (_speaker == "undyne" || _speaker == "und") { global.typer = 17; global.fc = 9; } if (_speaker == "temmie" || _speaker == "tem") global.typer = 21; if (_speaker == "jevil") global.typer = 35; if (_speaker == "catti") global.fc = 13; if (_speaker == "jockington" || _speaker == "joc") global.fc = 14; if (_speaker == "catty" || _speaker == "caddy") global.fc = 16; if (_speaker == "bratty" || _speaker == "bra") global.fc = 17; if (_speaker == "rouxls" || _speaker == "rou") global.fc = 18; if (_speaker == "burgerpants" || _speaker == "bur") global.fc = 19; if (_speaker == "spamton") { if (global.fighting == 0) global.typer = 66; else global.typer = 68; } if (_speaker == "sneo") global.typer = 67; if (_speaker == "susie" || _speaker == "sus") { global.fc = 1; global.typer = 10; if (global.darkzone == 1) { global.typer = 30; if (global.fighting == 1) global.typer = 47; } } if (_speaker == "ralsei" || _speaker == "ral") { global.fc = 2; global.typer = 31; if (global.fighting == 1) global.typer = 45; if (global.flag[30 ralsei_hat_state] == 1) global.typer = 6; } if (_speaker == "noelle" || _speaker == "noe") { global.fc = 3; if (global.darkzone == 0) global.typer = 12; else global.typer = 56; if (global.fighting == 1) global.typer = 59; } if (_speaker == "toriel" || _speaker == "tor") { global.fc = 4; global.typer = 7; } if (_speaker == "asgore" || _speaker == "asg") { global.fc = 10; global.typer = 18; if (global.darkzone == 1) global.typer = 89; } if (_speaker == "king" || _speaker == "kin") { global.fc = 20; global.typer = 33; if (global.chapter == 1) { if (global.plot < 235) global.typer = 36; ...
("no_name");
325
                    msgsetloc(0, 
* Have this break?Wait for input
"* Have this break?/", "obj_dw_fcastle_cafe_slash_Draw_0_gml_262_0"
);
326
                    if (menuOptions[mpos].watched)
327
                        msgsetloc(0, 
* Have this break again?Wait for input
"* Have this break again?/", "obj_dw_fcastle_cafe_slash_Draw_0_gml_265_0"
);
328
                    
scr_readychoicer
scr_readychoicer

function
scr_readychoicer(arg0 = "", arg1 = "", arg2 = "", arg3 = "", arg4 = -1, arg5 = -1)
{ global.msc = -99; global.choice = -1; global.choicemsg = [arg0, arg1, arg2, arg3]; var count = 2; if (arg2 != "") count++; if (arg3 != "") count++; var chooseString = "\\C" + string(count); if (arg4 == -1 && instance_exists(obj_cutscene_master)) arg4 = true; if (arg5) { if (arg4)
c_msgset(0, chooseString);
else msgset(0, chooseString); } else if (arg4) {
c_msgnext(chooseString);
} else { msgnext(chooseString); } }
(opt1, opt2);
329
                    d_make();
330
                }
331
            }
332
        }
333
        else if (button2_p())
334
        {
335
            resetcamera = true;
336
            resetcameratimer = 0;
337
            mpos = remmpos;
338
            menu = 0;
339
            global.interact = 0;
340
            with (tableselect)
341
                myinteract = 0;
342
            setTable(0);
343
        }
344
    }
345
    if (update)
346
    {
347
        snd_play(snd_menumove);
348
        setTable(menuOptions[mpos].cutscene);
349
    }
350
}
351
if (menu == 2 && global.choice != -1)
352
{
353
    if (global.choice == 0)
354
    {
355
        var cost = menuOptions[mpos].cost;
356
        var haveenough = false;
357
        if (global.flag[1411] >= cost)
358
            haveenough = true;
359
        if (haveenough)
360
        {
361
            global.flag[1411] -= cost;
362
            snd_play(snd_item);
363
            scr_flowercutsceneFlag_set(menuOptions[mpos].key, 1);
364
            scr_flowercutsceneWatchedFlag_set(menuOptions[mpos].key, 1);
365
            menuOptions[mpos].bought = true;
366
            menuOptions[mpos].watched = true;
367
            menu = 0;
368
            with (tableselect)
369
                myinteract = 0;
370
            cutscene = 1;
371
            global.interact = 1;
372
            k_d();
373
        }
374
        else
375
        {
376
            k_d(1);
377
            
scr_speaker
scr_speaker

function
scr_speaker(arg0)
{ _speaker = arg0; global.typer = 5; if (global.darkzone == 1) global.typer = 6; if (global.fighting == 1) global.typer = 4; global.fc = 0; global.fe = 0; if (_speaker == "silent" && global.darkzone == 0) global.typer = 2; if (_speaker == "silent" && global.darkzone == 1) global.typer = 36; if (_speaker == "balloon" || _speaker == "enemy") global.typer = 50; if (_speaker == "sans") { global.typer = 14; global.fc = 6; } if (_speaker == "undyne" || _speaker == "und") { global.typer = 17; global.fc = 9; } if (_speaker == "temmie" || _speaker == "tem") global.typer = 21; if (_speaker == "jevil") global.typer = 35; if (_speaker == "catti") global.fc = 13; if (_speaker == "jockington" || _speaker == "joc") global.fc = 14; if (_speaker == "catty" || _speaker == "caddy") global.fc = 16; if (_speaker == "bratty" || _speaker == "bra") global.fc = 17; if (_speaker == "rouxls" || _speaker == "rou") global.fc = 18; if (_speaker == "burgerpants" || _speaker == "bur") global.fc = 19; if (_speaker == "spamton") { if (global.fighting == 0) global.typer = 66; else global.typer = 68; } if (_speaker == "sneo") global.typer = 67; if (_speaker == "susie" || _speaker == "sus") { global.fc = 1; global.typer = 10; if (global.darkzone == 1) { global.typer = 30; if (global.fighting == 1) global.typer = 47; } } if (_speaker == "ralsei" || _speaker == "ral") { global.fc = 2; global.typer = 31; if (global.fighting == 1) global.typer = 45; if (global.flag[30 ralsei_hat_state] == 1) global.typer = 6; } if (_speaker == "noelle" || _speaker == "noe") { global.fc = 3; if (global.darkzone == 0) global.typer = 12; else global.typer = 56; if (global.fighting == 1) global.typer = 59; } if (_speaker == "toriel" || _speaker == "tor") { global.fc = 4; global.typer = 7; } if (_speaker == "asgore" || _speaker == "asg") { global.fc = 10; global.typer = 18; if (global.darkzone == 1) global.typer = 89; } if (_speaker == "king" || _speaker == "kin") { global.fc = 20; global.typer = 33; if (global.chapter == 1) { if (global.plot < 235) global.typer = 36; ...
("no_name");
378
            msgsetloc(0, 
* You don't have enough Flowery Dollars...Wait for inputClose Message
"* You don't have enough Flowery Dollars.../%", "obj_dw_fcastle_cafe_slash_Draw_0_gml_321_0"
);
379
            d_make();
380
            menu = 2.01;
381
        }
382
    }
383
    if (global.choice == 1)
384
    {
385
        menu = 1;
386
        k_d();
387
    }
388
}
389
if (menu == 2.01 && !d_ex())
390
{
391
    menu = 1;
392
    k_d();
393
}