mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-10 19:45:09 -05:00
Develop rando tidy up (#3425)
* Fixes some IDE warnings/linter-suggestions in context.* Most of these come from CLion Nova. Some of these may be controversial, such as the if-init-statement related ones. Most of them should not be controversial though, like replacing C-style casts with static casts. * Fixes IDE warnings/Linter suggestions in option.* * Fixes some IDE warnings/linter suggestions. Left a few about "Template Arguments can be deduced", and a "Redundant static_cast" for the sake of clarity. * Fixes some IDE warnings/linter suggestions in item.* * Fixes some IDE warnings/linter suggestions in location.* * Fixes some IDE warnings/linter suggestions in item_location.* * Fixes some IDE warnings/linter suggestions in item_override.* * Fixes some IDE warnings/linter suggestions in dungeon.* * Fixes some IDE warnings/linter suggestions in trial.* * Use std::ranges::generate rather than manually looping. * Fixes a typo * Changes a TODO comment with more info. Previously this TODO statement was a question of whether or not we ever want to not output a spoiler log. Eventually we may want different amounts or types of data to be output when generating a seed according to certain settings. For instance, maybe we want a human-readable spoiler log, that has item locations and hint content without the formatting info. Maybe we want a "Plandomizer File", which is that but the hint strings include formatting info so that the formatting/colors can be changed, and eventually we may want to let cosmetic info be specified in there as well. Or maybe we just want a Race/Patch file that just has the seed and settings, for Race files we could also specify non-rando settings that should be locked to certain values. Or maybe want one of each. All of that is stuff that should at least start being handled at the location of this TODO statement. * Fixes a scope issue Windows didn't catch * Removes std::ranges::generate as apparently AppleClang can't do it. * Removes std::ranges::any_of as apparently AppleClang can't do it. * Re-adds what I thought was an unused include. * An attempt to fix the macos construct_at error
This commit is contained in:
parent
3b5497cee3
commit
1cc3201c19
@ -152,7 +152,7 @@ Text AutoFormatHintText(Text unformattedHintText) {
|
||||
for (int i = 0; i < LANGUAGE_MAX; i++) {
|
||||
std::string textStr = unformattedHintText.GetForLanguage(i);
|
||||
// RANDOTODO: don't just make manual exceptions
|
||||
bool needsAutomaicNewlines = true;
|
||||
bool needsAutomaticNewlines = true;
|
||||
if (textStr == "Erreur 0x69a504:&Traduction manquante^C'est de la faute à Purple Hato!&J'vous jure!" ||
|
||||
textStr == "Mon très cher @:&Viens vite au château, je t'ai préparé&un délicieux gâteau...^À bientôt, Princesse Zelda" ||
|
||||
textStr == "What about Zelda makes you think&she'd be a better ruler than I?^I saved Lon Lon Ranch,&fed the hungry,&and my castle floats." ||
|
||||
@ -163,10 +163,10 @@ Text AutoFormatHintText(Text unformattedHintText) {
|
||||
textStr == "Oh! It's @.&I was expecting someone called Sheik.&Do you know what happened to them?" ||
|
||||
textStr == "Ah, c'est @.&J'attendais un certain Sheik.&Tu sais ce qui lui est arrivé?" ||
|
||||
textStr == "They say \"Forgive me, but-^Your script will not be used.&....After all...^The one writing the rest of the script...&will be me.\"") {
|
||||
needsAutomaicNewlines = false;
|
||||
needsAutomaticNewlines = false;
|
||||
}
|
||||
|
||||
if (needsAutomaicNewlines) {
|
||||
if (needsAutomaticNewlines) {
|
||||
// insert newlines either manually or when encountering a '&'
|
||||
constexpr size_t lineLength = 34;
|
||||
size_t lastNewline = 0;
|
||||
|
@ -59,7 +59,8 @@ int Playthrough_Init(uint32_t seed, std::unordered_map<RandomizerSettingKey, uin
|
||||
GenerateHash();
|
||||
WriteIngameSpoilerLog();
|
||||
|
||||
if (/*Settings::GenerateSpoilerLog TODO: do we ever not want to write a spoiler log?*/ true) {
|
||||
if (true) {
|
||||
//TODO: Handle different types of file output (i.e. Spoiler Log, Plando Template, Patch Files, Race Files, etc.)
|
||||
// write logs
|
||||
printf("\x1b[11;10HWriting Spoiler Log...");
|
||||
if (SpoilerLog_Write(cvarSettings[RSK_LANGUAGE])) {
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
namespace Rando {
|
||||
std::weak_ptr<Context> Context::mContext;
|
||||
|
||||
Context::Context() {
|
||||
for (auto& location : StaticData::GetLocationTable()) {
|
||||
mSpoilerfileCheckNameToEnum[location.GetName()] = location.GetRandomizerCheck();
|
||||
@ -25,8 +24,9 @@ Context::Context() {
|
||||
for (auto& item : StaticData::GetItemTable()) {
|
||||
// Easiest way to filter out all the empty values from the array, since we still technically want the 0/RG_NONE
|
||||
// entry
|
||||
if (item.GetName().english.empty())
|
||||
if (item.GetName().english.empty()) {
|
||||
continue;
|
||||
}
|
||||
mSpoilerfileGetNameToEnum[item.GetName().english] = item.GetRandomizerGet();
|
||||
mSpoilerfileGetNameToEnum[item.GetName().french] = item.GetRandomizerGet();
|
||||
}
|
||||
@ -46,8 +46,9 @@ Context::Context() {
|
||||
{ "Named Item", HINT_TYPE_NAMED_ITEM },
|
||||
{ "Random", HINT_TYPE_RANDOM }
|
||||
};
|
||||
|
||||
for (int i = 0; i < RC_MAX; i++) {
|
||||
itemLocationTable[i] = ItemLocation((RandomizerCheck)i);
|
||||
itemLocationTable[i] = ItemLocation(static_cast<RandomizerCheck>(i));
|
||||
}
|
||||
mEntranceShuffler = std::make_shared<EntranceShuffler>();
|
||||
mDungeons = std::make_shared<Dungeons>();
|
||||
@ -68,27 +69,27 @@ std::shared_ptr<Context> Context::GetInstance() {
|
||||
return mContext.lock();
|
||||
}
|
||||
|
||||
Hint* Context::GetHint(RandomizerHintKey hintKey) {
|
||||
Hint* Context::GetHint(const RandomizerHintKey hintKey) {
|
||||
return &hintTable[hintKey];
|
||||
}
|
||||
|
||||
void Context::AddHint(RandomizerHintKey hintId, Text text, RandomizerCheck hintedLocation, HintType hintType,
|
||||
Text hintedRegion) {
|
||||
void Context::AddHint(const RandomizerHintKey hintId, const Text& text, const RandomizerCheck hintedLocation, const HintType hintType,
|
||||
const Text& hintedRegion) {
|
||||
hintTable[hintId] = Hint(text, hintedLocation, hintType, hintedRegion);
|
||||
GetItemLocation(hintedLocation)->SetHintKey(hintId);
|
||||
}
|
||||
|
||||
ItemLocation* Context::GetItemLocation(RandomizerCheck locKey) {
|
||||
return &(itemLocationTable[locKey]);
|
||||
ItemLocation* Context::GetItemLocation(const RandomizerCheck locKey) {
|
||||
return &itemLocationTable[locKey];
|
||||
}
|
||||
|
||||
ItemLocation* Context::GetItemLocation(size_t locKey) {
|
||||
return &(itemLocationTable[static_cast<RandomizerCheck>(locKey)]);
|
||||
return &itemLocationTable[static_cast<RandomizerCheck>(locKey)];
|
||||
}
|
||||
|
||||
void Context::PlaceItemInLocation(RandomizerCheck locKey, RandomizerGet item, bool applyEffectImmediately,
|
||||
bool setHidden) {
|
||||
auto loc = GetItemLocation(locKey);
|
||||
void Context::PlaceItemInLocation(const RandomizerCheck locKey, const RandomizerGet item, const bool applyEffectImmediately,
|
||||
const bool setHidden) {
|
||||
const auto loc = GetItemLocation(locKey);
|
||||
SPDLOG_DEBUG("\n");
|
||||
SPDLOG_DEBUG(StaticData::RetrieveItem(item).GetName().GetEnglish());
|
||||
SPDLOG_DEBUG(" placed at ");
|
||||
@ -96,19 +97,19 @@ void Context::PlaceItemInLocation(RandomizerCheck locKey, RandomizerGet item, bo
|
||||
SPDLOG_DEBUG("\n\n");
|
||||
|
||||
if (applyEffectImmediately || mSettings->Setting(RSK_LOGIC_RULES).Is(RO_LOGIC_GLITCHLESS) || mSettings->Setting(RSK_LOGIC_RULES).Is(RO_LOGIC_VANILLA)) {
|
||||
Rando::StaticData::RetrieveItem(item).ApplyEffect();
|
||||
StaticData::RetrieveItem(item).ApplyEffect();
|
||||
}
|
||||
|
||||
// TODO? Show Progress
|
||||
|
||||
// If we're placing a non-shop item in a shop location, we want to record it for custom messages
|
||||
if (StaticData::RetrieveItem(item).GetItemType() != ITEMTYPE_SHOP &&
|
||||
Rando::StaticData::GetLocation(locKey)->IsCategory(Category::cShop)) {
|
||||
int index = TransformShopIndex(GetShopIndex(locKey));
|
||||
NonShopItems[index].Name = Rando::StaticData::RetrieveItem(item).GetName();
|
||||
StaticData::GetLocation(locKey)->IsCategory(Category::cShop)) {
|
||||
const int index = TransformShopIndex(GetShopIndex(locKey));
|
||||
NonShopItems[index].Name = StaticData::RetrieveItem(item).GetName();
|
||||
NonShopItems[index].Repurchaseable =
|
||||
Rando::StaticData::RetrieveItem(item).GetItemType() == ITEMTYPE_REFILL ||
|
||||
Rando::StaticData::RetrieveItem(item).GetHintKey() == RHT_PROGRESSIVE_BOMBCHUS;
|
||||
StaticData::RetrieveItem(item).GetItemType() == ITEMTYPE_REFILL ||
|
||||
StaticData::RetrieveItem(item).GetHintKey() == RHT_PROGRESSIVE_BOMBCHUS;
|
||||
}
|
||||
|
||||
loc->SetPlacedItem(item);
|
||||
@ -117,7 +118,7 @@ void Context::PlaceItemInLocation(RandomizerCheck locKey, RandomizerGet item, bo
|
||||
}
|
||||
}
|
||||
|
||||
void Context::AddLocation(RandomizerCheck loc, std::vector<RandomizerCheck>* destination) {
|
||||
void Context::AddLocation(const RandomizerCheck loc, std::vector<RandomizerCheck>* destination) {
|
||||
if (destination == nullptr) {
|
||||
destination = &allLocations;
|
||||
}
|
||||
@ -140,23 +141,23 @@ void Context::GenerateLocationPool() {
|
||||
}
|
||||
AddLocations(StaticData::overworldLocations);
|
||||
|
||||
for (auto dungeon : mDungeons->GetDungeonList()) {
|
||||
for (const auto dungeon : mDungeons->GetDungeonList()) {
|
||||
AddLocations(dungeon->GetDungeonLocations());
|
||||
}
|
||||
}
|
||||
|
||||
void Context::AddExcludedOptions() {
|
||||
AddLocations(StaticData::overworldLocations, &everyPossibleLocation);
|
||||
for (auto dungeon : mDungeons->GetDungeonList()) {
|
||||
for (const auto dungeon : mDungeons->GetDungeonList()) {
|
||||
AddLocations(dungeon->GetEveryLocation(), &everyPossibleLocation);
|
||||
}
|
||||
for (RandomizerCheck rc : everyPossibleLocation) {
|
||||
for (const RandomizerCheck rc : everyPossibleLocation) {
|
||||
GetItemLocation(rc)->AddExcludeOption();
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RandomizerCheck> Context::GetLocations(const std::vector<RandomizerCheck>& locationPool,
|
||||
Category categoryInclude, Category categoryExclude) {
|
||||
const Category categoryInclude, const Category categoryExclude) {
|
||||
std::vector<RandomizerCheck> locationsInCategory;
|
||||
for (RandomizerCheck locKey : locationPool) {
|
||||
if (StaticData::GetLocation(locKey)->IsCategory(categoryInclude) &&
|
||||
@ -168,25 +169,25 @@ std::vector<RandomizerCheck> Context::GetLocations(const std::vector<RandomizerC
|
||||
}
|
||||
|
||||
void Context::ItemReset() {
|
||||
for (RandomizerCheck il : allLocations) {
|
||||
for (const RandomizerCheck il : allLocations) {
|
||||
GetItemLocation(il)->ResetVariables();
|
||||
}
|
||||
|
||||
for (RandomizerCheck il : Rando::StaticData::dungeonRewardLocations) {
|
||||
for (const RandomizerCheck il : StaticData::dungeonRewardLocations) {
|
||||
GetItemLocation(il)->ResetVariables();
|
||||
}
|
||||
}
|
||||
|
||||
void Context::LocationReset() {
|
||||
for (RandomizerCheck il : allLocations) {
|
||||
for (const RandomizerCheck il : allLocations) {
|
||||
GetItemLocation(il)->RemoveFromPool();
|
||||
}
|
||||
|
||||
for (RandomizerCheck il : Rando::StaticData::dungeonRewardLocations) {
|
||||
for (const RandomizerCheck il : StaticData::dungeonRewardLocations) {
|
||||
GetItemLocation(il)->RemoveFromPool();
|
||||
}
|
||||
|
||||
for (RandomizerCheck il : Rando::StaticData::gossipStoneLocations) {
|
||||
for (const RandomizerCheck il : StaticData::gossipStoneLocations) {
|
||||
GetItemLocation(il)->RemoveFromPool();
|
||||
}
|
||||
|
||||
@ -194,18 +195,18 @@ void Context::LocationReset() {
|
||||
}
|
||||
|
||||
void Context::HintReset() {
|
||||
for (RandomizerCheck il : Rando::StaticData::gossipStoneLocations) {
|
||||
for (const RandomizerCheck il : StaticData::gossipStoneLocations) {
|
||||
GetItemLocation(il)->ResetVariables();
|
||||
GetHint((RandomizerHintKey)(il - RC_COLOSSUS_GOSSIP_STONE + 1))->ResetVariables();
|
||||
GetHint(static_cast<RandomizerHintKey>(il - RC_COLOSSUS_GOSSIP_STONE + 1))->ResetVariables();
|
||||
}
|
||||
}
|
||||
|
||||
void Context::CreateItemOverrides() {
|
||||
SPDLOG_DEBUG("NOW CREATING OVERRIDES\n\n");
|
||||
for (RandomizerCheck locKey : allLocations) {
|
||||
auto loc = Rando::StaticData::GetLocation(locKey);
|
||||
auto itemLoc = GetItemLocation(locKey);
|
||||
const auto loc = StaticData::GetLocation(locKey);
|
||||
// If this is an ice trap, store the disguise model in iceTrapModels
|
||||
const auto itemLoc = GetItemLocation(locKey);
|
||||
if (itemLoc->GetPlacedRandomizerGet() == RG_ICE_TRAP) {
|
||||
ItemOverride val(locKey, RandomElement(possibleIceTrapModels));
|
||||
iceTrapModels[locKey] = val.LooksLike();
|
||||
@ -225,32 +226,32 @@ void Context::CreateItemOverrides() {
|
||||
SPDLOG_DEBUG(std::to_string(overrides.size()));
|
||||
}
|
||||
|
||||
bool Context::IsSeedGenerated() {
|
||||
bool Context::IsSeedGenerated() const {
|
||||
return mSeedGenerated;
|
||||
}
|
||||
|
||||
void Context::SetSeedGenerated(bool seedGenerated) {
|
||||
void Context::SetSeedGenerated(const bool seedGenerated) {
|
||||
mSeedGenerated = seedGenerated;
|
||||
}
|
||||
|
||||
bool Context::IsSpoilerLoaded() {
|
||||
bool Context::IsSpoilerLoaded() const {
|
||||
return mSpoilerLoaded;
|
||||
}
|
||||
|
||||
void Context::SetSpoilerLoaded(bool spoilerLoaded) {
|
||||
void Context::SetSpoilerLoaded(const bool spoilerLoaded) {
|
||||
mSpoilerLoaded = spoilerLoaded;
|
||||
}
|
||||
|
||||
bool Context::IsPlandoLoaded() {
|
||||
bool Context::IsPlandoLoaded() const {
|
||||
return mPlandoLoaded;
|
||||
}
|
||||
|
||||
void Context::SetPlandoLoaded(bool plandoLoaded) {
|
||||
void Context::SetPlandoLoaded(const bool plandoLoaded) {
|
||||
mPlandoLoaded = plandoLoaded;
|
||||
}
|
||||
|
||||
GetItemEntry Context::GetFinalGIEntry(RandomizerCheck rc, bool checkObtainability, GetItemID ogItemId) {
|
||||
auto itemLoc = GetItemLocation(rc);
|
||||
GetItemEntry Context::GetFinalGIEntry(const RandomizerCheck rc, const bool checkObtainability, const GetItemID ogItemId) {
|
||||
const auto itemLoc = GetItemLocation(rc);
|
||||
if (itemLoc->GetPlacedRandomizerGet() == RG_NONE) {
|
||||
if (ogItemId != GI_NONE) {
|
||||
return ItemTableManager::Instance->RetrieveItemEntry(MOD_NONE, ogItemId);
|
||||
@ -264,7 +265,7 @@ GetItemEntry Context::GetFinalGIEntry(RandomizerCheck rc, bool checkObtainabilit
|
||||
}
|
||||
GetItemEntry giEntry = itemLoc->GetPlacedItem().GetGIEntry_Copy();
|
||||
if (overrides.contains(rc)) {
|
||||
auto fakeGiEntry = StaticData::RetrieveItem(overrides[rc].LooksLike()).GetGIEntry();
|
||||
const auto fakeGiEntry = StaticData::RetrieveItem(overrides[rc].LooksLike()).GetGIEntry();
|
||||
giEntry.gid = fakeGiEntry->gid;
|
||||
giEntry.gi = fakeGiEntry->gi;
|
||||
giEntry.drawItemId = fakeGiEntry->drawItemId;
|
||||
@ -286,14 +287,12 @@ std::string sanitize(std::string stringValue) {
|
||||
}
|
||||
|
||||
// Removes others.
|
||||
stringValue.erase(std::remove_if(stringValue.begin(), stringValue.end(),
|
||||
[](char const c) { return '\n' == c || '\r' == c || '\0' == c || '\x1A' == c; }),
|
||||
stringValue.end());
|
||||
std::erase_if(stringValue, [](char const c) { return '\n' == c || '\r' == c || '\0' == c || '\x1A' == c; });
|
||||
|
||||
return stringValue;
|
||||
}
|
||||
|
||||
void Context::ParseSpoiler(const char* spoilerFileName, bool plandoMode) {
|
||||
void Context::ParseSpoiler(const char* spoilerFileName, const bool plandoMode) {
|
||||
std::ifstream spoilerFileStream(sanitize(spoilerFileName));
|
||||
if (!spoilerFileStream) {
|
||||
return;
|
||||
@ -316,8 +315,8 @@ void Context::ParseSpoiler(const char* spoilerFileName, bool plandoMode) {
|
||||
}
|
||||
mSpoilerLoaded = true;
|
||||
mSeedGenerated = false;
|
||||
} catch (std::exception& e) {
|
||||
throw e;
|
||||
} catch (...) {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,117 +337,103 @@ void Context::ParseItemLocationsJson(nlohmann::json spoilerFileJson) {
|
||||
nlohmann::json itemJson = *it;
|
||||
for (auto itemit = itemJson.begin(); itemit != itemJson.end(); ++itemit) {
|
||||
if (itemit.key() == "item") {
|
||||
itemLocationTable[rc].SetPlacedItem(mSpoilerfileGetNameToEnum[itemit.value().template get<std::string>()]);
|
||||
itemLocationTable[rc].SetPlacedItem(mSpoilerfileGetNameToEnum[itemit.value().get<std::string>()]);
|
||||
} else if (itemit.key() == "price") {
|
||||
itemLocationTable[rc].SetCustomPrice(itemit.value().template get<uint16_t>());
|
||||
itemLocationTable[rc].SetCustomPrice(itemit.value().get<uint16_t>());
|
||||
} else if (itemit.key() == "model") {
|
||||
overrides[rc] = ItemOverride(rc, mSpoilerfileGetNameToEnum[itemit.value().template get<std::string>()]);
|
||||
overrides[rc] = ItemOverride(rc, mSpoilerfileGetNameToEnum[itemit.value().get<std::string>()]);
|
||||
} else if (itemit.key() == "trickName") {
|
||||
overrides[rc].SetTrickName(Text(itemit.value().template get<std::string>()));
|
||||
overrides[rc].SetTrickName(Text(itemit.value().get<std::string>()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
itemLocationTable[rc].SetPlacedItem(mSpoilerfileGetNameToEnum[it.value().template get<std::string>()]);
|
||||
itemLocationTable[rc].SetPlacedItem(mSpoilerfileGetNameToEnum[it.value().get<std::string>()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string AltarIconString(char iconChar) {
|
||||
std::string iconString = "";
|
||||
std::string AltarIconString(const char iconChar) {
|
||||
std::string iconString;
|
||||
iconString += '\x13';
|
||||
switch (iconChar) {
|
||||
case '0':
|
||||
// Kokiri Emerald
|
||||
iconString += 0x13;
|
||||
iconString += 0x6C;
|
||||
iconString += '\x6C';
|
||||
break;
|
||||
case '1':
|
||||
// Goron Ruby
|
||||
iconString += 0x13;
|
||||
iconString += 0x6D;
|
||||
iconString += '\x6D';
|
||||
break;
|
||||
case '2':
|
||||
// Zora Sapphire
|
||||
iconString += 0x13;
|
||||
iconString += 0x6E;
|
||||
iconString += '\x6E';
|
||||
break;
|
||||
case '3':
|
||||
// Forest Medallion
|
||||
iconString += 0x13;
|
||||
iconString += 0x66;
|
||||
iconString += '\x66';
|
||||
break;
|
||||
case '4':
|
||||
// Fire Medallion
|
||||
iconString += 0x13;
|
||||
iconString += 0x67;
|
||||
iconString += '\x67';
|
||||
break;
|
||||
case '5':
|
||||
// Water Medallion
|
||||
iconString += 0x13;
|
||||
iconString += 0x68;
|
||||
iconString += '\x68';
|
||||
break;
|
||||
case '6':
|
||||
// Spirit Medallion
|
||||
iconString += 0x13;
|
||||
iconString += 0x69;
|
||||
iconString += '\x69';
|
||||
break;
|
||||
case '7':
|
||||
// Shadow Medallion
|
||||
iconString += 0x13;
|
||||
iconString += 0x6A;
|
||||
iconString += '\x6A';
|
||||
break;
|
||||
case '8':
|
||||
// Light Medallion
|
||||
iconString += 0x13;
|
||||
iconString += 0x6B;
|
||||
iconString += '\x6B';
|
||||
break;
|
||||
case 'o':
|
||||
// Open DOT (master sword)
|
||||
iconString += 0x13;
|
||||
iconString += 0x3C;
|
||||
iconString += '\x3C';
|
||||
break;
|
||||
case 'c':
|
||||
// Closed DOT (fairy ocarina)
|
||||
iconString += 0x13;
|
||||
iconString += 0x07;
|
||||
iconString += '\x07';
|
||||
break;
|
||||
case 'i':
|
||||
// Intended DOT (oot)
|
||||
iconString += 0x13;
|
||||
iconString += 0x08;
|
||||
iconString += '\x08';
|
||||
break;
|
||||
case 'l':
|
||||
// Light Arrow (for bridge reqs)
|
||||
iconString += 0x13;
|
||||
iconString += 0x12;
|
||||
iconString += '\x12';
|
||||
break;
|
||||
case 'b':
|
||||
// Boss Key (ganon boss key location)
|
||||
iconString += 0x13;
|
||||
iconString += 0x74;
|
||||
iconString += '\x74';
|
||||
break;
|
||||
case 'L':
|
||||
// Bow with Light Arrow
|
||||
iconString += 0x13;
|
||||
iconString += 0x3A;
|
||||
iconString += '\x3A';
|
||||
break;
|
||||
case 'k':
|
||||
// Kokiri Tunic
|
||||
iconString += 0x13;
|
||||
iconString += 0x41;
|
||||
iconString += '\x41';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return iconString;
|
||||
}
|
||||
|
||||
std::string FormatJsonHintText(std::string jsonHint) {
|
||||
std::string FormatJsonHintText(const std::string& jsonHint) {
|
||||
std::string formattedHintMessage = jsonHint;
|
||||
|
||||
// add icons to altar text
|
||||
for (char iconChar : { '0', '1', '2', '3', '4', '5', '6', '7', '8', 'o', 'c', 'i', 'l', 'b', 'L', 'k' }) {
|
||||
for (const char iconChar : { '0', '1', '2', '3', '4', '5', '6', '7', '8', 'o', 'c', 'i', 'l', 'b', 'L', 'k' }) {
|
||||
std::string textToReplace = "$";
|
||||
textToReplace += iconChar;
|
||||
size_t start_pos = formattedHintMessage.find(textToReplace);
|
||||
if (!(start_pos == std::string::npos)) {
|
||||
if (const size_t start_pos = formattedHintMessage.find(textToReplace); start_pos != std::string::npos) {
|
||||
std::string iconString = AltarIconString(iconChar);
|
||||
formattedHintMessage.replace(start_pos, textToReplace.length(), iconString);
|
||||
}
|
||||
@ -458,69 +443,69 @@ std::string FormatJsonHintText(std::string jsonHint) {
|
||||
|
||||
void Context::ParseHintJson(nlohmann::json spoilerFileJson) {
|
||||
// Child Altar
|
||||
std::string childAltarJsonText = spoilerFileJson["childAltar"]["hintText"].template get<std::string>();
|
||||
std::string childAltarJsonText = spoilerFileJson["childAltar"]["hintText"].get<std::string>();
|
||||
std::string formattedChildAltarText = FormatJsonHintText(childAltarJsonText);
|
||||
AddHint(RH_ALTAR_CHILD, Text(formattedChildAltarText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, Text());
|
||||
mEmeraldLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["childAltar"]["rewards"]["emeraldLoc"]];
|
||||
mRubyLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["childAltar"]["rewards"]["rubyLoc"]];
|
||||
mSapphireLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["childAltar"]["rewards"]["sapphireLoc"]];
|
||||
// Adult Altar
|
||||
std::string adultAltarJsonText = spoilerFileJson["adultAltar"]["hintText"].template get<std::string>();
|
||||
std::string adultAltarJsonText = spoilerFileJson["adultAltar"]["hintText"].get<std::string>();
|
||||
std::string formattedAdultAltarText = FormatJsonHintText(adultAltarJsonText);
|
||||
AddHint(RH_ALTAR_ADULT, Text(formattedAdultAltarText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, Text());
|
||||
mForestMedallionLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["adultAltar"]["rewards"]["forestMedallionLoc"].template get<std::string>()];
|
||||
mFireMedallionLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["adultAltar"]["rewards"]["fireMedallionLoc"].template get<std::string>()];
|
||||
mWaterMedallionLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["adultAltar"]["rewards"]["waterMedallionLoc"].template get<std::string>()];
|
||||
mShadowMedallionLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["adultAltar"]["rewards"]["shadowMedallionLoc"].template get<std::string>()];
|
||||
mSpiritMedallionLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["adultAltar"]["rewards"]["spiritMedallionLoc"].template get<std::string>()];
|
||||
mLightMedallionLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["adultAltar"]["rewards"]["lightMedallionLoc"].template get<std::string>()];
|
||||
mForestMedallionLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["adultAltar"]["rewards"]["forestMedallionLoc"].get<std::string>()];
|
||||
mFireMedallionLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["adultAltar"]["rewards"]["fireMedallionLoc"].get<std::string>()];
|
||||
mWaterMedallionLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["adultAltar"]["rewards"]["waterMedallionLoc"].get<std::string>()];
|
||||
mShadowMedallionLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["adultAltar"]["rewards"]["shadowMedallionLoc"].get<std::string>()];
|
||||
mSpiritMedallionLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["adultAltar"]["rewards"]["spiritMedallionLoc"].get<std::string>()];
|
||||
mLightMedallionLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["adultAltar"]["rewards"]["lightMedallionLoc"].get<std::string>()];
|
||||
// Ganondorf and Sheik Light Arrow Hints
|
||||
std::string ganonHintText = FormatJsonHintText(spoilerFileJson["ganonHintText"].template get<std::string>());
|
||||
RandomizerCheck lightArrowLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["lightArrowHintLoc"].template get<std::string>()];
|
||||
std::string lightArrowRegion = spoilerFileJson["lightArrowHintRegion"].template get<std::string>();
|
||||
std::string ganonHintText = FormatJsonHintText(spoilerFileJson["ganonHintText"].get<std::string>());
|
||||
RandomizerCheck lightArrowLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["lightArrowHintLoc"].get<std::string>()];
|
||||
std::string lightArrowRegion = spoilerFileJson["lightArrowHintRegion"].get<std::string>();
|
||||
AddHint(RH_GANONDORF_HINT, Text(ganonHintText), lightArrowLoc, HINT_TYPE_STATIC, Text(lightArrowRegion));
|
||||
std::string sheikText = FormatJsonHintText(spoilerFileJson["sheikText"].template get<std::string>());
|
||||
std::string sheikText = FormatJsonHintText(spoilerFileJson["sheikText"].get<std::string>());
|
||||
AddHint(RH_SHEIK_LIGHT_ARROWS, Text(sheikText), lightArrowLoc, HINT_TYPE_STATIC, lightArrowRegion);
|
||||
std::string ganonText = FormatJsonHintText(spoilerFileJson["ganonText"].template get<std::string>());
|
||||
std::string ganonText = FormatJsonHintText(spoilerFileJson["ganonText"].get<std::string>());
|
||||
AddHint(RH_GANONDORF_NOHINT, Text(ganonText), RC_UNKNOWN_CHECK, HINT_TYPE_JUNK, Text());
|
||||
// Dampe Hookshot Hint
|
||||
std::string dampeText = FormatJsonHintText(spoilerFileJson["dampeText"].template get<std::string>());
|
||||
std::string dampeRegion = spoilerFileJson["dampeRegion"].template get<std::string>();
|
||||
RandomizerCheck dampeHintLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["dampeHintLoc"].template get<std::string>()];
|
||||
std::string dampeText = FormatJsonHintText(spoilerFileJson["dampeText"].get<std::string>());
|
||||
std::string dampeRegion = spoilerFileJson["dampeRegion"].get<std::string>();
|
||||
RandomizerCheck dampeHintLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["dampeHintLoc"].get<std::string>()];
|
||||
AddHint(RH_DAMPES_DIARY, Text(dampeText), dampeHintLoc, HINT_TYPE_STATIC, Text(dampeRegion));
|
||||
// Greg Hint
|
||||
std::string gregText = FormatJsonHintText(spoilerFileJson["gregText"].template get<std::string>());
|
||||
std::string gregRegion = spoilerFileJson["gregRegion"].template get<std::string>();
|
||||
RandomizerCheck gregLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["gregLoc"].template get<std::string>()];
|
||||
std::string gregText = FormatJsonHintText(spoilerFileJson["gregText"].get<std::string>());
|
||||
std::string gregRegion = spoilerFileJson["gregRegion"].get<std::string>();
|
||||
RandomizerCheck gregLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["gregLoc"].get<std::string>()];
|
||||
AddHint(RH_GREG_RUPEE, Text(gregText), gregLoc, HINT_TYPE_STATIC, Text(gregRegion));
|
||||
// Saria Magic Hint
|
||||
std::string sariaText = FormatJsonHintText(spoilerFileJson["sariaText"].template get<std::string>());
|
||||
std::string sariaRegion = spoilerFileJson["sariaRegion"].template get<std::string>();
|
||||
RandomizerCheck sariaHintLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["sariaHintLoc"].template get<std::string>()];
|
||||
std::string sariaText = FormatJsonHintText(spoilerFileJson["sariaText"].get<std::string>());
|
||||
std::string sariaRegion = spoilerFileJson["sariaRegion"].get<std::string>();
|
||||
RandomizerCheck sariaHintLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["sariaHintLoc"].get<std::string>()];
|
||||
AddHint(RH_SARIA, Text(sariaText), sariaHintLoc, HINT_TYPE_STATIC, Text(sariaRegion));
|
||||
// Warp Songs
|
||||
std::string warpMinuetText = FormatJsonHintText(spoilerFileJson["warpMinuetText"].template get<std::string>());
|
||||
std::string warpMinuetText = FormatJsonHintText(spoilerFileJson["warpMinuetText"].get<std::string>());
|
||||
AddHint(RH_MINUET_WARP_LOC, Text(warpMinuetText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, Text(warpMinuetText));
|
||||
std::string warpBoleroText = FormatJsonHintText(spoilerFileJson["warpBoleroText"].template get<std::string>());
|
||||
std::string warpBoleroText = FormatJsonHintText(spoilerFileJson["warpBoleroText"].get<std::string>());
|
||||
AddHint(RH_BOLERO_WARP_LOC, Text(warpBoleroText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, Text(warpBoleroText));
|
||||
std::string warpSerenadeText = FormatJsonHintText(spoilerFileJson["warpSerenadeText"].template get<std::string>());
|
||||
std::string warpSerenadeText = FormatJsonHintText(spoilerFileJson["warpSerenadeText"].get<std::string>());
|
||||
AddHint(RH_SERENADE_WARP_LOC, Text(warpSerenadeText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, Text(warpSerenadeText));
|
||||
std::string warpRequiemText = FormatJsonHintText(spoilerFileJson["warpRequiemText"].template get<std::string>());
|
||||
std::string warpRequiemText = FormatJsonHintText(spoilerFileJson["warpRequiemText"].get<std::string>());
|
||||
AddHint(RH_REQUIEM_WARP_LOC, Text(warpRequiemText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, Text(warpRequiemText));
|
||||
std::string warpNocturneText = FormatJsonHintText(spoilerFileJson["warpNocturneText"].template get<std::string>());
|
||||
std::string warpNocturneText = FormatJsonHintText(spoilerFileJson["warpNocturneText"].get<std::string>());
|
||||
AddHint(RH_NOCTURNE_WARP_LOC, Text(warpNocturneText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, Text(warpNocturneText));
|
||||
std::string warpPreludeText = FormatJsonHintText(spoilerFileJson["warpPreludeText"].template get<std::string>());
|
||||
std::string warpPreludeText = FormatJsonHintText(spoilerFileJson["warpPreludeText"].get<std::string>());
|
||||
AddHint(RH_PRELUDE_WARP_LOC, Text(warpPreludeText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, Text(warpPreludeText));
|
||||
// Gossip Stones
|
||||
nlohmann::json hintsJson = spoilerFileJson["hints"];
|
||||
for (auto it = hintsJson.begin(); it != hintsJson.end(); it++) {
|
||||
for (auto it = hintsJson.begin(); it != hintsJson.end(); ++it) {
|
||||
RandomizerCheck gossipStoneLoc = mSpoilerfileCheckNameToEnum[it.key()];
|
||||
nlohmann::json hintInfo = it.value();
|
||||
std::string hintText = FormatJsonHintText(hintInfo["hint"].template get<std::string>());
|
||||
HintType hintType = mSpoilerfileHintTypeNameToEnum[hintInfo["type"].template get<std::string>()];
|
||||
std::string hintText = FormatJsonHintText(hintInfo["hint"].get<std::string>());
|
||||
HintType hintType = mSpoilerfileHintTypeNameToEnum[hintInfo["type"].get<std::string>()];
|
||||
RandomizerCheck hintedLocation = mSpoilerfileCheckNameToEnum[hintInfo["location"]];
|
||||
std::string hintedArea = hintInfo["area"].template get<std::string>();
|
||||
AddHint(RandomizerHintKey(gossipStoneLoc - RC_COLOSSUS_GOSSIP_STONE + 1), Text(hintText), hintedLocation, hintType, hintedArea);
|
||||
std::string hintedArea = hintInfo["area"].get<std::string>();
|
||||
AddHint(static_cast<RandomizerHintKey>(gossipStoneLoc - RC_COLOSSUS_GOSSIP_STONE + 1), Text(hintText), hintedLocation, hintType, hintedArea);
|
||||
}
|
||||
}
|
||||
|
||||
@ -528,7 +513,7 @@ std::shared_ptr<Settings> Context::GetSettings() {
|
||||
return mSettings;
|
||||
}
|
||||
|
||||
const std::shared_ptr<EntranceShuffler> Context::GetEntranceShuffler() {
|
||||
std::shared_ptr<EntranceShuffler> Context::GetEntranceShuffler() {
|
||||
return mEntranceShuffler;
|
||||
}
|
||||
|
||||
@ -536,27 +521,27 @@ std::shared_ptr<Dungeons> Context::GetDungeons() {
|
||||
return mDungeons;
|
||||
}
|
||||
|
||||
DungeonInfo* Context::GetDungeon(size_t key) {
|
||||
return mDungeons->GetDungeon(DungeonKey(key));
|
||||
DungeonInfo* Context::GetDungeon(size_t key) const {
|
||||
return mDungeons->GetDungeon(static_cast<DungeonKey>(key));
|
||||
}
|
||||
|
||||
std::shared_ptr<Trials> Context::GetTrials() {
|
||||
return mTrials;
|
||||
}
|
||||
|
||||
TrialInfo* Context::GetTrial(size_t key) {
|
||||
return mTrials->GetTrial(TrialKey(key));
|
||||
TrialInfo* Context::GetTrial(size_t key) const {
|
||||
return mTrials->GetTrial(static_cast<TrialKey>(key));
|
||||
}
|
||||
|
||||
Sprite* Context::GetSeedTexture(uint8_t index) {
|
||||
Sprite* Context::GetSeedTexture(const uint8_t index) {
|
||||
return &gSeedTextures[index];
|
||||
}
|
||||
|
||||
Rando::Option& Context::GetOption(RandomizerSettingKey key) {
|
||||
Option& Context::GetOption(const RandomizerSettingKey key) const {
|
||||
return mSettings->Setting(key);
|
||||
}
|
||||
|
||||
Rando::Option& Context::GetTrickOption(RandomizerTrick key) {
|
||||
Option& Context::GetTrickOption(const RandomizerTrick key) const {
|
||||
return mSettings->GetTrickOption(key);
|
||||
}
|
||||
} // namespace Rando
|
||||
|
@ -33,8 +33,8 @@ class Context {
|
||||
static std::shared_ptr<Context> CreateInstance();
|
||||
static std::shared_ptr<Context> GetInstance();
|
||||
Hint* GetHint(RandomizerHintKey hintKey);
|
||||
void AddHint(RandomizerHintKey hintId, Text text, RandomizerCheck hintedLocation, HintType hintType,
|
||||
Text hintedRegion);
|
||||
void AddHint(RandomizerHintKey hintId, const Text& text, RandomizerCheck hintedLocation, HintType hintType,
|
||||
const Text& hintedRegion);
|
||||
ItemLocation* GetItemLocation(RandomizerCheck locKey);
|
||||
ItemLocation* GetItemLocation(size_t locKey);
|
||||
void PlaceItemInLocation(RandomizerCheck locKey, RandomizerGet item, bool applyEffectImmediately = false,
|
||||
@ -44,28 +44,28 @@ class Context {
|
||||
template <typename Container>
|
||||
void AddLocations(const Container& locations, std::vector<RandomizerCheck>* destination = nullptr);
|
||||
void GenerateLocationPool();
|
||||
std::vector<RandomizerCheck> GetLocations(const std::vector<RandomizerCheck>& locationPool,
|
||||
static std::vector<RandomizerCheck> GetLocations(const std::vector<RandomizerCheck>& locationPool,
|
||||
Category categoryInclude, Category categoryExclude = Category::cNull);
|
||||
void AddExcludedOptions();
|
||||
void LocationReset();
|
||||
void ItemReset();
|
||||
void HintReset();
|
||||
void CreateItemOverrides();
|
||||
bool IsSeedGenerated();
|
||||
bool IsSeedGenerated() const;
|
||||
void SetSeedGenerated(bool seedGenerated = true);
|
||||
bool IsSpoilerLoaded();
|
||||
bool IsSpoilerLoaded() const;
|
||||
void SetSpoilerLoaded(bool spoilerLoaded = true);
|
||||
bool IsPlandoLoaded();
|
||||
bool IsPlandoLoaded() const;
|
||||
void SetPlandoLoaded(bool plandoLoaded = true);
|
||||
std::shared_ptr<Settings> GetSettings();
|
||||
const std::shared_ptr<EntranceShuffler> GetEntranceShuffler();
|
||||
std::shared_ptr<EntranceShuffler> GetEntranceShuffler();
|
||||
std::shared_ptr<Dungeons> GetDungeons();
|
||||
DungeonInfo* GetDungeon(size_t key);
|
||||
DungeonInfo* GetDungeon(size_t key) const;
|
||||
std::shared_ptr<Trials> GetTrials();
|
||||
TrialInfo* GetTrial(size_t key);
|
||||
Sprite* GetSeedTexture(uint8_t index);
|
||||
Option& GetOption(RandomizerSettingKey key);
|
||||
Option& GetTrickOption(RandomizerTrick key);
|
||||
TrialInfo* GetTrial(size_t key) const;
|
||||
static Sprite* GetSeedTexture(uint8_t index);
|
||||
Option& GetOption(RandomizerSettingKey key) const;
|
||||
Option& GetTrickOption(RandomizerTrick key) const;
|
||||
GetItemEntry GetFinalGIEntry(RandomizerCheck rc, bool checkObtainability = true, GetItemID ogItemId = GI_NONE);
|
||||
void ParseSpoiler(const char* spoilerFileName, bool plandoMode);
|
||||
void ParseHashIconIndexesJson(nlohmann::json spoilerFileJson);
|
||||
@ -87,15 +87,15 @@ class Context {
|
||||
std::unordered_map<std::string, RandomizerGet> mSpoilerfileGetNameToEnum;
|
||||
std::unordered_map<std::string, HintType> mSpoilerfileHintTypeNameToEnum;
|
||||
std::array<Hint, RH_MAX> hintTable = {};
|
||||
RandomizerCheck mEmeraldLoc;
|
||||
RandomizerCheck mRubyLoc;
|
||||
RandomizerCheck mSapphireLoc;
|
||||
RandomizerCheck mForestMedallionLoc;
|
||||
RandomizerCheck mFireMedallionLoc;
|
||||
RandomizerCheck mWaterMedallionLoc;
|
||||
RandomizerCheck mShadowMedallionLoc;
|
||||
RandomizerCheck mSpiritMedallionLoc;
|
||||
RandomizerCheck mLightMedallionLoc;
|
||||
RandomizerCheck mEmeraldLoc = RC_UNKNOWN_CHECK;
|
||||
RandomizerCheck mRubyLoc = RC_UNKNOWN_CHECK;
|
||||
RandomizerCheck mSapphireLoc = RC_UNKNOWN_CHECK;
|
||||
RandomizerCheck mForestMedallionLoc = RC_UNKNOWN_CHECK;
|
||||
RandomizerCheck mFireMedallionLoc = RC_UNKNOWN_CHECK;
|
||||
RandomizerCheck mWaterMedallionLoc = RC_UNKNOWN_CHECK;
|
||||
RandomizerCheck mShadowMedallionLoc = RC_UNKNOWN_CHECK;
|
||||
RandomizerCheck mSpiritMedallionLoc = RC_UNKNOWN_CHECK;
|
||||
RandomizerCheck mLightMedallionLoc = RC_UNKNOWN_CHECK;
|
||||
std::array<ItemLocation, RC_MAX> itemLocationTable = {};
|
||||
std::shared_ptr<Settings> mSettings;
|
||||
std::shared_ptr<EntranceShuffler> mEntranceShuffler;
|
||||
|
@ -5,17 +5,18 @@
|
||||
#include "context.h"
|
||||
|
||||
namespace Rando {
|
||||
DungeonInfo::DungeonInfo(std::string name_, RandomizerHintTextKey hintKey_, RandomizerGet map_, RandomizerGet compass_,
|
||||
RandomizerGet smallKey_, RandomizerGet keyRing_, RandomizerGet bossKey_,
|
||||
uint8_t vanillaKeyCount_, uint8_t mqKeyCount_, std::vector<RandomizerCheck> vanillaLocations_,
|
||||
std::vector<RandomizerCheck> mqLocations_, std::vector<RandomizerCheck> sharedLocations_,
|
||||
std::vector<RandomizerCheck> bossRoomLocations_)
|
||||
DungeonInfo::DungeonInfo(std::string name_, const RandomizerHintTextKey hintKey_, const RandomizerGet map_,
|
||||
const RandomizerGet compass_, const RandomizerGet smallKey_, const RandomizerGet keyRing_,
|
||||
const RandomizerGet bossKey_, const uint8_t vanillaKeyCount_, const uint8_t mqKeyCount_,
|
||||
std::vector<RandomizerCheck> vanillaLocations_, std::vector<RandomizerCheck> mqLocations_,
|
||||
std::vector<RandomizerCheck> sharedLocations_, std::vector<RandomizerCheck> bossRoomLocations_)
|
||||
: name(std::move(name_)), hintKey(hintKey_), map(map_), compass(compass_), smallKey(smallKey_), keyRing(keyRing_),
|
||||
bossKey(bossKey_), vanillaKeyCount(vanillaKeyCount_), mqKeyCount(mqKeyCount_),
|
||||
vanillaLocations(std::move(vanillaLocations_)), mqLocations(std::move(mqLocations_)),
|
||||
sharedLocations(std::move(sharedLocations_)), bossRoomLocations(std::move(bossRoomLocations_)) {
|
||||
}
|
||||
DungeonInfo::DungeonInfo() = default;
|
||||
DungeonInfo::DungeonInfo() : hintKey(RHT_NONE), map(RG_NONE), compass(RG_NONE), smallKey(RG_NONE), keyRing(RG_NONE),
|
||||
bossKey(RG_NONE) {}
|
||||
DungeonInfo::~DungeonInfo() = default;
|
||||
|
||||
const std::string& DungeonInfo::GetName() const {
|
||||
@ -51,7 +52,7 @@ bool DungeonInfo::IsVanilla() const {
|
||||
}
|
||||
|
||||
uint8_t DungeonInfo::GetSmallKeyCount() const {
|
||||
return (masterQuest) ? mqKeyCount : vanillaKeyCount;
|
||||
return masterQuest ? mqKeyCount : vanillaKeyCount;
|
||||
}
|
||||
|
||||
RandomizerHintTextKey DungeonInfo::GetHintKey() const {
|
||||
@ -78,52 +79,52 @@ RandomizerGet DungeonInfo::GetBossKey() const {
|
||||
return bossKey;
|
||||
}
|
||||
|
||||
void DungeonInfo::PlaceVanillaMap() {
|
||||
void DungeonInfo::PlaceVanillaMap() const {
|
||||
if (map == RG_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto dungeonLocations = GetDungeonLocations();
|
||||
auto mapLocation = FilterFromPool(dungeonLocations, [](const RandomizerCheck loc) {
|
||||
const auto mapLocation = FilterFromPool(dungeonLocations, [](const RandomizerCheck loc) {
|
||||
return StaticData::GetLocation(loc)->IsCategory(Category::cVanillaMap);
|
||||
})[0];
|
||||
Context::GetInstance()->PlaceItemInLocation(mapLocation, map);
|
||||
}
|
||||
|
||||
void DungeonInfo::PlaceVanillaCompass() {
|
||||
void DungeonInfo::PlaceVanillaCompass() const {
|
||||
if (compass == RG_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto dungeonLocations = GetDungeonLocations();
|
||||
auto compassLocation = FilterFromPool(dungeonLocations, [](const RandomizerCheck loc) {
|
||||
const auto compassLocation = FilterFromPool(dungeonLocations, [](const RandomizerCheck loc) {
|
||||
return StaticData::GetLocation(loc)->IsCategory(Category::cVanillaCompass);
|
||||
})[0];
|
||||
Context::GetInstance()->PlaceItemInLocation(compassLocation, compass);
|
||||
}
|
||||
|
||||
void DungeonInfo::PlaceVanillaBossKey() {
|
||||
void DungeonInfo::PlaceVanillaBossKey() const {
|
||||
if (bossKey == RG_NONE || bossKey == RG_GANONS_CASTLE_BOSS_KEY) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto dungeonLocations = GetDungeonLocations();
|
||||
auto bossKeyLocation = FilterFromPool(dungeonLocations, [](const RandomizerCheck loc) {
|
||||
const auto bossKeyLocation = FilterFromPool(dungeonLocations, [](const RandomizerCheck loc) {
|
||||
return StaticData::GetLocation(loc)->IsCategory(Category::cVanillaBossKey);
|
||||
})[0];
|
||||
Context::GetInstance()->PlaceItemInLocation(bossKeyLocation, bossKey);
|
||||
}
|
||||
|
||||
void DungeonInfo::PlaceVanillaSmallKeys() {
|
||||
void DungeonInfo::PlaceVanillaSmallKeys() const {
|
||||
if (smallKey == RG_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto dungeonLocations = GetDungeonLocations();
|
||||
auto smallKeyLocations = FilterFromPool(dungeonLocations, [](const RandomizerCheck loc) {
|
||||
const auto smallKeyLocations = FilterFromPool(dungeonLocations, [](const RandomizerCheck loc) {
|
||||
return StaticData::GetLocation(loc)->IsCategory(Category::cVanillaSmallKey);
|
||||
});
|
||||
for (auto location : smallKeyLocations) {
|
||||
for (const auto location : smallKeyLocations) {
|
||||
Context::GetInstance()->PlaceItemInLocation(location, smallKey);
|
||||
}
|
||||
}
|
||||
@ -701,11 +702,11 @@ Dungeons::Dungeons() {
|
||||
|
||||
Dungeons::~Dungeons() = default;
|
||||
|
||||
DungeonInfo* Dungeons::GetDungeon(DungeonKey key) {
|
||||
DungeonInfo* Dungeons::GetDungeon(const DungeonKey key) {
|
||||
return &dungeonList[key];
|
||||
}
|
||||
|
||||
DungeonInfo* Dungeons::GetDungeonFromScene(uint16_t scene) {
|
||||
DungeonInfo* Dungeons::GetDungeonFromScene(const uint16_t scene) {
|
||||
switch (scene) {
|
||||
case SCENE_DEKU_TREE:
|
||||
return &dungeonList[DEKU_TREE];
|
||||
@ -753,21 +754,20 @@ void Dungeons::ClearAllMQ() {
|
||||
}
|
||||
|
||||
std::array<DungeonInfo*, 12> Dungeons::GetDungeonList() {
|
||||
std::array<DungeonInfo*, 12> dungeonList_;
|
||||
std::array<DungeonInfo*, 12> dungeonList_{};
|
||||
for (size_t i = 0; i < dungeonList.size(); i++) {
|
||||
dungeonList_[i] = &dungeonList[i];
|
||||
}
|
||||
return dungeonList_;
|
||||
}
|
||||
|
||||
size_t Dungeons::GetDungeonListSize() {
|
||||
size_t Dungeons::GetDungeonListSize() const {
|
||||
return dungeonList.size();
|
||||
}
|
||||
void Dungeons::ParseJson(nlohmann::json spoilerFileJson) {
|
||||
try {
|
||||
nlohmann::json mqDungeonsJson = spoilerFileJson["masterQuestDungeons"];
|
||||
for (auto it = mqDungeonsJson.begin(); it != mqDungeonsJson.end(); it++) {
|
||||
std::string dungeonName = it.value().template get<std::string>();
|
||||
for (auto it = mqDungeonsJson.begin(); it != mqDungeonsJson.end(); ++it) {
|
||||
std::string dungeonName = it.value().get<std::string>();
|
||||
for (auto& dungeon : dungeonList) {
|
||||
if (dungeon.GetName() == dungeonName) {
|
||||
dungeon.SetMQ();
|
||||
@ -776,8 +776,5 @@ void Dungeons::ParseJson(nlohmann::json spoilerFileJson) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
} // namespace Rando
|
@ -33,10 +33,10 @@ class DungeonInfo {
|
||||
RandomizerGet GetMap() const;
|
||||
RandomizerGet GetCompass() const;
|
||||
RandomizerGet GetBossKey() const;
|
||||
void PlaceVanillaMap();
|
||||
void PlaceVanillaCompass();
|
||||
void PlaceVanillaBossKey();
|
||||
void PlaceVanillaSmallKeys();
|
||||
void PlaceVanillaMap() const;
|
||||
void PlaceVanillaCompass() const;
|
||||
void PlaceVanillaBossKey() const;
|
||||
void PlaceVanillaSmallKeys() const;
|
||||
std::vector<RandomizerCheck> GetDungeonLocations() const;
|
||||
std::vector<RandomizerCheck> GetEveryLocation() const;
|
||||
|
||||
@ -48,8 +48,8 @@ class DungeonInfo {
|
||||
RandomizerGet smallKey;
|
||||
RandomizerGet keyRing;
|
||||
RandomizerGet bossKey;
|
||||
uint8_t vanillaKeyCount;
|
||||
uint8_t mqKeyCount;
|
||||
uint8_t vanillaKeyCount{};
|
||||
uint8_t mqKeyCount{};
|
||||
bool masterQuest = false;
|
||||
bool hasKeyRing = false;
|
||||
std::vector<RandomizerCheck> vanillaLocations;
|
||||
@ -88,7 +88,7 @@ class Dungeons {
|
||||
/// function from either here or the Context class.
|
||||
/// @return
|
||||
std::array<DungeonInfo*, 12> GetDungeonList();
|
||||
size_t GetDungeonListSize();
|
||||
size_t GetDungeonListSize() const;
|
||||
void ParseJson(nlohmann::json spoilerFileJson);
|
||||
private:
|
||||
std::array<DungeonInfo, 12> dungeonList;
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "item_location.h"
|
||||
|
||||
#include "3drando/logic.hpp"
|
||||
#include "3drando/random.hpp"
|
||||
#include "3drando/item_pool.hpp"
|
||||
#include "z64item.h"
|
||||
#include "variables.h"
|
||||
@ -10,53 +9,53 @@
|
||||
#include "../../OTRGlobals.h"
|
||||
|
||||
namespace Rando {
|
||||
Item::Item(RandomizerGet randomizerGet_, Text name_, ItemType type_, int16_t getItemId_, bool advancement_,
|
||||
bool* logicVar_, RandomizerHintTextKey hintKey_, uint16_t itemId_, uint16_t objectId_, uint16_t gid_,
|
||||
uint16_t textId_, uint16_t field_, int16_t chestAnimation_, GetItemCategory category_,
|
||||
uint16_t modIndex_, bool progressive_, uint16_t price_)
|
||||
Item::Item() : randomizerGet(RG_NONE), type(ITEMTYPE_ITEM), getItemId(GI_NONE), advancement(false), hintKey(RHT_NONE),
|
||||
progressive(false), price(0) {}
|
||||
Item::Item(const RandomizerGet randomizerGet_, Text name_, const ItemType type_, const int16_t getItemId_,
|
||||
const bool advancement_, bool* logicVar_, const RandomizerHintTextKey hintKey_, const uint16_t itemId_,
|
||||
const uint16_t objectId_, const uint16_t gid_, const uint16_t textId_, const uint16_t field_,
|
||||
const int16_t chestAnimation_, const GetItemCategory category_, const uint16_t modIndex_,
|
||||
const bool progressive_, const uint16_t price_)
|
||||
: randomizerGet(randomizerGet_), name(std::move(name_)), type(type_), getItemId(getItemId_),
|
||||
advancement(advancement_), logicVar(logicVar_), hintKey(hintKey_), progressive(progressive_), price(price_) {
|
||||
if (modIndex_ == MOD_RANDOMIZER || getItemId > 0x7D) {
|
||||
giEntry = std::shared_ptr<GetItemEntry>(
|
||||
new GetItemEntry(GET_ITEM(itemId_, objectId_, gid_, textId_, field_, chestAnimation_, category_, modIndex_,
|
||||
(int16_t)randomizerGet_)));
|
||||
giEntry = std::make_shared<GetItemEntry>(GetItemEntry{itemId_, field_, static_cast<int16_t>((chestAnimation_ != CHEST_ANIM_SHORT ? 1 : -1) * (gid_ + 1)), textId_, objectId_, modIndex_, static_cast<int16_t>(randomizerGet_), gid_, true, ITEM_FROM_NPC, category_, NULL});
|
||||
} else {
|
||||
giEntry = std::shared_ptr<GetItemEntry>(new GetItemEntry(
|
||||
GET_ITEM(itemId_, objectId_, gid_, textId_, field_, chestAnimation_, category_, modIndex_, getItemId_)));
|
||||
giEntry = std::make_shared<GetItemEntry>(GetItemEntry{itemId_, field_, static_cast<int16_t>((chestAnimation_ != CHEST_ANIM_SHORT ? 1 : -1) * (gid_ + 1)), textId_, objectId_, modIndex_, getItemId_, gid_, true, ITEM_FROM_NPC, category_, NULL});
|
||||
}
|
||||
}
|
||||
|
||||
Item::Item(RandomizerGet randomizerGet_, Text name_, ItemType type_, int16_t getItemId_, bool advancement_,
|
||||
uint8_t* logicVar_, RandomizerHintTextKey hintKey_, uint16_t itemId_, uint16_t objectId_, uint16_t gid_,
|
||||
uint16_t textId_, uint16_t field_, int16_t chestAnimation_, GetItemCategory category_,
|
||||
uint16_t modIndex_, bool progressive_, uint16_t price_)
|
||||
Item::Item(const RandomizerGet randomizerGet_, Text name_, const ItemType type_, const int16_t getItemId_,
|
||||
const bool advancement_, uint8_t* logicVar_, const RandomizerHintTextKey hintKey_, const uint16_t itemId_,
|
||||
const uint16_t objectId_, const uint16_t gid_, const uint16_t textId_, const uint16_t field_,
|
||||
const int16_t chestAnimation_, const GetItemCategory category_, const uint16_t modIndex_,
|
||||
const bool progressive_, const uint16_t price_)
|
||||
: randomizerGet(randomizerGet_), name(std::move(name_)), type(type_), getItemId(getItemId_),
|
||||
advancement(advancement_), logicVar(logicVar_), hintKey(hintKey_), progressive(progressive_), price(price_) {
|
||||
if (modIndex_ == MOD_RANDOMIZER || getItemId > 0x7D) {
|
||||
giEntry = std::shared_ptr<GetItemEntry>(
|
||||
new GetItemEntry(GET_ITEM(itemId_, objectId_, gid_, textId_, field_, chestAnimation_, category_, modIndex_,
|
||||
(int16_t)randomizerGet_)));
|
||||
giEntry = std::make_shared<GetItemEntry>(GetItemEntry{itemId_, field_, static_cast<int16_t>((chestAnimation_ != CHEST_ANIM_SHORT ? 1 : -1) * (gid_ + 1)), textId_, objectId_, modIndex_, static_cast<int16_t>(randomizerGet_), gid_, true, ITEM_FROM_NPC, category_, NULL});
|
||||
} else {
|
||||
giEntry = std::shared_ptr<GetItemEntry>(new GetItemEntry(
|
||||
GET_ITEM(itemId_, objectId_, gid_, textId_, field_, chestAnimation_, category_, modIndex_, getItemId_)));
|
||||
giEntry = std::make_shared<GetItemEntry>(GetItemEntry{itemId_, field_, static_cast<int16_t>((chestAnimation_ != CHEST_ANIM_SHORT ? 1 : -1) * (gid_ + 1)), textId_, objectId_, modIndex_, getItemId_, gid_, true, ITEM_FROM_NPC, category_, NULL});
|
||||
}
|
||||
}
|
||||
|
||||
Item::Item(RandomizerGet randomizerGet_, Text name_, ItemType type_, int getItemId_, bool advancement_,
|
||||
bool* logicVar_, RandomizerHintTextKey hintKey_, bool progressive_, uint16_t price_)
|
||||
Item::Item(const RandomizerGet randomizerGet_, Text name_, const ItemType type_, const int16_t getItemId_,
|
||||
const bool advancement_, bool* logicVar_, const RandomizerHintTextKey hintKey_, const bool progressive_,
|
||||
const uint16_t price_)
|
||||
: randomizerGet(randomizerGet_), name(std::move(name_)), type(type_), getItemId(getItemId_),
|
||||
advancement(advancement_), logicVar(logicVar_), hintKey(hintKey_), progressive(progressive_), price(price_) {
|
||||
}
|
||||
|
||||
Item::Item(RandomizerGet randomizerGet_, Text name_, ItemType type_, int getItemId_, bool advancement_,
|
||||
uint8_t* logicVar_, RandomizerHintTextKey hintKey_, bool progressive_, uint16_t price_)
|
||||
Item::Item(const RandomizerGet randomizerGet_, Text name_, const ItemType type_, const int16_t getItemId_,
|
||||
const bool advancement_, uint8_t* logicVar_, const RandomizerHintTextKey hintKey_, const bool progressive_,
|
||||
const uint16_t price_)
|
||||
: randomizerGet(randomizerGet_), name(std::move(name_)), type(type_), getItemId(getItemId_),
|
||||
advancement(advancement_), logicVar(logicVar_), hintKey(hintKey_), progressive(progressive_), price(price_) {
|
||||
}
|
||||
|
||||
Item::~Item() = default;
|
||||
|
||||
void Item::ApplyEffect() {
|
||||
void Item::ApplyEffect() const {
|
||||
// If this is a key ring, logically add as many keys as we could need
|
||||
if (RHT_FOREST_TEMPLE_KEY_RING <= hintKey && hintKey <= RHT_GANONS_CASTLE_KEY_RING) {
|
||||
*std::get<uint8_t*>(logicVar) += 10;
|
||||
@ -70,7 +69,7 @@ void Item::ApplyEffect() {
|
||||
Logic::UpdateHelpers();
|
||||
}
|
||||
|
||||
void Item::UndoEffect() {
|
||||
void Item::UndoEffect() const {
|
||||
if (RHT_FOREST_TEMPLE_KEY_RING <= hintKey && hintKey <= RHT_GANONS_CASTLE_KEY_RING) {
|
||||
*std::get<uint8_t*>(logicVar) -= 10;
|
||||
} else {
|
||||
@ -99,7 +98,7 @@ ItemType Item::GetItemType() const {
|
||||
return type;
|
||||
}
|
||||
|
||||
RandomizerGet Item::GetRandomizerGet() {
|
||||
RandomizerGet Item::GetRandomizerGet() const {
|
||||
return randomizerGet;
|
||||
}
|
||||
|
||||
@ -107,12 +106,12 @@ uint16_t Item::GetPrice() const {
|
||||
return price;
|
||||
}
|
||||
|
||||
std::shared_ptr<GetItemEntry> Item::GetGIEntry() const {
|
||||
std::shared_ptr<GetItemEntry> Item::GetGIEntry() const { // NOLINT(*-no-recursion)
|
||||
if (giEntry != nullptr) {
|
||||
return giEntry;
|
||||
}
|
||||
RandomizerGet actual = RG_NONE;
|
||||
u8 numWallets =
|
||||
const u8 numWallets =
|
||||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHOPSANITY) > RO_SHOPSANITY_ZERO_ITEMS ? 3 : 2;
|
||||
switch (randomizerGet) {
|
||||
case RG_PROGRESSIVE_STICK_UPGRADE:
|
||||
@ -125,6 +124,8 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const {
|
||||
case 3:
|
||||
actual = RG_DEKU_STICK_CAPACITY_30;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RG_PROGRESSIVE_NUT_UPGRADE:
|
||||
@ -137,6 +138,8 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const {
|
||||
case 3:
|
||||
actual = RG_DEKU_NUT_CAPACITY_40;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RG_PROGRESSIVE_BOMB_BAG:
|
||||
@ -151,6 +154,8 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const {
|
||||
case 3:
|
||||
actual = RG_BIGGEST_BOMB_BAG;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RG_PROGRESSIVE_BOW:
|
||||
@ -165,6 +170,8 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const {
|
||||
case 3:
|
||||
actual = RG_BIGGEST_QUIVER;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RG_PROGRESSIVE_SLINGSHOT:
|
||||
@ -179,6 +186,8 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const {
|
||||
case 3:
|
||||
actual = RG_BIGGEST_BULLET_BAG;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RG_PROGRESSIVE_OCARINA:
|
||||
@ -190,6 +199,8 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const {
|
||||
case ITEM_OCARINA_TIME:
|
||||
actual = RG_OCARINA_OF_TIME;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RG_PROGRESSIVE_HOOKSHOT:
|
||||
@ -201,6 +212,8 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const {
|
||||
case ITEM_LONGSHOT:
|
||||
actual = RG_LONGSHOT;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RG_PROGRESSIVE_STRENGTH:
|
||||
@ -215,6 +228,8 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const {
|
||||
case 3:
|
||||
actual = RG_GOLDEN_GAUNTLETS;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RG_PROGRESSIVE_WALLET:
|
||||
@ -229,6 +244,8 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const {
|
||||
case 3:
|
||||
actual = numWallets == 3 ? RG_TYCOON_WALLET : RG_GIANT_WALLET;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RG_PROGRESSIVE_SCALE:
|
||||
@ -240,6 +257,8 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const {
|
||||
case 2:
|
||||
actual = RG_GOLDEN_SCALE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RG_PROGRESSIVE_MAGIC_METER:
|
||||
@ -251,6 +270,8 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const {
|
||||
case 2:
|
||||
actual = RG_MAGIC_DOUBLE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RG_PROGRESSIVE_GORONSWORD: // todo progressive?
|
||||
@ -260,14 +281,14 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const {
|
||||
actual = RG_NONE;
|
||||
break;
|
||||
}
|
||||
return Rando::StaticData::RetrieveItem(actual).GetGIEntry();
|
||||
return StaticData::RetrieveItem(actual).GetGIEntry();
|
||||
}
|
||||
|
||||
GetItemEntry Item::GetGIEntry_Copy() const {
|
||||
return *GetGIEntry();
|
||||
}
|
||||
|
||||
void Item::SetPrice(uint16_t price_) {
|
||||
void Item::SetPrice(const uint16_t price_) {
|
||||
price = price_;
|
||||
}
|
||||
|
||||
@ -275,7 +296,7 @@ void Item::SetAsPlaythrough() {
|
||||
playthrough = true;
|
||||
}
|
||||
|
||||
void Item::SetCustomDrawFunc(CustomDrawFunc drawFunc) {
|
||||
void Item::SetCustomDrawFunc(const CustomDrawFunc drawFunc) const {
|
||||
giEntry->drawFunc = drawFunc;
|
||||
}
|
||||
|
||||
@ -290,7 +311,7 @@ bool Item::IsBottleItem() const {
|
||||
}
|
||||
|
||||
bool Item::IsMajorItem() const {
|
||||
auto ctx = Rando::Context::GetInstance();
|
||||
const auto ctx = Context::GetInstance();
|
||||
if (type == ITEMTYPE_TOKEN) {
|
||||
return ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_TOKENS) || ctx->GetSettings()->LACSCondition() == RO_LACS_TOKENS;
|
||||
}
|
||||
@ -300,7 +321,7 @@ bool Item::IsMajorItem() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type == ITEMTYPE_DUNGEONREWARD && (ctx->GetOption(RSK_SHUFFLE_DUNGEON_REWARDS).Is(RO_DUNGEON_REWARDS_END_OF_DUNGEON))) {
|
||||
if (type == ITEMTYPE_DUNGEONREWARD && ctx->GetOption(RSK_SHUFFLE_DUNGEON_REWARDS).Is(RO_DUNGEON_REWARDS_END_OF_DUNGEON)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -322,7 +343,7 @@ bool Item::IsMajorItem() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((type == ITEMTYPE_BOSSKEY && getItemId != 0xAD) &&
|
||||
if (type == ITEMTYPE_BOSSKEY && getItemId != 0xAD &&
|
||||
(ctx->GetOption(RSK_BOSS_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_VANILLA) || ctx->GetOption(RSK_BOSS_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_OWN_DUNGEON))) {
|
||||
return false;
|
||||
}
|
||||
|
@ -28,36 +28,36 @@ enum ItemType {
|
||||
namespace Rando {
|
||||
class Item {
|
||||
public:
|
||||
Item() = default;
|
||||
Item();
|
||||
Item(RandomizerGet randomizerGet_, Text name_, ItemType type_, int16_t getItemId_, bool advancement_,
|
||||
bool* logicVar_, RandomizerHintTextKey hintKey_, uint16_t itemId_, uint16_t objectId_, uint16_t gid_,
|
||||
uint16_t textId_, uint16_t field_, int16_t chestAnimation_, GetItemCategory category_,
|
||||
uint16_t modIndex_, bool progressive = false, uint16_t price_ = 0);
|
||||
uint16_t modIndex_, bool progressive_ = false, uint16_t price_ = 0);
|
||||
Item(RandomizerGet randomizerGet_, Text name_, ItemType type_, int16_t getItemId_, bool advancement_,
|
||||
uint8_t* logicVar_, RandomizerHintTextKey hintKey_, uint16_t itemId_, uint16_t objectId_, uint16_t gid_,
|
||||
uint16_t textId_, uint16_t field_, int16_t chestAnimation_, GetItemCategory category_, uint16_t modIndex_,
|
||||
bool progressive = false, uint16_t price_ = 0);
|
||||
Item(RandomizerGet randomizerGet_, Text name_, ItemType type_, int getItemId_, bool advancement_,
|
||||
bool* logicVar_, RandomizerHintTextKey hintKey_, bool progressive = false, uint16_t price = 0);
|
||||
Item(RandomizerGet randomizerGet_, Text name_, ItemType type_, int getItemId_, bool advancement_,
|
||||
uint8_t* logicVar_, RandomizerHintTextKey hintKey_, bool progressive = false, uint16_t price = 0);
|
||||
bool progressive_ = false, uint16_t price_ = 0);
|
||||
Item(RandomizerGet randomizerGet_, Text name_, ItemType type_, int16_t getItemId_, bool advancement_,
|
||||
bool* logicVar_, RandomizerHintTextKey hintKey_, bool progressive_ = false, uint16_t price_ = 0);
|
||||
Item(RandomizerGet randomizerGet_, Text name_, ItemType type_, int16_t getItemId_, bool advancement_,
|
||||
uint8_t* logicVar_, RandomizerHintTextKey hintKey_, bool progressive_ = false, uint16_t price_ = 0);
|
||||
~Item();
|
||||
|
||||
void ApplyEffect();
|
||||
void UndoEffect();
|
||||
void ApplyEffect() const;
|
||||
void UndoEffect() const;
|
||||
|
||||
|
||||
const Text& GetName() const;
|
||||
bool IsAdvancement() const;
|
||||
int GetItemID() const;
|
||||
ItemType GetItemType() const;
|
||||
RandomizerGet GetRandomizerGet();
|
||||
RandomizerGet GetRandomizerGet() const;
|
||||
uint16_t GetPrice() const;
|
||||
std::shared_ptr<GetItemEntry> GetGIEntry() const;
|
||||
GetItemEntry GetGIEntry_Copy() const;
|
||||
void SetPrice(uint16_t price_);
|
||||
void SetAsPlaythrough();
|
||||
void SetCustomDrawFunc(CustomDrawFunc);
|
||||
void SetCustomDrawFunc(CustomDrawFunc) const;
|
||||
bool IsPlaythrough() const;
|
||||
bool IsBottleItem() const;
|
||||
bool IsMajorItem() const;
|
||||
@ -74,9 +74,9 @@ class Item {
|
||||
bool advancement;
|
||||
std::variant<bool*, uint8_t*> logicVar;
|
||||
RandomizerHintTextKey hintKey;
|
||||
bool progressive = false;
|
||||
bool progressive;
|
||||
uint16_t price;
|
||||
bool playthrough = false;
|
||||
std::shared_ptr<GetItemEntry> giEntry = nullptr;
|
||||
std::shared_ptr<GetItemEntry> giEntry;
|
||||
};
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
#include "context.h"
|
||||
|
||||
namespace Rando {
|
||||
ItemLocation::ItemLocation(RandomizerCheck rc_) : rc(rc_) {}
|
||||
ItemLocation::ItemLocation() : rc(RC_UNKNOWN_CHECK) {}
|
||||
ItemLocation::ItemLocation(const RandomizerCheck rc_) : rc(rc_) {}
|
||||
|
||||
RandomizerCheck ItemLocation::GetRandomizerCheck() const {
|
||||
return rc;
|
||||
@ -21,7 +22,7 @@ void ItemLocation::RemoveFromPool() {
|
||||
}
|
||||
|
||||
const Item& ItemLocation::GetPlacedItem() const {
|
||||
return Rando::StaticData::RetrieveItem(placedItem);
|
||||
return StaticData::RetrieveItem(placedItem);
|
||||
}
|
||||
|
||||
RandomizerGet& ItemLocation::RefPlacedItem() {
|
||||
@ -29,7 +30,7 @@ RandomizerGet& ItemLocation::RefPlacedItem() {
|
||||
}
|
||||
|
||||
const Text& ItemLocation::GetPlacedItemName() const {
|
||||
return Rando::StaticData::RetrieveItem(placedItem).GetName();
|
||||
return StaticData::RetrieveItem(placedItem).GetName();
|
||||
}
|
||||
|
||||
RandomizerGet ItemLocation::GetPlacedRandomizerGet() const {
|
||||
@ -50,7 +51,7 @@ void ItemLocation::SaveDelayedItem () {
|
||||
delayedItem = RG_NONE;
|
||||
}
|
||||
|
||||
void ItemLocation::SetParentRegion(RandomizerRegion region) {
|
||||
void ItemLocation::SetParentRegion(const RandomizerRegion region) {
|
||||
parentRegion = region;
|
||||
}
|
||||
|
||||
@ -59,21 +60,21 @@ RandomizerRegion ItemLocation::GetParentRegionKey() const {
|
||||
}
|
||||
|
||||
void ItemLocation::PlaceVanillaItem() {
|
||||
placedItem = Rando::StaticData::GetLocation(rc)->GetVanillaItem();
|
||||
placedItem = StaticData::GetLocation(rc)->GetVanillaItem();
|
||||
}
|
||||
|
||||
void ItemLocation::ApplyPlacedItemEffect() {
|
||||
Rando::StaticData::RetrieveItem(placedItem).ApplyEffect();
|
||||
void ItemLocation::ApplyPlacedItemEffect() const {
|
||||
StaticData::RetrieveItem(placedItem).ApplyEffect();
|
||||
}
|
||||
|
||||
uint16_t ItemLocation::GetPrice() const {
|
||||
if (StaticData::RetrieveItem(placedItem).GetItemType() == ITEMTYPE_SHOP) {
|
||||
return Rando::StaticData::RetrieveItem(placedItem).GetPrice();
|
||||
return StaticData::RetrieveItem(placedItem).GetPrice();
|
||||
}
|
||||
return price;
|
||||
}
|
||||
|
||||
void ItemLocation::SetPrice(uint16_t price_) {
|
||||
void ItemLocation::SetPrice(const uint16_t price_) {
|
||||
if (hasCustomPrice) {
|
||||
return;
|
||||
}
|
||||
@ -84,7 +85,7 @@ bool ItemLocation::HasCustomPrice() const {
|
||||
return hasCustomPrice;
|
||||
}
|
||||
|
||||
void ItemLocation::SetCustomPrice(uint16_t price_) {
|
||||
void ItemLocation::SetCustomPrice(const uint16_t price_) {
|
||||
price = price_;
|
||||
hasCustomPrice = true;
|
||||
}
|
||||
@ -109,7 +110,7 @@ RandomizerHintKey ItemLocation::GetHintKey() const {
|
||||
return hintedBy;
|
||||
}
|
||||
|
||||
void ItemLocation::SetHintKey(RandomizerHintKey hintKey) {
|
||||
void ItemLocation::SetHintKey(const RandomizerHintKey hintKey) {
|
||||
hintedBy = hintKey;
|
||||
}
|
||||
|
||||
@ -125,38 +126,37 @@ bool ItemLocation::IsExcluded() const {
|
||||
return excludedOption.Value<bool>();
|
||||
}
|
||||
|
||||
Rando::Option* ItemLocation::GetExcludedOption() {
|
||||
Option* ItemLocation::GetExcludedOption() {
|
||||
return &excludedOption;
|
||||
}
|
||||
|
||||
void ItemLocation::AddExcludeOption() {
|
||||
const std::string name = StaticData::GetLocation(rc)->GetName();
|
||||
if (name.length() < 23) {
|
||||
excludedOption = Rando::Option::Bool(name, {"Include", "Exclude"});
|
||||
if (const std::string name = StaticData::GetLocation(rc)->GetName(); name.length() < 23) {
|
||||
excludedOption = Option::Bool(name, {"Include", "Exclude"});
|
||||
} else {
|
||||
size_t lastSpace = name.rfind(' ', 23);
|
||||
const size_t lastSpace = name.rfind(' ', 23);
|
||||
std::string settingText = name;
|
||||
settingText.replace(lastSpace, 1, "\n ");
|
||||
|
||||
excludedOption = Rando::Option::Bool(settingText, {"Include", "Exclude"});
|
||||
excludedOption = Option::Bool(settingText, {"Include", "Exclude"});
|
||||
}
|
||||
// RANDOTODO: this without string compares and loops
|
||||
bool alreadyAdded = false;
|
||||
Rando::Location* loc = StaticData::GetLocation(rc);
|
||||
for (const Rando::Option* location : Rando::Context::GetInstance()->GetSettings()->GetExcludeOptionsForGroup(loc->GetCollectionCheckGroup())) {
|
||||
const Location* loc = StaticData::GetLocation(rc);
|
||||
for (const Option* location : Context::GetInstance()->GetSettings()->GetExcludeOptionsForGroup(loc->GetCollectionCheckGroup())) {
|
||||
if (location->GetName() == excludedOption.GetName()) {
|
||||
alreadyAdded = true;
|
||||
}
|
||||
}
|
||||
if (!alreadyAdded) {
|
||||
Rando::Context::GetInstance()->GetSettings()->GetExcludeOptionsForGroup(loc->GetCollectionCheckGroup()).push_back(&excludedOption);
|
||||
Context::GetInstance()->GetSettings()->GetExcludeOptionsForGroup(loc->GetCollectionCheckGroup()).push_back(&excludedOption);
|
||||
}
|
||||
}
|
||||
|
||||
bool ItemLocation::IsVisible() const {
|
||||
return visibleInImGui;
|
||||
}
|
||||
void ItemLocation::SetVisible(bool visibleInImGui_) {
|
||||
void ItemLocation::SetVisible(const bool visibleInImGui_) {
|
||||
visibleInImGui = visibleInImGui_;
|
||||
|
||||
}
|
||||
|
@ -8,8 +8,8 @@
|
||||
namespace Rando {
|
||||
class ItemLocation {
|
||||
public:
|
||||
ItemLocation() = default;
|
||||
ItemLocation(RandomizerCheck rc);
|
||||
ItemLocation();
|
||||
explicit ItemLocation(RandomizerCheck rc_);
|
||||
RandomizerCheck GetRandomizerCheck() const;
|
||||
bool IsAddedToPool() const;
|
||||
void AddToPool();
|
||||
@ -17,13 +17,13 @@ class ItemLocation {
|
||||
const Item& GetPlacedItem() const;
|
||||
const Text& GetPlacedItemName() const;
|
||||
RandomizerGet GetPlacedRandomizerGet() const;
|
||||
void SetPlacedItem(const RandomizerGet item);
|
||||
void SetPlacedItem(RandomizerGet item);
|
||||
RandomizerGet& RefPlacedItem();
|
||||
void SetDelayedItem(const RandomizerGet item);
|
||||
void SetDelayedItem(RandomizerGet item);
|
||||
RandomizerRegion GetParentRegionKey() const;
|
||||
void SetParentRegion (RandomizerRegion region);
|
||||
void PlaceVanillaItem();
|
||||
void ApplyPlacedItemEffect();
|
||||
void ApplyPlacedItemEffect() const;
|
||||
void SaveDelayedItem();
|
||||
uint16_t GetPrice() const;
|
||||
void SetPrice(uint16_t price_);
|
||||
@ -39,14 +39,14 @@ class ItemLocation {
|
||||
bool IsExcluded() const;
|
||||
void AddExcludeOption();
|
||||
Option* GetExcludedOption();
|
||||
void SetHidden(const bool hidden_);
|
||||
void SetHidden(bool hidden_);
|
||||
bool IsVisible() const;
|
||||
void SetVisible(bool visibleInImGui_);
|
||||
void ResetVariables();
|
||||
|
||||
private:
|
||||
RandomizerCheck rc;
|
||||
RandomizerHintKey hintedBy;
|
||||
RandomizerHintKey hintedBy = RH_NONE;
|
||||
bool hintedAt = false;
|
||||
bool isHintable = false;
|
||||
bool addedToPool = false;
|
||||
|
@ -1,30 +1,33 @@
|
||||
#include "item_override.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace Rando {
|
||||
ItemOverride::ItemOverride(RandomizerCheck location_, RandomizerGet looksLike_)
|
||||
: location(location_), looksLike(looksLike_) {};
|
||||
ItemOverride::ItemOverride() : mLocation(RC_UNKNOWN_CHECK), mLooksLike(RG_NONE) {}
|
||||
ItemOverride::ItemOverride(const RandomizerCheck location, const RandomizerGet looksLike)
|
||||
: mLocation(location), mLooksLike(looksLike) {}
|
||||
|
||||
RandomizerCheck ItemOverride::GetLocation() const {
|
||||
return location;
|
||||
return mLocation;
|
||||
}
|
||||
|
||||
void ItemOverride::SetLocation(RandomizerCheck location_) {
|
||||
location = location_;
|
||||
void ItemOverride::SetLocation(const RandomizerCheck location) {
|
||||
mLocation = location;
|
||||
}
|
||||
|
||||
RandomizerGet ItemOverride::LooksLike() const {
|
||||
return looksLike;
|
||||
return mLooksLike;
|
||||
}
|
||||
|
||||
RandomizerGet& ItemOverride::RefLooksLike() {
|
||||
return looksLike;
|
||||
return mLooksLike;
|
||||
}
|
||||
|
||||
Text& ItemOverride::GetTrickName() {
|
||||
return trickName;
|
||||
return mTrickName;
|
||||
}
|
||||
|
||||
void ItemOverride::SetTrickName(Text trickName_) {
|
||||
trickName = trickName_;
|
||||
void ItemOverride::SetTrickName(Text trickName) {
|
||||
mTrickName = std::move(trickName);
|
||||
}
|
||||
} // namespace Rando
|
@ -7,17 +7,17 @@ namespace Rando {
|
||||
/// @brief Class representing overrides of individual items. Used for trick names and models for ice traps.
|
||||
class ItemOverride {
|
||||
public:
|
||||
ItemOverride() = default;
|
||||
ItemOverride(RandomizerCheck location_, RandomizerGet looksLike_);
|
||||
ItemOverride();
|
||||
ItemOverride(RandomizerCheck location, RandomizerGet looksLike);
|
||||
RandomizerCheck GetLocation() const;
|
||||
void SetLocation(RandomizerCheck);
|
||||
void SetLocation(RandomizerCheck location);
|
||||
RandomizerGet LooksLike() const;
|
||||
RandomizerGet& RefLooksLike();
|
||||
Text& GetTrickName();
|
||||
void SetTrickName (Text trickName);
|
||||
private:
|
||||
RandomizerCheck location;
|
||||
RandomizerGet looksLike;
|
||||
Text trickName;
|
||||
RandomizerCheck mLocation;
|
||||
RandomizerGet mLooksLike;
|
||||
Text mTrickName;
|
||||
};
|
||||
} // namespace Rando
|
@ -35,7 +35,7 @@ int32_t Rando::Location::GetActorParams() const {
|
||||
}
|
||||
|
||||
SceneID Rando::Location::GetScene() const {
|
||||
return (SceneID)scene;
|
||||
return static_cast<SceneID>(scene);
|
||||
}
|
||||
|
||||
uint8_t Rando::Location::GetFlag() const {
|
||||
@ -78,7 +78,7 @@ bool Rando::Location::IsOverworld() const {
|
||||
}
|
||||
|
||||
bool Rando::Location::IsShop() const {
|
||||
return (scene >= SCENE_BAZAAR && scene <= SCENE_BOMBCHU_SHOP);
|
||||
return scene >= SCENE_BAZAAR && scene <= SCENE_BOMBCHU_SHOP;
|
||||
}
|
||||
|
||||
bool Rando::Location::IsVanillaCompletion() const {
|
||||
@ -103,9 +103,9 @@ Rando::Location Rando::Location::Base(RandomizerCheck rc, RandomizerCheckQuest q
|
||||
const RandomizerHintTextKey hintKey, const RandomizerGet vanillaItem,
|
||||
std::vector<Category>&& categories, SpoilerCollectionCheck collectionCheck,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
|
||||
return Location(rc, quest_, checkType_, area_, LocationType::Base, actorId_, scene_, actorParams_, flag_,
|
||||
return {rc, quest_, checkType_, area_, LocationType::Base, actorId_, scene_, actorParams_, flag_,
|
||||
std::move(shortName_), std::move(spoilerName_), hintKey, vanillaItem, std::move(categories),
|
||||
isVanillaCompletion_, collectionCheck, collectionCheckGroup);
|
||||
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
|
||||
}
|
||||
|
||||
Rando::Location Rando::Location::Chest(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
|
||||
@ -114,11 +114,11 @@ Rando::Location Rando::Location::Chest(RandomizerCheck rc, RandomizerCheckQuest
|
||||
std::string&& spoilerName_, const RandomizerHintTextKey hintKey,
|
||||
const RandomizerGet vanillaItem, std::vector<Category>&& categories,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
|
||||
return Location(rc, quest_, checkType_, area_, LocationType::Chest, actorId_, scene_, actorParams_, flag_,
|
||||
return {rc, quest_, checkType_, area_, LocationType::Chest, actorId_, scene_, actorParams_, flag_,
|
||||
std::move(shortName_), std::move(spoilerName_), hintKey, vanillaItem, std::move(categories),
|
||||
isVanillaCompletion_,
|
||||
SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_CHEST, scene_, flag_),
|
||||
collectionCheckGroup);
|
||||
SpoilerCollectionCheck(SPOILER_CHK_CHEST, scene_, flag_),
|
||||
collectionCheckGroup};
|
||||
}
|
||||
|
||||
Rando::Location Rando::Location::Chest(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
|
||||
@ -128,9 +128,9 @@ Rando::Location Rando::Location::Chest(RandomizerCheck rc, RandomizerCheckQuest
|
||||
const RandomizerGet vanillaItem, std::vector<Category>&& categories,
|
||||
SpoilerCollectionCheck collectionCheck,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
|
||||
return Location(rc, quest_, checkType_, area_, LocationType::Chest, actorId_, scene_, actorParams_, flag_,
|
||||
return {rc, quest_, checkType_, area_, LocationType::Chest, actorId_, scene_, actorParams_, flag_,
|
||||
std::move(shortName_), std::move(spoilerName_), hintKey, vanillaItem, std::move(categories),
|
||||
isVanillaCompletion_, collectionCheck, collectionCheckGroup);
|
||||
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
|
||||
}
|
||||
|
||||
Rando::Location Rando::Location::Collectable(
|
||||
@ -138,11 +138,11 @@ Rando::Location Rando::Location::Collectable(
|
||||
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
|
||||
std::string&& spoilerName_, const RandomizerHintTextKey hintKey, const RandomizerGet vanillaItem,
|
||||
std::vector<Category>&& categories, SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
|
||||
return Location(rc, quest_, checkType_, area_, LocationType::Collectable, actorId_, scene_, actorParams_, flag_,
|
||||
return {rc, quest_, checkType_, area_, LocationType::Collectable, actorId_, scene_, actorParams_, flag_,
|
||||
std::move(shortName_), std::move(spoilerName_), hintKey, vanillaItem, std::move(categories),
|
||||
isVanillaCompletion_,
|
||||
SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_COLLECTABLE, scene_, flag_),
|
||||
collectionCheckGroup);
|
||||
SpoilerCollectionCheck(SPOILER_CHK_COLLECTABLE, scene_, flag_),
|
||||
collectionCheckGroup};
|
||||
}
|
||||
|
||||
Rando::Location Rando::Location::Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_,
|
||||
@ -150,14 +150,14 @@ Rando::Location Rando::Location::Collectable(RandomizerCheck rc, RandomizerCheck
|
||||
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
|
||||
std::string&& shortName_, std::string&& spoilerName_,
|
||||
const RandomizerHintTextKey hintKey, const RandomizerGet vanillaItem,
|
||||
std::vector<Category>&& categories, uint8_t collectFlag_,
|
||||
std::vector<Category>&& categories, const uint8_t collectFlag_,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup,
|
||||
bool isVanillaCompletion_) {
|
||||
return Location(rc, quest_, checkType_, area_, LocationType::Collectable, actorId_, scene_, actorParams_, flag_,
|
||||
return {rc, quest_, checkType_, area_, LocationType::Collectable, actorId_, scene_, actorParams_, flag_,
|
||||
std::move(shortName_), std::move(spoilerName_), hintKey, vanillaItem, std::move(categories),
|
||||
isVanillaCompletion_,
|
||||
SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_COLLECTABLE, scene_, collectFlag_),
|
||||
collectionCheckGroup);
|
||||
SpoilerCollectionCheck(SPOILER_CHK_COLLECTABLE, scene_, collectFlag_),
|
||||
collectionCheckGroup};
|
||||
}
|
||||
|
||||
Rando::Location Rando::Location::Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_,
|
||||
@ -168,9 +168,9 @@ Rando::Location Rando::Location::Collectable(RandomizerCheck rc, RandomizerCheck
|
||||
std::vector<Category>&& categories, SpoilerCollectionCheck collectionCheck,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup,
|
||||
bool isVanillaCompletion_) {
|
||||
return Location(rc, quest_, checkType_, area_, LocationType::Collectable, actorId_, scene_, actorParams_, flag_,
|
||||
return {rc, quest_, checkType_, area_, LocationType::Collectable, actorId_, scene_, actorParams_, flag_,
|
||||
std::move(shortName_), std::move(spoilerName_), hintKey, vanillaItem, std::move(categories),
|
||||
isVanillaCompletion_, collectionCheck, collectionCheckGroup);
|
||||
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
|
||||
}
|
||||
|
||||
Rando::Location Rando::Location::GSToken(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
|
||||
@ -178,23 +178,23 @@ Rando::Location Rando::Location::GSToken(RandomizerCheck rc, RandomizerCheckQues
|
||||
std::string&& spoilerName_, const RandomizerHintTextKey hintKey,
|
||||
std::vector<Category>&& categories,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
|
||||
return Location(rc, quest_, RCTYPE_SKULL_TOKEN, area_, LocationType::GSToken, ACTOR_EN_SI, scene_, actorParams_,
|
||||
return {rc, quest_, RCTYPE_SKULL_TOKEN, area_, LocationType::GSToken, ACTOR_EN_SI, scene_, actorParams_,
|
||||
flag_, std::move(shortName_), std::move(spoilerName_), hintKey, RG_GOLD_SKULLTULA_TOKEN,
|
||||
std::move(categories), isVanillaCompletion_,
|
||||
SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_GOLD_SKULLTULA, scene_, flag_),
|
||||
collectionCheckGroup);
|
||||
SpoilerCollectionCheck(SPOILER_CHK_GOLD_SKULLTULA, scene_, flag_),
|
||||
collectionCheckGroup};
|
||||
}
|
||||
|
||||
Rando::Location Rando::Location::GSToken(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
|
||||
uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
|
||||
std::string&& spoilerName_, const RandomizerHintTextKey hintKey,
|
||||
std::vector<Category>&& categories, uint8_t skullScene_,
|
||||
std::vector<Category>&& categories, const uint8_t skullScene_,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
|
||||
return Location(rc, quest_, RCTYPE_SKULL_TOKEN, area_, LocationType::GSToken, ACTOR_EN_SI, scene_, actorParams_,
|
||||
return {rc, quest_, RCTYPE_SKULL_TOKEN, area_, LocationType::GSToken, ACTOR_EN_SI, scene_, actorParams_,
|
||||
flag_, std::move(shortName_), std::move(spoilerName_), hintKey, RG_GOLD_SKULLTULA_TOKEN,
|
||||
std::move(categories), isVanillaCompletion_,
|
||||
SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_GOLD_SKULLTULA, skullScene_, flag_),
|
||||
collectionCheckGroup);
|
||||
SpoilerCollectionCheck(SPOILER_CHK_GOLD_SKULLTULA, skullScene_, flag_),
|
||||
collectionCheckGroup};
|
||||
}
|
||||
|
||||
Rando::Location Rando::Location::GrottoScrub(RandomizerCheck rc, RandomizerCheckQuest quest_,
|
||||
@ -205,9 +205,9 @@ Rando::Location Rando::Location::GrottoScrub(RandomizerCheck rc, RandomizerCheck
|
||||
std::vector<Category>&& categories, SpoilerCollectionCheck collectionCheck,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup,
|
||||
bool isVanillaCompletion_) {
|
||||
return Location(rc, quest_, checkType_, area_, LocationType::GrottoScrub, actorId_, scene_, actorParams_, flag_,
|
||||
return {rc, quest_, checkType_, area_, LocationType::GrottoScrub, actorId_, scene_, actorParams_, flag_,
|
||||
std::move(shortName_), std::move(spoilerName_), hintKey, vanillaItem, std::move(categories),
|
||||
isVanillaCompletion_, collectionCheck, collectionCheckGroup);
|
||||
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
|
||||
}
|
||||
|
||||
Rando::Location Rando::Location::Delayed(RandomizerCheck rc, RandomizerCheckQuest quest_,
|
||||
@ -217,9 +217,9 @@ Rando::Location Rando::Location::Delayed(RandomizerCheck rc, RandomizerCheckQues
|
||||
const RandomizerGet vanillaItem, std::vector<Category>&& categories,
|
||||
SpoilerCollectionCheck collectionCheck,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
|
||||
return Location(rc, quest_, checkType_, area_, LocationType::Delayed, actorId_, scene_, actorParams_, flag_,
|
||||
return {rc, quest_, checkType_, area_, LocationType::Delayed, actorId_, scene_, actorParams_, flag_,
|
||||
std::move(shortName_), std::move(spoilerName_), hintKey, vanillaItem, std::move(categories),
|
||||
isVanillaCompletion_, collectionCheck, collectionCheckGroup);
|
||||
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
|
||||
}
|
||||
|
||||
Rando::Location Rando::Location::Reward(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
|
||||
@ -229,9 +229,9 @@ Rando::Location Rando::Location::Reward(RandomizerCheck rc, RandomizerCheckQuest
|
||||
const RandomizerGet vanillaItem, std::vector<Category>&& categories,
|
||||
SpoilerCollectionCheck collectionCheck,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup, bool isVanillaCompletion_) {
|
||||
return Location(rc, quest_, checkType_, area_, LocationType::TempleReward, actorId_, scene_, actorParams_, flag_,
|
||||
return {rc, quest_, checkType_, area_, LocationType::TempleReward, actorId_, scene_, actorParams_, flag_,
|
||||
std::move(shortName_), std::move(spoilerName_), hintKey, vanillaItem, std::move(categories),
|
||||
isVanillaCompletion_, collectionCheck, collectionCheckGroup);
|
||||
isVanillaCompletion_, collectionCheck, collectionCheckGroup};
|
||||
}
|
||||
|
||||
Rando::Location Rando::Location::OtherHint(RandomizerCheck rc, RandomizerCheckQuest quest_,
|
||||
@ -239,15 +239,15 @@ Rando::Location Rando::Location::OtherHint(RandomizerCheck rc, RandomizerCheckQu
|
||||
uint8_t scene_,
|
||||
std::string&& shortName_, std::string&& spoilerName_,
|
||||
bool isVanillaCompletion_) {
|
||||
return Location(rc, quest_, checkType_, area_, LocationType::OtherHint, actorId_, scene_, 0x00, 0x00,
|
||||
std::move(shortName_), std::move(spoilerName_), RHT_NONE, RG_NONE, {}, isVanillaCompletion_);
|
||||
return {rc, quest_, checkType_, area_, LocationType::OtherHint, actorId_, scene_, 0x00, 0x00,
|
||||
std::move(shortName_), std::move(spoilerName_), RHT_NONE, RG_NONE, {}, isVanillaCompletion_};
|
||||
}
|
||||
|
||||
Rando::Location Rando::Location::HintStone(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
|
||||
uint8_t scene_, int32_t actorParams_, uint8_t flag_,
|
||||
std::string&& shortName_, std::string&& spoilerName_,
|
||||
std::vector<Category>&& categories, bool isVanillaCompletion_) {
|
||||
return Location(rc, quest_, RCTYPE_GOSSIP_STONE, area_, LocationType::Base, ACTOR_EN_GS, scene_, actorParams_, flag_,
|
||||
return {rc, quest_, RCTYPE_GOSSIP_STONE, area_, LocationType::Base, ACTOR_EN_GS, scene_, actorParams_, flag_,
|
||||
std::move(shortName_), std::move(spoilerName_), RHT_NONE, RG_NONE, std::move(categories),
|
||||
isVanillaCompletion_);
|
||||
isVanillaCompletion_};
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "3drando/spoiler_log.hpp"
|
||||
#include "3drando/category.hpp"
|
||||
#include "3drando/hints.hpp"
|
||||
|
||||
#include "z64item.h"
|
||||
#include "randomizerTypes.h"
|
||||
#include "z64actor_enum.h"
|
||||
#include "z64scene.h"
|
||||
@ -14,86 +14,85 @@
|
||||
namespace Rando {
|
||||
class SpoilerCollectionCheck {
|
||||
public:
|
||||
SpoilerCollectionCheckType type = SpoilerCollectionCheckType::SPOILER_CHK_NONE;
|
||||
SpoilerCollectionCheckType type = SPOILER_CHK_NONE;
|
||||
uint8_t scene = 0;
|
||||
uint8_t flag = 0;
|
||||
|
||||
SpoilerCollectionCheck() {
|
||||
}
|
||||
SpoilerCollectionCheck(SpoilerCollectionCheckType type_, uint8_t scene_, uint8_t flag_)
|
||||
SpoilerCollectionCheck() = default;
|
||||
SpoilerCollectionCheck(const SpoilerCollectionCheckType type_, const uint8_t scene_, const uint8_t flag_)
|
||||
: type(type_), scene(scene_), flag(flag_) {
|
||||
}
|
||||
|
||||
static auto None() {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_NONE, 0x00, 0x00);
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_NONE, 0x00, 0x00);
|
||||
}
|
||||
|
||||
static auto AlwaysCollected() {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_ALWAYS_COLLECTED, 0x00, 0x00);
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_ALWAYS_COLLECTED, 0x00, 0x00);
|
||||
}
|
||||
|
||||
static auto ItemGetInf(uint8_t slot) {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_ITEM_GET_INF, 0x00, slot);
|
||||
static auto ItemGetInf(const uint8_t slot) {
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_ITEM_GET_INF, 0x00, slot);
|
||||
}
|
||||
|
||||
static auto EventChkInf(uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_EVENT_CHK_INF, 0xFF, flag);
|
||||
static auto EventChkInf(const uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_EVENT_CHK_INF, 0xFF, flag);
|
||||
}
|
||||
|
||||
static auto InfTable(uint8_t offset, uint8_t bit) {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_INF_TABLE, offset, bit);
|
||||
static auto InfTable(const uint8_t offset, const uint8_t bit) {
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_INF_TABLE, offset, bit);
|
||||
}
|
||||
|
||||
static auto Collectable(uint8_t scene, uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_COLLECTABLE, scene, flag);
|
||||
static auto Collectable(const uint8_t scene, const uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_COLLECTABLE, scene, flag);
|
||||
}
|
||||
|
||||
static auto Chest(uint8_t scene, uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_CHEST, scene, flag);
|
||||
static auto Chest(const uint8_t scene, const uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_CHEST, scene, flag);
|
||||
}
|
||||
|
||||
static auto Cow(uint8_t scene, uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_COW, scene, flag);
|
||||
static auto Cow(const uint8_t scene, const uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_COW, scene, flag);
|
||||
}
|
||||
|
||||
static auto Fishing(uint8_t bit) {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_MINIGAME, 0x00, bit);
|
||||
static auto Fishing(const uint8_t bit) {
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_MINIGAME, 0x00, bit);
|
||||
}
|
||||
|
||||
static auto Scrub(uint8_t scene, uint8_t bit) {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_SCRUB, scene, bit);
|
||||
static auto Scrub(const uint8_t scene, const uint8_t bit) {
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_SCRUB, scene, bit);
|
||||
}
|
||||
|
||||
static auto GerudoToken() {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_GERUDO_MEMBERSHIP_CARD, 0x00, 0x00);
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_GERUDO_MEMBERSHIP_CARD, 0x00, 0x00);
|
||||
}
|
||||
|
||||
static auto BigPoePoints() {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_POE_POINTS, 0x00, 0x00);
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_POE_POINTS, 0x00, 0x00);
|
||||
}
|
||||
|
||||
static auto Gravedigger(uint8_t scene, uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_GRAVEDIGGER, scene, flag);
|
||||
static auto Gravedigger(const uint8_t scene, const uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_GRAVEDIGGER, scene, flag);
|
||||
}
|
||||
|
||||
static auto ShopItem(uint8_t scene, uint8_t itemSlot) {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_SHOP_ITEM, scene, itemSlot);
|
||||
static auto ShopItem(const uint8_t scene, const uint8_t itemSlot) {
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_SHOP_ITEM, scene, itemSlot);
|
||||
}
|
||||
|
||||
static auto MagicBeans(uint8_t scene, uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_MAGIC_BEANS, scene, flag);
|
||||
static auto MagicBeans(const uint8_t scene, const uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_MAGIC_BEANS, scene, flag);
|
||||
}
|
||||
|
||||
static auto MasterSword() {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_MASTER_SWORD, 0x00, 0x00);
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_MASTER_SWORD, 0x00, 0x00);
|
||||
}
|
||||
|
||||
static auto Merchant(int8_t scene, uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_MERCHANT, scene, flag);
|
||||
static auto Merchant(const int8_t scene, const uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_MERCHANT, scene, flag);
|
||||
}
|
||||
|
||||
static auto RandomizerInf(int8_t scene, uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SpoilerCollectionCheckType::SPOILER_CHK_RANDOMIZER_INF, scene, flag);
|
||||
static auto RandomizerInf(const int8_t scene, const uint8_t flag) {
|
||||
return SpoilerCollectionCheck(SPOILER_CHK_RANDOMIZER_INF, scene, flag);
|
||||
}
|
||||
};
|
||||
|
||||
@ -111,16 +110,19 @@ enum class LocationType {
|
||||
|
||||
class Location {
|
||||
public:
|
||||
Location() = default;
|
||||
Location(RandomizerCheck rc_, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
|
||||
RandomizerCheckArea area_, LocationType locationType_, ActorID actorId_, uint8_t scene_,
|
||||
int32_t actorParams_, uint8_t flag_, std::string shortName_, std::string spoilerName_,
|
||||
RandomizerHintTextKey hintKey_, RandomizerGet vanillaItem_, std::vector<Category> categories_,
|
||||
bool isVanillaCompletion_ = false, SpoilerCollectionCheck collectionCheck_ = SpoilerCollectionCheck(),
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup_ = SpoilerCollectionCheckGroup::GROUP_NO_GROUP)
|
||||
Location() : rc(RC_UNKNOWN_CHECK), quest(RCQUEST_BOTH), checkType(RCTYPE_STANDARD), area(RCAREA_INVALID),
|
||||
locationType(LocationType::Base), actorId(ACTOR_ID_MAX), scene(SCENE_ID_MAX), actorParams(0),
|
||||
flag(0), hintKey(RHT_NONE), vanillaItem(RG_NONE), isVanillaCompletion(false),
|
||||
collectionCheck(SpoilerCollectionCheck()), collectionCheckGroup(GROUP_NO_GROUP) {}
|
||||
Location(const RandomizerCheck rc_, const RandomizerCheckQuest quest_, const RandomizerCheckType checkType_,
|
||||
const RandomizerCheckArea area_, const LocationType locationType_, const ActorID actorId_, const uint8_t scene_,
|
||||
const int32_t actorParams_, const uint8_t flag_, std::string shortName_, std::string spoilerName_,
|
||||
const RandomizerHintTextKey hintKey_, const RandomizerGet vanillaItem_, std::vector<Category> categories_,
|
||||
const bool isVanillaCompletion_ = false, const SpoilerCollectionCheck collectionCheck_ = SpoilerCollectionCheck(),
|
||||
const SpoilerCollectionCheckGroup collectionCheckGroup_ = GROUP_NO_GROUP)
|
||||
: rc(rc_), quest(quest_), checkType(checkType_), area(area_), locationType(locationType_), actorId(actorId_),
|
||||
scene(scene_), actorParams(actorParams_), flag(flag_), shortName(std::move(shortName_)),
|
||||
spoilerName(spoilerName_), hintKey(hintKey_), vanillaItem(vanillaItem_), categories(std::move(categories_)),
|
||||
spoilerName(std::move(spoilerName_)), hintKey(hintKey_), vanillaItem(vanillaItem_), categories(std::move(categories_)),
|
||||
isVanillaCompletion(isVanillaCompletion_), collectionCheck(collectionCheck_),
|
||||
collectionCheckGroup(collectionCheckGroup_) {
|
||||
}
|
||||
@ -150,60 +152,60 @@ class Location {
|
||||
RandomizerGet GetVanillaItem() const;
|
||||
|
||||
static Location Base(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
|
||||
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene, int32_t actorParams_,
|
||||
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_,
|
||||
uint8_t flag_, std::string&& shortName_, std::string&& spoilerName_,
|
||||
const RandomizerHintTextKey hintKey, const RandomizerGet vanillaItem,
|
||||
RandomizerHintTextKey hintKey, RandomizerGet vanillaItem,
|
||||
std::vector<Category>&& categories,
|
||||
SpoilerCollectionCheck collectionCheck = SpoilerCollectionCheck(),
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = SpoilerCollectionCheckGroup::GROUP_NO_GROUP,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
|
||||
bool isVanillaCompletion_ = false);
|
||||
|
||||
static Location
|
||||
Chest(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
|
||||
ActorID actorId_, uint8_t scene, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
|
||||
std::string&& spoilerName_, const RandomizerHintTextKey hintKey, const RandomizerGet vanillaItem,
|
||||
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
|
||||
std::string&& spoilerName_, RandomizerHintTextKey hintKey, RandomizerGet vanillaItem,
|
||||
std::vector<Category>&& categories,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = SpoilerCollectionCheckGroup::GROUP_NO_GROUP,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
|
||||
bool isVanillaCompletion_ = false);
|
||||
|
||||
static Location
|
||||
Chest(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
|
||||
ActorID actorId_, uint8_t scene, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
|
||||
std::string&& spoilerName_, const RandomizerHintTextKey hintKey, const RandomizerGet vanillaItem,
|
||||
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
|
||||
std::string&& spoilerName_, RandomizerHintTextKey hintKey, RandomizerGet vanillaItem,
|
||||
std::vector<Category>&& categories, SpoilerCollectionCheck collectionCheck = SpoilerCollectionCheck(),
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = SpoilerCollectionCheckGroup::GROUP_NO_GROUP,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
|
||||
bool isVanillaCompletion_ = false);
|
||||
|
||||
static Location
|
||||
Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
|
||||
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene, int32_t actorParams_, uint8_t flag_,
|
||||
std::string&& shortName_, std::string&& spoilerName_, const RandomizerHintTextKey hintKey,
|
||||
const RandomizerGet vanillaItem, std::vector<Category>&& categories,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = SpoilerCollectionCheckGroup::GROUP_NO_GROUP,
|
||||
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
|
||||
std::string&& shortName_, std::string&& spoilerName_, RandomizerHintTextKey hintKey,
|
||||
RandomizerGet vanillaItem, std::vector<Category>&& categories,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
|
||||
bool isVanillaCompletion_ = false);
|
||||
|
||||
static Location
|
||||
Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
|
||||
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene, int32_t actorParams_, uint8_t flag_,
|
||||
std::string&& shortName_, std::string&& spoilerName_, const RandomizerHintTextKey hintKey,
|
||||
const RandomizerGet vanillaItem, std::vector<Category>&& categories, uint8_t collectFlag_,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = SpoilerCollectionCheckGroup::GROUP_NO_GROUP,
|
||||
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
|
||||
std::string&& shortName_, std::string&& spoilerName_, RandomizerHintTextKey hintKey,
|
||||
RandomizerGet vanillaItem, std::vector<Category>&& categories, uint8_t collectFlag_,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
|
||||
bool isVanillaCompletion_ = false);
|
||||
|
||||
static Location
|
||||
Collectable(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
|
||||
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene, int32_t actorParams_, uint8_t flag_,
|
||||
std::string&& shortName_, std::string&& spoilerName_, const RandomizerHintTextKey hintKey,
|
||||
const RandomizerGet vanillaItem, std::vector<Category>&& categories,
|
||||
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
|
||||
std::string&& shortName_, std::string&& spoilerName_, RandomizerHintTextKey hintKey,
|
||||
RandomizerGet vanillaItem, std::vector<Category>&& categories,
|
||||
SpoilerCollectionCheck collectionCheck = SpoilerCollectionCheck(),
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = SpoilerCollectionCheckGroup::GROUP_NO_GROUP,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
|
||||
bool isVanillaCompletion_ = false);
|
||||
|
||||
static Location
|
||||
GSToken(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
|
||||
uint8_t scene, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
|
||||
std::string&& spoilerName_, const RandomizerHintTextKey hintKey, std::vector<Category>&& categories,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = SpoilerCollectionCheckGroup::GROUP_NO_GROUP,
|
||||
uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
|
||||
std::string&& spoilerName_, RandomizerHintTextKey hintKey, std::vector<Category>&& categories,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
|
||||
bool isVanillaCompletion_ = true);
|
||||
|
||||
/// @brief For certain scenes, the sceneId and the "Scene" in spoiler collection check later used to check the
|
||||
@ -227,40 +229,40 @@ class Location {
|
||||
static Location
|
||||
GSToken(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_,
|
||||
uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
|
||||
std::string&& spoilerName_, const RandomizerHintTextKey hintKey, std::vector<Category>&& categories,
|
||||
std::string&& spoilerName_, RandomizerHintTextKey hintKey, std::vector<Category>&& categories,
|
||||
uint8_t skullScene_,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = SpoilerCollectionCheckGroup::GROUP_NO_GROUP,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
|
||||
bool isVanillaCompletion_ = true);
|
||||
|
||||
static Location
|
||||
GrottoScrub(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
|
||||
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene, int32_t actorParams_, uint8_t flag_,
|
||||
std::string&& shortName_, std::string&& spoilerName_, const RandomizerHintTextKey hintKey,
|
||||
const RandomizerGet vanillaItem, std::vector<Category>&& categories,
|
||||
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_,
|
||||
std::string&& shortName_, std::string&& spoilerName_, RandomizerHintTextKey hintKey,
|
||||
RandomizerGet vanillaItem, std::vector<Category>&& categories,
|
||||
SpoilerCollectionCheck collectionCheck = SpoilerCollectionCheck(),
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = SpoilerCollectionCheckGroup::GROUP_NO_GROUP,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
|
||||
bool isVanillaCompletion_ = false);
|
||||
|
||||
static Location
|
||||
Delayed(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
|
||||
ActorID actorId_, uint8_t scene, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
|
||||
std::string&& spoilerName_, const RandomizerHintTextKey hintKey, const RandomizerGet vanillaItem,
|
||||
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
|
||||
std::string&& spoilerName_, RandomizerHintTextKey hintKey, RandomizerGet vanillaItem,
|
||||
std::vector<Category>&& categories, SpoilerCollectionCheck collectionCheck = SpoilerCollectionCheck(),
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = SpoilerCollectionCheckGroup::GROUP_NO_GROUP,
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP,
|
||||
bool isVanillaCompletion_ = false);
|
||||
|
||||
static Location
|
||||
Reward(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_, RandomizerCheckArea area_,
|
||||
ActorID actorId_, uint8_t scene, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
|
||||
std::string&& spoilerName_, const RandomizerHintTextKey hintKey, const RandomizerGet vanillaItem,
|
||||
ActorID actorId_, uint8_t scene_, int32_t actorParams_, uint8_t flag_, std::string&& shortName_,
|
||||
std::string&& spoilerName_, RandomizerHintTextKey hintKey, RandomizerGet vanillaItem,
|
||||
std::vector<Category>&& categories, SpoilerCollectionCheck collectionCheck = SpoilerCollectionCheck(),
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = SpoilerCollectionCheckGroup::GROUP_NO_GROUP, bool isVanillaCompletion_ = false);
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup = GROUP_NO_GROUP, bool isVanillaCompletion_ = false);
|
||||
|
||||
static Location OtherHint(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckType checkType_,
|
||||
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene,
|
||||
RandomizerCheckArea area_, ActorID actorId_, uint8_t scene_,
|
||||
std::string&& shortName_, std::string&& spoilerName_, bool isVanillaCompletion_ = false);
|
||||
|
||||
static Location HintStone(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_, uint8_t scene,
|
||||
static Location HintStone(RandomizerCheck rc, RandomizerCheckQuest quest_, RandomizerCheckArea area_, uint8_t scene_,
|
||||
int32_t actorParams_, uint8_t flag_, std::string&& shortName_, std::string&& spoilerName_,
|
||||
std::vector<Category>&& categories, bool isVanillaCompletion_ = false);
|
||||
|
||||
@ -277,10 +279,10 @@ class Location {
|
||||
bool checked = false;
|
||||
std::string shortName;
|
||||
std::string spoilerName;
|
||||
RandomizerHintTextKey hintKey = RHT_NONE;
|
||||
RandomizerGet vanillaItem = RG_NONE;
|
||||
RandomizerHintTextKey hintKey;
|
||||
RandomizerGet vanillaItem;
|
||||
std::vector<Category> categories;
|
||||
bool isVanillaCompletion = false;
|
||||
bool isVanillaCompletion;
|
||||
SpoilerCollectionCheck collectionCheck;
|
||||
SpoilerCollectionCheckGroup collectionCheckGroup;
|
||||
bool isHintable = false;
|
||||
|
@ -1,26 +1,25 @@
|
||||
#include "option.h"
|
||||
|
||||
namespace Rando {
|
||||
Option Option::Bool(std::string name_, std::vector<std::string> options_, OptionCategory category_,
|
||||
uint8_t defaultOption_, bool defaultHidden_) {
|
||||
return Option(false, std::move(name_), std::move(options_), category_, defaultOption_, defaultHidden_);
|
||||
Option Option::Bool(std::string name_, std::vector<std::string> options_, const OptionCategory category_,
|
||||
const uint8_t defaultOption_, const bool defaultHidden_) {
|
||||
return {false, std::move(name_), std::move(options_), category_, defaultOption_, defaultHidden_};
|
||||
}
|
||||
|
||||
Option Option::U8(std::string name_, std::vector<std::string> options_, OptionCategory category_,
|
||||
uint8_t defaultOption_, bool defaultHidden_) {
|
||||
return Option(uint8_t(0), std::move(name_), std::move(options_), category_, defaultOption_, defaultHidden_);
|
||||
Option Option::U8(std::string name_, std::vector<std::string> options_, const OptionCategory category_,
|
||||
const uint8_t defaultOption_, const bool defaultHidden_) {
|
||||
return {static_cast<uint8_t>(0), std::move(name_), std::move(options_), category_, defaultOption_, defaultHidden_};
|
||||
}
|
||||
|
||||
Option Option::LogicTrick(std::string name_) {
|
||||
return Option(false, std::move(name_), { "Disabled", "Enabled" }, OptionCategory::Setting, 0, 0);
|
||||
return Option(false, std::move(name_), { "Disabled", "Enabled" }, OptionCategory::Setting, 0, false);
|
||||
}
|
||||
|
||||
Option::operator bool() const {
|
||||
if (std::holds_alternative<bool>(var)) {
|
||||
return Value<bool>();
|
||||
} else {
|
||||
return Value<uint8_t>() != 0;
|
||||
}
|
||||
return Value<uint8_t>() != 0;
|
||||
}
|
||||
|
||||
size_t Option::GetOptionCount() const {
|
||||
@ -56,7 +55,7 @@ void Option::RestoreDelayedOption() {
|
||||
SetVariable();
|
||||
}
|
||||
|
||||
void Option::SetSelectedIndex(size_t idx) {
|
||||
void Option::SetSelectedIndex(const size_t idx) {
|
||||
selectedOption = idx;
|
||||
if (selectedOption >= options.size()) {
|
||||
selectedOption = 0;
|
||||
@ -76,20 +75,20 @@ bool Option::IsHidden() const {
|
||||
return hidden;
|
||||
}
|
||||
|
||||
bool Option::IsCategory(OptionCategory category) const {
|
||||
bool Option::IsCategory(const OptionCategory category) const {
|
||||
return category == this->category;
|
||||
}
|
||||
|
||||
Option::Option(uint8_t var_, std::string name_, std::vector<std::string> options_, OptionCategory category_,
|
||||
uint8_t defaultOption_, bool defaultHidden_)
|
||||
Option::Option(uint8_t var_, std::string name_, std::vector<std::string> options_, const OptionCategory category_,
|
||||
const uint8_t defaultOption_, const bool defaultHidden_)
|
||||
: var(var_), name(std::move(name_)), options(std::move(options_)), category(category_),
|
||||
defaultOption(defaultOption_), defaultHidden(defaultHidden_) {
|
||||
selectedOption = defaultOption;
|
||||
hidden = defaultHidden;
|
||||
SetVariable();
|
||||
}
|
||||
Option::Option(bool var_, std::string name_, std::vector<std::string> options_, OptionCategory category_,
|
||||
uint8_t defaultOption_, bool defaultHidden_)
|
||||
Option::Option(bool var_, std::string name_, std::vector<std::string> options_, const OptionCategory category_,
|
||||
const uint8_t defaultOption_, const bool defaultHidden_)
|
||||
: var(var_), name(std::move(name_)), options(std::move(options_)), category(category_),
|
||||
defaultOption(defaultOption_), defaultHidden(defaultHidden_) {
|
||||
selectedOption = defaultOption;
|
||||
@ -97,25 +96,24 @@ Option::Option(bool var_, std::string name_, std::vector<std::string> options_,
|
||||
SetVariable();
|
||||
}
|
||||
|
||||
OptionGroup::OptionGroup(std::string name, std::vector<Option*> options, OptionGroupType groupType, bool printInSpoiler,
|
||||
OptionGroupType containsType)
|
||||
OptionGroup::OptionGroup(std::string name, std::vector<Option*> options, const OptionGroupType groupType,
|
||||
const bool printInSpoiler, const OptionGroupType containsType)
|
||||
: mName(std::move(name)), mOptions(std::move(options)), mGroupType(groupType), mPrintInSpoiler(printInSpoiler),
|
||||
mContainsType(containsType) {
|
||||
}
|
||||
|
||||
OptionGroup::OptionGroup(std::string name, std::vector<OptionGroup*> subGroups, OptionGroupType groupType,
|
||||
bool printInSpoiler, OptionGroupType containsType)
|
||||
OptionGroup::OptionGroup(std::string name, std::vector<OptionGroup*> subGroups, const OptionGroupType groupType,
|
||||
const bool printInSpoiler, const OptionGroupType containsType)
|
||||
: mName(std::move(name)), mSubGroups(std::move(subGroups)), mGroupType(groupType), mPrintInSpoiler(printInSpoiler),
|
||||
mContainsType(containsType) {
|
||||
}
|
||||
|
||||
OptionGroup OptionGroup::SubGroup(std::string name, std::vector<Option*> options, bool printInSpoiler) {
|
||||
return OptionGroup(std::move(name), std::move(options), OptionGroupType::SUBGROUP, printInSpoiler);
|
||||
OptionGroup OptionGroup::SubGroup(std::string name, std::vector<Option*> options, const bool printInSpoiler) {
|
||||
return {std::move(name), std::move(options), OptionGroupType::SUBGROUP, printInSpoiler};
|
||||
}
|
||||
|
||||
OptionGroup OptionGroup::SubGroup(std::string name, std::vector<OptionGroup*> subGroups, bool printInSpoiler) {
|
||||
return OptionGroup(std::move(name), std::move(subGroups), OptionGroupType::SUBGROUP, printInSpoiler,
|
||||
OptionGroupType::SUBGROUP);
|
||||
OptionGroup OptionGroup::SubGroup(std::string name, std::vector<OptionGroup*> subGroups, const bool printInSpoiler) {
|
||||
return {std::move(name), std::move(subGroups), OptionGroupType::SUBGROUP, printInSpoiler, OptionGroupType::SUBGROUP};
|
||||
}
|
||||
|
||||
const std::string& OptionGroup::GetName() const {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <variant>
|
||||
@ -19,8 +19,8 @@ class Option {
|
||||
OptionCategory category_ = OptionCategory::Setting, uint8_t defaultOption_ = 0,
|
||||
bool defaultHidden_ = false);
|
||||
static Option U8(std::string name_, std::vector<std::string> options_,
|
||||
OptionCategory category_ = OptionCategory::Setting, uint8_t defaultOption = 0,
|
||||
bool defaultHidden = false);
|
||||
OptionCategory category_ = OptionCategory::Setting, uint8_t defaultOption_ = 0,
|
||||
bool defaultHidden_ = false);
|
||||
static Option LogicTrick(std::string name_);
|
||||
|
||||
template <typename T> T Value() const {
|
||||
@ -65,7 +65,7 @@ class Option {
|
||||
uint8_t selectedOption = 0;
|
||||
uint8_t delayedOption = 0;
|
||||
bool hidden = false;
|
||||
OptionCategory category;
|
||||
OptionCategory category = OptionCategory::Setting;
|
||||
uint8_t defaultOption = false;
|
||||
bool defaultHidden = false;
|
||||
};
|
||||
@ -94,7 +94,7 @@ class OptionGroup {
|
||||
std::vector<Option*> mOptions;
|
||||
std::vector<OptionGroup*> mSubGroups;
|
||||
OptionGroupType mGroupType = OptionGroupType::DEFAULT;
|
||||
bool mPrintInSpoiler;
|
||||
bool mPrintInSpoiler = true;
|
||||
OptionGroupType mContainsType = OptionGroupType::DEFAULT;
|
||||
};
|
||||
} // namespace Rando
|
@ -5,25 +5,27 @@
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace Rando {
|
||||
std::vector<std::string> NumOpts(int min, int max, int step = 1, std::string textBefore = {}, std::string textAfter = {}) {
|
||||
std::vector<std::string> NumOpts(const int min, const int max, const int step = 1, const std::string& textBefore = {}, const std::string& textAfter = {}) {
|
||||
std::vector<std::string> options;
|
||||
options.reserve((max - min) / step + 1);
|
||||
for (int i = min; i <= max; i += step) {
|
||||
options.push_back(textBefore + std::to_string(i) + textAfter);
|
||||
options.push_back(textBefore + std::to_string(i) += textAfter);
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
std::vector<std::string> MultiVecOpts(std::vector<std::vector<std::string>> optionsVector) {
|
||||
std::vector<std::string> MultiVecOpts(const std::vector<std::vector<std::string>>& optionsVector) {
|
||||
uint32_t totalSize = 0;
|
||||
for (auto vector: optionsVector) {
|
||||
for (const auto& vector: optionsVector) {
|
||||
totalSize += vector.size();
|
||||
}
|
||||
std::vector<std::string> options;
|
||||
options.reserve(totalSize);
|
||||
for (auto vector : optionsVector) {
|
||||
for (auto op : vector) {
|
||||
for (const auto& vector : optionsVector) {
|
||||
for (const auto& op : vector) {
|
||||
options.push_back(op);
|
||||
}
|
||||
}
|
||||
@ -708,7 +710,7 @@ void Settings::CreateOptions() {
|
||||
// TODO: For some reason this group and only this group is an ambiguous constructor call, despite
|
||||
// the initializer list only having Option* in it. For now explictly declare and initialize
|
||||
// a vector of Option* and construct the group with that.
|
||||
std::vector<Option*> itemPoolOptions = {&mOptions[RSK_ITEM_POOL], &mOptions[RSK_ICE_TRAPS]};
|
||||
const std::vector<Option*> itemPoolOptions = {&mOptions[RSK_ITEM_POOL], &mOptions[RSK_ICE_TRAPS]};
|
||||
mOptionGroups[RSG_ITEM_POOL] = OptionGroup("Item Pool Settings", itemPoolOptions);
|
||||
// TODO: Progressive Goron Sword, Remove Double Defense
|
||||
mOptionGroups[RSG_EXCLUDES_KOKIRI_FOREST] = OptionGroup::SubGroup("Kokiri Forest", mExcludeLocationsOptionsGroups[GROUP_KOKIRI_FOREST], false);
|
||||
@ -928,11 +930,11 @@ void Settings::CreateOptions() {
|
||||
};
|
||||
}
|
||||
|
||||
Option& Settings::Setting(RandomizerSettingKey key) {
|
||||
Option& Settings::Setting(const RandomizerSettingKey key) {
|
||||
return mOptions[key];
|
||||
}
|
||||
|
||||
Option& Settings::GetTrickOption(RandomizerTrick key) {
|
||||
Option& Settings::GetTrickOption(const RandomizerTrick key) {
|
||||
return mTrickOptions[key];
|
||||
}
|
||||
|
||||
@ -940,7 +942,7 @@ const std::array<Option, RSK_MAX>& Settings::GetAllOptions() const {
|
||||
return mOptions;
|
||||
}
|
||||
|
||||
std::vector<Option *>& Settings::GetExcludeOptionsForGroup(SpoilerCollectionCheckGroup group) {
|
||||
std::vector<Option *>& Settings::GetExcludeOptionsForGroup(const SpoilerCollectionCheckGroup group) {
|
||||
return mExcludeLocationsOptionsGroups[group];
|
||||
}
|
||||
|
||||
@ -961,7 +963,7 @@ std::string Settings::GetHash() const {
|
||||
}
|
||||
|
||||
void Settings::SetHash(std::string hash) {
|
||||
mHash = hash;
|
||||
mHash = std::move(hash);
|
||||
}
|
||||
|
||||
const std::string& Settings::GetSeedString() const {
|
||||
@ -969,14 +971,14 @@ const std::string& Settings::GetSeedString() const {
|
||||
}
|
||||
|
||||
void Settings::SetSeedString(std::string seedString) {
|
||||
mSeedString = seedString;
|
||||
mSeedString = std::move(seedString);
|
||||
}
|
||||
|
||||
const uint32_t Settings::GetSeed() const {
|
||||
uint32_t Settings::GetSeed() const {
|
||||
return mFinalSeed;
|
||||
}
|
||||
|
||||
void Settings::SetSeed(uint32_t seed) {
|
||||
void Settings::SetSeed(const uint32_t seed) {
|
||||
mFinalSeed = seed;
|
||||
}
|
||||
|
||||
@ -984,12 +986,12 @@ const std::array<OptionGroup, RSG_MAX>& Settings::GetOptionGroups() {
|
||||
return mOptionGroups;
|
||||
}
|
||||
|
||||
const OptionGroup& Settings::GetOptionGroup(RandomizerSettingGroupKey key) {
|
||||
const OptionGroup& Settings::GetOptionGroup(const RandomizerSettingGroupKey key) {
|
||||
return mOptionGroups[key];
|
||||
}
|
||||
|
||||
void Settings::UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t> cvarSettings, std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks) {
|
||||
auto ctx = Rando::Context::GetInstance();
|
||||
void Settings::UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t> cvarSettings, const std::set<RandomizerCheck>& excludedLocations, const std::set<RandomizerTrick>& enabledTricks) {
|
||||
const auto ctx = Context::GetInstance();
|
||||
if (!ctx->IsSpoilerLoaded()) {
|
||||
// If we've loaded a spoiler file, the settings have already been populated, so we
|
||||
// only need to do things like resolve the starting age or determine MQ dungeons.
|
||||
@ -1004,6 +1006,9 @@ void Settings::UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t>
|
||||
case RO_LOGIC_NO_LOGIC:
|
||||
mOptions[RSK_LOGIC_RULES].SetSelectedIndex(RO_LOGIC_NO_LOGIC);
|
||||
break;
|
||||
default:
|
||||
mOptions[RSK_LOGIC_RULES].SetSelectedIndex(RO_LOGIC_GLITCHLESS);
|
||||
break;
|
||||
}
|
||||
|
||||
// if we skip child zelda, we start with zelda's letter, and malon starts
|
||||
@ -1031,16 +1036,15 @@ void Settings::UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t>
|
||||
// the ImGui slider can't go down to 0 (the first index aka 1 big poe).
|
||||
mOptions[RSK_BIG_POE_COUNT].SetSelectedIndex(cvarSettings[RSK_BIG_POE_COUNT] - 1);
|
||||
ctx->AddExcludedOptions();
|
||||
for (auto locationKey : ctx->everyPossibleLocation) {
|
||||
auto location = ctx->GetItemLocation(locationKey);
|
||||
if (excludedLocations.count(location->GetRandomizerCheck())) {
|
||||
for (const auto locationKey : ctx->everyPossibleLocation) {
|
||||
if (const auto location = ctx->GetItemLocation(locationKey); excludedLocations.contains(location->GetRandomizerCheck())) {
|
||||
location->GetExcludedOption()->SetSelectedIndex(1);
|
||||
} else {
|
||||
location->GetExcludedOption()->SetSelectedIndex(0);
|
||||
}
|
||||
}
|
||||
// Tricks
|
||||
for (auto randomizerTrick : enabledTricks) {
|
||||
for (const auto randomizerTrick : enabledTricks) {
|
||||
mTrickOptions[randomizerTrick].SetSelectedIndex(1);
|
||||
}
|
||||
}
|
||||
@ -1049,8 +1053,8 @@ void Settings::UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t>
|
||||
// ShuffleChestMinigame.SetSelectedIndex(cvarSettings[RSK_SHUFFLE_CHEST_MINIGAME]);
|
||||
//TODO: RandomizeAllSettings(true) when implementing the ability to randomize the options themselves.
|
||||
std::array<DungeonInfo*, 12> dungeons = ctx->GetDungeons()->GetDungeonList();
|
||||
std::array<bool, 12> dungeonModesKnown;
|
||||
std::vector<Option*> dungeonOptions = {
|
||||
std::array<bool, 12> dungeonModesKnown{};
|
||||
const std::vector<Option*> dungeonOptions = {
|
||||
&mOptions[RSK_MQ_DEKU_TREE],
|
||||
&mOptions[RSK_MQ_DODONGOS_CAVERN],
|
||||
&mOptions[RSK_MQ_JABU_JABU],
|
||||
@ -1064,13 +1068,13 @@ void Settings::UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t>
|
||||
&mOptions[RSK_MQ_GTG],
|
||||
&mOptions[RSK_MQ_GANONS_CASTLE]
|
||||
};
|
||||
uint8_t mqSet = mOptions[RSK_MQ_DUNGEON_COUNT].Value<uint8_t>();
|
||||
auto mqSet = mOptions[RSK_MQ_DUNGEON_COUNT].Value<uint8_t>();
|
||||
if (mOptions[RSK_MQ_DUNGEON_RANDOM].Is(RO_MQ_DUNGEONS_SELECTION)) {
|
||||
mqSet = 0;
|
||||
}
|
||||
uint8_t dungeonCount = 0;
|
||||
std::vector<uint8_t> randMQOption = {};
|
||||
if (mOptions[RSK_MQ_DUNGEON_SET]) {
|
||||
uint8_t dungeonCount = 0;
|
||||
for (size_t i = 0; i < dungeons.size(); i++) {
|
||||
dungeons[i]->ClearMQ();
|
||||
dungeonModesKnown[i] = true;
|
||||
@ -1083,11 +1087,13 @@ void Settings::UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t>
|
||||
randMQOption.push_back(i);
|
||||
dungeonModesKnown[i] = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
Shuffle(randMQOption);
|
||||
if (mOptions[RSK_MQ_DUNGEON_RANDOM].Is(RO_MQ_DUNGEONS_RANDOM_NUMBER)) {
|
||||
mqSet = dungeonCount + Random(0, randMQOption.size() + 1);
|
||||
mqSet = dungeonCount + Random(0, static_cast<int>(randMQOption.size()) + 1);
|
||||
}
|
||||
for (uint8_t i = 0; dungeonCount < mqSet; i++) {
|
||||
if (i > randMQOption.size()) {
|
||||
@ -1101,12 +1107,12 @@ void Settings::UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t>
|
||||
}
|
||||
} else {
|
||||
Shuffle(dungeons);
|
||||
for (size_t i = 0; i < dungeons.size(); i++) {
|
||||
dungeons[i]->ClearMQ();
|
||||
for (const auto dungeon : dungeons) {
|
||||
dungeon->ClearMQ();
|
||||
}
|
||||
bool allDungeonModesKnown = mqSet == 0 || mqSet == dungeons.size();
|
||||
for (uint8_t i = 0; i < sizeof(dungeonModesKnown); ++i) {
|
||||
dungeonModesKnown[i] = allDungeonModesKnown;
|
||||
const bool allDungeonModesKnown = mqSet == 0 || mqSet == dungeons.size();
|
||||
for (bool & i : dungeonModesKnown) {
|
||||
i = allDungeonModesKnown;
|
||||
}
|
||||
if (mOptions[RSK_MQ_DUNGEON_RANDOM].Is(RO_MQ_DUNGEONS_RANDOM_NUMBER)) {
|
||||
mqSet = Random(0, 13);
|
||||
@ -1117,11 +1123,11 @@ void Settings::UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t>
|
||||
}
|
||||
|
||||
// Set key ring for each dungeon
|
||||
for (size_t i = 0; i < dungeons.size(); i++) {
|
||||
dungeons[i]->ClearKeyRing();
|
||||
for (const auto dungeon : dungeons) {
|
||||
dungeon->ClearKeyRing();
|
||||
}
|
||||
|
||||
std::vector<Option*> keyRingOptions = {
|
||||
const std::vector<Option*> keyRingOptions = {
|
||||
&mOptions[RSK_KEYRINGS_FOREST_TEMPLE],
|
||||
&mOptions[RSK_KEYRINGS_FIRE_TEMPLE],
|
||||
&mOptions[RSK_KEYRINGS_WATER_TEMPLE],
|
||||
@ -1139,7 +1145,7 @@ void Settings::UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t>
|
||||
if (mOptions[RSK_GERUDO_FORTRESS].Is(RO_GF_NORMAL) && mOptions[RSK_GERUDO_KEYS].IsNot(RO_GERUDO_KEYS_VANILLA)) {
|
||||
keyrings.push_back(&mOptions[RSK_KEYRINGS_GERUDO_FORTRESS]);
|
||||
}
|
||||
int keyRingCount = mOptions[RSK_KEYRINGS].Is(RO_KEYRINGS_COUNT) ? mOptions[RSK_KEYRINGS_RANDOM_COUNT].Value<uint8_t>() : Random(0, keyrings.size());
|
||||
const uint32_t keyRingCount = mOptions[RSK_KEYRINGS].Is(RO_KEYRINGS_COUNT) ? mOptions[RSK_KEYRINGS_RANDOM_COUNT].Value<uint8_t>() : Random(0, static_cast<int>(keyrings.size()));
|
||||
Shuffle(keyrings);
|
||||
for (size_t i = 0; i < keyRingCount; i++) {
|
||||
keyrings[i]->SetSelectedIndex(RO_GENERIC_ON);
|
||||
@ -1172,11 +1178,11 @@ void Settings::UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t>
|
||||
}
|
||||
auto trials = ctx->GetTrials()->GetTrialList();
|
||||
Shuffle(trials);
|
||||
for (auto& trial : trials) {
|
||||
for (const auto trial : trials) {
|
||||
trial->SetAsSkipped();
|
||||
}
|
||||
if (mOptions[RSK_GANONS_TRIALS].Is(RO_GANONS_TRIALS_RANDOM_NUMBER)) {
|
||||
mOptions[RSK_TRIAL_COUNT].SetSelectedIndex(Random(0, mOptions[RSK_TRIAL_COUNT].GetOptionCount()));
|
||||
mOptions[RSK_TRIAL_COUNT].SetSelectedIndex(Random(0, static_cast<int>(mOptions[RSK_TRIAL_COUNT].GetOptionCount())));
|
||||
}
|
||||
for (uint8_t i = 0; i < mOptions[RSK_TRIAL_COUNT].Value<uint8_t>(); i++) {
|
||||
trials[i]->SetAsRequired();
|
||||
@ -1190,8 +1196,7 @@ void Settings::UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t>
|
||||
}
|
||||
|
||||
if (mOptions[RSK_STARTING_AGE].Is(RO_AGE_RANDOM)) {
|
||||
int choice = Random(0, 2);
|
||||
if (choice == 0) {
|
||||
if (const uint32_t choice = Random(0, 2); choice == 0) {
|
||||
mResolvedStartingAge = RO_AGE_CHILD;
|
||||
} else {
|
||||
mResolvedStartingAge = RO_AGE_ADULT;
|
||||
@ -1226,19 +1231,18 @@ void Settings::UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t>
|
||||
}
|
||||
}
|
||||
void Settings::ParseJson(nlohmann::json spoilerFileJson) {
|
||||
mSeedString = spoilerFileJson["seed"].template get<std::string>();
|
||||
mSeedString = spoilerFileJson["seed"].get<std::string>();
|
||||
mFinalSeed = spoilerFileJson["finalSeed"].get<uint32_t>();
|
||||
nlohmann::json settingsJson = spoilerFileJson["settings"];
|
||||
for (auto it = settingsJson.begin(); it != settingsJson.end(); ++it) {
|
||||
// todo load into cvars for UI
|
||||
|
||||
if (mSpoilerfileSettingNameToEnum.contains(it.key())) {
|
||||
std::string numericValueString;
|
||||
if (mSpoilerfileSettingNameToEnum.count(it.key())) {
|
||||
RandomizerSettingKey index = mSpoilerfileSettingNameToEnum[it.key()];
|
||||
// this is annoying but the same strings are used in different orders
|
||||
// and i don't want the spoilerfile to just have numbers instead of
|
||||
// human readable settings values so it'll have to do for now
|
||||
switch (index) {
|
||||
switch (const RandomizerSettingKey index = mSpoilerfileSettingNameToEnum[it.key()]) {
|
||||
case RSK_LOGIC_RULES:
|
||||
if (it.value() == "Glitchless") {
|
||||
mOptions[index].SetSelectedIndex(RO_LOGIC_GLITCHLESS);
|
||||
@ -1791,18 +1795,18 @@ void Settings::ParseJson(nlohmann::json spoilerFileJson) {
|
||||
}
|
||||
|
||||
nlohmann::json jsonExcludedLocations = spoilerFileJson["excludedLocations"];
|
||||
auto ctx = Rando::Context::GetInstance();
|
||||
const auto ctx = Context::GetInstance();
|
||||
|
||||
ctx->AddExcludedOptions();
|
||||
for (auto it = jsonExcludedLocations.begin(); it != jsonExcludedLocations.end(); it++) {
|
||||
RandomizerCheck rc = ctx->mSpoilerfileCheckNameToEnum[it.value()];
|
||||
for (auto it = jsonExcludedLocations.begin(); it != jsonExcludedLocations.end(); ++it) {
|
||||
const RandomizerCheck rc = ctx->mSpoilerfileCheckNameToEnum[it.value()];
|
||||
ctx->GetItemLocation(rc)->GetExcludedOption()->SetSelectedIndex(RO_GENERIC_ON);
|
||||
}
|
||||
|
||||
nlohmann::json enabledTricksJson = spoilerFileJson["enabledTricks"];
|
||||
for (auto it = enabledTricksJson.begin(); it != enabledTricksJson.end(); it++) {
|
||||
for (auto it = enabledTricksJson.begin(); it != enabledTricksJson.end(); ++it) {
|
||||
std::string numericValueString = it.value();
|
||||
RandomizerTrick rt = (RandomizerTrick)std::stoi(numericValueString);
|
||||
const auto rt = static_cast<RandomizerTrick>(std::stoi(numericValueString));
|
||||
GetTrickOption(rt).SetSelectedIndex(RO_GENERIC_ON);
|
||||
}
|
||||
}
|
||||
|
@ -24,26 +24,26 @@ class Settings {
|
||||
std::string GetHash() const;
|
||||
const std::string& GetSeedString() const;
|
||||
void SetSeedString(std::string seedString);
|
||||
const uint32_t GetSeed() const;
|
||||
uint32_t GetSeed() const;
|
||||
void SetSeed(uint32_t seed);
|
||||
void SetHash(std::string hash);
|
||||
const std::array<OptionGroup, RSG_MAX>& GetOptionGroups();
|
||||
const OptionGroup& GetOptionGroup(RandomizerSettingGroupKey key);
|
||||
void UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t> cvarSettings,
|
||||
std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks);
|
||||
const std::set<RandomizerCheck>& excludedLocations, const std::set<RandomizerTrick>& enabledTricks);
|
||||
void ParseJson(nlohmann::json spoilerFileJson);
|
||||
std::vector<Option*> VanillaLogicDefaults = {};
|
||||
|
||||
private:
|
||||
std::array<Option, RSK_MAX> mOptions = {};
|
||||
std::array<OptionGroup, RSG_MAX> mOptionGroups = {};
|
||||
std::array<Option, RT_MAX> mTrickOptions;
|
||||
std::vector<std::vector<Option*>> mExcludeLocationsOptionsGroups;
|
||||
std::array<Option, RT_MAX> mTrickOptions = {};
|
||||
std::vector<std::vector<Option*>> mExcludeLocationsOptionsGroups = {};
|
||||
std::unordered_map<std::string, RandomizerSettingKey> mSpoilerfileSettingNameToEnum;
|
||||
RandoOptionStartingAge mResolvedStartingAge;
|
||||
RandoOptionLACSCondition mLACSCondition;
|
||||
RandoOptionStartingAge mResolvedStartingAge = RO_AGE_CHILD;
|
||||
RandoOptionLACSCondition mLACSCondition = RO_LACS_VANILLA;
|
||||
std::string mHash;
|
||||
std::string mSeedString;
|
||||
uint32_t mFinalSeed;
|
||||
uint32_t mFinalSeed = 0;
|
||||
};
|
||||
} // namespace Rando
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "trial.h"
|
||||
|
||||
namespace Rando {
|
||||
TrialInfo::TrialInfo(const Text name_) : name(std::move(name_)) {}
|
||||
TrialInfo::TrialInfo(Text name_) : name(std::move(name_)) {}
|
||||
TrialInfo::TrialInfo() = default;
|
||||
TrialInfo::~TrialInfo() = default;
|
||||
|
||||
@ -35,7 +35,7 @@ Trials::Trials() {
|
||||
}
|
||||
Trials::~Trials() = default;
|
||||
|
||||
TrialInfo* Trials::GetTrial(TrialKey key) {
|
||||
TrialInfo* Trials::GetTrial(const TrialKey key) {
|
||||
return &mTrials[key];
|
||||
}
|
||||
|
||||
@ -52,21 +52,20 @@ void Trials::RequireAll() {
|
||||
}
|
||||
|
||||
std::array<TrialInfo*, 6> Trials::GetTrialList() {
|
||||
std::array<TrialInfo*, 6> trialList;
|
||||
std::array<TrialInfo*, 6> trialList{};
|
||||
for (size_t i = 0; i < mTrials.size(); i++) {
|
||||
trialList[i] = &mTrials[i];
|
||||
}
|
||||
return trialList;
|
||||
}
|
||||
|
||||
size_t Trials::GetTrialListSize() {
|
||||
size_t Trials::GetTrialListSize() const {
|
||||
return mTrials.size();
|
||||
}
|
||||
void Trials::ParseJson(nlohmann::json spoilerFileJson) {
|
||||
try {
|
||||
nlohmann::json trialsJson = spoilerFileJson["requiredTrials"];
|
||||
for (auto it = trialsJson.begin(); it != trialsJson.end(); it++) {
|
||||
std::string trialName = it.value().template get<std::string>();
|
||||
for (auto it = trialsJson.begin(); it != trialsJson.end(); ++it) {
|
||||
std::string trialName = it.value().get<std::string>();
|
||||
for (auto& trial : mTrials) {
|
||||
if (trial.GetName() == trialName) {
|
||||
trial.SetAsRequired();
|
||||
@ -75,8 +74,5 @@ void Trials::ParseJson(nlohmann::json spoilerFileJson) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
} // namespace Rando
|
@ -8,7 +8,7 @@
|
||||
namespace Rando {
|
||||
class TrialInfo {
|
||||
public:
|
||||
TrialInfo(const Text name_);
|
||||
explicit TrialInfo(Text name_);
|
||||
TrialInfo();
|
||||
~TrialInfo();
|
||||
|
||||
@ -39,7 +39,7 @@ class Trials {
|
||||
void SkipAll();
|
||||
void RequireAll();
|
||||
std::array<TrialInfo*, 6> GetTrialList();
|
||||
size_t GetTrialListSize();
|
||||
size_t GetTrialListSize() const;
|
||||
void ParseJson(nlohmann::json spoilerFileJson);
|
||||
private:
|
||||
std::array<TrialInfo, 6> mTrials;
|
||||
|
Loading…
Reference in New Issue
Block a user