diff options
| author | Pepe20129 <72659707+Pepe20129@users.noreply.github.com> | 2024-07-17 18:42:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-17 09:42:56 -0700 |
| commit | a5c0cede12d3a53cb0f1069a5d4a5c4febe991fa (patch) | |
| tree | 7e26a7af9e34c4d9630f7fee5e13ffbeac6dcc5a /soh/src/code | |
| parent | f2958aea1ccf8419e0fd8b77324e77739c8c0da3 (diff) | |
Rando: Shuffle consumable bags (#3959)
* Main implementation
* Fix sticks & nuts from shops & checks
* Change the models to normal stick & nut
Worth noting that before you have the bags, the refills are blue rupees so there will not be model collision
* Update hook_handlers.cpp
Diffstat (limited to 'soh/src/code')
| -rw-r--r-- | soh/src/code/z_parameter.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 658e96394..2f39ade8c 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1926,6 +1926,26 @@ u8 Return_Item(u8 itemID, ModIndex modId, ItemID returnItem) { * @return u8 */ u8 Item_Give(PlayState* play, u8 item) { + //prevents getting sticks without the bag in case something got missed + if ( + IS_RANDO && + (item == ITEM_STICK || item == ITEM_STICKS_5 || item == ITEM_STICKS_10) && + Randomizer_GetSettingValue(RSK_SHUFFLE_DEKU_STICK_BAG) && + CUR_UPG_VALUE(UPG_STICKS) == 0 + ) { + return; + } + + //prevents getting nuts without the bag in case something got missed + if ( + IS_RANDO && + (item == ITEM_NUT || item == ITEM_NUTS_5 || item == ITEM_NUTS_10) && + Randomizer_GetSettingValue(RSK_SHUFFLE_DEKU_NUT_BAG) && + CUR_UPG_VALUE(UPG_NUTS) == 0 + ) { + return; + } + lusprintf(__FILE__, __LINE__, 2, "Item Give - item: %#x", item); static s16 sAmmoRefillCounts[] = { 5, 10, 20, 30, 5, 10, 30, 0, 5, 20, 1, 5, 20, 50, 200, 10 }; s16 i; @@ -2776,6 +2796,20 @@ u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) { return Return_Item_Entry(giEntry, RG_NONE); } + if (item == RG_DEKU_STICK_BAG) { + Inventory_ChangeUpgrade(UPG_STICKS, 1); + INV_CONTENT(ITEM_STICK) = ITEM_STICK; + AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS); + return Return_Item_Entry(giEntry, RG_NONE); + } + + if (item == RG_DEKU_NUT_BAG) { + Inventory_ChangeUpgrade(UPG_NUTS, 1); + INV_CONTENT(ITEM_NUT) = ITEM_NUT; + AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS); + return Return_Item_Entry(giEntry, RG_NONE); + } + temp = gSaveContext.inventory.items[slot]; osSyncPrintf("Item_Register(%d)=%d %d\n", slot, item, temp); INV_CONTENT(item) = item; |
