Deltarune (Chapter 3) 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)
{ var item_id = item[arg0]; 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 base_y_pos = (cameray() + 418) - 20; var line_height = 12; draw_sprite_ext(
scr_84_get_sprite("spr_shop_space_ui"), 0, camerax() + 555, base_y_pos, 1, 1, 0, c_white, 1);
draw_set_font(fnt_8bit); draw_text_ext_transformed(camerax() + 555 + 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, camerax() + 555, 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(camerax() + 555 + 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 = (cameray() + 418) - 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, camerax() + 555, 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, camerax() + 555, inventory_y_pos, 1, 1, 0, c_white, 1);
draw_set_font(fnt_8bit); draw_text_ext_transformed(camerax() + 555 + 1, base_y_pos + (line_height * 2) + 4, inventory_amount + "/48", 1, 999, 0.5, 0.5, 0); draw_set_font(fnt_main); } }
(arg0)
2
{
3
    var item_id = item[arg0];
4
    if (itemtype[arg0] == "item")
5
    {
6
        
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);
7
        var inventory_space = 12 - itemcount;
8
        var inventory_amount = "00";
9
        if (inventory_space < 10)
10
            inventory_amount = "0" + string(inventory_space);
11
        else
12
            inventory_amount = string(inventory_space);
13
        var base_y_pos = (cameray() + 418) - 20;
14
        var line_height = 12;
15
        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, camerax() + 555, base_y_pos, 1, 1, 0, c_white, 1);
16
        draw_set_font(fnt_8bit);
17
        draw_text_ext_transformed(camerax() + 555 + 1, base_y_pos + line_height + 4, inventory_amount + "/12", 1, 999, 0.5, 0.5, 0);
18
        draw_set_font(fnt_main);
19
        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, camerax() + 555, base_y_pos + (line_height * 2) + 8, 1, 1, 0, c_white, 1);
20
        
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);
21
        var storage_space = global.flag[64 storage_size] - itemcount;
22
        var storage_amount = "00";
23
        if (storage_space < 10)
24
            storage_amount = "0" + string(storage_space);
25
        else
26
            storage_amount = string(storage_space);
27
        draw_set_font(fnt_8bit);
28
        draw_text_ext_transformed(camerax() + 555 + 1, base_y_pos + (line_height * 3) + 12, storage_amount + "/" + string(global.flag[64 storage_size]), 1, 999, 0.5, 0.5, 0);
29
        draw_set_font(fnt_main);
30
    }
31
    else
32
    {
33
        var inventory_space = 0;
34
        if (itemtype[arg0] == "weapon")
35
        {
36
            
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);
37
            inventory_space = 48 - itemcount;
38
        }
39
        else
40
        {
41
            
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);
42
            inventory_space = 48 - itemcount;
43
        }
44
        var inventory_amount = "00";
45
        if (inventory_space < 10)
46
            inventory_amount = "0" + string(inventory_space);
47
        else
48
            inventory_amount = string(inventory_space);
49
        var base_y_pos = (cameray() + 418) - 8;
50
        var line_height = 12;
51
        var header_index = (itemtype[arg0] == "weapon") ? 3 : 4;
52
        var header_y_pos = langopt(base_y_pos, base_y_pos + line_height);
53
        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, camerax() + 555, header_y_pos, 1, 1, 0, c_white, 1);
54
        var inventory_y_pos = langopt(base_y_pos + line_height, base_y_pos);
55
        var inventory_index = (global.lang == "ja") ? 1 : 0;
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"), inventory_index, camerax() + 555, inventory_y_pos, 1, 1, 0, c_white, 1);
57
        draw_set_font(fnt_8bit);
58
        draw_text_ext_transformed(camerax() + 555 + 1, base_y_pos + (line_height * 2) + 4, inventory_amount + "/48", 1, 999, 0.5, 0.5, 0);
59
        draw_set_font(fnt_main);
60
    }
61
}