From e1b403a31b1dde6ae190a2a8352d1f0fd69073dd Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Sun, 21 Aug 2022 15:14:50 -0400 Subject: [PATCH] Removes unused `Randomizer_GetItemIdFromGetItemId`. --- .../Enhancements/randomizer/randomizer.cpp | 50 ------------------- soh/soh/OTRGlobals.cpp | 4 -- soh/soh/OTRGlobals.h | 1 - soh/src/code/z_sram.c | 2 +- 4 files changed, 1 insertion(+), 56 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 80bdf1c8d..1fc95a04f 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -808,48 +808,6 @@ std::unordered_map SpoilerfileCheckNameToEnum = { { "ZR Open Grotto Gossip Stone", RC_ZR_OPEN_GROTTO_GOSSIP_STONE } }; -std::unordered_map getItemIdToItemId = { - { GI_BOW, ITEM_BOW }, - { GI_ARROW_FIRE, ITEM_ARROW_FIRE }, - { GI_DINS_FIRE, ITEM_DINS_FIRE }, - { GI_SLINGSHOT, ITEM_SLINGSHOT }, - { GI_OCARINA_FAIRY, ITEM_OCARINA_FAIRY }, - { GI_OCARINA_OOT, ITEM_OCARINA_TIME }, - { GI_HOOKSHOT, ITEM_HOOKSHOT }, - { GI_LONGSHOT, ITEM_LONGSHOT }, - { GI_ARROW_ICE, ITEM_ARROW_ICE }, - { GI_FARORES_WIND, ITEM_FARORES_WIND }, - { GI_BOOMERANG, ITEM_BOOMERANG }, - { GI_LENS, ITEM_LENS }, - { GI_HAMMER, ITEM_HAMMER }, - { GI_ARROW_LIGHT, ITEM_ARROW_LIGHT }, - { GI_NAYRUS_LOVE, ITEM_NAYRUS_LOVE }, - { GI_BOTTLE, ITEM_BOTTLE }, - { GI_POTION_RED, ITEM_POTION_RED }, - { GI_POTION_GREEN, ITEM_POTION_GREEN }, - { GI_POTION_BLUE, ITEM_POTION_BLUE }, - { GI_FAIRY, ITEM_FAIRY }, - { GI_FISH, ITEM_FISH }, - { GI_MILK_BOTTLE, ITEM_MILK_BOTTLE }, - { GI_LETTER_RUTO, ITEM_LETTER_RUTO }, - { GI_BLUE_FIRE, ITEM_BLUE_FIRE }, - { GI_BUGS, ITEM_BUG }, - { GI_BIG_POE, ITEM_BIG_POE }, - { GI_POE, ITEM_POE }, - { GI_WEIRD_EGG, ITEM_WEIRD_EGG }, - { GI_LETTER_ZELDA, ITEM_LETTER_ZELDA }, - { GI_POCKET_EGG, ITEM_POCKET_EGG }, - { GI_COJIRO, ITEM_COJIRO }, - { GI_ODD_MUSHROOM, ITEM_ODD_MUSHROOM }, - { GI_ODD_POTION, ITEM_ODD_POTION }, - { GI_SAW, ITEM_SAW }, - { GI_SWORD_BROKEN, ITEM_SWORD_BROKEN }, - { GI_PRESCRIPTION, ITEM_PRESCRIPTION }, - { GI_FROG, ITEM_FROG }, - { GI_EYEDROPS, ITEM_EYEDROPS }, - { GI_CLAIM_CHECK, ITEM_CLAIM_CHECK } -}; - std::unordered_map SpoilerfileGetNameToEnum = { { "No Item", RG_NONE }, { "Rien", RG_NONE }, @@ -1266,14 +1224,6 @@ std::unordered_map SpoilerfileSettingNameToEn { "Timesaver Settings:Skip Tower Escape", RSK_SKIP_TOWER_ESCAPE } }; -s32 Randomizer::GetItemIDFromGetItemID(s32 getItemId) { - if (getItemIdToItemId.count(getItemId) == 0) { - return -1; - } - - return getItemIdToItemId[getItemId]; -} - std::string sanitize(std::string stringValue) { // Add backslashes. for (auto i = stringValue.begin();;) { diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index ebfc15d79..3b24bafb3 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -1544,10 +1544,6 @@ extern "C" void* getN64WeirdFrame(s32 i) { return &weirdFrameBytes[i + sizeof(n64WeirdFrames)]; } -extern "C" s32 Randomizer_GetItemIDFromGetItemID(s32 getItemId) { - return OTRGlobals::Instance->gRandomizer->GetItemIDFromGetItemID(getItemId); -} - extern "C" void Randomizer_LoadSettings(const char* spoilerFileName) { OTRGlobals::Instance->gRandomizer->LoadRandomizerSettings(spoilerFileName); } diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index 5be94cb40..069707cd9 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -98,7 +98,6 @@ u8 Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey); RandomizerCheck Randomizer_GetCheckFromActor(s16 actorId, s16 actorParams, s16 sceneNum); void Randomizer_LoadHintLocations(const char* spoilerFileName); void Randomizer_LoadItemLocations(const char* spoilerFileName, bool silent); -s32 Randomizer_GetItemIDFromGetItemID(s32 getItemId); // TODO: Remove me GetItemEntry Randomizer_GetRandomizedItem(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum); GetItemEntry Randomizer_GetItemFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId); bool Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId, Actor* actor); diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index 6e58af4d0..6ab65e3cb 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -757,7 +757,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) { } else if (giid == GI_NUT_UPGRADE_30 || giid == GI_NUT_UPGRADE_40) { GiveLinkDekuNutUpgrade(giid); } else { - s32 iid = Randomizer_GetItemIDFromGetItemID(giid); + s32 iid = getItem.itemId; if (iid != -1) INV_CONTENT(iid) = iid; } } else if (getItem.modIndex == MOD_RANDOMIZER) {