Available Checks Entrance Shuffle (#5363)

* EntranceShuffler ApplyEntranceOverrides.

* Updated ApplyEntranceOverrides.

* Updated ApplyEntranceOverrides.

* Initial Entrance Discovery.

* Added Randomizer_EntranceDiscovered.

* Updated Randomizer_DiscoverRegion to discover unshuffled connected regions.

* Removed extra semi-colon.

* Update to latest entranceShuffleTable.

* Format fixes.

* Updated EntranceDiscovered to account for entrances not in the entranceShuffleTable.

* Rediscover regions when loading a game.

* Rediscover entrances when enabling Available Checks.

* Added Rando::Context::ParseTricksJson.

* Updated ApplyEntranceOverrides to skip default (unset) overrides.

* Fix clang-format failed check.

* Set mLACSCondition when loading a Randomizer game.

* Updated rediscover loop to use MAX_ENTRANCE_RANDO_USED_INDEX.

* Move entrance discovered into ProcessExits.

* Discover spawns when pulling/placing the master sword.

* Discover adult/child spawn when using Song of Time to switch age.

* Reset logic and ApplyOrStoreItems without applying the item effects to the save when calculating available checks.

* Removed !itemLoc->IsAddedToPool() from the check tracker.

* Remove region discovery as its not needed anymore.

* Cleanup changed files for PR.

* Added Available Checks - Process Undiscovered Exits DebugConsole command.

* Added initial Available Checks - Recalculate DebugConsole command.

* ACPUE, recalculate only if save loaded. ACR, set age and times for the starting region.
This commit is contained in:
xxAtrain223 2025-05-23 19:49:01 -05:00 committed by GitHub
commit d330f22071
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 583 additions and 373 deletions

View file

@ -580,6 +580,13 @@ void CheckTrackerLoadGame(int32_t fileNum) {
UpdateAllOrdering();
UpdateInventoryChecks();
UpdateFilters();
RegionTable_Init();
if (Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_ENTRANCES).Get()) {
Rando::Context::GetInstance()->GetEntranceShuffler()->ApplyEntranceOverrides();
}
RecalculateAvailableChecks();
}
@ -898,7 +905,6 @@ void LoadFile() {
SaveManager::Instance->LoadData("areasSpoiled", areasSpoiled, (uint32_t)0);
UpdateAllOrdering();
UpdateAllAreas();
RegionTable_Init();
}
void Teardown() {
@ -1481,6 +1487,27 @@ void LoadSettings() {
showOverworldFreestanding = false;
showDungeonFreestanding = true;
}
switch (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GANONS_BOSS_KEY)) {
case RO_GANON_BOSS_KEY_LACS_STONES:
Rando::Context::GetInstance()->LACSCondition(RO_LACS_STONES);
break;
case RO_GANON_BOSS_KEY_LACS_MEDALLIONS:
Rando::Context::GetInstance()->LACSCondition(RO_LACS_MEDALLIONS);
break;
case RO_GANON_BOSS_KEY_LACS_REWARDS:
Rando::Context::GetInstance()->LACSCondition(RO_LACS_REWARDS);
break;
case RO_GANON_BOSS_KEY_LACS_DUNGEONS:
Rando::Context::GetInstance()->LACSCondition(RO_LACS_DUNGEONS);
break;
case RO_GANON_BOSS_KEY_LACS_TOKENS:
Rando::Context::GetInstance()->LACSCondition(RO_LACS_TOKENS);
break;
default:
Rando::Context::GetInstance()->LACSCondition(RO_LACS_VANILLA);
break;
}
}
bool IsCheckShuffled(RandomizerCheck rc) {
@ -1820,7 +1847,7 @@ void DrawLocation(RandomizerCheck rc) {
case RCSHOW_IDENTIFIED:
case RCSHOW_SEEN:
if (IS_RANDO) {
if (itemLoc->GetPlacedRandomizerGet() == RG_ICE_TRAP && !mystery && !itemLoc->IsAddedToPool()) {
if (itemLoc->GetPlacedRandomizerGet() == RG_ICE_TRAP && !mystery) {
if (status == RCSHOW_IDENTIFIED) {
txt = OTRGlobals::Instance->gRandoContext->overrides[rc].GetTrickName().GetForLanguage(
gSaveContext.language);
@ -1830,11 +1857,10 @@ void DrawLocation(RandomizerCheck rc) {
.GetName()
.GetForLanguage(gSaveContext.language);
}
} else if (!mystery && !itemLoc->IsAddedToPool()) {
} else if (!mystery) {
txt = itemLoc->GetPlacedItem().GetName().GetForLanguage(gSaveContext.language);
}
if (IsVisibleInCheckTracker(rc) && status == RCSHOW_IDENTIFIED && !mystery &&
!itemLoc->IsAddedToPool()) {
if (IsVisibleInCheckTracker(rc) && status == RCSHOW_IDENTIFIED && !mystery) {
auto price = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->GetPrice();
if (price) {
txt += fmt::format(" - {}", price);
@ -1958,7 +1984,7 @@ void ImGuiDrawTwoColorPickerSection(const char* text, const char* cvarMainName,
UIWidgets::PopStyleCombobox();
}
void RecalculateAvailableChecks() {
void RecalculateAvailableChecks(RandomizerRegion startingRegion /* = RR_ROOT */) {
if (!enableAvailableChecks) {
return;
}
@ -1966,20 +1992,22 @@ void RecalculateAvailableChecks() {
ResetPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS);
StartPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS);
const auto& ctx = Rando::Context::GetInstance();
std::vector<RandomizerCheck> targetLocations;
targetLocations.reserve(RC_MAX);
for (auto& location : Rando::StaticData::GetLocationTable()) {
RandomizerCheck rc = location.GetRandomizerCheck();
Rando::ItemLocation* itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc);
Rando::ItemLocation* itemLocation = ctx->GetItemLocation(rc);
itemLocation->SetAvailable(false);
if (!itemLocation->HasObtained()) {
targetLocations.emplace_back(rc);
}
}
std::vector<RandomizerCheck> availableChecks = ReachabilitySearch(targetLocations, RG_NONE, true);
std::vector<RandomizerCheck> availableChecks = ReachabilitySearch(targetLocations, RG_NONE, true, startingRegion);
for (auto& rc : availableChecks) {
const auto& itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc);
const auto& itemLocation = ctx->GetItemLocation(rc);
itemLocation->SetAvailable(true);
}
@ -1987,7 +2015,7 @@ void RecalculateAvailableChecks() {
for (auto& [rcArea, vec] : checksByArea) {
areaChecksAvailable[rcArea] = 0;
for (auto& rc : vec) {
Rando::ItemLocation* itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc);
Rando::ItemLocation* itemLocation = ctx->GetItemLocation(rc);
if (itemLocation->IsAvailable() && IsVisibleInCheckTracker(rc) && !IsCheckHidden(rc)) {
areaChecksAvailable[rcArea]++;
}