From bb481bc3ccf3e2c355af4df4d12c5d6ebfae3d17 Mon Sep 17 00:00:00 2001 From: judicornadamsfoster Date: Sun, 5 Jul 2026 21:04:20 +0100 Subject: [PATCH] Created Increase item bag capacity (markdown) --- Increase-item-bag-capacity.md | 135 ++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 Increase-item-bag-capacity.md diff --git a/Increase-item-bag-capacity.md b/Increase-item-bag-capacity.md new file mode 100644 index 0000000..1e3a410 --- /dev/null +++ b/Increase-item-bag-capacity.md @@ -0,0 +1,135 @@ + +original source: [MapleFall's pokecommunity post](https://www.pokecommunity.com/threads/simple-modifications-directory.416647/page-20#post-10523495) and +[Lunos' 999 items branch](https://github.com/LOuroboros/pokeemerald/tree/999items) + +This code increases the bag item capacity from 99 up to 999 items + +pokeemerald-0 +pokeemerald-2 + + +> `include/shop.h` is now at `src/shop.c` and is slightly different code to the original + +__________ + +### include/constants/items.h + +change `#define MAX_BAG_ITEM_CAPACITY 99` (at line 451) +to +``` +#define MAX_BAG_ITEM_CAPACITY 999 +``` +__ + +change `#define BAG_ITEM_CAPACITY_DIGITS 2` (at line 455) +to +``` +#define BAG_ITEM_CAPACITY_DIGITS 3 +``` + +__________ + +### include/global.h + +in section `struct PyramidBag` (line 224) +change `u8 quantity[FRONTIER_LVL_MODE_COUNT][PYRAMID_BAG_ITEMS_COUNT];` +to +``` + u16 quantity[FRONTIER_LVL_MODE_COUNT][PYRAMID_BAG_ITEMS_COUNT]; +``` + +__________ + +### src/shop.c +(data no longer stored in include/shop.h) + +in section `struct ShopData` (line 94) +change `u8 maxQuantity;` +to +``` + u16 maxQuantity; +``` + +__________ + +### src/battle_pyramid_bag.c + +in these 3 sections (they are all after each other) +`static void SwapItems(u8 id1, u8 id2)` (line 725) +`static void MovePyramidBagItemSlotInList(u8 from, u8 to)` (line 735) +`static void CompactItems(void)` (line 768) + +change `u8 *quantities = gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode];` +to +``` + u16 *quantities = gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode]; +``` +__ + +in section void `TryStoreHeldItemsInPyramidBag(void)` (line 1402) +change `u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));` +to +``` + u16 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); +``` + +__________ + +### src/item.c + +in these 4 sections (they're all after each other): +`static bool8 CheckPyramidBagHasItem(u16 itemId, u16 count)` (line 685) +`static bool8 CheckPyramidBagHasSpace(u16 itemId, u16 count)` (line 707) +`bool8 AddPyramidBagItem(u16 itemId, u16 count)` (line 729) +`bool8 RemovePyramidBagItem(u16 itemId, u16 count)` (line 802) + +change `u8 *quantities = gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode];` +to +``` + u16 *quantities = gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode]; +``` + +in these 2 sections: +`bool8 AddPyramidBagItem(u16 itemId, u16 count)` (line 729) +`bool8 RemovePyramidBagItem(u16 itemId, u16 count)` (line 802) + +change `u8 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities));` +to +``` + u16 *newQuantities = Alloc(PYRAMID_BAG_ITEMS_COUNT * sizeof(*newQuantities)); +``` + +__________ + +### src/scrcmd.c + +> these 4 sections are after each other + +__ +in section `bool8 ScrCmd_additem(struct ScriptContext *ctx)` (line 488) +change `gSpecialVar_Result = AddBagItem(itemId, (u8)quantity);` +to +``` + gSpecialVar_Result = AddBagItem(itemId, quantity); +``` +__ +in section `bool8 ScrCmd_removeitem(struct ScriptContext *ctx)` (line 497) +change `gSpecialVar_Result = RemoveBagItem(itemId, (u8)quantity);` +to +``` + gSpecialVar_Result = RemoveBagItem(itemId, quantity); +``` +__ +in section `bool8 ScrCmd_checkitemspace(struct ScriptContext *ctx)` (line 506) +change `gSpecialVar_Result = CheckBagHasSpace(itemId, (u8)quantity);` +to +``` + gSpecialVar_Result = CheckBagHasSpace(itemId, quantity); +``` + +in section `bool8 ScrCmd_checkitem(struct ScriptContext *ctx)` (line 515) +change `gSpecialVar_Result = CheckBagHasItem(itemId, (u8)quantity);` +to +``` + gSpecialVar_Result = CheckBagHasItem(itemId, quantity); +```