Added StartingAgeTime to RecalculateAvailableChecks. (#6237)
This commit is contained in:
@@ -1478,6 +1478,7 @@ static bool AvailableChecksProcessUndiscoveredExitsHandler(std::shared_ptr<Ship:
|
|||||||
static bool AvailableChecksRecalculateHandler(std::shared_ptr<Ship::Console> Console,
|
static bool AvailableChecksRecalculateHandler(std::shared_ptr<Ship::Console> Console,
|
||||||
const std::vector<std::string>& args, std::string* output) {
|
const std::vector<std::string>& args, std::string* output) {
|
||||||
RandomizerRegion startingRegion = RR_ROOT;
|
RandomizerRegion startingRegion = RR_ROOT;
|
||||||
|
RandoAgeTime startingAgeTime = RAT_NONE;
|
||||||
|
|
||||||
if (args.size() > 1) {
|
if (args.size() > 1) {
|
||||||
try {
|
try {
|
||||||
@@ -1493,7 +1494,21 @@ static bool AvailableChecksRecalculateHandler(std::shared_ptr<Ship::Console> Con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckTracker::RecalculateAvailableChecks(startingRegion);
|
if (args.size() > 2) {
|
||||||
|
if (args[2] == "ChildDay") {
|
||||||
|
startingAgeTime = RAT_CHILD_DAY;
|
||||||
|
} else if (args[2] == "ChildNight") {
|
||||||
|
startingAgeTime = RAT_CHILD_NIGHT;
|
||||||
|
} else if (args[2] == "AdultDay") {
|
||||||
|
startingAgeTime = RAT_ADULT_DAY;
|
||||||
|
} else if (args[2] == "AdultNight") {
|
||||||
|
startingAgeTime = RAT_ADULT_NIGHT;
|
||||||
|
} else {
|
||||||
|
ERROR_MESSAGE("[SOH] Age Time should be ChildDay, ChildNight, AdultDay, or AdultNight");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckTracker::RecalculateAvailableChecks(startingRegion, startingAgeTime);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1759,10 +1774,12 @@ void DebugConsole_Init(void) {
|
|||||||
"Available Checks - Process Undiscovered Exits",
|
"Available Checks - Process Undiscovered Exits",
|
||||||
{ { "enable", Ship::ArgumentType::NUMBER, true } } });
|
{ { "enable", Ship::ArgumentType::NUMBER, true } } });
|
||||||
|
|
||||||
CMD_REGISTER("acr", { AvailableChecksRecalculateHandler,
|
Ship::Context::GetInstance()->GetConsole()->AddCommand(
|
||||||
|
"acr", { AvailableChecksRecalculateHandler,
|
||||||
"Available Checks - Recalculate",
|
"Available Checks - Recalculate",
|
||||||
{
|
{
|
||||||
{ "starting_region", Ship::ArgumentType::NUMBER, true },
|
{ "starting_region", Ship::ArgumentType::NUMBER, true },
|
||||||
|
{ "ChildDay|ChildNight|AdultDay|AdultNight", Ship::ArgumentType::TEXT, true },
|
||||||
} });
|
} });
|
||||||
|
|
||||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
||||||
|
|||||||
@@ -510,7 +510,8 @@ void ProcessRegion(Region* region, GetAccessibleLocationsStruct& gals, Randomize
|
|||||||
std::vector<RandomizerCheck> ReachabilitySearch(const std::vector<RandomizerCheck>& targetLocations,
|
std::vector<RandomizerCheck> ReachabilitySearch(const std::vector<RandomizerCheck>& targetLocations,
|
||||||
RandomizerGet ignore /* = RG_NONE*/,
|
RandomizerGet ignore /* = RG_NONE*/,
|
||||||
bool calculatingAvailableChecks /* = false */,
|
bool calculatingAvailableChecks /* = false */,
|
||||||
RandomizerRegion startingRegion /* = RR_ROOT */) {
|
RandomizerRegion startingRegion /* = RR_ROOT */,
|
||||||
|
RandoAgeTime startingAgeTime /* = RAT_NONE*/) {
|
||||||
auto ctx = Rando::Context::GetInstance();
|
auto ctx = Rando::Context::GetInstance();
|
||||||
GetAccessibleLocationsStruct gals(0);
|
GetAccessibleLocationsStruct gals(0);
|
||||||
ResetLogic(ctx, gals, !calculatingAvailableChecks);
|
ResetLogic(ctx, gals, !calculatingAvailableChecks);
|
||||||
@@ -518,17 +519,18 @@ std::vector<RandomizerCheck> ReachabilitySearch(const std::vector<RandomizerChec
|
|||||||
gals.regionPool.insert(gals.regionPool.begin(), startingRegion);
|
gals.regionPool.insert(gals.regionPool.begin(), startingRegion);
|
||||||
|
|
||||||
const auto& region = RegionTable(startingRegion);
|
const auto& region = RegionTable(startingRegion);
|
||||||
if (ctx->GetOption(RSK_SELECTED_STARTING_AGE).Is(RO_AGE_CHILD)) {
|
if (startingAgeTime == RAT_CHILD_DAY) {
|
||||||
region->childDay = true;
|
region->childDay = true;
|
||||||
} else {
|
region->childNight = region->timePass;
|
||||||
region->adultDay = true;
|
} else if (startingAgeTime == RAT_CHILD_NIGHT) {
|
||||||
}
|
|
||||||
if (region->timePass) {
|
|
||||||
if (ctx->GetOption(RSK_SELECTED_STARTING_AGE).Is(RO_AGE_CHILD)) {
|
|
||||||
region->childNight = true;
|
region->childNight = true;
|
||||||
} else {
|
region->childDay = region->timePass;
|
||||||
|
} else if (startingAgeTime == RAT_ADULT_DAY) {
|
||||||
|
region->adultDay = true;
|
||||||
|
region->adultNight = region->timePass;
|
||||||
|
} else if (startingAgeTime == RAT_ADULT_NIGHT) {
|
||||||
region->adultNight = true;
|
region->adultNight = true;
|
||||||
}
|
region->adultDay = region->timePass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (calculatingAvailableChecks) {
|
if (calculatingAvailableChecks) {
|
||||||
|
|||||||
@@ -66,7 +66,8 @@ void ProcessRegion(Region* region, GetAccessibleLocationsStruct& gals, Randomize
|
|||||||
|
|
||||||
std::vector<RandomizerCheck> ReachabilitySearch(const std::vector<RandomizerCheck>& allowedLocations,
|
std::vector<RandomizerCheck> ReachabilitySearch(const std::vector<RandomizerCheck>& allowedLocations,
|
||||||
RandomizerGet ignore = RG_NONE, bool calculatingAvailableChecks = false,
|
RandomizerGet ignore = RG_NONE, bool calculatingAvailableChecks = false,
|
||||||
RandomizerRegion startingRegion = RR_ROOT);
|
RandomizerRegion startingRegion = RR_ROOT,
|
||||||
|
RandoAgeTime startingAgeTime = RAT_NONE);
|
||||||
|
|
||||||
void GeneratePlaythrough();
|
void GeneratePlaythrough();
|
||||||
|
|
||||||
|
|||||||
@@ -7240,6 +7240,15 @@ typedef enum {
|
|||||||
WL_HIGH_OR_MID,
|
WL_HIGH_OR_MID,
|
||||||
} RandoWaterLevel;
|
} RandoWaterLevel;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RAT_NONE,
|
||||||
|
RAT_CHILD_DAY,
|
||||||
|
RAT_CHILD_NIGHT,
|
||||||
|
RAT_ADULT_DAY,
|
||||||
|
RAT_ADULT_NIGHT,
|
||||||
|
RAT_MAX,
|
||||||
|
} RandoAgeTime;
|
||||||
|
|
||||||
#define ENTRANCE_GROTTO_LOAD_START 0x0700
|
#define ENTRANCE_GROTTO_LOAD_START 0x0700
|
||||||
#define ENTRANCE_GROTTO_EXIT_START 0x0800
|
#define ENTRANCE_GROTTO_EXIT_START 0x0800
|
||||||
|
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ Color_RGBA8 Color_Saved_Extra = { 0, 185, 0, 255 }; // Green
|
|||||||
static ImGuiTextFilter checkSearch;
|
static ImGuiTextFilter checkSearch;
|
||||||
static bool recalculateAvailable = false;
|
static bool recalculateAvailable = false;
|
||||||
static RandomizerRegion availableChecksStartingRegion = RR_ROOT;
|
static RandomizerRegion availableChecksStartingRegion = RR_ROOT;
|
||||||
|
static RandoAgeTime availableChecksStartingAgeTime = RAT_NONE;
|
||||||
static int16_t previousEntrance = 0;
|
static int16_t previousEntrance = 0;
|
||||||
std::array<bool, RCAREA_INVALID> filterAreasHidden = { 0 };
|
std::array<bool, RCAREA_INVALID> filterAreasHidden = { 0 };
|
||||||
std::array<bool, RC_MAX> filterChecksHidden = { 0 };
|
std::array<bool, RC_MAX> filterChecksHidden = { 0 };
|
||||||
@@ -945,7 +946,7 @@ void SetAreaSpoiled(RandomizerCheckArea rcArea) {
|
|||||||
SaveManager::Instance->SaveSection(gSaveContext.fileNum, sectionId, true);
|
SaveManager::Instance->SaveSection(gSaveContext.fileNum, sectionId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InternalRecalculateAvailableChecks(RandomizerRegion startingRegion);
|
void InternalRecalculateAvailableChecks(RandomizerRegion startingRegion, RandoAgeTime startingAgeTime);
|
||||||
|
|
||||||
void CheckTrackerWindow::DrawElement() {
|
void CheckTrackerWindow::DrawElement() {
|
||||||
Color_Background = CVarGetColor(CVAR_TRACKER_CHECK("BgColor.Value"), Color_Bg_Default);
|
Color_Background = CVarGetColor(CVAR_TRACKER_CHECK("BgColor.Value"), Color_Bg_Default);
|
||||||
@@ -1024,8 +1025,9 @@ void CheckTrackerWindow::DrawElement() {
|
|||||||
|
|
||||||
if (recalculateAvailable) {
|
if (recalculateAvailable) {
|
||||||
recalculateAvailable = false;
|
recalculateAvailable = false;
|
||||||
InternalRecalculateAvailableChecks(availableChecksStartingRegion);
|
InternalRecalculateAvailableChecks(availableChecksStartingRegion, availableChecksStartingAgeTime);
|
||||||
availableChecksStartingRegion = RR_ROOT;
|
availableChecksStartingRegion = RR_ROOT;
|
||||||
|
availableChecksStartingAgeTime = RAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quick Options
|
// Quick Options
|
||||||
@@ -2017,7 +2019,7 @@ void ImGuiDrawTwoColorPickerSection(const char* text, const char* cvarMainName,
|
|||||||
UIWidgets::PopStyleCombobox();
|
UIWidgets::PopStyleCombobox();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InternalRecalculateAvailableChecks(RandomizerRegion startingRegion) {
|
void InternalRecalculateAvailableChecks(RandomizerRegion startingRegion, RandoAgeTime startingAgeTime) {
|
||||||
if (!enableAvailableChecks || !GameInteractor::IsSaveLoaded()) {
|
if (!enableAvailableChecks || !GameInteractor::IsSaveLoaded()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2042,6 +2044,18 @@ void InternalRecalculateAvailableChecks(RandomizerRegion startingRegion) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (startingAgeTime == RAT_NONE) {
|
||||||
|
if (LINK_IS_CHILD && IS_DAY) {
|
||||||
|
startingAgeTime = RAT_CHILD_DAY;
|
||||||
|
} else if (LINK_IS_CHILD && IS_NIGHT) {
|
||||||
|
startingAgeTime = RAT_CHILD_NIGHT;
|
||||||
|
} else if (LINK_IS_ADULT && IS_DAY) {
|
||||||
|
startingAgeTime = RAT_ADULT_DAY;
|
||||||
|
} else if (LINK_IS_ADULT && IS_NIGHT) {
|
||||||
|
startingAgeTime = RAT_ADULT_NIGHT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<RandomizerCheck> targetLocations;
|
std::vector<RandomizerCheck> targetLocations;
|
||||||
targetLocations.reserve(RC_MAX);
|
targetLocations.reserve(RC_MAX);
|
||||||
for (auto& location : Rando::StaticData::GetLocationTable()) {
|
for (auto& location : Rando::StaticData::GetLocationTable()) {
|
||||||
@@ -2053,7 +2067,8 @@ void InternalRecalculateAvailableChecks(RandomizerRegion startingRegion) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<RandomizerCheck> availableChecks = ReachabilitySearch(targetLocations, RG_NONE, true, startingRegion);
|
std::vector<RandomizerCheck> availableChecks =
|
||||||
|
ReachabilitySearch(targetLocations, RG_NONE, true, startingRegion, startingAgeTime);
|
||||||
for (auto& rc : availableChecks) {
|
for (auto& rc : availableChecks) {
|
||||||
const auto& itemLocation = ctx->GetItemLocation(rc);
|
const auto& itemLocation = ctx->GetItemLocation(rc);
|
||||||
itemLocation->SetAvailable(true);
|
itemLocation->SetAvailable(true);
|
||||||
@@ -2076,9 +2091,11 @@ void InternalRecalculateAvailableChecks(RandomizerRegion startingRegion) {
|
|||||||
GetPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS).count());
|
GetPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS).count());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecalculateAvailableChecks(RandomizerRegion startingRegion /* = RR_ROOT */) {
|
void RecalculateAvailableChecks(RandomizerRegion startingRegion /* = RR_ROOT */,
|
||||||
|
RandoAgeTime startingAgeTime /* = RAT_NONE */) {
|
||||||
recalculateAvailable = true;
|
recalculateAvailable = true;
|
||||||
availableChecksStartingRegion = startingRegion;
|
availableChecksStartingRegion = startingRegion;
|
||||||
|
availableChecksStartingAgeTime = startingAgeTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadFromPreset(nlohmann::json info) {
|
void LoadFromPreset(nlohmann::json info) {
|
||||||
|
|||||||
@@ -62,6 +62,6 @@ void UpdateAllOrdering();
|
|||||||
void UpdateAllAreas();
|
void UpdateAllAreas();
|
||||||
void RecalculateAllAreaTotals();
|
void RecalculateAllAreaTotals();
|
||||||
void SpoilAreaFromCheck(RandomizerCheck rc);
|
void SpoilAreaFromCheck(RandomizerCheck rc);
|
||||||
void RecalculateAvailableChecks(RandomizerRegion startingRegion = RR_ROOT);
|
void RecalculateAvailableChecks(RandomizerRegion startingRegion = RR_ROOT, RandoAgeTime startingAgeTime = RAT_NONE);
|
||||||
void LoadFromPreset(nlohmann::json info);
|
void LoadFromPreset(nlohmann::json info);
|
||||||
} // namespace CheckTracker
|
} // namespace CheckTracker
|
||||||
|
|||||||
Reference in New Issue
Block a user