Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_b2westshop_Draw_0

(view raw script w/o annotations or w/e)
1
if (active && 
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
2
{
3
    if (obj_board_camera.shift == "none")
4
    {
5
        
scr_board_objname
scr_board_objname

function
scr_board_objname()
{ if (
scr_debug())
{ if (global.chemg_show_room) { var __cx = board_tilex(12) - 2; var __cy = board_tiley(0); if (argument_count >= 1) __cx = argument0; if (argument_count >= 2) __cy = argument1; draw_set_halign(fa_right); draw_set_font(fnt_main); draw_set_color(c_aqua); draw_text_outline(__cx, __cy, string_copy(object_get_name(object_index), 5, 99)); draw_set_font(fnt_small); draw_set_halign(fa_left); draw_set_color(c_white); } } }
();
6
        var count = 0;
7
    }
8
}
9
if (active && obj_board_camera.con == 0)
10
{
11
    timer++;
12
    if ((timer % 2) == 0 && timer > 0 && texttimer <= (string_length(shopstring) + 20))
13
    {
14
        texttimer++;
15
        if (texttimer < string_length(shopstring))
16
        {
17
            if (string_char_at(shopstring, texttimer) != " " && string_char_at(shopstring, texttimer) != "#")
18
                snd_play(snd_board_text_main);
19
        }
20
        if (texttimer == string_length(shopstring))
21
        {
22
            textcomplete = true;
23
            snd_play(snd_board_text_main_end);
24
        }
25
    }
26
    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); }
("8bit"));
27
    draw_set_color(c_white);
28
    var currentstring = string_hash_to_newline(string_copy(shopstring, 1, texttimer));
29
    var txtwidth = string_width(string_hash_to_newline(shopstring));
30
    if (drawtext)
31
        draw_text_ext((320 - (round(txtwidth) / 2)) + 4, board_tiley(2) + 12, currentstring, 24, 640);
32
    var linespace = 18;
33
    if (i_ex(key) && (textcomplete || forcedraw || drawitanyways))
34
    {
35
        draw_text((key.x + 16) - (round(string_width(keystring)) / 2), key.y + 32 + 4, keystring);
36
        draw_text((key.x + 16) - (round(string_width(string(key.cost))) / 2), key.y + 32 + 4 + linespace, string(key.cost));
37
    }
38
    if (i_ex(candy) && (textcomplete || forcedraw || drawitanyways))
39
    {
40
        draw_set_halign(fa_center);
41
        if (pocketcheck == 0)
42
        {
43
            pocketcheck = 1;
44
            emptypocket = scr_pocketspace() + 
scr_inventoryspace
scr_inventoryspace

function
scr_inventoryspace()
{ var freespace = 0; var inventoryspace = 12; for (var i = 0; i < inventoryspace; i++) { if (global.item[i] == 0) freespace++; } debug_message("from " + object_get_name(object_index) + ":
scr_inventoryspace(): free inventory slots=" + string(freespace));
return freespace; } function scr_pocketspace() { var pocketspace = 0; for (var i = 0; i < global.flag[64 storage_size]; i++) { if (global.pocketitem[i] == 0) pocketspace++; } debug_message("from " + object_get_name(object_index) + ": scr_pocketspace(): free pocket slots=" + string(pocketspace)); return pocketspace; }
();
45
        }
46
        if (!emptypocket)
47
            draw_set_color(c_gray);
48
        if (candy.cost == 0 && emptypocket)
49
        {
50
            if (candy.myinteract < 3)
51
            {
52
                var remfont = draw_get_font();
53
                draw_set_font(fnt_8bit);
54
                draw_text(candy.x + 16, candy.y + 32 + 4, string_hash_to_newline(freestring));
55
                draw_set_font(remfont);
56
            }
57
        }
58
        else
59
        {
60
            draw_text(candy.x + 16, candy.y + 32 + 4, string_hash_to_newline(candy.mystring));
61
        }
62
        draw_set_color(c_white);
63
        draw_set_halign(fa_left);
64
    }
65
}