diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 957613b17..26fcc992d 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1843,16 +1843,16 @@ void Randomizer::ParseItemLocationsFile(const char* spoilerFileName, bool silent } } -GetItemID Randomizer::GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum) { - GetItemID itemId = GetItemFromActor(actorId, actorParams, sceneNum, ogId); +s16 Randomizer::GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum) { + s16 itemId = GetItemFromActor(actorId, actorParams, sceneNum, ogId); return itemId; } -GetItemID Randomizer::GetItemFromActor(s16 actorId, s16 actorParams, s16 sceneNum, GetItemID ogItemId) { +s16 Randomizer::GetItemFromActor(s16 actorId, s16 actorParams, s16 sceneNum, GetItemID ogItemId) { return GetItemFromGet(this->itemLocations[GetCheckFromActor(sceneNum, actorId, actorParams)], ogItemId); } -GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId) { +s16 Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId) { switch (randoGet) { case RG_NONE: return ogItemId; @@ -2067,49 +2067,6 @@ GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId) return GI_BOTTLE; case RG_BOTTLE_WITH_MILK: return GI_MILK_BOTTLE; - - case RG_DEKU_TREE_MAP: - case RG_DODONGOS_CAVERN_MAP: - case RG_JABU_JABUS_BELLY_MAP: - case RG_FOREST_TEMPLE_MAP: - case RG_FIRE_TEMPLE_MAP: - case RG_WATER_TEMPLE_MAP: - case RG_SPIRIT_TEMPLE_MAP: - case RG_SHADOW_TEMPLE_MAP: - case RG_BOTTOM_OF_THE_WELL_MAP: - case RG_ICE_CAVERN_MAP: - return GI_MAP; - - case RG_DEKU_TREE_COMPASS: - case RG_DODONGOS_CAVERN_COMPASS: - case RG_JABU_JABUS_BELLY_COMPASS: - case RG_FOREST_TEMPLE_COMPASS: - case RG_FIRE_TEMPLE_COMPASS: - case RG_WATER_TEMPLE_COMPASS: - case RG_SPIRIT_TEMPLE_COMPASS: - case RG_SHADOW_TEMPLE_COMPASS: - case RG_BOTTOM_OF_THE_WELL_COMPASS: - case RG_ICE_CAVERN_COMPASS: - return GI_COMPASS; - - case RG_FOREST_TEMPLE_BOSS_KEY: - case RG_FIRE_TEMPLE_BOSS_KEY: - case RG_WATER_TEMPLE_BOSS_KEY: - case RG_SPIRIT_TEMPLE_BOSS_KEY: - case RG_SHADOW_TEMPLE_BOSS_KEY: - case RG_GANONS_CASTLE_BOSS_KEY: - return GI_KEY_BOSS; - - case RG_FOREST_TEMPLE_SMALL_KEY: - case RG_FIRE_TEMPLE_SMALL_KEY: - case RG_WATER_TEMPLE_SMALL_KEY: - case RG_SPIRIT_TEMPLE_SMALL_KEY: - case RG_SHADOW_TEMPLE_SMALL_KEY: - case RG_BOTTOM_OF_THE_WELL_SMALL_KEY: - case RG_GERUDO_TRAINING_GROUNDS_SMALL_KEY: - case RG_GERUDO_FORTRESS_SMALL_KEY: - case RG_GANONS_CASTLE_SMALL_KEY: - return GI_KEY_SMALL; // todo test this with keys in own dungeon case RG_TREASURE_GAME_SMALL_KEY: @@ -2201,6 +2158,9 @@ GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId) return GI_RUPEE_BLUE; //todo default: + if (!IsItemVanilla(randoGet)) { + return randoGet; + } return ogItemId; } } @@ -4575,7 +4535,7 @@ void InitRandoItemTable() { GetItemEntry randoGetItemTable[] = { GET_ITEM(RG_ICE_TRAP, OBJECT_GI_RUPY, GID_RUPEE_GOLD, 0, 0x80, CHEST_ANIM_SHORT, MOD_RANDOMIZER, RG_ICE_TRAP), GET_ITEM(RG_MAGIC_SINGLE, OBJECT_GI_MAGICPOT, GID_MAGIC_SMALL, 0xE4, 0x80, CHEST_ANIM_LONG, MOD_RANDOMIZER, RG_MAGIC_SINGLE), - GET_ITEM(RG_MAGIC_DOUBLE, OBJECT_GI_MAGICPOT, GID_MAGIC_LARGE, 0xE8, 0x80, CHEST_ANIM_LONG, MOD_RANDOMIZER, MOD_RANDOMIZER, RG_MAGIC_DOUBLE), + GET_ITEM(RG_MAGIC_DOUBLE, OBJECT_GI_MAGICPOT, GID_MAGIC_LARGE, 0xE8, 0x80, CHEST_ANIM_LONG, MOD_RANDOMIZER, RG_MAGIC_DOUBLE), GET_ITEM(RG_DOUBLE_DEFENSE, OBJECT_GI_HEARTS, GID_HEART_CONTAINER, 0xE9, 0x80, CHEST_ANIM_LONG, MOD_RANDOMIZER, RG_DOUBLE_DEFENSE), GET_ITEM(RG_BOTTLE_WITH_RED_POTION, OBJECT_GI_LIQUID, GID_POTION_RED, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, MOD_RANDOMIZER, RG_BOTTLE_WITH_RED_POTION), GET_ITEM(RG_BOTTLE_WITH_GREEN_POTION, OBJECT_GI_LIQUID, GID_POTION_GREEN, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, MOD_RANDOMIZER, RG_BOTTLE_WITH_GREEN_POTION), diff --git a/soh/soh/Enhancements/randomizer/randomizer.h b/soh/soh/Enhancements/randomizer/randomizer.h index f6aa8279a..b9d1caac7 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.h +++ b/soh/soh/Enhancements/randomizer/randomizer.h @@ -16,8 +16,8 @@ class Randomizer { std::string ganonHintText; std::string ganonText; std::unordered_map randoSettings; - GetItemID GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId); - GetItemID GetItemFromActor(s16 actorId, s16 actorParams, s16 sceneNum, GetItemID ogItemId); + s16 GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId); + s16 GetItemFromActor(s16 actorId, s16 actorParams, s16 sceneNum, GetItemID ogItemId); void ParseRandomizerSettingsFile(const char* spoilerFileName); void ParseHintLocationsFile(const char* spoilerFileName); void ParseItemLocationsFile(const char* spoilerFileName, bool silent); @@ -46,7 +46,7 @@ class Randomizer { std::string GetGanonText() const; std::string GetGanonHintText() const; GetItemID GetRandomizedItemIdFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId); - GetItemID GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum); + s16 GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum); static void CreateCustomMessages(); bool CheckContainsVanillaItem(RandomizerCheck randoCheck); }; diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 9ade808d0..3644f5958 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -2223,7 +2223,7 @@ u16 Randomizer_Item_Give(GlobalContext* globalCtx, GetItemEntry giEntry) { return ITEM_NONE; } } - } else if ((item >= RG_GERUDO_FORTRESS_SMALL_KEY && item <= RG_GANONS_CASTLE_SMALL_KEY) || + } else if ((item >= RG_FOREST_TEMPLE_SMALL_KEY && item <= RG_GANONS_CASTLE_SMALL_KEY) || (item >= RG_FOREST_TEMPLE_BOSS_KEY && item <= RG_GANONS_CASTLE_BOSS_KEY) || (item >= RG_DEKU_TREE_MAP && item <= RG_ICE_CAVERN_MAP) || (item >= RG_DEKU_TREE_COMPASS && item <= RG_ICE_CAVERN_COMPASS)) { @@ -2294,7 +2294,7 @@ u16 Randomizer_Item_Give(GlobalContext* globalCtx, GetItemEntry giEntry) { break; } - if ((item >= RG_GERUDO_FORTRESS_SMALL_KEY) && (item <= RG_GANONS_CASTLE_SMALL_KEY)) { + if ((item >= RG_FOREST_TEMPLE_SMALL_KEY) && (item <= RG_GANONS_CASTLE_SMALL_KEY)) { if (gSaveContext.inventory.dungeonKeys[mapIndex] < 0) { gSaveContext.inventory.dungeonKeys[mapIndex] = 1; return RG_NONE; diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index ae2b363e2..73d281793 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -507,7 +507,7 @@ void GiveLinkDungeonItem(GetItemID getItemId) { } void GiveLinksPocketMedallion() { - GetItemID getItemId = Randomizer_GetItemIdFromKnownCheck(RC_LINKS_POCKET, RG_NONE); + RandomizerGet getItemId = Randomizer_GetItemIdFromKnownCheck(RC_LINKS_POCKET, RG_NONE); GiveLinkDungeonReward(getItemId); } @@ -796,81 +796,71 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) { } if(Randomizer_GetSettingValue(RSK_SKIP_CHILD_ZELDA)) { - s32 giid = Randomizer_GetItemIdFromKnownCheck(RC_SONG_FROM_IMPA, RG_ZELDAS_LULLABY); + GetItemEntry getItem = Randomizer_GetItemFromKnownCheck(RC_SONG_FROM_IMPA, RG_ZELDAS_LULLABY); + s32 giid = getItem.getItemId; - if (giid >= RG_ZELDAS_LULLABY && giid <= RG_PRELUDE_OF_LIGHT) { - GiveLinkSong(giid); - } else if (giid == GI_RUPEE_GREEN || giid == GI_RUPEE_BLUE || giid == GI_RUPEE_RED || - giid == GI_RUPEE_PURPLE || giid == GI_RUPEE_GOLD) { - GiveLinkRupeesByGetItemId(giid); - } else if (giid == GI_BOMBCHUS_10 || giid == GI_BOMBCHUS_5 || giid == GI_BOMBCHUS_20) { - GiveLinkBombchus(giid); - } else if (giid == GI_STICKS_1 || giid == GI_STICKS_5 || giid == GI_STICKS_10) { - GiveLinkDekuSticksByGetItemId(giid); - } else if (giid == GI_NUTS_5 || giid == GI_NUTS_10) { - GiveLinkDekuNutsByGetItemId(giid); - } else if (giid == GI_BEAN) { - GiveLinkBeans(); - } else if (giid >= RG_KOKIRI_EMERALD && giid <= RG_LIGHT_MEDALLION) { - GiveLinkDungeonReward(giid); - } else if (giid == GI_SWORD_KOKIRI) { - GiveLinkKokiriSword(); - } else if (giid == GI_SWORD_BGS) { - GiveLinkBiggoronSword(); - } else if (giid == GI_SWORD_KNIFE) { - GiveLinkGiantsKnife(); - } else if (giid == GI_SHIELD_DEKU) { - GiveLinkDekuShield(); - } else if (giid == GI_SHIELD_HYLIAN) { - GiveLinkHylianShield(); - } else if (giid == GI_SHIELD_MIRROR) { - GiveLinkMirrorShield(); - } else if (giid == GI_TUNIC_GORON) { - GiveLinkGoronTunic(); - } else if (giid == GI_TUNIC_ZORA) { - GiveLinkZoraTunic(); - } else if (giid == GI_BOOTS_IRON) { - GiveLinkIronBoots(); - } else if (giid == GI_BOOTS_HOVER) { - GiveLinkHoverBoots(); - } else if (giid == GI_SLINGSHOT || giid == GI_BULLET_BAG_40 || giid == GI_BULLET_BAG_50) { - GiveLinkBulletBagUpgrade(giid); - } else if (giid == GI_BOW || giid == GI_QUIVER_40 || giid == GI_QUIVER_50) { - GiveLinkQuiverUpgrade(giid); - } else if (giid == GI_BOMB_BAG_20 || giid == GI_BOMB_BAG_30 || giid == GI_BOMB_BAG_40) { - GiveLinkBombBagUpgrade(giid); - } else if (giid == GI_BRACELET || giid == GI_GAUNTLETS_SILVER || giid == GI_GAUNTLETS_GOLD) { - GiveLinkStrengthUpgrade(giid); - } else if (giid == GI_SCALE_SILVER || giid == GI_SCALE_GOLD) { - GiveLinkScaleUpgrade(giid); - } else if (giid == GI_WALLET_ADULT || giid == GI_WALLET_GIANT) { - GiveLinkWalletUpgrade(giid); - } else if (giid == GI_STONE_OF_AGONY) { - GiveLinkStoneOfAgony(); - } else if (giid == GI_GERUDO_CARD) { - GiveLinkGerudoCard(); - } else if (giid == GI_HEART_PIECE) { - GiveLinkPieceOfHeart(); - } else if (giid == GI_HEART_CONTAINER) { - GiveLinkHeartContainer(); - } else if (giid == GI_STICK_UPGRADE_20 || giid == GI_STICK_UPGRADE_30) { - GiveLinkDekuStickUpgrade(giid); - } else if (giid == GI_NUT_UPGRADE_30 || giid == GI_NUT_UPGRADE_40) { - GiveLinkDekuNutUpgrade(giid); - } else if (giid == RG_MAGIC_SINGLE || giid == RG_MAGIC_DOUBLE) { - GiveLinkMagic(giid); - } else if (giid == RG_DOUBLE_DEFENSE) { - GiveLinkDoubleDefense(); - } else if ( - (giid >= RG_GERUDO_FORTRESS_SMALL_KEY && giid <= RG_GANONS_CASTLE_SMALL_KEY) || - (giid >= RG_FOREST_TEMPLE_BOSS_KEY && giid <= RG_GANONS_CASTLE_BOSS_KEY) || - (giid >= RG_DEKU_TREE_MAP && giid <= RG_ICE_CAVERN_MAP) || - (giid >= RG_DEKU_TREE_COMPASS && giid <= RG_ICE_CAVERN_COMPASS) - ) { - GiveLinkDungeonItem(giid); - } else { - s32 iid = Randomizer_GetItemIDFromGetItemID(giid); - if (iid != -1) INV_CONTENT(iid) = iid; + if (getItem.modIndex == MOD_NONE) { + if (giid == GI_RUPEE_GREEN || giid == GI_RUPEE_BLUE || giid == GI_RUPEE_RED || + giid == GI_RUPEE_PURPLE || giid == GI_RUPEE_GOLD) { + GiveLinkRupeesByGetItemId(giid); + } else if (giid == GI_BOMBCHUS_10 || giid == GI_BOMBCHUS_5 || giid == GI_BOMBCHUS_20) { + GiveLinkBombchus(giid); + } else if (giid == GI_STICKS_1 || giid == GI_STICKS_5 || giid == GI_STICKS_10) { + GiveLinkDekuSticksByGetItemId(giid); + } else if (giid == GI_NUTS_5 || giid == GI_NUTS_10) { + GiveLinkDekuNutsByGetItemId(giid); + } else if (giid == GI_BEAN) { + GiveLinkBeans(); + } else if (giid == GI_SWORD_KOKIRI) { + GiveLinkKokiriSword(); + } else if (giid == GI_SWORD_BGS) { + GiveLinkBiggoronSword(); + } else if (giid == GI_SWORD_KNIFE) { + GiveLinkGiantsKnife(); + } else if (giid == GI_SHIELD_DEKU) { + GiveLinkDekuShield(); + } else if (giid == GI_SHIELD_HYLIAN) { + GiveLinkHylianShield(); + } else if (giid == GI_SHIELD_MIRROR) { + GiveLinkMirrorShield(); + } else if (giid == GI_TUNIC_GORON) { + GiveLinkGoronTunic(); + } else if (giid == GI_TUNIC_ZORA) { + GiveLinkZoraTunic(); + } else if (giid == GI_BOOTS_IRON) { + GiveLinkIronBoots(); + } else if (giid == GI_BOOTS_HOVER) { + GiveLinkHoverBoots(); + } else if (giid == GI_SLINGSHOT || giid == GI_BULLET_BAG_40 || giid == GI_BULLET_BAG_50) { + GiveLinkBulletBagUpgrade(giid); + } else if (giid == GI_BOW || giid == GI_QUIVER_40 || giid == GI_QUIVER_50) { + GiveLinkQuiverUpgrade(giid); + } else if (giid == GI_BOMB_BAG_20 || giid == GI_BOMB_BAG_30 || giid == GI_BOMB_BAG_40) { + GiveLinkBombBagUpgrade(giid); + } else if (giid == GI_BRACELET || giid == GI_GAUNTLETS_SILVER || giid == GI_GAUNTLETS_GOLD) { + GiveLinkStrengthUpgrade(giid); + } else if (giid == GI_SCALE_SILVER || giid == GI_SCALE_GOLD) { + GiveLinkScaleUpgrade(giid); + } else if (giid == GI_WALLET_ADULT || giid == GI_WALLET_GIANT) { + GiveLinkWalletUpgrade(giid); + } else if (giid == GI_STONE_OF_AGONY) { + GiveLinkStoneOfAgony(); + } else if (giid == GI_GERUDO_CARD) { + GiveLinkGerudoCard(); + } else if (giid == GI_HEART_PIECE) { + GiveLinkPieceOfHeart(); + } else if (giid == GI_HEART_CONTAINER) { + GiveLinkHeartContainer(); + } else if (giid == GI_STICK_UPGRADE_20 || giid == GI_STICK_UPGRADE_30) { + GiveLinkDekuStickUpgrade(giid); + } else if (giid == GI_NUT_UPGRADE_30 || giid == GI_NUT_UPGRADE_40) { + GiveLinkDekuNutUpgrade(giid); + } else { + s32 iid = Randomizer_GetItemIDFromGetItemID(giid); + if (iid != -1) INV_CONTENT(iid) = iid; + } + } else if (getItem.modIndex == MOD_RANDOMIZER) { + Randomizer_Item_Give(NULL, getItem); } // malon/talon back at ranch