Kelsidavis-WoWee/include/game/zone_manager.hpp
Kelsi 43b9ecd857 Enrich zone music from AreaTable/ZoneMusic/SoundEntries DBC chain
Add ZoneManager::enrichFromDBC() which walks AreaTable.dbc (field 8 = ZoneMusicId)
→ ZoneMusic.dbc (fields 6/7 = day/night SoundEntryIds) → SoundEntries.dbc
(fields 3-12 = files, field 23 = DirectoryBase) and appends MPQ music paths for
all zones in the DBC, covering ~2300+ areas vs the previous ~15 hardcoded entries.

Existing hardcoded paths are preserved as the primary pool; DBC paths are added
only if not already present. Called from Renderer::init() after initialize().
2026-03-09 16:04:52 -07:00

44 lines
1.3 KiB
C++

#pragma once
#include <string>
#include <cstdint>
#include <unordered_map>
#include <vector>
namespace wowee {
namespace pipeline { class AssetManager; }
namespace game {
struct ZoneInfo {
uint32_t id;
std::string name;
std::vector<std::string> musicPaths; // MPQ paths to music files
};
class ZoneManager {
public:
void initialize();
// Supplement zone music paths using AreaTable → ZoneMusic → SoundEntries DBC chain.
// Safe to call after initialize(); idempotent and additive (does not remove existing paths).
void enrichFromDBC(pipeline::AssetManager* assets);
uint32_t getZoneId(int tileX, int tileY) const;
const ZoneInfo* getZoneInfo(uint32_t zoneId) const;
std::string getRandomMusic(uint32_t zoneId);
std::vector<std::string> getAllMusicPaths() const;
// When false, file: (original soundtrack) tracks are excluded from the pool
void setUseOriginalSoundtrack(bool use) { useOriginalSoundtrack_ = use; }
bool getUseOriginalSoundtrack() const { return useOriginalSoundtrack_; }
private:
// tile key = tileX * 100 + tileY
std::unordered_map<int, uint32_t> tileToZone;
std::unordered_map<uint32_t, ZoneInfo> zones;
std::string lastPlayedMusic_;
bool useOriginalSoundtrack_ = true;
};
} // namespace game
} // namespace wowee