From 66f5e6c26c2558e8e25d513a08ac9dc07d3ec4ae Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Sun, 12 Jan 2025 00:50:50 +0000 Subject: [PATCH] Fix generation errors exposed by loccacc refactor (#4861) * Fix generation errors exposed by loccacc refactor * oops --- soh/soh/Enhancements/randomizer/3drando/fill.cpp | 6 +++--- soh/soh/Enhancements/randomizer/item_location.cpp | 1 + .../Enhancements/randomizer/location_access.cpp | 3 +-- soh/soh/Enhancements/randomizer/location_access.h | 4 +++- .../location_access/dungeons/fire_temple.cpp | 14 +++++++------- soh/soh/Enhancements/randomizer/randomizerTypes.h | 4 ++-- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index e7a6ce38b..248fd960d 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -391,14 +391,14 @@ void ApplyOrStoreItem(Rando::ItemLocation* loc, GetAccessibleLocationsStruct& ga } // Adds the contents of a location to the current progression and optionally playthrough -bool AddCheckToLogic(LocationAccess& locPair, GetAccessibleLocationsStruct& gals, RandomizerGet ignore, bool stopOnBeatable, bool addToPlaythrough=false){ +bool AddCheckToLogic(LocationAccess& locPair, GetAccessibleLocationsStruct& gals, RandomizerGet ignore, bool stopOnBeatable, Region* parentRegion, bool addToPlaythrough=false){ auto ctx = Rando::Context::GetInstance(); StartPerformanceTimer(PT_LOCATION_LOGIC); RandomizerCheck loc = locPair.GetLocation(); Rando::ItemLocation* location = ctx->GetItemLocation(loc); RandomizerGet locItem = location->GetPlacedRandomizerGet(); - if (!location->IsAddedToPool() && locPair.ConditionsMet()) { + if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion)) { location->AddToPool(); if (locItem == RG_NONE) { @@ -486,7 +486,7 @@ void ProcessRegion(Region* region, GetAccessibleLocationsStruct& gals, Randomize PropagateTimeTravel(gals, ignore, stopOnBeatable, addToPlaythrough); for (size_t k = 0; k < region->locations.size(); k++) { - if(AddCheckToLogic(region->locations[k], gals, ignore, stopOnBeatable, addToPlaythrough)){ + if(AddCheckToLogic(region->locations[k], gals, ignore, stopOnBeatable, region, addToPlaythrough)){ Rando::Context::GetInstance()->playthroughBeatable = true; return; } diff --git a/soh/soh/Enhancements/randomizer/item_location.cpp b/soh/soh/Enhancements/randomizer/item_location.cpp index 9f0f84509..47c1f09f1 100644 --- a/soh/soh/Enhancements/randomizer/item_location.cpp +++ b/soh/soh/Enhancements/randomizer/item_location.cpp @@ -56,6 +56,7 @@ void ItemLocation::SetParentRegion(const RandomizerRegion region) { parentRegion = region; } +//RANDOTODO only used in tracker now, could possibly be removed RandomizerRegion ItemLocation::GetParentRegionKey() const { return parentRegion; } diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index f8bb8f421..7c9cf7e7f 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -27,11 +27,10 @@ bool LocationAccess::CheckConditionAtAgeTime(bool& age, bool& time) const { return GetConditionsMet(); } -bool LocationAccess::ConditionsMet() const { +bool LocationAccess::ConditionsMet(Region* parentRegion) const { //WARNING enterance validation can run this after resetting the access for sphere 0 validation //When refactoring ToD access, either fix the above or do not assume that we //have any access at all just because this is being run - Region* parentRegion = RegionTable(Rando::Context::GetInstance()->GetItemLocation(location)->GetParentRegionKey()); bool conditionsMet = false; if ( diff --git a/soh/soh/Enhancements/randomizer/location_access.h b/soh/soh/Enhancements/randomizer/location_access.h index 1f2cdfcab..3af0a498d 100644 --- a/soh/soh/Enhancements/randomizer/location_access.h +++ b/soh/soh/Enhancements/randomizer/location_access.h @@ -15,6 +15,8 @@ typedef bool (*ConditionFn)(); extern Rando::Context* ctx; extern std::shared_ptr logic; +class Region; + class EventAccess { public: explicit EventAccess(bool* event_, ConditionFn condition_function_) : event(event_), condition_function(condition_function_) {} @@ -81,7 +83,7 @@ class LocationAccess { bool CheckConditionAtAgeTime(bool& age, bool& time) const; - bool ConditionsMet() const; + bool ConditionsMet(Region* parentRegion) const; RandomizerCheck GetLocation() const { return location; diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp index 4abfa9c23..65efe4cfe 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp @@ -426,21 +426,21 @@ void RegionTable_Init_FireTemple() { Entrance(RR_FIRE_TEMPLE_MQ_MAP_ROOM_SOUTH, []{return logic->OpenedLowestGoronCage;}), }); - areaTable[RR_FIRE_TEMPLE_NEAR_BOSS_ROOM] = Region("Fire Temple MQ Near Boss Room", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, {}, { + areaTable[RR_FIRE_TEMPLE_MQ_NEAR_BOSS_ROOM] = Region("Fire Temple MQ Near Boss Room", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, {}, { //Locations //If we're using the south torch as the initial torch, or using FAs, we either have to cross to the north to remove the crate, or use a trick to ignore it LOCATION(RC_FIRE_TEMPLE_MQ_NEAR_BOSS_CHEST, logic->FireTimer() > 25 && ctx->GetTrickOption(RT_FIRE_MQ_NEAR_BOSS) && (logic->CanUse(RG_FIRE_ARROWS) || (logic->IsAdult && logic->CanUse(RG_DINS_FIRE) && logic->CanUse(RG_FAIRY_BOW)))) }, { //Exits - Entrance(RR_FIRE_TEMPLE_MQ_FIRST_ROOM_UPPER, []{return true;}), + Entrance(RR_FIRE_TEMPLE_MQ_FIRST_ROOM_UPPER, []{return true;}), //Child cannot make it to the north side torches without a hook without specifically bunny hood speed + hover boots - Entrance(RR_FIRE_TEMPLE_NEAR_BOSS_ROOM_NORTH, []{return logic->FireTimer() > 32 && (logic->CanUse(RG_HOOKSHOT) || (logic->IsAdult && logic->CanUse(RG_HOVER_BOOTS)));}), - Entrance(RR_FIRE_TEMPLE_BOSS_ENTRYWAY, []{return logic->HasItem(RG_FIRE_TEMPLE_BOSS_KEY) && logic->FireTimer() >= 15 && ((logic->IsAdult && (ctx->GetTrickOption(RT_FIRE_BOSS_DOOR_JUMP) || logic->CanUse(RG_HOVER_BOOTS))) || (logic->IsAdult && logic->HitFireTemplePlatform) || (logic->HitFireTemplePlatform && logic->CanUse(RG_HOVER_BOOTS)));}), + Entrance(RR_FIRE_TEMPLE_MQ_NEAR_BOSS_ROOM_NORTH, []{return logic->FireTimer() > 32 && (logic->CanUse(RG_HOOKSHOT) || (logic->IsAdult && logic->CanUse(RG_HOVER_BOOTS)));}), + Entrance(RR_FIRE_TEMPLE_BOSS_ENTRYWAY, []{return logic->HasItem(RG_FIRE_TEMPLE_BOSS_KEY) && logic->FireTimer() >= 15 && ((logic->IsAdult && (ctx->GetTrickOption(RT_FIRE_BOSS_DOOR_JUMP) || logic->CanUse(RG_HOVER_BOOTS))) || (logic->IsAdult && logic->HitFireTemplePlatform) || (logic->HitFireTemplePlatform && logic->CanUse(RG_HOVER_BOOTS)));}), }); //This room assumes tunic logic is handled on entry. //Covers the upper section too, as all methods to reach this can climb up somehow - areaTable[RR_FIRE_TEMPLE_NEAR_BOSS_ROOM_NORTH] = Region("Fire Temple MQ Near Boss Room North", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, {}, { + areaTable[RR_FIRE_TEMPLE_MQ_NEAR_BOSS_ROOM_NORTH] = Region("Fire Temple MQ Near Boss Room North", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, {}, { //Locations //If we have FAs, we can just remove the crate and use those to light the torches. //otherwise, with Dins, we first light them with dins and then either use a bow shot or to cross back over to light the other torch @@ -616,7 +616,7 @@ void RegionTable_Init_FireTemple() { LOCATION(RC_FIRE_TEMPLE_MQ_SOUTH_FIRE_MAZE_EAST_POT, logic->CanBreakPots()), }, { //Exits - Entrance(RR_FIRE_TEMPLE_MQ_NEAR_BOSS_DOOR, []{return logic->HitFireTemplePlatform;}), + Entrance(RR_FIRE_TEMPLE_MQ_NEAR_BOSS_ROOM, []{return logic->HitFireTemplePlatform;}), Entrance(RR_FIRE_TEMPLE_MQ_HIGH_TORCH_ROOM, []{return true;}), Entrance(RR_FIRE_TEMPLE_MQ_FIRE_MAZE_PLATFORMS, []{return logic->IsAdult || logic->CanUse(RG_SONG_OF_TIME) || logic->CanUse(RG_HOVER_BOOTS);}), //Hover boots get there via the platforms @@ -699,7 +699,7 @@ void RegionTable_Init_FireTemple() { areaTable[RR_FIRE_TEMPLE_BOSS_ENTRYWAY] = Region("Fire Temple Boss Entryway", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, {}, {}, { // Exits Entrance(RR_FIRE_TEMPLE_NEAR_BOSS_ROOM, []{return ctx->GetDungeon(FIRE_TEMPLE)->IsVanilla() && false;}), - Entrance(RR_FIRE_TEMPLE_MQ_NEAR_BOSS_DOOR, []{return ctx->GetDungeon(FIRE_TEMPLE)->IsMQ() && false;}), + Entrance(RR_FIRE_TEMPLE_MQ_NEAR_BOSS_ROOM, []{return ctx->GetDungeon(FIRE_TEMPLE)->IsMQ() && false;}), Entrance(RR_FIRE_TEMPLE_BOSS_ROOM, []{return true;}), }); diff --git a/soh/soh/Enhancements/randomizer/randomizerTypes.h b/soh/soh/Enhancements/randomizer/randomizerTypes.h index 72dd800e6..87ba34adf 100644 --- a/soh/soh/Enhancements/randomizer/randomizerTypes.h +++ b/soh/soh/Enhancements/randomizer/randomizerTypes.h @@ -666,7 +666,6 @@ typedef enum { RR_FIRE_TEMPLE_FIRST_ROOM, RR_FIRE_TEMPLE_NEAR_BOSS_ROOM, - RR_FIRE_TEMPLE_NEAR_BOSS_ROOM_NORTH, RR_FIRE_TEMPLE_LOOP_ENEMIES, RR_FIRE_TEMPLE_LOOP_TILES, RR_FIRE_TEMPLE_LOOP_FLARE_DANCER, @@ -709,7 +708,8 @@ typedef enum { RR_FIRE_TEMPLE_MQ_LOWER_FLARE_DANCER, RR_FIRE_TEMPLE_MQ_MAP_ROOM_NORTH, RR_FIRE_TEMPLE_MQ_MAP_ROOM_CAGE, - RR_FIRE_TEMPLE_MQ_NEAR_BOSS_DOOR, + RR_FIRE_TEMPLE_MQ_NEAR_BOSS_ROOM, + RR_FIRE_TEMPLE_MQ_NEAR_BOSS_ROOM_NORTH, RR_FIRE_TEMPLE_MQ_BIG_LAVA_ROOM, RR_FIRE_TEMPLE_MQ_TORCH_FIREWALL_ROOM, RR_FIRE_TEMPLE_MQ_ELEVATOR_ROOM,