mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-18 22:32:19 -05:00
Merge branch 'develop-rando' into potsanity
This commit is contained in:
commit
3840afcb39
@ -46,6 +46,7 @@ bool GenerateRandomizer(std::set<RandomizerCheck> excludedLocations, std::set<Ra
|
|||||||
uint32_t seedHash = boost::hash_32<std::string>{}(ctx->GetSettings()->GetSeedString());
|
uint32_t seedHash = boost::hash_32<std::string>{}(ctx->GetSettings()->GetSeedString());
|
||||||
ctx->GetSettings()->SetSeed(seedHash & 0xFFFFFFFF);
|
ctx->GetSettings()->SetSeed(seedHash & 0xFFFFFFFF);
|
||||||
|
|
||||||
|
ctx->ClearItemLocations();
|
||||||
int ret = Playthrough::Playthrough_Init(ctx->GetSettings()->GetSeed(), excludedLocations, enabledTricks);
|
int ret = Playthrough::Playthrough_Init(ctx->GetSettings()->GetSeed(), excludedLocations, enabledTricks);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (ret == -1) { // Failed to generate after 5 tries
|
if (ret == -1) { // Failed to generate after 5 tries
|
||||||
|
@ -226,6 +226,12 @@ std::vector<RandomizerCheck> Context::GetLocations(const std::vector<RandomizerC
|
|||||||
return locationsInCategory;
|
return locationsInCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Context::ClearItemLocations() {
|
||||||
|
for (int i = 0; i < itemLocationTable.size(); i++) {
|
||||||
|
GetItemLocation(static_cast<RandomizerCheck>(i))->ResetVariables();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Context::ItemReset() {
|
void Context::ItemReset() {
|
||||||
for (const RandomizerCheck il : allLocations) {
|
for (const RandomizerCheck il : allLocations) {
|
||||||
GetItemLocation(il)->ResetVariables();
|
GetItemLocation(il)->ResetVariables();
|
||||||
@ -524,44 +530,64 @@ void Context::ParseHintJson(nlohmann::json spoilerFileJson) {
|
|||||||
// Ganondorf and Sheik Light Arrow Hints
|
// Ganondorf and Sheik Light Arrow Hints
|
||||||
std::string ganonHintText = FormatJsonHintText(spoilerFileJson["ganonHintText"].get<std::string>());
|
std::string ganonHintText = FormatJsonHintText(spoilerFileJson["ganonHintText"].get<std::string>());
|
||||||
RandomizerCheck lightArrowLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["lightArrowHintLoc"].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]);
|
AddHint(RH_GANONDORF_HINT, Text(ganonHintText), lightArrowLoc, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[lightArrowRegion]);
|
||||||
|
if (spoilerFileJson.contains("sheikText")) {
|
||||||
std::string sheikText = FormatJsonHintText(spoilerFileJson["sheikText"].get<std::string>());
|
std::string sheikText = FormatJsonHintText(spoilerFileJson["sheikText"].get<std::string>());
|
||||||
AddHint(RH_SHEIK_LIGHT_ARROWS, Text(sheikText), lightArrowLoc, HINT_TYPE_STATIC, lightArrowRegion);
|
AddHint(RH_SHEIK_LIGHT_ARROWS, Text(sheikText), lightArrowLoc, HINT_TYPE_STATIC, lightArrowRegion);
|
||||||
|
}
|
||||||
std::string ganonText = FormatJsonHintText(spoilerFileJson["ganonText"].get<std::string>());
|
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);
|
AddHint(RH_GANONDORF_NOHINT, Text(ganonText), RC_UNKNOWN_CHECK, HINT_TYPE_JUNK, "Static", RA_GANONS_CASTLE);
|
||||||
|
|
||||||
// Dampe Hookshot Hint
|
// Dampe Hookshot Hint
|
||||||
|
if (spoilerFileJson.contains("dampeText")) {
|
||||||
std::string dampeText = FormatJsonHintText(spoilerFileJson["dampeText"].get<std::string>());
|
std::string dampeText = FormatJsonHintText(spoilerFileJson["dampeText"].get<std::string>());
|
||||||
std::string dampeRegion = spoilerFileJson["dampeRegion"].get<std::string>();
|
std::string dampeRegion = spoilerFileJson["dampeRegion"].get<std::string>();
|
||||||
RandomizerCheck dampeHintLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["dampeHintLoc"].get<std::string>()];
|
RandomizerCheck dampeHintLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["dampeHintLoc"].get<std::string>()];
|
||||||
AddHint(RH_DAMPES_DIARY, Text(dampeText), dampeHintLoc, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[dampeRegion]);
|
AddHint(RH_DAMPES_DIARY, Text(dampeText), dampeHintLoc, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[dampeRegion]);
|
||||||
|
}
|
||||||
|
|
||||||
// Greg Hint
|
// Greg Hint
|
||||||
|
if (spoilerFileJson.contains("gregText")) {
|
||||||
std::string gregText = FormatJsonHintText(spoilerFileJson["gregText"].get<std::string>());
|
std::string gregText = FormatJsonHintText(spoilerFileJson["gregText"].get<std::string>());
|
||||||
std::string gregRegion = spoilerFileJson["gregRegion"].get<std::string>();
|
std::string gregRegion = spoilerFileJson["gregRegion"].get<std::string>();
|
||||||
RandomizerCheck gregLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["gregLoc"].get<std::string>()];
|
RandomizerCheck gregLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["gregLoc"].get<std::string>()];
|
||||||
AddHint(RH_GREG_RUPEE, Text(gregText), gregLoc, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[gregRegion]);
|
AddHint(RH_GREG_RUPEE, Text(gregText), gregLoc, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[gregRegion]);
|
||||||
|
}
|
||||||
|
|
||||||
// Saria Magic Hint
|
// Saria Magic Hint
|
||||||
|
if (spoilerFileJson.contains("sariaText")) {
|
||||||
std::string sariaText = FormatJsonHintText(spoilerFileJson["sariaText"].get<std::string>());
|
std::string sariaText = FormatJsonHintText(spoilerFileJson["sariaText"].get<std::string>());
|
||||||
std::string sariaRegion = spoilerFileJson["sariaRegion"].get<std::string>();
|
std::string sariaRegion = spoilerFileJson["sariaRegion"].get<std::string>();
|
||||||
RandomizerCheck sariaHintLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["sariaHintLoc"].get<std::string>()];
|
RandomizerCheck sariaHintLoc = mSpoilerfileCheckNameToEnum[spoilerFileJson["sariaHintLoc"].get<std::string>()];
|
||||||
AddHint(RH_SARIA, Text(sariaText), sariaHintLoc, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[sariaRegion]);
|
AddHint(RH_SARIA, Text(sariaText), sariaHintLoc, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[sariaRegion]);
|
||||||
|
}
|
||||||
|
|
||||||
// Warp Songs
|
// Warp Songs
|
||||||
|
if (spoilerFileJson.contains("warpMinuetText")) {
|
||||||
std::string warpMinuetText = FormatJsonHintText(spoilerFileJson["warpMinuetText"].get<std::string>()); //RANDOTODO fall back for if location is used
|
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]);
|
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>());
|
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]);
|
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>());
|
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]);
|
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>());
|
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]);
|
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>());
|
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]);
|
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>());
|
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]);
|
AddHint(RH_PRELUDE_WARP_LOC, Text(warpPreludeText), RC_UNKNOWN_CHECK, HINT_TYPE_STATIC, "Static", mSpoilerfileAreaNameToEnum[warpPreludeText]);
|
||||||
|
}
|
||||||
|
|
||||||
// Gossip Stones
|
// Gossip Stones
|
||||||
nlohmann::json hintsJson = spoilerFileJson["hints"];
|
nlohmann::json hintsJson = spoilerFileJson["hints"];
|
||||||
@ -570,8 +596,8 @@ void Context::ParseHintJson(nlohmann::json spoilerFileJson) {
|
|||||||
nlohmann::json hintInfo = it.value();
|
nlohmann::json hintInfo = it.value();
|
||||||
std::string hintText = FormatJsonHintText(hintInfo["hint"].get<std::string>());
|
std::string hintText = FormatJsonHintText(hintInfo["hint"].get<std::string>());
|
||||||
HintType hintType = mSpoilerfileHintTypeNameToEnum[hintInfo["type"].get<std::string>()];
|
HintType hintType = mSpoilerfileHintTypeNameToEnum[hintInfo["type"].get<std::string>()];
|
||||||
RandomizerCheck hintedLocation = mSpoilerfileCheckNameToEnum[hintInfo["location"]];
|
RandomizerCheck hintedLocation = hintInfo.contains("location") ? mSpoilerfileCheckNameToEnum[hintInfo["location"]] : RC_UNKNOWN_CHECK;
|
||||||
std::string hintedArea = hintInfo["area"].get<std::string>();
|
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);
|
AddHint(static_cast<RandomizerHintKey>(gossipStoneLoc - RC_COLOSSUS_GOSSIP_STONE + 1), Text(hintText), hintedLocation, hintType, hintedArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ class Context {
|
|||||||
Category categoryInclude, Category categoryExclude = Category::cNull);
|
Category categoryInclude, Category categoryExclude = Category::cNull);
|
||||||
void AddExcludedOptions();
|
void AddExcludedOptions();
|
||||||
void LocationReset();
|
void LocationReset();
|
||||||
|
void ClearItemLocations();
|
||||||
void ItemReset();
|
void ItemReset();
|
||||||
void HintReset();
|
void HintReset();
|
||||||
void CreateItemOverrides();
|
void CreateItemOverrides();
|
||||||
|
@ -241,7 +241,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
|
|||||||
|
|
||||||
u8 currentQuest = fileChooseCtx->questType[fileChooseCtx->buttonIndex];
|
u8 currentQuest = fileChooseCtx->questType[fileChooseCtx->buttonIndex];
|
||||||
|
|
||||||
if (Randomizer_IsSeedGenerated()) {
|
if (Randomizer_IsSeedGenerated() || Randomizer_IsPlandoLoaded()) {
|
||||||
gSaveContext.questId = QUEST_RANDOMIZER;
|
gSaveContext.questId = QUEST_RANDOMIZER;
|
||||||
|
|
||||||
Randomizer_InitSaveFile();
|
Randomizer_InitSaveFile();
|
||||||
|
Loading…
Reference in New Issue
Block a user