Deltarune (Chapter 4) script viewer

← back to main script listing

gml_GlobalScript_scr_shop_space_display

(view raw script w/o annotations or w/e)
1
function 
scr_shop_space_display
scr_shop_space_display

function
scr_shop_space_display(arg0, arg1 = 545, arg2 = 398)
{ var item_id = item[arg0]; var __cx = camerax(); var __cy = cameray(); if (itemtype[arg0] == "item") {
scr_itemcheck(0);
var inventory_space = 12 - itemcount; var inventory_amount = "00"; if (inventory_space < 10) inventory_amount = "0" + string(inventory_space); else inventory_amount = string(inventory_space); var y_offset = (global.lang == "ja") ? 4 : 0; var base_y_pos = __cy + arg2 + y_offset; var line_height = 12; draw_sprite_ext(
scr_84_get_sprite("spr_shop_space_ui"), 0, __cx + arg1, base_y_pos, 1, 1, 0, c_white, 1);
draw_set_font(fnt_8bit); draw_text_ext_transformed(__cx + arg1 + 1, base_y_pos + line_height + 4, inventory_amount + "/12", 1, 999, 0.5, 0.5, 0); draw_set_font(fnt_main); draw_sprite_ext(
scr_84_get_sprite("spr_shop_space_ui"), 2, __cx + arg1, base_y_pos + (line_height * 2) + 8, 1, 1, 0, c_white, 1);
scr_itemcheck_pocket(0);
var storage_space = global.flag[64 storage_size] - itemcount; var storage_amount = "00"; if (storage_space < 10) storage_amount = "0" + string(storage_space); else storage_amount = string(storage_space); draw_set_font(fnt_8bit); draw_text_ext_transformed(__cx + arg1 + 1, base_y_pos + (line_height * 3) + 12, storage_amount + "/" + string(global.flag[64 storage_size]), 1, 999, 0.5, 0.5, 0); draw_set_font(fnt_main); } else { var inventory_space = 0; if (itemtype[arg0] == "weapon") {
scr_weaponcheck_inventory(0);
inventory_space = 48 - itemcount; } else {
scr_armorcheck_inventory(0);
inventory_space = 48 - itemcount; } var inventory_amount = "00"; if (inventory_space < 10) inventory_amount = "0" + string(inventory_space); else inventory_amount = string(inventory_space); var base_y_pos = (__cy + arg2 + 20) - 8; var line_height = 12; var header_index = (itemtype[arg0] == "weapon") ? 3 : 4; var header_y_pos = langopt(base_y_pos, base_y_pos + line_height); draw_sprite_ext(
scr_84_get_sprite("spr_shop_space_ui"), header_index, __cx + arg1, header_y_pos, 1, 1, 0, c_white, 1);
var inventory_y_pos = langopt(base_y_pos + line_height, base_y_pos); var inventory_index = (global.lang == "ja") ? 1 : 0; draw_sprite_ext(
scr_84_get_sprite("spr_shop_space_ui"), inventory_index, __cx + arg1, inventory_y_pos, 1, 1, 0, c_white, 1);
draw_set_font(fnt_8bit); draw_text_ext_transformed(__cx + arg1 + 1, base_y_pos + (line_height * 2) + 4, inventory_amount + "/48", 1, 999, 0.5, 0.5, 0); draw_set_font(fnt_main); } } function scr_shopspace_displaybox(arg0 = "item", arg1 = 413, arg2 = 161, arg3 = true, arg4 = false) { var cx = camerax(); var cy = cameray(); var xpos = cx + (arg1 - 8); var ypos = cy + (arg2 - 8); var wid = 211; var hei = 97; if (arg3) { draw_sprite_ext(spr_pxwhite, 0, xpos + 18, ypos + 18, wid - 36, hei - 36, 0, c_black, 1);
scr_darkbox(xpos, ypos, xpos + wid, ypos + hei);
if (arg4) draw_sprite_ext(spr_pxwhite, 0, xpos + 22, (ypos - 2) + 8, 168, 2, 0, #9DA2C4, 1); } draw_set_color(c_white); draw_set_font(fnt_mainbig); draw_text(xpos + 39 + 8, ypos + 24 + 8, "$" + string(global.gold)); item = [0]; itemtype = [arg0];
scr_shop_space_display(0, (xpos - cx) + 131, (ypos - cy) + 21);
}
(arg0, arg1 = 545, arg2 = 398)
2
{
3
    var item_id = item[arg0];
4
    var __cx = camerax();
5
    var __cy = cameray();
6
    if (itemtype[arg0] == "item")
7
    {
8
        
scr_itemcheck
scr_itemcheck

function
scr_itemcheck(arg0)
{ haveit = 0; itemcount = 0; for (var __i = 0; __i < 12; __i += 1) { if (global.item[__i] == arg0) haveit = 1; if (global.item[__i] == arg0) itemcount += 1; } return haveit; }
(0);
9
        var inventory_space = 12 - itemcount;
10
        var inventory_amount = "00";
11
        if (inventory_space < 10)
12
            inventory_amount = "0" + string(inventory_space);
13
        else
14
            inventory_amount = string(inventory_space);
15
        var y_offset = (global.lang == "ja") ? 4 : 0;
16
        var base_y_pos = __cy + arg2 + y_offset;
17
        var line_height = 12;
18
        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_shop_space_ui"), 0, __cx + arg1, base_y_pos, 1, 1, 0, c_white, 1);
19
        draw_set_font(fnt_8bit);
20
        draw_text_ext_transformed(__cx + arg1 + 1, base_y_pos + line_height + 4, inventory_amount + "/12", 1, 999, 0.5, 0.5, 0);
21
        draw_set_font(fnt_main);
22
        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_shop_space_ui"), 2, __cx + arg1, base_y_pos + (line_height * 2) + 8, 1, 1, 0, c_white, 1);
23
        
scr_itemcheck_pocket
scr_itemcheck_pocket

function
scr_itemcheck_pocket(arg0)
{ haveit = 0; itemcount = 0; for (var __i = 0; __i < global.flag[64 storage_size]; __i += 1) { if (global.pocketitem[__i] == arg0) haveit = 1; if (global.pocketitem[__i] == arg0) itemcount += 1; } return haveit; }
(0);
24
        var storage_space = global.flag[64 storage_size] - itemcount;
25
        var storage_amount = "00";
26
        if (storage_space < 10)
27
            storage_amount = "0" + string(storage_space);
28
        else
29
            storage_amount = string(storage_space);
30
        draw_set_font(fnt_8bit);
31
        draw_text_ext_transformed(__cx + arg1 + 1, base_y_pos + (line_height * 3) + 12, storage_amount + "/" + string(global.flag[64 storage_size]), 1, 999, 0.5, 0.5, 0);
32
        draw_set_font(fnt_main);
33
    }
34
    else
35
    {
36
        var inventory_space = 0;
37
        if (itemtype[arg0] == "weapon")
38
        {
39
            
scr_weaponcheck_inventory
scr_weaponcheck_inventory

function
scr_weaponcheck_inventory(arg0)
{ haveit = 0; itemcount = 0; for (i = 0; i < 48; i += 1) { if (global.weapon[i] == arg0) haveit = 1; if (global.weapon[i] == arg0) itemcount += 1; } return haveit; }
(0);
40
            inventory_space = 48 - itemcount;
41
        }
42
        else
43
        {
44
            
scr_armorcheck_inventory
scr_armorcheck_inventory

function
scr_armorcheck_inventory(arg0)
{ haveit = 0; itemcount = 0; for (i = 0; i < 48; i += 1) { if (global.armor[i] == arg0) haveit = 1; if (global.armor[i] == arg0) itemcount += 1; } return haveit; }
(0);
45
            inventory_space = 48 - itemcount;
46
        }
47
        var inventory_amount = "00";
48
        if (inventory_space < 10)
49
            inventory_amount = "0" + string(inventory_space);
50
        else
51
            inventory_amount = string(inventory_space);
52
        var base_y_pos = (__cy + arg2 + 20) - 8;
53
        var line_height = 12;
54
        var header_index = (itemtype[arg0] == "weapon") ? 3 : 4;
55
        var header_y_pos = langopt(base_y_pos, base_y_pos + line_height);
56
        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_shop_space_ui"), header_index, __cx + arg1, header_y_pos, 1, 1, 0, c_white, 1);
57
        var inventory_y_pos = langopt(base_y_pos + line_height, base_y_pos);
58
        var inventory_index = (global.lang == "ja") ? 1 : 0;
59
        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_shop_space_ui"), inventory_index, __cx + arg1, inventory_y_pos, 1, 1, 0, c_white, 1);
60
        draw_set_font(fnt_8bit);
61
        draw_text_ext_transformed(__cx + arg1 + 1, base_y_pos + (line_height * 2) + 4, inventory_amount + "/48", 1, 999, 0.5, 0.5, 0);
62
        draw_set_font(fnt_main);
63
    }
64
}
65
66
function scr_shopspace_displaybox(arg0 = "item", arg1 = 413, arg2 = 161, arg3 = true, arg4 = false)
67
{
68
    var cx = camerax();
69
    var cy = cameray();
70
    var xpos = cx + (arg1 - 8);
71
    var ypos = cy + (arg2 - 8);
72
    var wid = 211;
73
    var hei = 97;
74
    if (arg3)
75
    {
76
        draw_sprite_ext(spr_pxwhite, 0, xpos + 18, ypos + 18, wid - 36, hei - 36, 0, c_black, 1);
77
        
scr_darkbox
scr_darkbox

function
scr_darkbox(arg0, arg1, arg2, arg3)
{ if (!variable_instance_exists(id, "cur_jewel")) cur_jewel = 0; cur_jewel += 1; textbox_width = arg2 - arg0 - 63; if (textbox_width < 0) textbox_width = 0; textbox_height = arg3 - arg1 - 63; if (textbox_height < 0) textbox_height = 0; if (textbox_width > 0) { draw_sprite_stretched(spr_textbox_top, 0, arg0 + 32, arg1, textbox_width, 32); draw_sprite_ext(spr_textbox_top, 0, arg0 + 32, arg3 + 1, textbox_width, -2, 0, c_white, 1); } if (textbox_height > 0) { draw_sprite_ext(spr_textbox_left, 0, arg2 + 1, arg1 + 32, -2, textbox_height, 0, c_white, 1); draw_sprite_ext(spr_textbox_left, 0, arg0, arg1 + 32, 2, textbox_height, 0, c_white, 1); } if (global.flag[8 simplify_vfx] == 0) { draw_sprite_ext(spr_textbox_topleft, cur_jewel / 10, arg0, arg1, 2, 2, 0, c_white, 1); draw_sprite_ext(spr_textbox_topleft, cur_jewel / 10, arg2 + 1, arg1, -2, 2, 0, c_white, 1); draw_sprite_ext(spr_textbox_topleft, cur_jewel / 10, arg0, arg3 + 1, 2, -2, 0, c_white, 1); draw_sprite_ext(spr_textbox_topleft, cur_jewel / 10, arg2 + 1, arg3 + 1, -2, -2, 0, c_white, 1); } else { draw_sprite_ext(spr_textbox_topleft, 0, arg0, arg1, 2, 2, 0, c_white, 1); draw_sprite_ext(spr_textbox_topleft, 0, arg2 + 1, arg1, -2, 2, 0, c_white, 1); draw_sprite_ext(spr_textbox_topleft, 0, arg0, arg3 + 1, 2, -2, 0, c_white, 1); draw_sprite_ext(spr_textbox_topleft, 0, arg2 + 1, arg3 + 1, -2, -2, 0, c_white, 1); } }
(xpos, ypos, xpos + wid, ypos + hei);
78
        if (arg4)
79
            draw_sprite_ext(spr_pxwhite, 0, xpos + 22, (ypos - 2) + 8, 168, 2, 0, #9DA2C4, 1);
80
    }
81
    draw_set_color(c_white);
82
    draw_set_font(fnt_mainbig);
83
    draw_text(xpos + 39 + 8, ypos + 24 + 8, "$" + string(global.gold));
84
    item = [0];
85
    itemtype = [arg0];
86
    
scr_shop_space_display
scr_shop_space_display

function
scr_shop_space_display(arg0, arg1 = 545, arg2 = 398)
{ var item_id = item[arg0]; var __cx = camerax(); var __cy = cameray(); if (itemtype[arg0] == "item") {
scr_itemcheck(0);
var inventory_space = 12 - itemcount; var inventory_amount = "00"; if (inventory_space < 10) inventory_amount = "0" + string(inventory_space); else inventory_amount = string(inventory_space); var y_offset = (global.lang == "ja") ? 4 : 0; var base_y_pos = __cy + arg2 + y_offset; var line_height = 12; draw_sprite_ext(
scr_84_get_sprite("spr_shop_space_ui"), 0, __cx + arg1, base_y_pos, 1, 1, 0, c_white, 1);
draw_set_font(fnt_8bit); draw_text_ext_transformed(__cx + arg1 + 1, base_y_pos + line_height + 4, inventory_amount + "/12", 1, 999, 0.5, 0.5, 0); draw_set_font(fnt_main); draw_sprite_ext(
scr_84_get_sprite("spr_shop_space_ui"), 2, __cx + arg1, base_y_pos + (line_height * 2) + 8, 1, 1, 0, c_white, 1);
scr_itemcheck_pocket(0);
var storage_space = global.flag[64 storage_size] - itemcount; var storage_amount = "00"; if (storage_space < 10) storage_amount = "0" + string(storage_space); else storage_amount = string(storage_space); draw_set_font(fnt_8bit); draw_text_ext_transformed(__cx + arg1 + 1, base_y_pos + (line_height * 3) + 12, storage_amount + "/" + string(global.flag[64 storage_size]), 1, 999, 0.5, 0.5, 0); draw_set_font(fnt_main); } else { var inventory_space = 0; if (itemtype[arg0] == "weapon") {
scr_weaponcheck_inventory(0);
inventory_space = 48 - itemcount; } else {
scr_armorcheck_inventory(0);
inventory_space = 48 - itemcount; } var inventory_amount = "00"; if (inventory_space < 10) inventory_amount = "0" + string(inventory_space); else inventory_amount = string(inventory_space); var base_y_pos = (__cy + arg2 + 20) - 8; var line_height = 12; var header_index = (itemtype[arg0] == "weapon") ? 3 : 4; var header_y_pos = langopt(base_y_pos, base_y_pos + line_height); draw_sprite_ext(
scr_84_get_sprite("spr_shop_space_ui"), header_index, __cx + arg1, header_y_pos, 1, 1, 0, c_white, 1);
var inventory_y_pos = langopt(base_y_pos + line_height, base_y_pos); var inventory_index = (global.lang == "ja") ? 1 : 0; draw_sprite_ext(
scr_84_get_sprite("spr_shop_space_ui"), inventory_index, __cx + arg1, inventory_y_pos, 1, 1, 0, c_white, 1);
draw_set_font(fnt_8bit); draw_text_ext_transformed(__cx + arg1 + 1, base_y_pos + (line_height * 2) + 4, inventory_amount + "/48", 1, 999, 0.5, 0.5, 0); draw_set_font(fnt_main); } } function scr_shopspace_displaybox(arg0 = "item", arg1 = 413, arg2 = 161, arg3 = true, arg4 = false) { var cx = camerax(); var cy = cameray(); var xpos = cx + (arg1 - 8); var ypos = cy + (arg2 - 8); var wid = 211; var hei = 97; if (arg3) { draw_sprite_ext(spr_pxwhite, 0, xpos + 18, ypos + 18, wid - 36, hei - 36, 0, c_black, 1);
scr_darkbox(xpos, ypos, xpos + wid, ypos + hei);
if (arg4) draw_sprite_ext(spr_pxwhite, 0, xpos + 22, (ypos - 2) + 8, 168, 2, 0, #9DA2C4, 1); } draw_set_color(c_white); draw_set_font(fnt_mainbig); draw_text(xpos + 39 + 8, ypos + 24 + 8, "$" + string(global.gold)); item = [0]; itemtype = [arg0];
scr_shop_space_display(0, (xpos - cx) + 131, (ypos - cy) + 21);
}
(0, (xpos - cx) + 131, (ypos - cy) + 21);
87
}