Fix Dungeon Type Spoiling (#4719)

* Make new `SpoilAreaFromCheck` function to spoil areas when getting maps or a first check in a dungeon that isn't spoiled by entrance.

* Add scummed check dungeon spoiling on load.
This commit is contained in:
Malkierian 2024-12-18 21:42:36 -07:00 committed by GitHub
parent fd8bd31507
commit 0afffe24fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 1 deletions

View File

@ -328,6 +328,7 @@ void RandomizerOnItemReceiveHandler(GetItemEntry receivedItemEntry) {
if (randomizerQueuedItemEntry.modIndex == receivedItemEntry.modIndex && randomizerQueuedItemEntry.itemId == receivedItemEntry.itemId) {
SPDLOG_INFO("Item received mod {} item {} from RC {}", receivedItemEntry.modIndex, receivedItemEntry.itemId, static_cast<uint32_t>(randomizerQueuedCheck));
loc->SetCheckStatus(RCSHOW_COLLECTED);
CheckTracker::SpoilAreaFromCheck(randomizerQueuedCheck);
CheckTracker::RecalculateAllAreaTotals();
SaveManager::Instance->SaveSection(gSaveContext.fileNum, SECTION_ID_TRACKER_DATA, true);
randomizerQueuedCheck = RC_UNKNOWN_CHECK;

View File

@ -259,6 +259,33 @@ void RecalculateAreaTotals(RandomizerCheckArea rcArea) {
CalculateTotals();
}
std::map<RandomizerGet, RandomizerCheckArea> MapRGtoRandomizerCheckArea = {
{ RG_DEKU_TREE_MAP, RCAREA_DEKU_TREE},
{ RG_DODONGOS_CAVERN_MAP, RCAREA_DODONGOS_CAVERN },
{ RG_JABU_JABUS_BELLY_MAP, RCAREA_JABU_JABUS_BELLY },
{ RG_FOREST_TEMPLE_MAP, RCAREA_FOREST_TEMPLE },
{ RG_FIRE_TEMPLE_MAP, RCAREA_FIRE_TEMPLE },
{ RG_WATER_TEMPLE_MAP, RCAREA_WATER_TEMPLE },
{ RG_SPIRIT_TEMPLE_MAP, RCAREA_SPIRIT_TEMPLE },
{ RG_SHADOW_TEMPLE_MAP, RCAREA_SHADOW_TEMPLE },
{ RG_BOTTOM_OF_THE_WELL_MAP, RCAREA_BOTTOM_OF_THE_WELL },
{ RG_ICE_CAVERN_MAP, RCAREA_ICE_CAVERN }
};
void SpoilAreaFromCheck(RandomizerCheck rc) {
Rando::Location* loc = Rando::StaticData::GetLocation(rc);
Rando::ItemLocation* itemLoc = Rando::Context::GetInstance()->GetItemLocation(rc);
if (itemLoc->GetPlacedItem().GetItemType() == ItemType::ITEMTYPE_MAP) {
RandomizerCheckArea area = MapRGtoRandomizerCheckArea[itemLoc->GetPlacedRandomizerGet()];
if (!IsAreaSpoiled(area)) {
SetAreaSpoiled(area);
}
}
if (!IsAreaSpoiled(loc->GetArea())) {
SetAreaSpoiled(loc->GetArea());
}
}
void RecalculateAllAreaTotals() {
for (auto& [rcArea, checks] : checksByArea) {
if (rcArea == RCAREA_INVALID) {
@ -437,7 +464,8 @@ void CheckTrackerLoadGame(int32_t fileNum) {
}
}
if (areaChecksGotten[entry2->GetArea()] != 0 || RandomizerCheckObjects::AreaIsOverworld(entry2->GetArea())) {
if (areaChecksGotten[entry2->GetArea()] != 0 || RandomizerCheckObjects::AreaIsOverworld(entry2->GetArea()) ||
loc->GetCheckStatus() == RCSHOW_SCUMMED) {
areasSpoiled |= (1 << entry2->GetArea());
}

View File

@ -59,4 +59,5 @@ void UpdateAreas(RandomizerCheckArea area);
void UpdateAllOrdering();
void UpdateAllAreas();
void RecalculateAllAreaTotals();
void SpoilAreaFromCheck(RandomizerCheck rc);
} // namespace CheckTracker