From a04e0104f9db69a7ec74aaaa886ad9f8314dc029 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 10 Mar 2020 19:40:37 +1100 Subject: [PATCH] Inventory in classic+hax mode should be the same as classic mode This also matches how it appears in original classic and WoM --- src/Inventory.c | 16 ++++------------ src/Inventory.h | 2 ++ src/Screens.c | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/Inventory.c b/src/Inventory.c index b446703db..a7fd35f77 100644 --- a/src/Inventory.c +++ b/src/Inventory.c @@ -76,20 +76,11 @@ static const cc_uint8 classicInventory[42] = { BLOCK_INDIGO, BLOCK_VIOLET, BLOCK_MAGENTA, BLOCK_PINK, BLOCK_BLACK, BLOCK_GRAY, BLOCK_WHITE, BLOCK_COAL_ORE, BLOCK_IRON_ORE, BLOCK_GOLD_ORE, BLOCK_IRON, BLOCK_GOLD, BLOCK_BOOKSHELF, BLOCK_TNT, BLOCK_OBSIDIAN, }; -static const cc_uint8 classicHacksInventory[49] = { - BLOCK_STONE, BLOCK_GRASS, BLOCK_COBBLE, BLOCK_BRICK, BLOCK_DIRT, BLOCK_WOOD, BLOCK_BEDROCK, BLOCK_WATER, BLOCK_STILL_WATER, BLOCK_LAVA, - BLOCK_STILL_LAVA, BLOCK_LOG, BLOCK_LEAVES, BLOCK_GLASS, BLOCK_SLAB, BLOCK_MOSSY_ROCKS, BLOCK_SAPLING, BLOCK_DANDELION, BLOCK_ROSE, BLOCK_BROWN_SHROOM, - BLOCK_RED_SHROOM, BLOCK_SAND, BLOCK_GRAVEL, BLOCK_SPONGE, BLOCK_RED, BLOCK_ORANGE, BLOCK_YELLOW, BLOCK_LIME, BLOCK_GREEN, BLOCK_TEAL, - BLOCK_AQUA, BLOCK_CYAN, BLOCK_BLUE, BLOCK_INDIGO, BLOCK_VIOLET, BLOCK_MAGENTA, BLOCK_PINK, BLOCK_BLACK, BLOCK_GRAY, BLOCK_WHITE, - BLOCK_COAL_ORE, BLOCK_IRON_ORE, BLOCK_GOLD_ORE, BLOCK_DOUBLE_SLAB, BLOCK_IRON, BLOCK_GOLD, BLOCK_BOOKSHELF, BLOCK_TNT, BLOCK_OBSIDIAN, -}; static BlockID Inventory_DefaultMapping(int slot) { - if (Game_PureClassic) { - if (slot < 9 * 4 + 6) return classicInventory[slot]; - } else if (Game_ClassicMode) { - if (slot < 10 * 4 + 9) return classicHacksInventory[slot]; - } else if (slot < BLOCK_MAX_CPE) { + if (Game_ClassicMode) { + if (slot < 9 * 4 + 6) return classicInventory[slot]; + }else if (slot < BLOCK_MAX_CPE) { return (BlockID)(slot + 1); } return BLOCK_AIR; @@ -134,6 +125,7 @@ static void Inventory_Reset(void) { static void Inventory_Init(void) { BlockID* inv = Inventory.Table; Inventory_Reset(); + Inventory.BlocksPerRow = Game_ClassicMode ? 9 : 10; inv[0] = BLOCK_STONE; inv[1] = BLOCK_COBBLE; inv[2] = BLOCK_BRICK; inv[3] = BLOCK_DIRT; inv[4] = BLOCK_WOOD; inv[5] = BLOCK_LOG; diff --git a/src/Inventory.h b/src/Inventory.h index 3c0926c41..0bf35c276 100644 --- a/src/Inventory.h +++ b/src/Inventory.h @@ -25,6 +25,8 @@ CC_VAR extern struct _InventoryData { int Offset; /* Whether the user is allowed to change selected/held block. */ cc_bool CanChangeSelected; + /* Number of blocks in each row in inventory menu. */ + cc_uint8 BlocksPerRow; } Inventory; /* Gets the block at the nth index in the current hotbar. */ diff --git a/src/Screens.c b/src/Screens.c index 8c394a95e..b410b4724 100644 --- a/src/Screens.c +++ b/src/Screens.c @@ -1070,7 +1070,7 @@ static void InventoryScreen_Init(void* screen) { TableWidget_Create(&s->table); s->table.font = &s->font; - s->table.blocksPerRow = Game_PureClassic ? 9 : 10; + s->table.blocksPerRow = Inventory.BlocksPerRow; TableWidget_RecreateBlocks(&s->table); /* Can't immediately move to selected here, because cursor grabbed */