Wire ambient sound zone detection: setZoneType/setCityType was never called

Add AmbientSoundManager::setZoneId() that maps WoW zone IDs to the
appropriate ZoneType (forest/grasslands/desert/jungle/marsh/beach) or
CityType (Stormwind/Ironforge/Darnassus/Orgrimmar/Undercity/ThunderBluff)
and delegates to setZoneType/setCityType. Call it from the renderer's
zone transition handler so zone ambience (looping sounds, city bells,
etc.) actually activates when the player enters a zone.
This commit is contained in:
Kelsi 2026-03-09 16:24:12 -07:00
parent 4ac32a1206
commit 68bf3d32b0
3 changed files with 95 additions and 0 deletions

View file

@ -45,6 +45,9 @@ public:
void setZoneType(ZoneType type);
ZoneType getCurrentZone() const { return currentZone_; }
// Convenience: derive ZoneType and CityType from a WoW zone ID
void setZoneId(uint32_t zoneId);
// City ambience control
enum class CityType {
NONE,

View file

@ -554,6 +554,94 @@ void AmbientSoundManager::setZoneType(ZoneType type) {
}
}
void AmbientSoundManager::setZoneId(uint32_t zoneId) {
// Map WoW zone ID to ZoneType + CityType.
// City zones: set CityType and clear ZoneType.
// Outdoor zones: set ZoneType and clear CityType.
CityType city = CityType::NONE;
ZoneType zone = ZoneType::NONE;
switch (zoneId) {
// ---- Major cities ----
case 1519: city = CityType::STORMWIND; break;
case 1537: city = CityType::IRONFORGE; break;
case 1657: city = CityType::DARNASSUS; break;
case 1637: city = CityType::ORGRIMMAR; break;
case 1497: city = CityType::UNDERCITY; break;
case 1638: city = CityType::THUNDERBLUFF; break;
// ---- Forest / snowy forest ----
case 12: // Elwynn Forest
case 141: // Teldrassil
case 148: // Darkshore
case 493: // Moonglade
case 361: // Felwood
case 331: // Ashenvale
case 357: // Feralas
case 15: // Dustwallow Marsh (lush)
case 267: // Hillsbrad Foothills
case 36: // Alterac Mountains
case 45: // Arathi Highlands
zone = ZoneType::FOREST_NORMAL; break;
case 1: // Dun Morogh
case 196: // Winterspring
case 3: // Badlands (actually dry but close enough)
case 2817: // Crystalsong Forest
case 66: // Storm Peaks
case 67: // Icecrown
case 394: // Dragonblight
case 65: // Howling Fjord
zone = ZoneType::FOREST_SNOW; break;
// ---- Grasslands / plains ----
case 40: // Westfall
case 215: // Mulgore
case 44: // Redridge Mountains
case 10: // Duskwood (counts as grassland night)
case 38: // Loch Modan
zone = ZoneType::GRASSLANDS; break;
// ---- Desert ----
case 17: // The Barrens
case 14: // Durotar
case 440: // Tanaris
case 400: // Thousand Needles
zone = ZoneType::DESERT_PLAINS; break;
case 46: // Burning Steppes
case 51: // Searing Gorge
case 241: // Eastern Plaguelands (barren)
case 28: // Western Plaguelands
zone = ZoneType::DESERT_CANYON; break;
// ---- Jungle ----
case 33: // Stranglethorn Vale
case 78: // Un'Goro Crater
case 210: // Uldaman
case 1377: // Silithus (arid but closest)
zone = ZoneType::JUNGLE; break;
// ---- Marsh / swamp ----
case 8: // Swamp of Sorrows
case 11: // Wetlands
case 139: // Eastern Plaguelands
case 763: // Zangarmarsh
zone = ZoneType::MARSH; break;
// ---- Beach / coast ----
case 4: // Barrens coast (Merchant Coast)
case 3537: // Azuremyst Isle
case 3524: // Bloodmyst Isle
zone = ZoneType::BEACH; break;
default: break;
}
setCityType(city);
setZoneType(zone);
}
void AmbientSoundManager::setCityType(CityType type) {
if (currentCity_ != type) {
LOG_INFO("AmbientSoundManager: City changed from ", static_cast<int>(currentCity_),

View file

@ -3155,6 +3155,10 @@ void Renderer::update(float deltaTime) {
}
}
}
// Update ambient sound manager zone type
if (ambientSoundManager) {
ambientSoundManager->setZoneId(zoneId);
}
}
musicManager->update(deltaTime);