diff --git a/soh/soh/Enhancements/randomizer/ShuffleBeehives.cpp b/soh/soh/Enhancements/randomizer/ShuffleBeehives.cpp index 00c060cf901..4f50d5acbc5 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleBeehives.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleBeehives.cpp @@ -11,7 +11,7 @@ extern void EnItem00_DrawRandomizedItem(EnItem00* enItem00, PlayState* play); void ObjComb_RandomizerChooseItemDrop(ObjComb* objComb, PlayState* play) { s16 params = objComb->actor.params & 0x1F; - const auto beehiveIdentity = ObjectExtension::GetInstance().Get(&objComb->actor); + const auto beehiveIdentity = ObjectExtension::GetInstance().Get(&objComb->actor); if (RAND_GET_OPTION(RSK_SHUFFLE_BEEHIVES) && beehiveIdentity != nullptr && !Flags_GetRandomizerInf(beehiveIdentity->randomizerInf)) { @@ -42,7 +42,7 @@ void ObjComb_RandomizerChooseItemDrop(ObjComb* objComb, PlayState* play) { void ObjComb_RandomizerWait(ObjComb* objComb, PlayState* play) { objComb->unk_1B0 -= 50; - const auto beehiveIdentity = ObjectExtension::GetInstance().Get(&objComb->actor); + const auto beehiveIdentity = ObjectExtension::GetInstance().Get(&objComb->actor); if (RAND_GET_OPTION(RSK_SHUFFLE_BEEHIVES) && beehiveIdentity != nullptr && !Flags_GetRandomizerInf(beehiveIdentity->randomizerInf)) { if (objComb->unk_1B0 <= -5000) { @@ -79,7 +79,7 @@ void ObjComb_RandomizerInit(void* actor) { s16 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data & ((1 << 8) - 1); auto beehiveIdentity = OTRGlobals::Instance->gRandomizer->IdentifyBeehive( gPlayState->sceneNum, (s16)objComb->actor.world.pos.x, respawnData); - ObjectExtension::GetInstance().Set(actor, std::move(beehiveIdentity)); + ObjectExtension::GetInstance().Set(actor, std::move(beehiveIdentity)); objComb->actionFunc = (ObjCombActionFunc)ObjComb_RandomizerWait; } @@ -142,5 +142,4 @@ void Rando::StaticData::RegisterBeehiveLocations() { // clang-format-on } -static ObjectExtension::Register RegisterBeehiveIdentity; static RegisterShipInitFunc registerBeehiveLocations(Rando::StaticData::RegisterBeehiveLocations); diff --git a/soh/soh/Enhancements/randomizer/ShuffleCows.cpp b/soh/soh/Enhancements/randomizer/ShuffleCows.cpp index 63fbd858cd5..6660912be67 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleCows.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleCows.cpp @@ -38,7 +38,7 @@ void RegisterShuffleCows() { COND_VB_SHOULD(VB_GIVE_ITEM_FROM_COW, shouldRegister, { EnCow* enCow = va_arg(args, EnCow*); - CowIdentity cowIdentity = OTRGlobals::Instance->gRandomizer->IdentifyCow( + CheckIdentity cowIdentity = OTRGlobals::Instance->gRandomizer->IdentifyCow( gPlayState->sceneNum, static_cast(enCow->actor.world.pos.x), static_cast(enCow->actor.world.pos.z)); // Has this cow already rewarded an item? diff --git a/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp b/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp index 1762824d971..c4c4e1a7a11 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp @@ -32,7 +32,7 @@ extern "C" void ObjKibako2_RandomizerDraw(Actor* thisx, PlayState* play) { return; } - const auto crateIdentity = ObjectExtension::GetInstance().Get(thisx); + const auto crateIdentity = ObjectExtension::GetInstance().Get(thisx); if (crateIdentity == nullptr) { Gfx_DrawDListOpa(play, (Gfx*)gLargeRandoCrateDL); return; @@ -106,7 +106,7 @@ extern "C" void ObjKibako_RandomizerDraw(Actor* thisx, PlayState* play) { return; } - const auto crateIdentity = ObjectExtension::GetInstance().Get(thisx); + const auto crateIdentity = ObjectExtension::GetInstance().Get(thisx); if (crateIdentity == nullptr) { Gfx_DrawDListOpa(play, (Gfx*)gSmallRandoCrateDL); return; @@ -167,7 +167,7 @@ extern "C" void ObjKibako_RandomizerDraw(Actor* thisx, PlayState* play) { } uint8_t ObjKibako2_RandomizerHoldsItem(ObjKibako2* crateActor, PlayState* play) { - const auto crateIdentity = ObjectExtension::GetInstance().Get(&crateActor->dyna.actor); + const auto crateIdentity = ObjectExtension::GetInstance().Get(&crateActor->dyna.actor); if (crateIdentity == nullptr) { return false; } @@ -187,7 +187,7 @@ uint8_t ObjKibako2_RandomizerHoldsItem(ObjKibako2* crateActor, PlayState* play) } uint8_t ObjKibako_RandomizerHoldsItem(ObjKibako* smallCrateActor, PlayState* play) { - const auto crateIdentity = ObjectExtension::GetInstance().Get(&smallCrateActor->actor); + const auto crateIdentity = ObjectExtension::GetInstance().Get(&smallCrateActor->actor); if (crateIdentity == nullptr) { return false; } @@ -207,7 +207,7 @@ uint8_t ObjKibako_RandomizerHoldsItem(ObjKibako* smallCrateActor, PlayState* pla } void ObjKibako2_RandomizerSpawnCollectible(ObjKibako2* crateActor, PlayState* play) { - const auto crateIdentity = ObjectExtension::GetInstance().Get(&crateActor->dyna.actor); + const auto crateIdentity = ObjectExtension::GetInstance().Get(&crateActor->dyna.actor); if (crateIdentity == nullptr) { return; } @@ -222,7 +222,7 @@ void ObjKibako2_RandomizerSpawnCollectible(ObjKibako2* crateActor, PlayState* pl } void ObjKibako_RandomizerSpawnCollectible(ObjKibako* smallCrateActor, PlayState* play) { - const auto crateIdentity = ObjectExtension::GetInstance().Get(&smallCrateActor->actor); + const auto crateIdentity = ObjectExtension::GetInstance().Get(&smallCrateActor->actor); if (crateIdentity == nullptr) { return; } @@ -262,7 +262,7 @@ void ObjKibako2_RandomizerInit(void* actorRef) { auto crateIdentity = OTRGlobals::Instance->gRandomizer->IdentifyCrate(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z); - ObjectExtension::GetInstance().Set(actor, std::move(crateIdentity)); + ObjectExtension::GetInstance().Set(actor, std::move(crateIdentity)); } void ObjKibako_RandomizerInit(void* actorRef) { @@ -275,7 +275,7 @@ void ObjKibako_RandomizerInit(void* actorRef) { auto crateIdentity = OTRGlobals::Instance->gRandomizer->IdentifySmallCrate( gPlayState->sceneNum, (s16)actor->home.pos.x, (s16)actor->home.pos.z); - ObjectExtension::GetInstance().Set(actor, std::move(crateIdentity)); + ObjectExtension::GetInstance().Set(actor, std::move(crateIdentity)); } void RegisterShuffleCrates() { @@ -595,7 +595,5 @@ void Rando::StaticData::RegisterCrateLocations() { // clang-format on } -static ObjectExtension::Register RegisterCrateIdentity; -static ObjectExtension::Register RegisterSmallCrateIdentity; static RegisterShipInitFunc registerShuffleCrates(RegisterShuffleCrates, { "IS_RANDO" }); static RegisterShipInitFunc registerCrateLocations(Rando::StaticData::RegisterCrateLocations); diff --git a/soh/soh/Enhancements/randomizer/ShuffleFairies.cpp b/soh/soh/Enhancements/randomizer/ShuffleFairies.cpp index 0801da406b9..c10011454c8 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleFairies.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleFairies.cpp @@ -16,7 +16,7 @@ extern "C" { #define FAIRY_FLAG_TIMED (1 << 8) void ShuffleFairies_DrawRandomizedItem(EnElf* enElf, PlayState* play) { - const auto fairyIdentity = ObjectExtension::GetInstance().Get(&enElf->actor); + const auto fairyIdentity = ObjectExtension::GetInstance().Get(&enElf->actor); if (fairyIdentity == nullptr) { return; } @@ -35,14 +35,14 @@ void ShuffleFairies_DrawRandomizedItem(EnElf* enElf, PlayState* play) { Matrix_Pop(); } -bool ShuffleFairies_FairyExists(FairyIdentity fairyIdentity) { +bool ShuffleFairies_FairyExists(CheckIdentity fairyIdentity) { Actor* actor = gPlayState->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; while (actor != NULL) { if (actor->id != ACTOR_EN_ELF) { actor = actor->next; } else { - const auto actorFairyIdentity = ObjectExtension::GetInstance().Get(&actor); + const auto actorFairyIdentity = ObjectExtension::GetInstance().Get(&actor); if (actorFairyIdentity != nullptr && fairyIdentity.randomizerInf == actorFairyIdentity->randomizerInf) { return true; } @@ -53,8 +53,8 @@ bool ShuffleFairies_FairyExists(FairyIdentity fairyIdentity) { return false; } -FairyIdentity ShuffleFairies_GetFairyIdentity(int32_t params) { - FairyIdentity fairyIdentity; +CheckIdentity ShuffleFairies_GetFairyIdentity(int32_t params) { + CheckIdentity fairyIdentity; s16 sceneNum = gPlayState->sceneNum; fairyIdentity.randomizerInf = RAND_INF_MAX; @@ -77,11 +77,11 @@ FairyIdentity ShuffleFairies_GetFairyIdentity(int32_t params) { } static bool SpawnFairy(f32 posX, f32 posY, f32 posZ, int32_t params, FairyType fairyType) { - FairyIdentity fairyIdentity = ShuffleFairies_GetFairyIdentity(params); + CheckIdentity fairyIdentity = ShuffleFairies_GetFairyIdentity(params); if (!Flags_GetRandomizerInf(fairyIdentity.randomizerInf)) { Actor* fairy = Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_ELF, posX, posY - 30.0f, posZ, 0, 0, 0, fairyType, true); - ObjectExtension::GetInstance().Set(fairy, std::move(fairyIdentity)); + ObjectExtension::GetInstance().Set(fairy, std::move(fairyIdentity)); fairy->draw = (ActorFunc)ShuffleFairies_DrawRandomizedItem; return true; } @@ -98,7 +98,7 @@ void RegisterShuffleFairies() { // Grant item when picking up fairy. COND_VB_SHOULD(VB_FAIRY_HEAL, shouldRegister, { EnElf* enElf = va_arg(args, EnElf*); - const auto fairyIdentity = ObjectExtension::GetInstance().Get(&enElf->actor); + const auto fairyIdentity = ObjectExtension::GetInstance().Get(&enElf->actor); if (fairyIdentity != nullptr && fairyIdentity->randomizerInf != RAND_INF_MAX) { Flags_SetRandomizerInf(fairyIdentity->randomizerInf); } @@ -106,7 +106,7 @@ void RegisterShuffleFairies() { COND_VB_SHOULD(VB_BOTTLE_ACTOR, shouldRegister, { Actor* actor = va_arg(args, Actor*); - const auto fairyIdentity = ObjectExtension::GetInstance().Get(actor); + const auto fairyIdentity = ObjectExtension::GetInstance().Get(actor); if (fairyIdentity != nullptr && fairyIdentity->randomizerInf != RAND_INF_MAX) { Flags_SetRandomizerInf(fairyIdentity->randomizerInf); actor->parent = &GET_PLAYER(gPlayState)->actor; @@ -183,7 +183,7 @@ void RegisterShuffleFairies() { // stop spawning the vanilla fairy as well when these fairies exist, otherwise both // the randomized and the vanilla fairy will spawn. When the randomized fairy is already // collected, the vanilla code will handle that part automatically. - FairyIdentity fairyIdentity = ShuffleFairies_GetFairyIdentity(params); + CheckIdentity fairyIdentity = ShuffleFairies_GetFairyIdentity(params); if (!ShuffleFairies_FairyExists(fairyIdentity)) { Player* player = GET_PLAYER(gPlayState); if (SpawnFairy(player->actor.world.pos.x, (player->actor.world.pos.y + 20), player->actor.world.pos.z, @@ -429,6 +429,5 @@ void Rando::StaticData::RegisterFairyLocations() { // clang-format on } -static ObjectExtension::Register RegisterFairyIdentity; static RegisterShipInitFunc registerShuffleFairies(RegisterShuffleFairies, { "IS_RANDO" }); static RegisterShipInitFunc registerFairyLocations(Rando::StaticData::RegisterFairyLocations); diff --git a/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp b/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp index d82c3b39320..67f090da77a 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp @@ -27,7 +27,7 @@ extern "C" void EnKusa_RandomizerDraw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { (Gfx*)gRandoBushJunkDL, (Gfx*)gRandoCuttableGrassJunkDL, (Gfx*)gRandoCuttableGrassJunkDL }; auto grassActor = ((EnKusa*)thisx); - const auto grassIdentity = ObjectExtension::GetInstance().Get(thisx); + const auto grassIdentity = ObjectExtension::GetInstance().Get(thisx); OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL_25Opa(play->state.gfxCtx); @@ -90,7 +90,7 @@ extern "C" void EnKusa_RandomizerDraw(Actor* thisx, PlayState* play) { } uint8_t EnKusa_RandomizerHoldsItem(EnKusa* grassActor, PlayState* play) { - const auto grassIdentity = ObjectExtension::GetInstance().Get(&grassActor->actor); + const auto grassIdentity = ObjectExtension::GetInstance().Get(&grassActor->actor); if (grassIdentity == nullptr || grassIdentity->randomizerCheck == RC_MAX) return false; @@ -110,7 +110,7 @@ uint8_t EnKusa_RandomizerHoldsItem(EnKusa* grassActor, PlayState* play) { } void EnKusa_RandomizerSpawnCollectible(EnKusa* grassActor, PlayState* play) { - const auto grassIdentity = ObjectExtension::GetInstance().Get(&grassActor->actor); + const auto grassIdentity = ObjectExtension::GetInstance().Get(&grassActor->actor); if (grassIdentity == nullptr) { return; } @@ -135,7 +135,7 @@ void EnKusa_RandomizerInit(void* actorRef) { auto grassIdentity = OTRGlobals::Instance->gRandomizer->IdentifyGrass( gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z, respawnData, gPlayState->linkAgeOnLoad); - ObjectExtension::GetInstance().Set(actor, std::move(grassIdentity)); + ObjectExtension::GetInstance().Set(actor, std::move(grassIdentity)); } void RegisterShuffleGrass() { @@ -157,7 +157,7 @@ void RegisterShuffleGrass() { EnKusa* grassActor = va_arg(args, EnKusa*); if (EnKusa_RandomizerHoldsItem(grassActor, gPlayState)) { EnKusa_RandomizerSpawnCollectible(grassActor, gPlayState); - ObjectExtension::GetInstance().Set(&grassActor->actor, std::move(GrassIdentity{ + ObjectExtension::GetInstance().Set(&grassActor->actor, std::move(CheckIdentity{ .randomizerInf = RAND_INF_MAX, .randomizerCheck = RC_MAX, })); @@ -528,6 +528,5 @@ void Rando::StaticData::RegisterGrassLocations() { // clang-format on } -static ObjectExtension::Register RegisterGrassIdentity; static RegisterShipInitFunc registerShuffleGrass(RegisterShuffleGrass, { "IS_RANDO" }); static RegisterShipInitFunc registerGrassLocations(Rando::StaticData::RegisterGrassLocations); diff --git a/soh/soh/Enhancements/randomizer/ShufflePots.cpp b/soh/soh/Enhancements/randomizer/ShufflePots.cpp index 815562578ab..dcdbae91392 100644 --- a/soh/soh/Enhancements/randomizer/ShufflePots.cpp +++ b/soh/soh/Enhancements/randomizer/ShufflePots.cpp @@ -26,7 +26,7 @@ extern "C" void ObjTsubo_RandomizerDraw(Actor* thisx, PlayState* play) { } uint8_t ObjTsubo_RandomizerHoldsItem(ObjTsubo* potActor, PlayState* play) { - const auto potIdentity = ObjectExtension::GetInstance().Get(&potActor->actor); + const auto potIdentity = ObjectExtension::GetInstance().Get(&potActor->actor); if (potIdentity == nullptr) { return false; } @@ -46,7 +46,7 @@ uint8_t ObjTsubo_RandomizerHoldsItem(ObjTsubo* potActor, PlayState* play) { } void ObjTsubo_RandomizerSpawnCollectible(ObjTsubo* potActor, PlayState* play) { - const auto potIdentity = ObjectExtension::GetInstance().Get(&potActor->actor); + const auto potIdentity = ObjectExtension::GetInstance().Get(&potActor->actor); if (potIdentity == nullptr) { return; } @@ -69,7 +69,7 @@ void RegisterShufflePots() { auto potIdentity = OTRGlobals::Instance->gRandomizer->IdentifyPot(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z); - ObjectExtension::GetInstance().Set(actor, std::move(potIdentity)); + ObjectExtension::GetInstance().Set(actor, std::move(potIdentity)); }); // Draw custom model for pot to indicate it holding a randomized item. @@ -659,6 +659,5 @@ void Rando::StaticData::RegisterPotLocations() { // clang-format on } -static ObjectExtension::Register RegisterPotIdentity; static RegisterShipInitFunc registerShufflePots(RegisterShufflePots, { "IS_RANDO" }); static RegisterShipInitFunc registerPotLocations(Rando::StaticData::RegisterPotLocations); diff --git a/soh/soh/Enhancements/randomizer/ShuffleTrees.cpp b/soh/soh/Enhancements/randomizer/ShuffleTrees.cpp index 6ef30592626..b79ae1e4b83 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleTrees.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleTrees.cpp @@ -37,7 +37,7 @@ extern void EnItem00_DrawRandomizedItem(EnItem00* enItem00, PlayState* play); uint8_t EnWood02_RandomizerHoldsItem(EnWood02* treeActor, PlayState* play) { // Don't pull randomized item if tree isn't randomized or is already checked - const auto treeIdentity = ObjectExtension::GetInstance().Get(&treeActor->actor); + const auto treeIdentity = ObjectExtension::GetInstance().Get(&treeActor->actor); return treeIdentity != nullptr && treeIdentity->randomizerCheck != RC_UNKNOWN_CHECK && treeIdentity->randomizerInf != RAND_INF_MAX && !Flags_GetRandomizerInf(treeIdentity->randomizerInf); } @@ -47,7 +47,7 @@ extern "C" void EnWood02_RandomizerDraw(Actor* thisx, PlayState* play) { GetItemEntry treeItem; auto treeActor = (EnWood02*)thisx; - const auto treeIdentity = ObjectExtension::GetInstance().Get(&treeActor->actor); + const auto treeIdentity = ObjectExtension::GetInstance().Get(&treeActor->actor); if (treeIdentity == nullptr || treeIdentity->randomizerCheck == RC_UNKNOWN_CHECK) { return; } @@ -127,7 +127,7 @@ extern "C" void EnWood02_RandomizerDraw(Actor* thisx, PlayState* play) { } void EnWood02_RandomizerSpawnCollectible(EnWood02* treeActor, PlayState* play) { - const auto treeIdentity = ObjectExtension::GetInstance().Get(&treeActor->actor); + const auto treeIdentity = ObjectExtension::GetInstance().Get(&treeActor->actor); if (treeIdentity == nullptr || treeIdentity->randomizerCheck == RC_UNKNOWN_CHECK) { return; } @@ -155,7 +155,7 @@ void EnWood02_RandomizerInit(void* actorRef) { auto treeIdentity = OTRGlobals::Instance->gRandomizer->IdentifyTree( gPlayState->sceneNum, (s16)treeActor->actor.world.pos.x, (s16)treeActor->actor.world.pos.z); if (treeIdentity.randomizerInf != RAND_INF_MAX && treeIdentity.randomizerCheck != RC_UNKNOWN_CHECK) { - ObjectExtension::GetInstance().Set(actorRef, std::move(treeIdentity)); + ObjectExtension::GetInstance().Set(actorRef, std::move(treeIdentity)); } } } @@ -194,7 +194,7 @@ void RegisterShuffleTrees() { COND_VB_SHOULD(VB_BUSH_DROP_ITEM, shouldRegisterBush, { EnWood02* treeActor = va_arg(args, EnWood02*); if (EnWood02_RandomizerHoldsItem(treeActor, gPlayState)) { - const auto treeIdentity = ObjectExtension::GetInstance().Get(&treeActor->actor); + const auto treeIdentity = ObjectExtension::GetInstance().Get(&treeActor->actor); if (treeIdentity == nullptr || treeIdentity->randomizerCheck == RC_UNKNOWN_CHECK) { return; } @@ -346,6 +346,5 @@ void Rando::StaticData::RegisterTreeLocations() { // clang-format on } -static ObjectExtension::Register RegisterTreeIdentity; static RegisterShipInitFunc registerShuffleTrees(RegisterShuffleTrees, { "IS_RANDO" }); static RegisterShipInitFunc registerTreeLocations(Rando::StaticData::RegisterTreeLocations); diff --git a/soh/soh/Enhancements/randomizer/fishsanity.cpp b/soh/soh/Enhancements/randomizer/fishsanity.cpp index 8cf5ec23c07..eaa4ac911b9 100644 --- a/soh/soh/Enhancements/randomizer/fishsanity.cpp +++ b/soh/soh/Enhancements/randomizer/fishsanity.cpp @@ -55,7 +55,7 @@ static s16 fishGroupCounter = 0; static bool enableAdvance = false; namespace Rando { -const FishIdentity Fishsanity::defaultIdentity = { RAND_INF_MAX, RC_UNKNOWN_CHECK }; +const CheckIdentity Fishsanity::defaultIdentity = { RAND_INF_MAX, RC_UNKNOWN_CHECK }; bool Fishsanity::fishsanityHelpersInit = false; std::unordered_map Fishsanity::pondFishAgeMap; std::vector Fishsanity::childPondFish; @@ -162,9 +162,9 @@ Fishsanity::GetFishsanityLocations(FishsanityOptionsSource optionsSource) { return std::make_pair(activeFish, remainingFish); } -FishIdentity Fishsanity::IdentifyPondFish(u8 fishParams) { +CheckIdentity Fishsanity::IdentifyPondFish(u8 fishParams) { auto [mode, pondCount, ageSplit] = GetOptions(); - FishIdentity identity = defaultIdentity; + CheckIdentity identity = defaultIdentity; if (!GetPondFishShuffled()) { return identity; @@ -200,7 +200,7 @@ FishsanityPondOptions Fishsanity::GetOptions(FishsanityOptionsSource optionsSour void Fishsanity::UpdateCurrentPondFish() { auto [mode, pondCount, ageSplit] = GetOptions(); - mCurrPondFish = std::pair(); + mCurrPondFish = std::pair(); mCurrPondFish.first = defaultIdentity; mCurrPondFish.second = defaultIdentity; @@ -305,13 +305,13 @@ void Fishsanity::InitializeHelpers() { } } -FishIdentity Fishsanity::GetPondFish(s16 params, bool adultPond) { +CheckIdentity Fishsanity::GetPondFish(s16 params, bool adultPond) { auto pair = Rando::StaticData::randomizerFishingPondFish[params - 100]; RandomizerCheck rc = adultPond ? pair.second : pair.first; return { OTRGlobals::Instance->gRandomizer->GetRandomizerInfFromCheck(rc), rc }; } -FishIdentity Fishsanity::AdvancePond() { +CheckIdentity Fishsanity::AdvancePond() { auto [mode, pondCount, ageSplit] = GetOptions(); // No need to update state with full pond shuffle @@ -343,7 +343,7 @@ FishsanityCheckType Fishsanity::GetCheckType(RandomizerCheck rc) { } } -bool Fishsanity::IsFish(FishIdentity* fish) { +bool Fishsanity::IsFish(CheckIdentity* fish) { if (fish->randomizerCheck == RC_UNKNOWN_CHECK || fish->randomizerInf == RAND_INF_MAX) { return false; } @@ -355,7 +355,7 @@ void Fishsanity::OnActorInitHandler(void* refActor) { Actor* actor = static_cast(refActor); auto fs = OTRGlobals::Instance->gRandoContext->GetFishsanity(); - FishIdentity fish; + CheckIdentity fish; if (actor->id == ACTOR_EN_FISH && fs->GetOverworldFishShuffled()) { // Set fish ID for ZD fish @@ -413,7 +413,7 @@ void Fishsanity::OnActorUpdateHandler(void* refActor) { // State 6 -> Fish caught and hoisted if (fish->fishState == 6) { - FishIdentity identity = + CheckIdentity identity = OTRGlobals::Instance->gRandomizer->IdentifyFish(gPlayState->sceneNum, actor->params); if (identity.randomizerCheck != RC_UNKNOWN_CHECK) { Flags_SetRandomizerInf(identity.randomizerInf); @@ -428,7 +428,7 @@ void Fishsanity::OnActorUpdateHandler(void* refActor) { } if (actor->id == ACTOR_EN_FISH && fs->GetOverworldFishShuffled()) { - FishIdentity fish = OTRGlobals::Instance->gRandomizer->IdentifyFish(gPlayState->sceneNum, actor->params); + CheckIdentity fish = OTRGlobals::Instance->gRandomizer->IdentifyFish(gPlayState->sceneNum, actor->params); EnFish* fishActor = static_cast(refActor); if (Rando::Fishsanity::IsFish(&fish) && Flags_GetRandomizerInf(fish.randomizerInf)) { // Reset draw method @@ -505,7 +505,7 @@ void Fishsanity_DrawEffShadow(Actor* actor, Lights* lights, PlayState* play) { } void Fishsanity_DrawEnFish(struct Actor* actor, struct PlayState* play) { - FishIdentity fish = OTRGlobals::Instance->gRandomizer->IdentifyFish(play->sceneNum, actor->params); + CheckIdentity fish = OTRGlobals::Instance->gRandomizer->IdentifyFish(play->sceneNum, actor->params); GetItemEntry randoItem = Rando::Context::GetInstance()->GetFinalGIEntry(fish.randomizerCheck, true, GI_FISH); if (CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MysteriousShuffle"), 0)) { randoItem = GET_ITEM_MYSTERY; @@ -565,7 +565,7 @@ void RegisterShuffleFish() { Actor* actor = va_arg(args, Actor*); auto fs = OTRGlobals::Instance->gRandoContext->GetFishsanity(); if (actor->id == ACTOR_EN_FISH && fs->GetOverworldFishShuffled()) { - FishIdentity fish = OTRGlobals::Instance->gRandomizer->IdentifyFish(gPlayState->sceneNum, actor->params); + auto fish = OTRGlobals::Instance->gRandomizer->IdentifyFish(gPlayState->sceneNum, actor->params); if (fish.randomizerCheck != RC_UNKNOWN_CHECK && !Flags_GetRandomizerInf(fish.randomizerInf)) { Flags_SetRandomizerInf(fish.randomizerInf); actor->parent = &GET_PLAYER(gPlayState)->actor; diff --git a/soh/soh/Enhancements/randomizer/fishsanity.h b/soh/soh/Enhancements/randomizer/fishsanity.h index 1584d138743..3105521bab6 100644 --- a/soh/soh/Enhancements/randomizer/fishsanity.h +++ b/soh/soh/Enhancements/randomizer/fishsanity.h @@ -35,7 +35,7 @@ class Fishsanity { Fishsanity(); ~Fishsanity(); - static const FishIdentity defaultIdentity; + static const CheckIdentity defaultIdentity; /** * @brief Gets the type of a fishsanity check @@ -45,10 +45,10 @@ class Fishsanity { static FishsanityCheckType GetCheckType(RandomizerCheck rc); /** - * @brief Returns true if the given FishIdentity represents an actual fish + * @brief Returns true if the given CheckIdentity represents an actual fish * @param fish The fish to check */ - static bool IsFish(FishIdentity* fish); + static bool IsFish(CheckIdentity* fish); /** * @brief Returns true if the given fish location is active @@ -80,11 +80,11 @@ class Fishsanity { /** * @brief Returns the identity for a caught pond fish given its params. - * Not for use externally from rando, use Randomizer::IdentifyFish or Randomizer_IdentifyFish for that + * Not for use externally from rando, use Randomizer::IdentifyFish * * @param fishParams Actor parameters for the fish to identify */ - FishIdentity IdentifyPondFish(u8 fishParams); + CheckIdentity IdentifyPondFish(u8 fishParams); /** * @brief Get fishsanity fishing pond options from the requested source @@ -128,9 +128,9 @@ class Fishsanity { /** * @brief Advances current fishing pond check; no effect if every fish is shuffled - * @return The new FishIdentity for the current pond, or default identity if every fish is shuffled + * @return The new CheckIdentity for the current pond, or default identity if every fish is shuffled */ - FishIdentity AdvancePond(); + CheckIdentity AdvancePond(); /** * @brief ActorInit hook handler for fishsanity @@ -149,18 +149,18 @@ class Fishsanity { void InitializeHelpers(); /** - * @brief Resolves a pond fish's FishIdentity directly from params & pond age + * @brief Resolves a pond fish's CheckIdentity directly from params & pond age * * @param params Params for Fishing actor * @param adultPond Whether to resolve this fish as an adult check - * @return The FishIdentity for the described fish + * @return The CheckIdentity for the described fish */ - static FishIdentity GetPondFish(s16 params, bool adultPond); + static CheckIdentity GetPondFish(s16 params, bool adultPond); /** * @brief Current pond fish when all pond fish are not randomized */ - std::pair mCurrPondFish; + std::pair mCurrPondFish; /** * @brief True if fishsanity helpers have been initialized diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 1605f6fc49a..a43bf0caf87 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -773,8 +773,8 @@ void RandomizerOnDialogMessageHandler() { EnDns* enDns = (EnDns*)actor; auto checkIdentity = ObjectExtension::GetInstance().Get(actor); if (checkIdentity != nullptr) { - reveal = - OTRGlobals::Instance->gRandomizer->GetCheckFromRandomizerInf(checkIdentity->randomizerInf); + reveal = OTRGlobals::Instance->gRandomizer->GetCheckFromRandomizerInf( + checkIdentity->identity.randomizerInf); } } break; @@ -1398,8 +1398,8 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l ScrubIdentity scrubIdentity = OTRGlobals::Instance->gRandomizer->IdentifyScrub( gPlayState->sceneNum, enShopnuts->actor.params, respawnData); - if (scrubIdentity.randomizerCheck != RC_UNKNOWN_CHECK) { - *should = Flags_GetRandomizerInf(scrubIdentity.randomizerInf); + if (scrubIdentity.identity.randomizerCheck != RC_UNKNOWN_CHECK) { + *should = Flags_GetRandomizerInf(scrubIdentity.identity.randomizerInf); } break; } @@ -1989,7 +1989,7 @@ void EnSi_DrawRandomizedItem(EnSi* enSi, PlayState* play) { u32 EnDns_RandomizerPurchaseableCheck(EnDns* enDns) { auto checkIdentity = ObjectExtension::GetInstance().Get(enDns); - if (checkIdentity != nullptr && Flags_GetRandomizerInf(checkIdentity->randomizerInf)) { + if (checkIdentity != nullptr && Flags_GetRandomizerInf(checkIdentity->identity.randomizerInf)) { return DNS_CANBUY_RESULT_CANT_GET_NOW; } if (gSaveContext.rupees < enDns->dnsItemEntry->itemPrice) { @@ -2002,7 +2002,7 @@ void EnDns_RandomizerPurchase(EnDns* enDns) { Rupees_ChangeBy(-enDns->dnsItemEntry->itemPrice); auto checkIdentity = ObjectExtension::GetInstance().Get(enDns); if (checkIdentity != nullptr) { - Flags_SetRandomizerInf(checkIdentity->randomizerInf); + Flags_SetRandomizerInf(checkIdentity->identity.randomizerInf); } } @@ -2075,7 +2075,7 @@ void RandomizerOnActorInitHandler(void* actorRef) { auto scrubIdentity = OTRGlobals::Instance->gRandomizer->IdentifyScrub(gPlayState->sceneNum, enDns->actor.params, respawnData); - if (scrubIdentity.randomizerCheck != RC_UNKNOWN_CHECK) { + if (scrubIdentity.identity.randomizerCheck != RC_UNKNOWN_CHECK) { // DNS uses pointers so we're creating our own entry instead of modifying the original ObjectExtension::GetInstance().Set(actorRef, std::move(DnsItemEntry{ enDns->dnsItemEntry->itemPrice, diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 5064b61c0c5..1712ebc8cf8 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -40,6 +40,9 @@ #include "fishsanity.h" #include "randomizerTypes.h" #include "soh/Notification/Notification.h" +#include "soh/ObjectExtension/ObjectExtension.h" + +static ObjectExtension::Register RegisterIdentity; extern std::map rcAreaNames; @@ -3487,8 +3490,8 @@ std::map rcToRandomizerInf = { { RC_ZF_BUSH_6, RAND_INF_ZF_BUSH_6 }, }; -BeehiveIdentity Randomizer::IdentifyBeehive(s32 sceneNum, s16 xPosition, s32 respawnData) { - struct BeehiveIdentity beehiveIdentity; +CheckIdentity Randomizer::IdentifyBeehive(s32 sceneNum, s16 xPosition, s32 respawnData) { + struct CheckIdentity beehiveIdentity; beehiveIdentity.randomizerInf = RAND_INF_MAX; beehiveIdentity.randomizerCheck = RC_UNKNOWN_CHECK; @@ -3649,8 +3652,8 @@ Rando::Location* Randomizer::GetCheckObjectFromActor(s16 actorId, s16 sceneNum, ScrubIdentity Randomizer::IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respawnData) { struct ScrubIdentity scrubIdentity; - scrubIdentity.randomizerInf = RAND_INF_MAX; - scrubIdentity.randomizerCheck = RC_UNKNOWN_CHECK; + scrubIdentity.identity.randomizerInf = RAND_INF_MAX; + scrubIdentity.identity.randomizerCheck = RC_UNKNOWN_CHECK; scrubIdentity.getItemId = GI_NONE; scrubIdentity.itemPrice = -1; @@ -3675,11 +3678,11 @@ ScrubIdentity Randomizer::IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respa return scrubIdentity; } - scrubIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()]; - scrubIdentity.randomizerCheck = location->GetRandomizerCheck(); + scrubIdentity.identity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()]; + scrubIdentity.identity.randomizerCheck = location->GetRandomizerCheck(); scrubIdentity.getItemId = (GetItemID)Rando::StaticData::RetrieveItem(location->GetVanillaItem()).GetItemID(); scrubIdentity.itemPrice = - OTRGlobals::Instance->gRandoContext->GetItemLocation(scrubIdentity.randomizerCheck)->GetPrice(); + OTRGlobals::Instance->gRandoContext->GetItemLocation(scrubIdentity.identity.randomizerCheck)->GetPrice(); } return scrubIdentity; @@ -3688,8 +3691,8 @@ ScrubIdentity Randomizer::IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respa ShopItemIdentity Randomizer::IdentifyShopItem(s32 sceneNum, u8 slotIndex) { ShopItemIdentity shopItemIdentity; - shopItemIdentity.randomizerInf = RAND_INF_MAX; - shopItemIdentity.randomizerCheck = RC_UNKNOWN_CHECK; + shopItemIdentity.identity.randomizerInf = RAND_INF_MAX; + shopItemIdentity.identity.randomizerCheck = RC_UNKNOWN_CHECK; shopItemIdentity.ogItemId = GI_NONE; shopItemIdentity.itemPrice = -1; shopItemIdentity.enGirlAShopItem = 0x32; @@ -3705,25 +3708,26 @@ ShopItemIdentity Randomizer::IdentifyShopItem(s32 sceneNum, u8 slotIndex) { slotIndex - 1); if (location->GetRandomizerCheck() != RC_UNKNOWN_CHECK) { - shopItemIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()]; - shopItemIdentity.randomizerCheck = location->GetRandomizerCheck(); + shopItemIdentity.identity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()]; + shopItemIdentity.identity.randomizerCheck = location->GetRandomizerCheck(); shopItemIdentity.ogItemId = (GetItemID)Rando::StaticData::RetrieveItem(location->GetVanillaItem()).GetItemID(); - RandomizerGet randoGet = - Rando::Context::GetInstance()->GetItemLocation(shopItemIdentity.randomizerCheck)->GetPlacedRandomizerGet(); + RandomizerGet randoGet = Rando::Context::GetInstance() + ->GetItemLocation(shopItemIdentity.identity.randomizerCheck) + ->GetPlacedRandomizerGet(); if (randomizerGetToEnGirlShopItem.find(randoGet) != randomizerGetToEnGirlShopItem.end()) { shopItemIdentity.enGirlAShopItem = randomizerGetToEnGirlShopItem[randoGet]; } shopItemIdentity.itemPrice = - OTRGlobals::Instance->gRandoContext->GetItemLocation(shopItemIdentity.randomizerCheck)->GetPrice(); + OTRGlobals::Instance->gRandoContext->GetItemLocation(shopItemIdentity.identity.randomizerCheck)->GetPrice(); } return shopItemIdentity; } -CowIdentity Randomizer::IdentifyCow(s32 sceneNum, s32 posX, s32 posZ) { - struct CowIdentity cowIdentity; +CheckIdentity Randomizer::IdentifyCow(s32 sceneNum, s32 posX, s32 posZ) { + struct CheckIdentity cowIdentity; cowIdentity.randomizerInf = RAND_INF_MAX; cowIdentity.randomizerCheck = RC_UNKNOWN_CHECK; @@ -3744,8 +3748,8 @@ CowIdentity Randomizer::IdentifyCow(s32 sceneNum, s32 posX, s32 posZ) { return cowIdentity; } -PotIdentity Randomizer::IdentifyPot(s32 sceneNum, s32 posX, s32 posZ) { - struct PotIdentity potIdentity; +CheckIdentity Randomizer::IdentifyPot(s32 sceneNum, s32 posX, s32 posZ) { + struct CheckIdentity potIdentity; uint32_t potSceneNum = sceneNum; if (sceneNum == SCENE_GANONDORF_BOSS) { @@ -3769,8 +3773,8 @@ PotIdentity Randomizer::IdentifyPot(s32 sceneNum, s32 posX, s32 posZ) { return potIdentity; } -FishIdentity Randomizer::IdentifyFish(s32 sceneNum, s32 actorParams) { - struct FishIdentity fishIdentity; +CheckIdentity Randomizer::IdentifyFish(s32 sceneNum, s32 actorParams) { + struct CheckIdentity fishIdentity; fishIdentity.randomizerInf = RAND_INF_MAX; fishIdentity.randomizerCheck = RC_UNKNOWN_CHECK; @@ -3790,8 +3794,8 @@ FishIdentity Randomizer::IdentifyFish(s32 sceneNum, s32 actorParams) { return fishIdentity; } -GrassIdentity Randomizer::IdentifyGrass(s32 sceneNum, s32 posX, s32 posZ, s32 respawnData, s32 linkAge) { - struct GrassIdentity grassIdentity; +CheckIdentity Randomizer::IdentifyGrass(s32 sceneNum, s32 posX, s32 posZ, s32 respawnData, s32 linkAge) { + struct CheckIdentity grassIdentity; grassIdentity.randomizerInf = RAND_INF_MAX; grassIdentity.randomizerCheck = RC_UNKNOWN_CHECK; @@ -3852,8 +3856,8 @@ GrassIdentity Randomizer::IdentifyGrass(s32 sceneNum, s32 posX, s32 posZ, s32 re return grassIdentity; } -CrateIdentity Randomizer::IdentifyCrate(s32 sceneNum, s32 posX, s32 posZ) { - struct CrateIdentity crateIdentity; +CheckIdentity Randomizer::IdentifyCrate(s32 sceneNum, s32 posX, s32 posZ) { + struct CheckIdentity crateIdentity; uint32_t crateSceneNum = sceneNum; // pretend night is day to align crates in market and align GF child/adult crates @@ -3885,8 +3889,8 @@ CrateIdentity Randomizer::IdentifyCrate(s32 sceneNum, s32 posX, s32 posZ) { return crateIdentity; } -SmallCrateIdentity Randomizer::IdentifySmallCrate(s32 sceneNum, s32 posX, s32 posZ) { - struct SmallCrateIdentity smallCrateIdentity; +CheckIdentity Randomizer::IdentifySmallCrate(s32 sceneNum, s32 posX, s32 posZ) { + struct CheckIdentity smallCrateIdentity; uint32_t smallCrateSceneNum = sceneNum; smallCrateIdentity.randomizerInf = RAND_INF_MAX; @@ -3907,8 +3911,8 @@ SmallCrateIdentity Randomizer::IdentifySmallCrate(s32 sceneNum, s32 posX, s32 po return smallCrateIdentity; } -TreeIdentity Randomizer::IdentifyTree(s32 sceneNum, s32 posX, s32 posZ) { - struct TreeIdentity treeIdentity; +CheckIdentity Randomizer::IdentifyTree(s32 sceneNum, s32 posX, s32 posZ) { + struct CheckIdentity treeIdentity; if (sceneNum == SCENE_MARKET_NIGHT) { sceneNum = SCENE_MARKET_DAY; diff --git a/soh/soh/Enhancements/randomizer/randomizer.h b/soh/soh/Enhancements/randomizer/randomizer.h index 4b4d96c3ef3..7cdc2935a78 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.h +++ b/soh/soh/Enhancements/randomizer/randomizer.h @@ -49,15 +49,15 @@ class Randomizer { RandomizerInf GetRandomizerInfFromCheck(RandomizerCheck rc); Rando::Location* GetCheckObjectFromActor(s16 actorId, s16 sceneNum, s32 actorParams); ScrubIdentity IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respawnData); - BeehiveIdentity IdentifyBeehive(s32 sceneNum, s16 xPosition, s32 respawnData); + CheckIdentity IdentifyBeehive(s32 sceneNum, s16 xPosition, s32 respawnData); ShopItemIdentity IdentifyShopItem(s32 sceneNum, u8 slotIndex); - CowIdentity IdentifyCow(s32 sceneNum, s32 posX, s32 posZ); - PotIdentity IdentifyPot(s32 sceneNum, s32 posX, s32 posZ); - FishIdentity IdentifyFish(s32 sceneNum, s32 actorParams); - GrassIdentity IdentifyGrass(s32 sceneNum, s32 posX, s32 posZ, s32 respawnData, s32 linkAge); - CrateIdentity IdentifyCrate(s32 sceneNum, s32 posX, s32 posZ); - SmallCrateIdentity IdentifySmallCrate(s32 sceneNum, s32 posX, s32 posZ); - TreeIdentity IdentifyTree(s32 sceneNum, s32 posX, s32 posZ); + CheckIdentity IdentifyCow(s32 sceneNum, s32 posX, s32 posZ); + CheckIdentity IdentifyPot(s32 sceneNum, s32 posX, s32 posZ); + CheckIdentity IdentifyFish(s32 sceneNum, s32 actorParams); + CheckIdentity IdentifyGrass(s32 sceneNum, s32 posX, s32 posZ, s32 respawnData, s32 linkAge); + CheckIdentity IdentifyCrate(s32 sceneNum, s32 posX, s32 posZ); + CheckIdentity IdentifySmallCrate(s32 sceneNum, s32 posX, s32 posZ); + CheckIdentity IdentifyTree(s32 sceneNum, s32 posX, s32 posZ); GetItemEntry GetItemFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogItemId, bool checkObtainability = true); GetItemEntry GetItemFromActor(s16 actorId, s16 sceneNum, s16 actorParams, GetItemID ogItemId, diff --git a/soh/soh/Enhancements/randomizer/randomizerTypes.h b/soh/soh/Enhancements/randomizer/randomizerTypes.h index a94b15b9bd3..ccce77b4e82 100644 --- a/soh/soh/Enhancements/randomizer/randomizerTypes.h +++ b/soh/soh/Enhancements/randomizer/randomizerTypes.h @@ -6846,66 +6846,24 @@ typedef enum { CANT_OBTAIN_NEED_EMPTY_BOTTLE, } ItemObtainability; -typedef struct BeehiveIdentity { +typedef struct CheckIdentity { RandomizerInf randomizerInf; RandomizerCheck randomizerCheck; -} BeehiveIdentity; +} CheckIdentity; typedef struct ScrubIdentity { - RandomizerInf randomizerInf; - RandomizerCheck randomizerCheck; + CheckIdentity identity; GetItemID getItemId; int32_t itemPrice; } ScrubIdentity; typedef struct ShopItemIdentity { - RandomizerInf randomizerInf; - RandomizerCheck randomizerCheck; + CheckIdentity identity; GetItemID ogItemId; int32_t enGirlAShopItem; int32_t itemPrice; } ShopItemIdentity; -typedef struct CowIdentity { - RandomizerInf randomizerInf; - RandomizerCheck randomizerCheck; -} CowIdentity; - -typedef struct PotIdentity { - RandomizerInf randomizerInf; - RandomizerCheck randomizerCheck; -} PotIdentity; - -typedef struct FishIdentity { - RandomizerInf randomizerInf; - RandomizerCheck randomizerCheck; -} FishIdentity; - -typedef struct FairyIdentity { - RandomizerInf randomizerInf; - RandomizerCheck randomizerCheck; -} FairyIdentity; - -typedef struct GrassIdentity { - RandomizerInf randomizerInf; - RandomizerCheck randomizerCheck; -} GrassIdentity; - -typedef struct CrateIdentity { - RandomizerInf randomizerInf; - RandomizerCheck randomizerCheck; -} CrateIdentity; - -typedef struct SmallCrateIdentity { - RandomizerInf randomizerInf; - RandomizerCheck randomizerCheck; -} SmallCrateIdentity; - -typedef struct TreeIdentity { - RandomizerInf randomizerInf; - RandomizerCheck randomizerCheck; -} TreeIdentity; - typedef enum { TRACKER_WINDOW_FLOATING, TRACKER_WINDOW_WINDOW, diff --git a/soh/soh/Enhancements/randomizer/settings.cpp b/soh/soh/Enhancements/randomizer/settings.cpp index 5eb2642cff4..85bd08c26b6 100644 --- a/soh/soh/Enhancements/randomizer/settings.cpp +++ b/soh/soh/Enhancements/randomizer/settings.cpp @@ -2311,6 +2311,7 @@ void Settings::CreateOptions() { &mOptions[RSK_SHUFFLE_POTS], &mOptions[RSK_SHUFFLE_CRATES], &mOptions[RSK_SHUFFLE_TREES], + &mOptions[RSK_SHUFFLE_BUSHES], &mOptions[RSK_SHUFFLE_FROG_SONG_RUPEES], &mOptions[RSK_SHUFFLE_ADULT_TRADE], &mOptions[RSK_SHUFFLE_100_GS_REWARD], diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 77aaf6a5264..9af82067e0d 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -2169,26 +2169,10 @@ extern "C" RandomizerCheck Randomizer_GetCheckFromActor(s16 actorId, s16 sceneNu return OTRGlobals::Instance->gRandomizer->GetCheckFromActor(actorId, sceneNum, actorParams); } -extern "C" ScrubIdentity Randomizer_IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respawnData) { - return OTRGlobals::Instance->gRandomizer->IdentifyScrub(sceneNum, actorParams, respawnData); -} - -extern "C" BeehiveIdentity Randomizer_IdentifyBeehive(s32 sceneNum, s16 xPosition, s32 respawnData) { - return OTRGlobals::Instance->gRandomizer->IdentifyBeehive(sceneNum, xPosition, respawnData); -} - extern "C" ShopItemIdentity Randomizer_IdentifyShopItem(s32 sceneNum, u8 slotIndex) { return OTRGlobals::Instance->gRandomizer->IdentifyShopItem(sceneNum, slotIndex); } -extern "C" CowIdentity Randomizer_IdentifyCow(s32 sceneNum, s32 posX, s32 posZ) { - return OTRGlobals::Instance->gRandomizer->IdentifyCow(sceneNum, posX, posZ); -} - -extern "C" FishIdentity Randomizer_IdentifyFish(s32 sceneNum, s32 actorParams) { - return OTRGlobals::Instance->gRandomizer->IdentifyFish(sceneNum, actorParams); -} - extern "C" GetItemEntry ItemTable_Retrieve(int16_t getItemID) { GetItemEntry giEntry = ItemTableManager::Instance->RetrieveItemEntry(MOD_NONE, getItemID); return giEntry; @@ -2536,7 +2520,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { auto scrubIdentity = ObjectExtension::GetInstance().Get(player->talkActor); if (scrubIdentity != nullptr) { RandomizerCheck rc = - OTRGlobals::Instance->gRandomizer->GetCheckFromRandomizerInf(scrubIdentity->randomizerInf); + OTRGlobals::Instance->gRandomizer->GetCheckFromRandomizerInf(scrubIdentity->identity.randomizerInf); messageEntry = OTRGlobals::Instance->gRandomizer->GetMerchantMessage( rc, TEXT_SCRUB_RANDOM, TEXT_SCRUB_RANDOM_FREE, Randomizer_GetSettingValue(RSK_SCRUB_TEXT_HINT) == RO_GENERIC_OFF); diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index c7c5702a0ac..42bb1a74874 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -131,11 +131,7 @@ Sprite* GetSeedTexture(uint8_t index); uint8_t GetSeedIconIndex(uint8_t index); u8 Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey); RandomizerCheck Randomizer_GetCheckFromActor(s16 actorId, s16 sceneNum, s16 actorParams); -ScrubIdentity Randomizer_IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respawnData); -BeehiveIdentity Randomizer_IdentifyBeehive(s32 sceneNum, s16 xPosition, s32 respawnData); ShopItemIdentity Randomizer_IdentifyShopItem(s32 sceneNum, u8 slotIndex); -CowIdentity Randomizer_IdentifyCow(s32 sceneNum, s32 posX, s32 posZ); -FishIdentity Randomizer_IdentifyFish(s32 sceneNum, s32 actorParams); void Randomizer_ParseSpoiler(const char* fileLoc); void Randomizer_LoadHintMessages(); void Randomizer_LoadMerchantMessages(); diff --git a/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index a8924cf11b1..9576c7a82fa 100644 --- a/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -387,10 +387,10 @@ s32 EnGirlA_TryChangeShopItemShip(EnGirlA* this, PlayState* play) { } } else if (this->actor.params == SI_RANDOMIZED_ITEM) { ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); - if (Flags_GetRandomizerInf(shopItemIdentity.randomizerInf)) { + if (Flags_GetRandomizerInf(shopItemIdentity.identity.randomizerInf)) { this->actor.params = SI_SOLD_OUT; GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck( - shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); + shopItemIdentity.identity.randomizerCheck, shopItemIdentity.ogItemId); // Undo the rotation for spiritual stones if (getItemEntry.getItemId >= RG_KOKIRI_EMERALD && getItemEntry.getItemId <= RG_ZORA_SAPPHIRE) { @@ -485,7 +485,7 @@ void EnGirlA_InitItem(EnGirlA* this, PlayState* play) { if (params == SI_RANDOMIZED_ITEM) { ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck( - shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); + shopItemIdentity.identity.randomizerCheck, shopItemIdentity.ogItemId); objectId = getItemEntry.objectId; } @@ -851,9 +851,9 @@ s32 EnGirlA_CanBuy_Fairy(PlayState* play, EnGirlA* this) { s32 EnGirlA_CanBuy_Randomizer(PlayState* play, EnGirlA* this) { ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck( - shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); + shopItemIdentity.identity.randomizerCheck, shopItemIdentity.ogItemId); ItemObtainability itemObtainability = - Randomizer_GetItemObtainabilityFromRandomizerCheck(shopItemIdentity.randomizerCheck); + Randomizer_GetItemObtainabilityFromRandomizerCheck(shopItemIdentity.identity.randomizerCheck); if (itemObtainability == CANT_OBTAIN_NEED_EMPTY_BOTTLE) { return CANBUY_RESULT_NEED_BOTTLE; @@ -863,8 +863,8 @@ s32 EnGirlA_CanBuy_Randomizer(PlayState* play, EnGirlA* this) { return CANBUY_RESULT_CANT_GET_NOW_5; } - if (Flags_GetRandomizerInf(shopItemIdentity.randomizerInf) || itemObtainability == CANT_OBTAIN_ALREADY_HAVE || - itemObtainability == CANT_OBTAIN_MISC) { + if (Flags_GetRandomizerInf(shopItemIdentity.identity.randomizerInf) || + itemObtainability == CANT_OBTAIN_ALREADY_HAVE || itemObtainability == CANT_OBTAIN_MISC) { return CANBUY_RESULT_CANT_GET_NOW; } @@ -1056,9 +1056,9 @@ void EnGirlA_ItemGive_Randomizer(PlayState* play, EnGirlA* this) { Player* player = GET_PLAYER(play); ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck( - shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); + shopItemIdentity.identity.randomizerCheck, shopItemIdentity.ogItemId); - Flags_SetRandomizerInf(shopItemIdentity.randomizerInf); + Flags_SetRandomizerInf(shopItemIdentity.identity.randomizerInf); Rupees_ChangeBy(-this->basePrice); } @@ -1181,7 +1181,7 @@ void EnGirlA_SetItemDescription(PlayState* play, EnGirlA* this) { if (params == SI_RANDOMIZED_ITEM) { ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); - this->actor.textId = 0x9100 + (shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1); + this->actor.textId = 0x9100 + (shopItemIdentity.identity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1); } this->isInvisible = false; @@ -1207,7 +1207,8 @@ void EnGirlA_UpdateStockedItem(PlayState* play, EnGirlA* this) { if (this->actor.params == SI_RANDOMIZED_ITEM) { ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); - this->actor.textId = 0x9100 + (shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1); + this->actor.textId = + 0x9100 + (shopItemIdentity.identity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1); } else { this->actor.textId = itemEntry->itemDescTextId; } @@ -1348,10 +1349,12 @@ void EnGirlA_WaitForObject(EnGirlA* this, PlayState* play) { if (params == SI_RANDOMIZED_ITEM) { ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, this->randoSlotIndex); GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck( - shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); - this->actor.textId = 0x9100 + (shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1); + shopItemIdentity.identity.randomizerCheck, shopItemIdentity.ogItemId); + this->actor.textId = + 0x9100 + (shopItemIdentity.identity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1); this->itemBuyPromptTextId = - 0x9100 + ((shopItemIdentity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1) + NUM_SHOP_ITEMS); + 0x9100 + + ((shopItemIdentity.identity.randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1) + NUM_SHOP_ITEMS); this->getItemId = getItemEntry.getItemId; this->basePrice = shopItemIdentity.itemPrice; this->giDrawId = getItemEntry.gid; @@ -1438,7 +1441,7 @@ void EnGirlA_Draw(Actor* thisx, PlayState* play) { this->actor.params == SI_RANDOMIZED_ITEM) ? GetItemMystery() : Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck( - shopItemIdentity.randomizerCheck, shopItemIdentity.ogItemId); + shopItemIdentity.identity.randomizerCheck, shopItemIdentity.ogItemId); EnItem00_CustomItemsParticles(&this->actor, play, getItemEntry); GetItemEntry_Draw(play, getItemEntry); diff --git a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index d78daafe457..8eb5055c48b 100644 --- a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -434,10 +434,10 @@ void EnOssan_SpawnItemsOnShelves(EnOssan* this, PlayState* play, ShopItem* shopI itemParams = sShopItemReplaceFunc[shopItems->shopItemIndex](shopItems->shopItemIndex); if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHOPSANITY) != RO_SHOPSANITY_OFF) { ShopItemIdentity shopItemIdentity = Randomizer_IdentifyShopItem(play->sceneNum, i + 1); - if (shopItemIdentity.randomizerCheck != RC_UNKNOWN_CHECK) { + if (shopItemIdentity.identity.randomizerCheck != RC_UNKNOWN_CHECK) { itemParams = shopItemIdentity.enGirlAShopItem; - if (Flags_GetRandomizerInf(shopItemIdentity.randomizerInf)) { + if (Flags_GetRandomizerInf(shopItemIdentity.identity.randomizerInf)) { itemParams = SI_SOLD_OUT; } }