mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 22:33:43 -07:00
Rediscover regions when loading a game.
This commit is contained in:
parent
faf8318383
commit
cd9b6eee21
4 changed files with 20 additions and 7 deletions
|
@ -1706,18 +1706,24 @@ void Randomizer_DiscoverRegion(Region* region, std::unordered_set<RandomizerRegi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Randomizer_EntranceDiscovered(s16 index) {
|
void Randomizer_RegionDiscovered(RandomizerRegion region) {
|
||||||
|
std::unordered_set<RandomizerRegion> visitedRegions;
|
||||||
|
Randomizer_DiscoverRegion(&areaTable[region], visitedRegions);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Randomizer_EntranceDiscovered(s16 index, bool recalculateAvailableChecks) {
|
||||||
auto entranceEntry = Rando::entranceMap.find(index);
|
auto entranceEntry = Rando::entranceMap.find(index);
|
||||||
if (entranceEntry == Rando::entranceMap.end()) {
|
if (entranceEntry == Rando::entranceMap.end()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rando::Entrance* entrance = entranceEntry->second;
|
Rando::Entrance* entrance = entranceEntry->second;
|
||||||
Region* region = entrance->GetConnectedRegion();
|
RandomizerRegion connectedRegionKey = entrance->GetConnectedRegionKey();
|
||||||
|
|
||||||
std::unordered_set<RandomizerRegion> visitedRegions;
|
Randomizer_RegionDiscovered(connectedRegionKey);
|
||||||
Randomizer_DiscoverRegion(region, visitedRegions);
|
|
||||||
|
|
||||||
|
if (recalculateAvailableChecks) {
|
||||||
CheckTracker::RecalculateAvailableChecks();
|
CheckTracker::RecalculateAvailableChecks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -153,7 +153,8 @@ class EntranceShuffler {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
EntranceOverride* Randomizer_GetEntranceOverrides();
|
EntranceOverride* Randomizer_GetEntranceOverrides();
|
||||||
void Randomizer_EntranceDiscovered(s16 index);
|
void Randomizer_RegionDiscovered(RandomizerRegion region);
|
||||||
|
void Randomizer_EntranceDiscovered(s16 index, bool recalculateAvailableChecks);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -585,6 +585,12 @@ void CheckTrackerLoadGame(int32_t fileNum) {
|
||||||
|
|
||||||
if (Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_ENTRANCES).Get()) {
|
if (Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_ENTRANCES).Get()) {
|
||||||
Rando::Context::GetInstance()->GetEntranceShuffler()->ApplyEntranceOverrides();
|
Rando::Context::GetInstance()->GetEntranceShuffler()->ApplyEntranceOverrides();
|
||||||
|
|
||||||
|
for (s16 entranceIndex = 0; entranceIndex < ENTR_MAX; entranceIndex++) {
|
||||||
|
if (IsEntranceDiscovered(entranceIndex)) {
|
||||||
|
Randomizer_EntranceDiscovered(entranceIndex, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RecalculateAvailableChecks();
|
RecalculateAvailableChecks();
|
||||||
|
|
|
@ -809,7 +809,7 @@ void Entrance_SetEntranceDiscovered(u16 entranceIndex, u8 isReversedEntrance) {
|
||||||
if (idx < SAVEFILE_ENTRANCES_DISCOVERED_IDX_COUNT) {
|
if (idx < SAVEFILE_ENTRANCES_DISCOVERED_IDX_COUNT) {
|
||||||
u32 entranceBit = 1 << (entranceIndex - (idx * bitsPerIndex));
|
u32 entranceBit = 1 << (entranceIndex - (idx * bitsPerIndex));
|
||||||
gSaveContext.ship.stats.entrancesDiscovered[idx] |= entranceBit;
|
gSaveContext.ship.stats.entrancesDiscovered[idx] |= entranceBit;
|
||||||
Randomizer_EntranceDiscovered(entranceIndex);
|
Randomizer_EntranceDiscovered(entranceIndex, true);
|
||||||
|
|
||||||
// Set reverse entrance when not decoupled
|
// Set reverse entrance when not decoupled
|
||||||
if (!Randomizer_GetSettingValue(RSK_DECOUPLED_ENTRANCES) && !isReversedEntrance) {
|
if (!Randomizer_GetSettingValue(RSK_DECOUPLED_ENTRANCES) && !isReversedEntrance) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue