// data_repository.hpp — DBC data loading, ZMP pixel map, and zone/POI/overlay storage. // Extracted from WorldMap::loadZonesFromDBC, loadPOIData, buildCosmicView // (Phase 5 of refactoring plan). SRP — all DBC parsing lives here. #pragma once #include "rendering/world_map/world_map_types.hpp" #include #include #include #include #include namespace wowee { namespace pipeline { class AssetManager; } namespace rendering { namespace world_map { class DataRepository { public: /// Load all zone data from DBC files for the given map name. void loadZones(const std::string& mapName, pipeline::AssetManager& assetManager); /// Load area POI markers from AreaPOI.dbc. void loadPOIs(pipeline::AssetManager& assetManager); /// Build cosmic view entries for the active expansion (uses isActiveExpansion). void buildCosmicView(int expansionLevel = 0); /// Build Azeroth world-view continent regions for the active expansion. void buildAzerothView(int expansionLevel = 0); /// Load ZMP pixel map for the given continent name (e.g. "Azeroth"). /// The ZMP is a 128x128 grid of uint32 AreaTable IDs. void loadZmpPixelMap(const std::string& continentName, pipeline::AssetManager& assetManager); /// Determine expansion level from the active expansion profile. static int getExpansionLevel(); // --- Accessors --- std::vector& zones() { return zones_; } const std::vector& zones() const { return zones_; } int cosmicIdx() const { return cosmicIdx_; } int worldIdx() const { return worldIdx_; } int currentMapId() const { return currentMapId_; } const std::vector& cosmicMaps() const { return cosmicMaps_; } const std::vector& azerothRegions() const { return azerothRegions_; } bool cosmicEnabled() const { return cosmicEnabled_; } const std::vector& poiMarkers() const { return poiMarkers_; } const std::unordered_map& exploreFlagByAreaId() const { return exploreFlagByAreaId_; } const std::unordered_map& areaNameByAreaId() const { return areaNameByAreaId_; } /// ZMP pixel map accessors. static constexpr int ZMP_SIZE = 128; const std::array& zmpGrid() const { return zmpGrid_; } bool hasZmpData() const { return zmpLoaded_; } /// Look up zone index from an AreaTable ID (from ZMP). Returns -1 if not found. int zoneIndexForAreaId(uint32_t areaId) const; /// ZMP-derived bounding rectangles per zone index (UV [0,1] on display). const std::unordered_map& zmpZoneBounds() const { return zmpZoneBounds_; } /// Reset all data (called on map change). void clear(); private: std::vector zones_; std::vector poiMarkers_; std::vector cosmicMaps_; std::vector azerothRegions_; std::unordered_map exploreFlagByAreaId_; std::unordered_map areaNameByAreaId_; int cosmicIdx_ = -1; int worldIdx_ = -1; int currentMapId_ = -1; bool cosmicEnabled_ = true; bool poisLoaded_ = false; // ZMP pixel map: 128x128 grid of AreaTable IDs for continent-level hover std::array zmpGrid_{}; bool zmpLoaded_ = false; // AreaID → zone index (zones_ vector) for quick resolution std::unordered_map areaIdToZoneIdx_; // ZMP-derived bounding boxes per zone index (UV coords on display) std::unordered_map zmpZoneBounds_; /// Scan ZMP grid and build bounding boxes for each zone. void buildZmpZoneBounds(); }; } // namespace world_map } // namespace rendering } // namespace wowee