mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 22:33:43 -07:00
EntranceShuffler ApplyEntranceOverrides.
This commit is contained in:
parent
85bc67ef24
commit
4e17050e0c
3 changed files with 348 additions and 311 deletions
|
@ -851,13 +851,7 @@ void EntranceShuffler::ShuffleEntrancePool(std::vector<Entrance*>& entrancePool,
|
|||
}
|
||||
}
|
||||
|
||||
int EntranceShuffler::ShuffleAllEntrances() {
|
||||
auto ctx = Rando::Context::GetInstance();
|
||||
|
||||
mTotalRandomizableEntrances = 0;
|
||||
mCurNumRandomizedEntrances = 0;
|
||||
|
||||
std::vector<EntranceInfoPair> entranceShuffleTable = {
|
||||
std::vector<EntranceInfoPair> entranceShuffleTable = {
|
||||
// clang-format off
|
||||
// Type Parent Region Connected Region Index
|
||||
{ { EntranceType::Dungeon, RR_KF_OUTSIDE_DEKU_TREE, RR_DEKU_TREE_ENTRYWAY, ENTR_DEKU_TREE_ENTRANCE },
|
||||
|
@ -1165,7 +1159,13 @@ int EntranceShuffler::ShuffleAllEntrances() {
|
|||
{ { EntranceType::BlueWarp, RR_SHADOW_TEMPLE_BOSS_ROOM, RR_GRAVEYARD_WARP_PAD_REGION, ENTR_GRAVEYARD_SHADOW_TEMPLE_BLUE_WARP },
|
||||
NO_RETURN_ENTRANCE },
|
||||
// clang-format on
|
||||
};
|
||||
};
|
||||
|
||||
int EntranceShuffler::ShuffleAllEntrances() {
|
||||
auto ctx = Rando::Context::GetInstance();
|
||||
|
||||
mTotalRandomizableEntrances = 0;
|
||||
mCurNumRandomizedEntrances = 0;
|
||||
|
||||
std::map<std::string, PriorityEntrance> priorityEntranceTable = {
|
||||
{ "Bolero", { { RR_DMC_CENTRAL_LOCAL }, { EntranceType::OwlDrop, EntranceType::WarpSong } } },
|
||||
|
@ -1663,6 +1663,36 @@ void EntranceShuffler::ParseJson(nlohmann::json spoilerFileJson) {
|
|||
}
|
||||
} catch (const std::exception& e) { throw e; }
|
||||
}
|
||||
|
||||
void EntranceShuffler::ApplyEntranceOverrides() {
|
||||
std::vector<EntranceInfoPair> shuffledEntrances;
|
||||
shuffledEntrances.reserve(entranceOverrides.size());
|
||||
|
||||
for (size_t i = 0; i < entranceOverrides.size(); i++) {
|
||||
EntranceOverride entranceOverride = entranceOverrides[i];
|
||||
|
||||
const EntranceLinkInfo* forwardInfo;
|
||||
const EntranceLinkInfo* returnInfo;
|
||||
for (const auto& pair : entranceShuffleTable) {
|
||||
if (pair.first.index == entranceOverride.index) {
|
||||
forwardInfo = &pair.first;
|
||||
}
|
||||
if (pair.second.index == entranceOverride.index) {
|
||||
forwardInfo = &pair.second;
|
||||
}
|
||||
if (pair.first.index == entranceOverride.override) {
|
||||
returnInfo = &pair.first;
|
||||
}
|
||||
if (pair.second.index == entranceOverride.override) {
|
||||
returnInfo = &pair.second;
|
||||
}
|
||||
}
|
||||
|
||||
shuffledEntrances.push_back({ *forwardInfo, *returnInfo });
|
||||
}
|
||||
|
||||
SetAllEntrancesData(shuffledEntrances);
|
||||
}
|
||||
} // namespace Rando
|
||||
|
||||
extern "C" EntranceOverride* Randomizer_GetEntranceOverrides() {
|
||||
|
|
|
@ -128,6 +128,7 @@ class EntranceShuffler {
|
|||
void CreateEntranceOverrides();
|
||||
void UnshuffleAllEntrances();
|
||||
void ParseJson(nlohmann::json spoilerFileJson);
|
||||
void ApplyEntranceOverrides();
|
||||
|
||||
private:
|
||||
std::vector<Entrance*> AssumeEntrancePool(std::vector<Entrance*>& entrancePool);
|
||||
|
|
|
@ -580,6 +580,13 @@ void CheckTrackerLoadGame(int32_t fileNum) {
|
|||
UpdateAllOrdering();
|
||||
UpdateInventoryChecks();
|
||||
UpdateFilters();
|
||||
|
||||
RegionTable_Init();
|
||||
|
||||
if (Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_ENTRANCES).Get()) {
|
||||
Rando::Context::GetInstance()->GetEntranceShuffler()->ApplyEntranceOverrides();
|
||||
}
|
||||
|
||||
RecalculateAvailableChecks();
|
||||
}
|
||||
|
||||
|
@ -898,7 +905,6 @@ void LoadFile() {
|
|||
SaveManager::Instance->LoadData("areasSpoiled", areasSpoiled, (uint32_t)0);
|
||||
UpdateAllOrdering();
|
||||
UpdateAllAreas();
|
||||
RegionTable_Init();
|
||||
}
|
||||
|
||||
void Teardown() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue