mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-26 03:12:18 -05:00
Fixes parsing of spoiler files in plando mode. (#3823)
It was specifically failing on Hints because of changes to the spoiler output that were not reflected in the parsing code.
This commit is contained in:
parent
63413e8159
commit
b96df0b642
@ -530,44 +530,64 @@ void Context::ParseHintJson(nlohmann::json spoilerFileJson) {
|
||||
// Ganondorf and Sheik Light Arrow Hints
|
||||
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>();
|
||||
std::string lightArrowRegion = spoilerFileJson["lightArrowArea"].get<std::string>();
|
||||
AddHint(RH_GANONDORF_HINT, Text(ganonHintText), lightArrowLoc, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[lightArrowRegion]);
|
||||
std::string sheikText = FormatJsonHintText(spoilerFileJson["sheikText"].get<std::string>());
|
||||
AddHint(RH_SHEIK_LIGHT_ARROWS, Text(sheikText), lightArrowLoc, HINT_TYPE_STATIC, lightArrowRegion);
|
||||
if (spoilerFileJson.contains("sheikText")) {
|
||||
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"].get<std::string>());
|
||||
AddHint(RH_GANONDORF_NOHINT, Text(ganonText), RC_UNKNOWN_CHECK, HINT_TYPE_JUNK, "Static", RA_GANONS_CASTLE);
|
||||
|
||||
// Dampe Hookshot Hint
|
||||
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, "Static", mSpoilerfileAreaNameToEnum[dampeRegion]);
|
||||
if (spoilerFileJson.contains("dampeText")) {
|
||||
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, "Static", mSpoilerfileAreaNameToEnum[dampeRegion]);
|
||||
}
|
||||
|
||||
// Greg Hint
|
||||
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, "Static", mSpoilerfileAreaNameToEnum[gregRegion]);
|
||||
if (spoilerFileJson.contains("gregText")) {
|
||||
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, "Static", mSpoilerfileAreaNameToEnum[gregRegion]);
|
||||
}
|
||||
|
||||
// Saria Magic Hint
|
||||
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, "Static", mSpoilerfileAreaNameToEnum[sariaRegion]);
|
||||
if (spoilerFileJson.contains("sariaText")) {
|
||||
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, "Static", mSpoilerfileAreaNameToEnum[sariaRegion]);
|
||||
}
|
||||
|
||||
// Warp Songs
|
||||
std::string warpMinuetText = FormatJsonHintText(spoilerFileJson["warpMinuetText"].get<std::string>()); //RANDOTODO fall back for if location is used
|
||||
AddHint(RH_MINUET_WARP_LOC, Text(warpMinuetText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[warpMinuetText]);
|
||||
std::string warpBoleroText = FormatJsonHintText(spoilerFileJson["warpBoleroText"].get<std::string>());
|
||||
AddHint(RH_BOLERO_WARP_LOC, Text(warpBoleroText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[warpBoleroText]);
|
||||
std::string warpSerenadeText = FormatJsonHintText(spoilerFileJson["warpSerenadeText"].get<std::string>());
|
||||
AddHint(RH_SERENADE_WARP_LOC, Text(warpSerenadeText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[warpSerenadeText]);
|
||||
std::string warpRequiemText = FormatJsonHintText(spoilerFileJson["warpRequiemText"].get<std::string>());
|
||||
AddHint(RH_REQUIEM_WARP_LOC, Text(warpRequiemText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[warpRequiemText]);
|
||||
std::string warpNocturneText = FormatJsonHintText(spoilerFileJson["warpNocturneText"].get<std::string>());
|
||||
AddHint(RH_NOCTURNE_WARP_LOC, Text(warpNocturneText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[warpNocturneText]);
|
||||
std::string warpPreludeText = FormatJsonHintText(spoilerFileJson["warpPreludeText"].get<std::string>());
|
||||
AddHint(RH_PRELUDE_WARP_LOC, Text(warpPreludeText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[warpPreludeText]);
|
||||
if (spoilerFileJson.contains("warpMinuetText")) {
|
||||
std::string warpMinuetText = FormatJsonHintText(spoilerFileJson["warpMinuetText"].get<std::string>()); //RANDOTODO fall back for if location is used
|
||||
AddHint(RH_MINUET_WARP_LOC, Text(warpMinuetText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[warpMinuetText]);
|
||||
}
|
||||
if (spoilerFileJson.contains("warpBoleroText")) {
|
||||
std::string warpBoleroText = FormatJsonHintText(spoilerFileJson["warpBoleroText"].get<std::string>());
|
||||
AddHint(RH_BOLERO_WARP_LOC, Text(warpBoleroText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[warpBoleroText]);
|
||||
}
|
||||
if (spoilerFileJson.contains("warpSerenadeText")) {
|
||||
std::string warpSerenadeText = FormatJsonHintText(spoilerFileJson["warpSerenadeText"].get<std::string>());
|
||||
AddHint(RH_SERENADE_WARP_LOC, Text(warpSerenadeText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[warpSerenadeText]);
|
||||
}
|
||||
if (spoilerFileJson.contains("warpRequiemText")) {
|
||||
std::string warpRequiemText = FormatJsonHintText(spoilerFileJson["warpRequiemText"].get<std::string>());
|
||||
AddHint(RH_REQUIEM_WARP_LOC, Text(warpRequiemText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[warpRequiemText]);
|
||||
}
|
||||
if (spoilerFileJson.contains("warpNocturneText")) {
|
||||
std::string warpNocturneText = FormatJsonHintText(spoilerFileJson["warpNocturneText"].get<std::string>());
|
||||
AddHint(RH_NOCTURNE_WARP_LOC, Text(warpNocturneText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[warpNocturneText]);
|
||||
}
|
||||
if (spoilerFileJson.contains("warpPreludeText")) {
|
||||
std::string warpPreludeText = FormatJsonHintText(spoilerFileJson["warpPreludeText"].get<std::string>());
|
||||
AddHint(RH_PRELUDE_WARP_LOC, Text(warpPreludeText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[warpPreludeText]);
|
||||
}
|
||||
|
||||
// Gossip Stones
|
||||
nlohmann::json hintsJson = spoilerFileJson["hints"];
|
||||
@ -576,8 +596,8 @@ void Context::ParseHintJson(nlohmann::json spoilerFileJson) {
|
||||
nlohmann::json hintInfo = it.value();
|
||||
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"].get<std::string>();
|
||||
RandomizerCheck hintedLocation = hintInfo.contains("location") ? mSpoilerfileCheckNameToEnum[hintInfo["location"]] : RC_UNKNOWN_CHECK;
|
||||
std::string hintedArea = hintInfo.contains("area") ? hintInfo["area"].get<std::string>() : "";
|
||||
AddHint(static_cast<RandomizerHintKey>(gossipStoneLoc - RC_COLOSSUS_GOSSIP_STONE + 1), Text(hintText), hintedLocation, hintType, hintedArea);
|
||||
}
|
||||
}
|
||||
|
@ -2723,7 +2723,7 @@ extern "C" void Save_SaveGlobal(void) {
|
||||
extern "C" void Save_LoadFile(void) {
|
||||
if (gSaveContext.questId == QUEST_RANDOMIZER) {
|
||||
// Reset rando context for rando saves.
|
||||
OTRGlobals::Instance->gRandoContext.reset();
|
||||
OTRGlobals::Instance->gRandoContext.reset();
|
||||
OTRGlobals::Instance->gRandoContext = Rando::Context::CreateInstance();
|
||||
OTRGlobals::Instance->gRandoContext->AddExcludedOptions();
|
||||
OTRGlobals::Instance->gRandoContext->GetSettings()->CreateOptions();
|
||||
|
@ -241,7 +241,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
|
||||
|
||||
u8 currentQuest = fileChooseCtx->questType[fileChooseCtx->buttonIndex];
|
||||
|
||||
if (Randomizer_IsSeedGenerated()) {
|
||||
if (Randomizer_IsSeedGenerated() || Randomizer_IsPlandoLoaded()) {
|
||||
gSaveContext.questId = QUEST_RANDOMIZER;
|
||||
|
||||
Randomizer_InitSaveFile();
|
||||
|
Loading…
Reference in New Issue
Block a user