Excluded Locations Migration (#7302)

This commit is contained in:
Chris
2026-10-04 13:27:22 -04:00
committed by GitHub
parent 3ea7aa9b77
commit 316d8e6a1b
6 changed files with 2567 additions and 25 deletions
@@ -16,7 +16,7 @@
"DampeHint": 1,
"DoorOfTime": 2,
"EnableBombchuDrops": 1,
"ExcludedLocations": "147,148,233,323,",
"ExcludedLocations": "RC_KAK_40_GOLD_SKULLTULA_REWARD,RC_KAK_50_GOLD_SKULLTULA_REWARD,RC_ZR_FROGS_OCARINA_GAME,RC_GF_HBA_1500_POINTS,",
"FortressCarpenters": 1,
"FrogsHint": 1,
"FullWallets": 1,
@@ -1,7 +1,10 @@
#include "static_data.h"
#include "randomizerEnumStrings.h"
#include "z64save.h"
#include "SeedContext.h"
#include "dungeon.h"
#include <cassert>
#include <spdlog/spdlog.h>
std::array<Rando::Location, RC_MAX> Rando::StaticData::locationTable;
std::multimap<std::tuple<s16, s16, s32>, RandomizerCheck> Rando::StaticData::CheckFromActorMultimap;
@@ -1020,6 +1023,15 @@ void Rando::StaticData::InitHashMaps() {
CheckFromActorMultimap.emplace(
std::make_tuple((int16_t)location.GetActorID(), (int16_t)location.GetScene(), location.GetActorParams()),
location.GetRandomizerCheck());
if (location.GetRandomizerCheck() != RC_UNKNOWN_CHECK) {
std::string name(EnumToString(location.GetRandomizerCheck()));
if (excludedLocationToEnum.contains(name)) {
SPDLOG_ERROR("REPEATED EXCLUDED LOCATION NAME " + name);
assert(false);
} else {
excludedLocationToEnum[name] = location.GetRandomizerCheck();
}
}
}
}
@@ -937,13 +937,8 @@ void GenerateRandomizerImgui(std::string seed = "") {
// RANDOTODO proper UI for selecting if a spoiler loaded should be used for settings
Rando::Settings::GetInstance()->SetAllToContext();
// todo: this efficiently when we build out cvar array support
std::set<RandomizerCheck> excludedLocations;
std::stringstream excludedLocationStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), ""));
std::string excludedLocationString;
while (getline(excludedLocationStringStream, excludedLocationString, ',')) {
excludedLocations.insert((RandomizerCheck)std::stoi(excludedLocationString));
}
std::set<RandomizerCheck> excludedLocations =
Rando::StaticData::ParseExcludedLocations(CVarGetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), ""));
// todo: better way to sort out linking tricks rather than name
File diff suppressed because it is too large Load Diff
@@ -95,6 +95,9 @@ class StaticData {
static std::unordered_map<RandomizerGet, RandomizerCheckArea> silverToArea;
static std::set<RandomizerGet> constantSilvers;
static std::unordered_map<std::string, RandomizerTrick> trickToEnum;
static std::unordered_map<std::string, RandomizerCheck> excludedLocationToEnum;
static std::set<RandomizerCheck> ParseExcludedLocations(const std::string& value);
static std::string SerializeExcludedLocations(const std::set<RandomizerCheck>& locations);
static std::array<HintText, RHT_MAX> hintTextTable;
static std::vector<RandomizerGet> normalBottles;
static std::vector<RandomizerGet> beanSouls;
+3 -17
View File
@@ -52,14 +52,7 @@ void SaveEnabledTricks() {
}
void SaveExcludedLocations() {
// todo: this efficiently when we build out cvar array support
std::string excludedLocationString = "";
for (auto excludedLocationIt : excludedLocations) {
if (!excludedLocationString.empty()) {
excludedLocationString += ",";
}
excludedLocationString += std::to_string(excludedLocationIt);
}
std::string excludedLocationString = Rando::StaticData::SerializeExcludedLocations(excludedLocations);
if (excludedLocationString == "") {
CVarClear(CVAR_RANDOMIZER_SETTING("ExcludedLocations"));
} else {
@@ -330,15 +323,8 @@ void MarkRandomizerMenusDirty() {
void UpdateMenuLocations() {
RandomizerCheckObjects::UpdateImGuiVisibility();
// todo: this efficiently when we build out cvar array support
std::stringstream excludedLocationStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), ""));
std::string excludedLocationString;
excludedLocations.clear();
while (getline(excludedLocationStringStream, excludedLocationString, ',')) {
if (!excludedLocationString.empty()) {
excludedLocations.insert((RandomizerCheck)std::stoi(excludedLocationString));
}
}
excludedLocations =
Rando::StaticData::ParseExcludedLocations(CVarGetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), ""));
}
void UpdateMenuTricks() {