Fix generation errors exposed by loccacc refactor (#4861)

* Fix generation errors exposed by loccacc refactor

* oops
This commit is contained in:
Pepper0ni 2025-01-12 00:50:50 +00:00 committed by GitHub
parent 61de721fe5
commit 66f5e6c26c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 17 additions and 15 deletions

View File

@ -391,14 +391,14 @@ void ApplyOrStoreItem(Rando::ItemLocation* loc, GetAccessibleLocationsStruct& ga
} }
// Adds the contents of a location to the current progression and optionally playthrough // 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(); auto ctx = Rando::Context::GetInstance();
StartPerformanceTimer(PT_LOCATION_LOGIC); StartPerformanceTimer(PT_LOCATION_LOGIC);
RandomizerCheck loc = locPair.GetLocation(); RandomizerCheck loc = locPair.GetLocation();
Rando::ItemLocation* location = ctx->GetItemLocation(loc); Rando::ItemLocation* location = ctx->GetItemLocation(loc);
RandomizerGet locItem = location->GetPlacedRandomizerGet(); RandomizerGet locItem = location->GetPlacedRandomizerGet();
if (!location->IsAddedToPool() && locPair.ConditionsMet()) { if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion)) {
location->AddToPool(); location->AddToPool();
if (locItem == RG_NONE) { if (locItem == RG_NONE) {
@ -486,7 +486,7 @@ void ProcessRegion(Region* region, GetAccessibleLocationsStruct& gals, Randomize
PropagateTimeTravel(gals, ignore, stopOnBeatable, addToPlaythrough); PropagateTimeTravel(gals, ignore, stopOnBeatable, addToPlaythrough);
for (size_t k = 0; k < region->locations.size(); k++) { 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; Rando::Context::GetInstance()->playthroughBeatable = true;
return; return;
} }

View File

@ -56,6 +56,7 @@ void ItemLocation::SetParentRegion(const RandomizerRegion region) {
parentRegion = region; parentRegion = region;
} }
//RANDOTODO only used in tracker now, could possibly be removed
RandomizerRegion ItemLocation::GetParentRegionKey() const { RandomizerRegion ItemLocation::GetParentRegionKey() const {
return parentRegion; return parentRegion;
} }

View File

@ -27,11 +27,10 @@ bool LocationAccess::CheckConditionAtAgeTime(bool& age, bool& time) const {
return GetConditionsMet(); 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 //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 //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 //have any access at all just because this is being run
Region* parentRegion = RegionTable(Rando::Context::GetInstance()->GetItemLocation(location)->GetParentRegionKey());
bool conditionsMet = false; bool conditionsMet = false;
if ( if (

View File

@ -15,6 +15,8 @@ typedef bool (*ConditionFn)();
extern Rando::Context* ctx; extern Rando::Context* ctx;
extern std::shared_ptr<Rando::Logic> logic; extern std::shared_ptr<Rando::Logic> logic;
class Region;
class EventAccess { class EventAccess {
public: public:
explicit EventAccess(bool* event_, ConditionFn condition_function_) : event(event_), condition_function(condition_function_) {} 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 CheckConditionAtAgeTime(bool& age, bool& time) const;
bool ConditionsMet() const; bool ConditionsMet(Region* parentRegion) const;
RandomizerCheck GetLocation() const { RandomizerCheck GetLocation() const {
return location; return location;

View File

@ -426,7 +426,7 @@ void RegionTable_Init_FireTemple() {
Entrance(RR_FIRE_TEMPLE_MQ_MAP_ROOM_SOUTH, []{return logic->OpenedLowestGoronCage;}), 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 //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 //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)))) 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))))
@ -434,13 +434,13 @@ void RegionTable_Init_FireTemple() {
//Exits //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 //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_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)));}), 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. //This room assumes tunic logic is handled on entry.
//Covers the upper section too, as all methods to reach this can climb up somehow //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 //Locations
//If we have FAs, we can just remove the crate and use those to light the torches. //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 //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()), LOCATION(RC_FIRE_TEMPLE_MQ_SOUTH_FIRE_MAZE_EAST_POT, logic->CanBreakPots()),
}, { }, {
//Exits //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_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);}), 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 //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, {}, {}, { areaTable[RR_FIRE_TEMPLE_BOSS_ENTRYWAY] = Region("Fire Temple Boss Entryway", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, {}, {}, {
// Exits // Exits
Entrance(RR_FIRE_TEMPLE_NEAR_BOSS_ROOM, []{return ctx->GetDungeon(FIRE_TEMPLE)->IsVanilla() && false;}), 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;}), Entrance(RR_FIRE_TEMPLE_BOSS_ROOM, []{return true;}),
}); });

View File

@ -666,7 +666,6 @@ typedef enum {
RR_FIRE_TEMPLE_FIRST_ROOM, RR_FIRE_TEMPLE_FIRST_ROOM,
RR_FIRE_TEMPLE_NEAR_BOSS_ROOM, RR_FIRE_TEMPLE_NEAR_BOSS_ROOM,
RR_FIRE_TEMPLE_NEAR_BOSS_ROOM_NORTH,
RR_FIRE_TEMPLE_LOOP_ENEMIES, RR_FIRE_TEMPLE_LOOP_ENEMIES,
RR_FIRE_TEMPLE_LOOP_TILES, RR_FIRE_TEMPLE_LOOP_TILES,
RR_FIRE_TEMPLE_LOOP_FLARE_DANCER, RR_FIRE_TEMPLE_LOOP_FLARE_DANCER,
@ -709,7 +708,8 @@ typedef enum {
RR_FIRE_TEMPLE_MQ_LOWER_FLARE_DANCER, RR_FIRE_TEMPLE_MQ_LOWER_FLARE_DANCER,
RR_FIRE_TEMPLE_MQ_MAP_ROOM_NORTH, RR_FIRE_TEMPLE_MQ_MAP_ROOM_NORTH,
RR_FIRE_TEMPLE_MQ_MAP_ROOM_CAGE, 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_BIG_LAVA_ROOM,
RR_FIRE_TEMPLE_MQ_TORCH_FIREWALL_ROOM, RR_FIRE_TEMPLE_MQ_TORCH_FIREWALL_ROOM,
RR_FIRE_TEMPLE_MQ_ELEVATOR_ROOM, RR_FIRE_TEMPLE_MQ_ELEVATOR_ROOM,