Use GetDungeonFromScene (#5271)

* Use GetDungeonFromScene.

* Remove SceneToDungeon map.
This commit is contained in:
xxAtrain223 2025-03-31 23:18:07 -05:00 committed by GitHub
parent 05219cbbf7
commit 2bde8fbe5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2104,30 +2104,16 @@ namespace Rando {
} }
} }
std::unordered_map<SceneID, DungeonKey> SceneToDungeon = {
{ SceneID::SCENE_DEKU_TREE, DungeonKey::DEKU_TREE },
{ SceneID::SCENE_DODONGOS_CAVERN, DungeonKey::DODONGOS_CAVERN },
{ SceneID::SCENE_JABU_JABU, DungeonKey::JABU_JABUS_BELLY },
{ SceneID::SCENE_FOREST_TEMPLE, DungeonKey::FOREST_TEMPLE },
{ SceneID::SCENE_FIRE_TEMPLE, DungeonKey::FIRE_TEMPLE },
{ SceneID::SCENE_WATER_TEMPLE, DungeonKey::WATER_TEMPLE },
{ SceneID::SCENE_SPIRIT_TEMPLE, DungeonKey::SPIRIT_TEMPLE },
{ SceneID::SCENE_SHADOW_TEMPLE, DungeonKey::SHADOW_TEMPLE },
{ SceneID::SCENE_BOTTOM_OF_THE_WELL, DungeonKey::BOTTOM_OF_THE_WELL },
{ SceneID::SCENE_ICE_CAVERN, DungeonKey::ICE_CAVERN },
{ SceneID::SCENE_GERUDO_TRAINING_GROUND, DungeonKey::GERUDO_TRAINING_GROUND },
{ SceneID::SCENE_INSIDE_GANONS_CASTLE, DungeonKey::GANONS_CASTLE },
};
// Get the swch bit positions for the dungeon // Get the swch bit positions for the dungeon
const std::vector<uint8_t>& GetDungeonSmallKeyDoors(SceneID sceneId) { const std::vector<uint8_t>& GetDungeonSmallKeyDoors(SceneID sceneId) {
static const std::vector<uint8_t> emptyVector; static const std::vector<uint8_t> emptyVector;
auto foundDungeon = SceneToDungeon.find(static_cast<SceneID>(sceneId));
if (foundDungeon == SceneToDungeon.end()) { auto dungeonInfo = Rando::Context::GetInstance()->GetDungeons()->GetDungeonFromScene(sceneId);
if (dungeonInfo == nullptr) {
return emptyVector; return emptyVector;
} }
bool masterQuest = Rando::Context::GetInstance()->GetDungeon(foundDungeon->second)->IsMQ(); bool masterQuest = dungeonInfo->IsMQ();
// Create a unique key for the dungeon and master quest // Create a unique key for the dungeon and master quest
uint8_t key = sceneId | (masterQuest << 7); uint8_t key = sceneId | (masterQuest << 7);