diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index dac3b2de9..8bb0a9cc8 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -1408,8 +1408,8 @@ static bool SfxHandler(std::shared_ptr Console, const std::vector return 0; } -static bool RecalculateAccessibleChecksHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { - CheckTracker::RecalculateAccessibleChecks(); +static bool RecalculateAvailableChecksHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { + CheckTracker::RecalculateAvailableChecks(); return 0; } @@ -1602,7 +1602,7 @@ void DebugConsole_Init(void) { {"group_name", Ship::ArgumentType::TEXT, true}, }}); - CMD_REGISTER("recalculate_accessible_checks", {RecalculateAccessibleChecksHandler, "Recalculate accessible checks."}); + CMD_REGISTER("recalculate_available_checks", {RecalculateAvailableChecksHandler, "Recalculate available checks."}); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } diff --git a/soh/soh/Enhancements/debugger/performanceTimer.h b/soh/soh/Enhancements/debugger/performanceTimer.h index 7df90db70..a2470e4dd 100644 --- a/soh/soh/Enhancements/debugger/performanceTimer.h +++ b/soh/soh/Enhancements/debugger/performanceTimer.h @@ -25,7 +25,7 @@ typedef enum { PT_TOD_ACCESS, PT_ENTRANCE_LOGIC, PT_LOCATION_LOGIC, - PT_RECALCULATE_ACCESSIBLE_CHECKS, + PT_RECALCULATE_AVAILABLE_CHECKS, PT_MAX } TimerID; diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index 90130d2b5..b0a245790 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -396,8 +396,8 @@ bool AddCheckToLogic(LocationAccess& locPair, GetAccessibleLocationsStruct& gals Rando::ItemLocation* location = ctx->GetItemLocation(loc); RandomizerGet locItem = location->GetPlacedRandomizerGet(); - if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion, gals.calculatingAccessibleChecks)) { - if (gals.calculatingAccessibleChecks) { + if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion, gals.calculatingAvailableChecks)) { + if (gals.calculatingAvailableChecks) { gals.accessibleLocations.push_back(loc); StopPerformanceTimer(PT_LOCATION_LOGIC); return false; @@ -498,19 +498,19 @@ void ProcessRegion(Region* region, GetAccessibleLocationsStruct& gals, Randomize } // Return any of the targetLocations that are accessible in logic -std::vector ReachabilitySearch(const std::vector& targetLocations, RandomizerGet ignore /* = RG_NONE*/, bool calculatingAccessibleChecks /* = false */) { +std::vector ReachabilitySearch(const std::vector& targetLocations, RandomizerGet ignore /* = RG_NONE*/, bool calculatingAvailableChecks /* = false */) { auto ctx = Rando::Context::GetInstance(); GetAccessibleLocationsStruct gals(0); - gals.calculatingAccessibleChecks = calculatingAccessibleChecks; - ResetLogic(ctx, gals, !calculatingAccessibleChecks); + gals.calculatingAvailableChecks = calculatingAvailableChecks; + ResetLogic(ctx, gals, !calculatingAvailableChecks); do { gals.InitLoop(); for (size_t i = 0; i < gals.regionPool.size(); i++) { ProcessRegion(RegionTable(gals.regionPool[i]), gals, ignore); } } while (gals.logicUpdated); - erase_if(gals.accessibleLocations, [&targetLocations, ctx, calculatingAccessibleChecks](RandomizerCheck loc) { - if (ctx->GetItemLocation(loc)->GetPlacedRandomizerGet() != RG_NONE && !calculatingAccessibleChecks) { + erase_if(gals.accessibleLocations, [&targetLocations, ctx, calculatingAvailableChecks](RandomizerCheck loc) { + if (ctx->GetItemLocation(loc)->GetPlacedRandomizerGet() != RG_NONE && !calculatingAvailableChecks) { return false; } for (RandomizerCheck allowedLocation : targetLocations) { diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.hpp b/soh/soh/Enhancements/randomizer/3drando/fill.hpp index 8ca5999d4..bb013cc13 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.hpp @@ -34,7 +34,7 @@ struct GetAccessibleLocationsStruct { std::vector itemSphere; std::list entranceSphere; - bool calculatingAccessibleChecks = false; + bool calculatingAvailableChecks = false; GetAccessibleLocationsStruct(int _maxGsCount){ regionPool = {RR_ROOT}; @@ -64,7 +64,7 @@ std::vector GetEmptyLocations(std::vector allo void ProcessRegion(Region* region, GetAccessibleLocationsStruct& gals, RandomizerGet ignore = RG_NONE, bool stopOnBeatable = false, bool addToPlaythrough = false); -std::vector ReachabilitySearch(const std::vector& allowedLocations, RandomizerGet ignore=RG_NONE, bool calculatingAccessibleChecks=false); +std::vector ReachabilitySearch(const std::vector& allowedLocations, RandomizerGet ignore=RG_NONE, bool calculatingAvailableChecks=false); void GeneratePlaythrough(); diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index d8a7bd7a7..5ba39d0b3 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -347,7 +347,7 @@ void RandomizerOnItemReceiveHandler(GetItemEntry receivedItemEntry) { loc->SetCheckStatus(RCSHOW_COLLECTED); CheckTracker::SpoilAreaFromCheck(randomizerQueuedCheck); CheckTracker::RecalculateAllAreaTotals(); - CheckTracker::RecalculateAccessibleChecks(); + CheckTracker::RecalculateAvailableChecks(); SaveManager::Instance->SaveSection(gSaveContext.fileNum, SECTION_ID_TRACKER_DATA, true); randomizerQueuedCheck = RC_UNKNOWN_CHECK; randomizerQueuedItemEntry = GET_ITEM_NONE; diff --git a/soh/soh/Enhancements/randomizer/item_location.cpp b/soh/soh/Enhancements/randomizer/item_location.cpp index a3560859e..cfdfb4204 100644 --- a/soh/soh/Enhancements/randomizer/item_location.cpp +++ b/soh/soh/Enhancements/randomizer/item_location.cpp @@ -228,14 +228,14 @@ void ItemLocation::ResetVariables() { areas = {}; status = RCSHOW_UNCHECKED; isSkipped = false; - isAccessible = false; + isAvailable = false; } -bool ItemLocation::IsAccessible() const { - return isAccessible; +bool ItemLocation::IsAvailable() const { + return isAvailable; } -void ItemLocation::SetAccessible(bool isAccessible_) { - isAccessible = isAccessible_; +void ItemLocation::SetAvailable(bool isAvailable_) { + isAvailable = isAvailable_; } } \ No newline at end of file diff --git a/soh/soh/Enhancements/randomizer/item_location.h b/soh/soh/Enhancements/randomizer/item_location.h index 7a4c0b286..e60d358eb 100644 --- a/soh/soh/Enhancements/randomizer/item_location.h +++ b/soh/soh/Enhancements/randomizer/item_location.h @@ -56,8 +56,8 @@ class ItemLocation { bool IsFoolishCandidate() const; void SetBarrenCandidate(); void ResetVariables(); - bool IsAccessible() const; - void SetAccessible(bool isAccessible_); + bool IsAvailable() const; + void SetAvailable(bool isAvailable_); private: RandomizerCheck rc; @@ -78,6 +78,6 @@ class ItemLocation { bool barrenCandidate = false; RandomizerCheckStatus status = RCSHOW_UNCHECKED; bool isSkipped = false; - bool isAccessible = false; + bool isAvailable = false; }; } // namespace Rando \ No newline at end of file diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index 28f9075ba..bcf5f33b3 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -32,7 +32,7 @@ bool LocationAccess::CheckConditionAtAgeTime(bool& age, bool& time) const { return GetConditionsMet(); } -bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAccessibleChecks) const { +bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) 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 @@ -47,7 +47,7 @@ bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAccessi conditionsMet = true; } - return conditionsMet && (calculatingAccessibleChecks || CanBuy()); + return conditionsMet && (calculatingAvailableChecks || CanBuy()); } bool LocationAccess::CanBuy() const { diff --git a/soh/soh/Enhancements/randomizer/location_access.h b/soh/soh/Enhancements/randomizer/location_access.h index 383bfd31f..ad7061963 100644 --- a/soh/soh/Enhancements/randomizer/location_access.h +++ b/soh/soh/Enhancements/randomizer/location_access.h @@ -75,7 +75,7 @@ class LocationAccess { bool CheckConditionAtAgeTime(bool& age, bool& time) const; - bool ConditionsMet(Region* parentRegion, bool calculatingAccessibleChecks) const; + bool ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const; RandomizerCheck GetLocation() const { return location; diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 854137ba1..0408f3a2f 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -131,10 +131,10 @@ bool areasFullyChecked[RCAREA_INVALID]; u32 areasSpoiled = 0; bool showVOrMQ; s8 areaChecksGotten[RCAREA_INVALID]; //| "Kokiri Forest (4/9)" -s8 areaChecksAccessible[RCAREA_INVALID]; +s8 areaChecksAvailable[RCAREA_INVALID]; s8 areaCheckTotals[RCAREA_INVALID]; uint16_t totalChecks = 0; -uint16_t totalChecksAccessible = 0; +uint16_t totalChecksAvailable = 0; uint16_t totalChecksGotten = 0; bool optCollapseAll; // A bool that will collapse all checks once bool optExpandAll; // A bool that will expand all checks once @@ -237,12 +237,12 @@ void TrySetAreas() { void CalculateTotals() { totalChecks = 0; - totalChecksAccessible = 0; + totalChecksAvailable = 0; totalChecksGotten = 0; for (uint8_t i = 0; i < RCAREA_INVALID; i++) { totalChecks += areaCheckTotals[i]; - totalChecksAccessible += areaChecksAccessible[i]; + totalChecksAvailable += areaChecksAvailable[i]; totalChecksGotten += areaChecksGotten[i]; } } @@ -257,7 +257,7 @@ uint16_t GetTotalChecksGotten() { void RecalculateAreaTotals(RandomizerCheckArea rcArea) { areaChecksGotten[rcArea] = 0; - areaChecksAccessible[rcArea] = 0; + areaChecksAvailable[rcArea] = 0; areaCheckTotals[rcArea] = 0; for (auto rc : checksByArea.at(rcArea)) { if (!IsVisibleInCheckTracker(rc)) { @@ -266,8 +266,8 @@ void RecalculateAreaTotals(RandomizerCheckArea rcArea) { areaCheckTotals[rcArea]++; if (OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->GetIsSkipped() || OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->HasObtained()) { areaChecksGotten[rcArea]++; - } else if (OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->IsAccessible()) { - areaChecksAccessible[rcArea]++; + } else if (OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->IsAvailable()) { + areaChecksAvailable[rcArea]++; } } CalculateTotals(); @@ -315,7 +315,7 @@ void SetCheckCollected(RandomizerCheck rc) { if (IsVisibleInCheckTracker(rc)) { if (!OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->GetIsSkipped()) { areaChecksGotten[loc->GetArea()]++; - areaChecksAccessible[loc->GetArea()]--; + areaChecksAvailable[loc->GetArea()]--; } else { OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->SetIsSkipped(false); } @@ -432,12 +432,12 @@ void ClearAreaChecksAndTotals() { for (auto& [rcArea, vec] : checksByArea) { vec.clear(); areaChecksGotten[rcArea] = 0; - areaChecksAccessible[rcArea] = 0; + areaChecksAvailable[rcArea] = 0; areaCheckTotals[rcArea] = 0; } totalChecks = 0; totalChecksGotten = 0; - totalChecksAccessible = 0; + totalChecksAvailable = 0; } void SetShopSeen(uint32_t sceneNum, bool prices) { @@ -479,8 +479,8 @@ void CheckTrackerLoadGame(int32_t fileNum) { if (loc->GetCheckStatus() == RCSHOW_SAVED || loc->GetIsSkipped()) { areaChecksGotten[entry2->GetArea()]++; } - if (loc->IsAccessible()) { - areaChecksAccessible[entry2->GetArea()]++; + if (loc->IsAvailable()) { + areaChecksAvailable[entry2->GetArea()]++; } } @@ -533,7 +533,7 @@ void CheckTrackerLoadGame(int32_t fileNum) { UpdateAllOrdering(); UpdateInventoryChecks(); UpdateFilters(); - RecalculateAccessibleChecks(); + RecalculateAvailableChecks(); } void CheckTrackerShopSlotChange(uint8_t cursorSlot, int16_t basePrice) { @@ -549,7 +549,7 @@ void CheckTrackerShopSlotChange(uint8_t cursorSlot, int16_t basePrice) { if (status == RCSHOW_SEEN) { OTRGlobals::Instance->gRandoContext->GetItemLocation(slot)->SetCheckStatus(RCSHOW_IDENTIFIED); SaveManager::Instance->SaveSection(gSaveContext.fileNum, sectionId, true); - RecalculateAccessibleChecks(); + RecalculateAvailableChecks(); } } @@ -824,7 +824,7 @@ void SaveTrackerData(SaveContext* saveContext, int sectionID, bool fullSave) { void SaveFile(SaveContext* saveContext, int sectionID, bool fullSave) { SaveTrackerData(saveContext, sectionID, fullSave); if (fullSave) { - RecalculateAccessibleChecks(); + RecalculateAvailableChecks(); } } @@ -978,7 +978,7 @@ void CheckTrackerWindow::DrawElement() { ImGui::Separator(); - ImGui::Text("Total Checks: %d Available / %d Checked / %d Total", totalChecksAccessible, totalChecksGotten, totalChecks); + ImGui::Text("Total Checks: %d Available / %d Checked / %d Total", totalChecksAvailable, totalChecksGotten, totalChecks); UIWidgets::PaddedSeparator(); @@ -1031,7 +1031,7 @@ void CheckTrackerWindow::DrawElement() { } if ((shouldHideFilteredAreas && filterAreasHidden[rcArea]) || (!showHidden && ((hideComplete && thisAreaFullyChecked) || (hideIncomplete && !thisAreaFullyChecked))) || - (onlyShowAvailable && areaChecksAccessible[rcArea] == 0) + (onlyShowAvailable && areaChecksAvailable[rcArea] == 0) ) { doDraw = false; } else { @@ -1072,14 +1072,14 @@ void CheckTrackerWindow::DrawElement() { if (isThisAreaSpoiled) { if (showVOrMQ && RandomizerCheckObjects::AreaIsDungeon(rcArea)) { if (OTRGlobals::Instance->gRandoContext->GetDungeons()->GetDungeonFromScene(DungeonSceneLookupByArea(rcArea))->IsMQ()) { - ImGui::Text("(%d / %d / %d) - MQ", areaChecksAccessible[rcArea], areaChecksGotten[rcArea], areaCheckTotals[rcArea]); + ImGui::Text("(%d / %d / %d) - MQ", areaChecksAvailable[rcArea], areaChecksGotten[rcArea], areaCheckTotals[rcArea]); UIWidgets::Tooltip("Available / Checked / Total"); } else { - ImGui::Text("(%d / %d / %d) - Vanilla", areaChecksAccessible[rcArea], areaChecksGotten[rcArea], areaCheckTotals[rcArea]); + ImGui::Text("(%d / %d / %d) - Vanilla", areaChecksAvailable[rcArea], areaChecksGotten[rcArea], areaCheckTotals[rcArea]); UIWidgets::Tooltip("Available / Checked / Total"); } } else { - ImGui::Text("(%d / %d / %d)", areaChecksAccessible[rcArea], areaChecksGotten[rcArea], areaCheckTotals[rcArea]); + ImGui::Text("(%d / %d / %d)", areaChecksAvailable[rcArea], areaChecksGotten[rcArea], areaCheckTotals[rcArea]); UIWidgets::Tooltip("Available / Checked / Total"); } } else { @@ -1095,7 +1095,7 @@ void CheckTrackerWindow::DrawElement() { } for (auto rc : checks) { if (doDraw && isThisAreaSpoiled && !filterChecksHidden[rc] && - (!onlyShowAvailable || OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->IsAccessible())) { + (!onlyShowAvailable || OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->IsAvailable())) { DrawLocation(rc); } } @@ -1529,7 +1529,7 @@ void DrawLocation(RandomizerCheck rc) { Rando::ItemLocation* itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); RandomizerCheckStatus status = itemLoc->GetCheckStatus(); bool skipped = itemLoc->GetIsSkipped(); - bool accessible = itemLoc->IsAccessible(); + bool available = itemLoc->IsAvailable(); if (status == RCSHOW_COLLECTED) { if (!showHidden && hideCollected) { return; @@ -1606,17 +1606,17 @@ void DrawLocation(RandomizerCheck rc) { OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->SetIsSkipped(false); areaChecksGotten[loc->GetArea()]--; totalChecksGotten--; - if (accessible) { - areaChecksAccessible[loc->GetArea()]++; - totalChecksAccessible++; + if (available) { + areaChecksAvailable[loc->GetArea()]++; + totalChecksAvailable++; } } else { OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->SetIsSkipped(true); areaChecksGotten[loc->GetArea()]++; totalChecksGotten++; - if (accessible) { - areaChecksAccessible[loc->GetArea()]--; - totalChecksAccessible--; + if (available) { + areaChecksAvailable[loc->GetArea()]--; + totalChecksAvailable--; } } UpdateOrdering(loc->GetArea()); @@ -1637,7 +1637,7 @@ void DrawLocation(RandomizerCheck rc) { } else { ImGui::PushStyleColor(ImGuiCol_Text, styleColor); } - ImGui::Text("%s", accessible ? ICON_FA_UNLOCK : ICON_FA_LOCK); + ImGui::Text("%s", available ? ICON_FA_UNLOCK : ICON_FA_LOCK); ImGui::PopStyleColor(); ImGui::SameLine(); @@ -1791,47 +1791,47 @@ void ImGuiDrawTwoColorPickerSection(const char* text, const char* cvarMainName, UIWidgets::PopStyleCombobox(); } -void RecalculateAccessibleChecks() { - StartPerformanceTimer(PT_RECALCULATE_ACCESSIBLE_CHECKS); +void RecalculateAvailableChecks() { + StartPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS); std::vector targetLocations; targetLocations.reserve(RR_MAX); for (auto& location : Rando::StaticData::GetLocationTable()) { RandomizerCheck rc = location.GetRandomizerCheck(); Rando::ItemLocation* itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); - itemLocation->SetAccessible(false); + itemLocation->SetAvailable(false); if (!itemLocation->HasObtained()) { targetLocations.emplace_back(rc); } } - std::vector accessibleChecks = ReachabilitySearch(targetLocations, RG_NONE, true); - for (auto& rc : accessibleChecks) { + std::vector availableChecks = ReachabilitySearch(targetLocations, RG_NONE, true); + for (auto& rc : availableChecks) { const auto& location = Rando::StaticData::GetLocation(rc); const auto& itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); if (location->GetRCType() == RCTYPE_SHOP && itemLocation->GetCheckStatus() == RCSHOW_IDENTIFIED) { if (CanBuyAnother(rc)) { - itemLocation->SetAccessible(true); + itemLocation->SetAvailable(true); } } else { - itemLocation->SetAccessible(true); + itemLocation->SetAvailable(true); } } - totalChecksAccessible = 0; + totalChecksAvailable = 0; for (auto& [rcArea, vec] : checksByArea) { - areaChecksAccessible[rcArea] = 0; + areaChecksAvailable[rcArea] = 0; for (auto& rc : vec) { Rando::ItemLocation* itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); - if (itemLocation->IsAccessible() && !itemLocation->GetIsSkipped() && !itemLocation->HasObtained() && IsVisibleInCheckTracker(rc)) { - areaChecksAccessible[rcArea]++; + if (itemLocation->IsAvailable() && !itemLocation->GetIsSkipped() && !itemLocation->HasObtained() && IsVisibleInCheckTracker(rc)) { + areaChecksAvailable[rcArea]++; } } - totalChecksAccessible += areaChecksAccessible[rcArea]; + totalChecksAvailable += areaChecksAvailable[rcArea]; } - StopPerformanceTimer(PT_RECALCULATE_ACCESSIBLE_CHECKS); - SPDLOG_INFO("Recalculate Accessible Checks Time: {}ms", GetPerformanceTimer(PT_RECALCULATE_ACCESSIBLE_CHECKS).count()); + StopPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS); + SPDLOG_INFO("Recalculate Available Checks Time: {}ms", GetPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS).count()); } diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h index 113264e91..962da88e3 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h @@ -61,5 +61,5 @@ void UpdateAllOrdering(); void UpdateAllAreas(); void RecalculateAllAreaTotals(); void SpoilAreaFromCheck(RandomizerCheck rc); -void RecalculateAccessibleChecks(); +void RecalculateAvailableChecks(); } // namespace CheckTracker