|
|
|
|
@@ -6,7 +6,6 @@
|
|
|
|
|
#include "../entrance.h"
|
|
|
|
|
#include "random.hpp"
|
|
|
|
|
#include "../trial.h"
|
|
|
|
|
#include "tinyxml2.h"
|
|
|
|
|
#include "utils.hpp"
|
|
|
|
|
#include "hints.hpp"
|
|
|
|
|
#include "pool_functions.hpp"
|
|
|
|
|
@@ -56,9 +55,6 @@ void GenerateHash() {
|
|
|
|
|
int number = std::stoi(hash.substr(j, 2));
|
|
|
|
|
ctx->hashIconIndexes[i] = number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Clear out spoiler log data here, in case we aren't going to re-generate it
|
|
|
|
|
// spoilerData = { 0 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static auto GetGeneralPath() {
|
|
|
|
|
@@ -79,7 +75,6 @@ static void WriteLocation(
|
|
|
|
|
Rando::Location* location = Rando::StaticData::GetLocation(locationKey);
|
|
|
|
|
Rando::ItemLocation* itemLocation = Rando::Context::GetInstance()->GetItemLocation(locationKey);
|
|
|
|
|
|
|
|
|
|
// auto node = parentNode->InsertNewChildElement("location");
|
|
|
|
|
switch (gSaveContext.language) {
|
|
|
|
|
case LANGUAGE_ENG:
|
|
|
|
|
default:
|
|
|
|
|
@@ -89,35 +84,6 @@ static void WriteLocation(
|
|
|
|
|
jsonData["playthrough"][sphere][location->GetName()] = itemLocation->GetPlacedItemName().GetFrench();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// node->SetAttribute("name", location->GetName().c_str());
|
|
|
|
|
// node->SetText(location->GetPlacedItemName().GetEnglish().c_str());
|
|
|
|
|
|
|
|
|
|
// if (withPadding) {
|
|
|
|
|
// constexpr int16_t LONGEST_NAME = 56; // The longest name of a location.
|
|
|
|
|
// constexpr int16_t PRICE_ATTRIBUTE = 12; // Length of a 3-digit price attribute.
|
|
|
|
|
|
|
|
|
|
// // Insert a padding so we get a kind of table in the XML document.
|
|
|
|
|
// int16_t requiredPadding = LONGEST_NAME - location->GetName().length();
|
|
|
|
|
// if (location->GetRCType() == RCTYPE_SHOP) {
|
|
|
|
|
// // Shop items have short location names, but come with an additional price attribute.
|
|
|
|
|
// requiredPadding -= PRICE_ATTRIBUTE;
|
|
|
|
|
// }
|
|
|
|
|
// if (requiredPadding >= 0) {
|
|
|
|
|
// std::string padding(requiredPadding, ' ');
|
|
|
|
|
// node->SetAttribute("_", padding.c_str());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if (location->GetRCType() == RCTYPE_SHOP) {
|
|
|
|
|
// char price[6];
|
|
|
|
|
// sprintf(price, "%03d", location->GetPrice());
|
|
|
|
|
// node->SetAttribute("price", price);
|
|
|
|
|
// }
|
|
|
|
|
// if (!location->IsAddedToPool()) {
|
|
|
|
|
// #ifdef ENABLE_DEBUG
|
|
|
|
|
// node->SetAttribute("not-added", true);
|
|
|
|
|
// #endif
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Writes a shuffled entrance to the specified node
|
|
|
|
|
@@ -186,7 +152,6 @@ static void WriteSettings() {
|
|
|
|
|
|
|
|
|
|
// Writes the excluded locations to the spoiler log, if there are any.
|
|
|
|
|
static void WriteExcludedLocations() {
|
|
|
|
|
// auto parentNode = spoilerLog.NewElement("excluded-locations");
|
|
|
|
|
auto ctx = Rando::Context::GetInstance();
|
|
|
|
|
|
|
|
|
|
for (size_t i = 1; i < ctx->GetSettings()->GetExcludeLocationsOptions().size(); i++) {
|
|
|
|
|
@@ -197,15 +162,8 @@ static void WriteExcludedLocations() {
|
|
|
|
|
|
|
|
|
|
jsonData["excludedLocations"].push_back(RemoveLineBreaks(location->GetName()));
|
|
|
|
|
|
|
|
|
|
// tinyxml2::XMLElement* node = spoilerLog.NewElement("location");
|
|
|
|
|
// node->SetAttribute("name", RemoveLineBreaks(location->GetName()).c_str());
|
|
|
|
|
// parentNode->InsertEndChild(node);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (!parentNode->NoChildren()) {
|
|
|
|
|
// spoilerLog.RootElement()->InsertEndChild(parentNode);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Writes the starting inventory to the spoiler log, if there is any.
|
|
|
|
|
@@ -221,56 +179,20 @@ static void WriteStartingInventory() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Writes the enabled tricks to the spoiler log, if there are any.
|
|
|
|
|
static void WriteEnabledTricks(tinyxml2::XMLDocument& spoilerLog) {
|
|
|
|
|
//auto parentNode = spoilerLog.NewElement("enabled-tricks");
|
|
|
|
|
//Writes the enabled tricks to the spoiler log, if there are any.
|
|
|
|
|
static void WriteEnabledTricks() {
|
|
|
|
|
auto ctx = Rando::Context::GetInstance();
|
|
|
|
|
|
|
|
|
|
for (const auto& setting : ctx->GetSettings()->GetOptionGroup(RSG_TRICKS).GetOptions()) {
|
|
|
|
|
if (setting->GetContextOptionIndex() != RO_GENERIC_ON/* || !setting->IsCategory(OptionCategory::Setting)*/) {
|
|
|
|
|
if (setting->GetContextOptionIndex() != RO_GENERIC_ON) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
jsonData["enabledTricks"].push_back(RemoveLineBreaks(setting->GetName()).c_str());
|
|
|
|
|
//auto node = parentNode->InsertNewChildElement("trick");
|
|
|
|
|
//node->SetAttribute("name", RemoveLineBreaks(setting->GetName()).c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (!parentNode->NoChildren()) {
|
|
|
|
|
// spoilerLog.RootElement()->InsertEndChild(parentNode);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Writes the enabled glitches to the spoiler log, if there are any.
|
|
|
|
|
// TODO: Implement Glitches
|
|
|
|
|
// static void WriteEnabledGlitches(tinyxml2::XMLDocument& spoilerLog) {
|
|
|
|
|
// auto parentNode = spoilerLog.NewElement("enabled-glitches");
|
|
|
|
|
|
|
|
|
|
// for (const auto& setting : Settings::glitchCategories) {
|
|
|
|
|
// if (setting->Value<uint8_t>() == 0) {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// auto node = parentNode->InsertNewChildElement("glitch-category");
|
|
|
|
|
// node->SetAttribute("name", setting->GetName().c_str());
|
|
|
|
|
// node->SetText(setting->GetSelectedOptionText().c_str());
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// for (const auto& setting : Settings::miscGlitches) {
|
|
|
|
|
// if (!setting->Value<bool>()) {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// auto node = parentNode->InsertNewChildElement("misc-glitch");
|
|
|
|
|
// node->SetAttribute("name", RemoveLineBreaks(setting->GetName()).c_str());
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if (!parentNode->NoChildren()) {
|
|
|
|
|
// spoilerLog.RootElement()->InsertEndChild(parentNode);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// Writes the Master Quest dungeons to the spoiler log, if there are any.
|
|
|
|
|
static void WriteMasterQuestDungeons(tinyxml2::XMLDocument& spoilerLog) {
|
|
|
|
|
static void WriteMasterQuestDungeons() {
|
|
|
|
|
auto ctx = Rando::Context::GetInstance();
|
|
|
|
|
for (const auto* dungeon : ctx->GetDungeons()->GetDungeonList()) {
|
|
|
|
|
std::string dungeonName;
|
|
|
|
|
@@ -294,7 +216,6 @@ static void WriteRequiredTrials() {
|
|
|
|
|
|
|
|
|
|
// Writes the intended playthrough to the spoiler log, separated into spheres.
|
|
|
|
|
static void WritePlaythrough() {
|
|
|
|
|
// auto playthroughNode = spoilerLog.NewElement("playthrough");
|
|
|
|
|
auto ctx = Rando::Context::GetInstance();
|
|
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < ctx->playthroughLocations.size(); ++i) {
|
|
|
|
|
@@ -306,8 +227,6 @@ static void WritePlaythrough() {
|
|
|
|
|
WriteLocation(sphereString, key, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// spoilerLog.RootElement()->InsertEndChild(playthroughNode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Write the randomized entrance playthrough to the spoiler log, if applicable
|
|
|
|
|
@@ -389,11 +308,6 @@ static void WriteAllLocations() {
|
|
|
|
|
|
|
|
|
|
const char* SpoilerLog_Write() {
|
|
|
|
|
auto ctx = Rando::Context::GetInstance();
|
|
|
|
|
auto spoilerLog = tinyxml2::XMLDocument(false);
|
|
|
|
|
spoilerLog.InsertEndChild(spoilerLog.NewDeclaration());
|
|
|
|
|
|
|
|
|
|
auto rootNode = spoilerLog.NewElement("spoiler-log");
|
|
|
|
|
spoilerLog.InsertEndChild(rootNode);
|
|
|
|
|
|
|
|
|
|
jsonData.clear();
|
|
|
|
|
|
|
|
|
|
@@ -413,11 +327,8 @@ const char* SpoilerLog_Write() {
|
|
|
|
|
WriteSettings();
|
|
|
|
|
WriteExcludedLocations();
|
|
|
|
|
WriteStartingInventory();
|
|
|
|
|
WriteEnabledTricks(spoilerLog); //RANDOTODO clean up spoilerLog refernces
|
|
|
|
|
//if (Settings::Logic.Is(LOGIC_GLITCHED)) {
|
|
|
|
|
// WriteEnabledGlitches(spoilerLog);
|
|
|
|
|
//}
|
|
|
|
|
WriteMasterQuestDungeons(spoilerLog);
|
|
|
|
|
WriteEnabledTricks();
|
|
|
|
|
WriteMasterQuestDungeons();
|
|
|
|
|
WriteRequiredTrials();
|
|
|
|
|
WritePlaythrough();
|
|
|
|
|
|
|
|
|
|
@@ -466,30 +377,3 @@ void PlacementLog_Clear() {
|
|
|
|
|
placementtxt = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RANDOTODO: Do we even use this?
|
|
|
|
|
bool PlacementLog_Write() {
|
|
|
|
|
auto placementLog = tinyxml2::XMLDocument(false);
|
|
|
|
|
placementLog.InsertEndChild(placementLog.NewDeclaration());
|
|
|
|
|
|
|
|
|
|
auto rootNode = placementLog.NewElement("placement-log");
|
|
|
|
|
placementLog.InsertEndChild(rootNode);
|
|
|
|
|
|
|
|
|
|
// rootNode->SetAttribute("version", Settings::version.c_str());
|
|
|
|
|
// rootNode->SetAttribute("seed", Settings::seed);
|
|
|
|
|
|
|
|
|
|
// WriteSettings(placementLog, true); // Include hidden settings.
|
|
|
|
|
// WriteExcludedLocations(placementLog);
|
|
|
|
|
// WriteStartingInventory(placementLog);
|
|
|
|
|
WriteEnabledTricks(placementLog);
|
|
|
|
|
//WriteEnabledGlitches(placementLog);
|
|
|
|
|
WriteMasterQuestDungeons(placementLog);
|
|
|
|
|
//WriteRequiredTrials(placementLog);
|
|
|
|
|
|
|
|
|
|
placementtxt = "\n" + placementtxt;
|
|
|
|
|
|
|
|
|
|
auto node = rootNode->InsertNewChildElement("log");
|
|
|
|
|
auto contentNode = node->InsertNewText(placementtxt.c_str());
|
|
|
|
|
contentNode->SetCData(true);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|