From 2d417aa1251f2a4df9884274d90c72967f93d2cc Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 5 May 2026 12:00:31 -0700 Subject: [PATCH] feat: client detects WOB buildings and JSON DBCs from custom zones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TerrainManager now checks for .wob files before loading WMO buildings (searches custom_zones/buildings/ and output/MapName/buildings/) - AssetManager::loadDBC() scans custom_zones/*/data/ for JSON DBC overrides exported by the editor - WOB detection logs when found (full WOB→WMOModel conversion pending) - JSON DBC detection logs when found (full JSON→DBCFile loading pending) Client open format support status: - WOT/WHM terrain: FULL (loads and renders) - PNG textures: FULL (override system) - WOM models: FULL (loads and renders) - zone.json: DETECTION (CustomZoneDiscovery scans) - WOB buildings: DETECTION (found, conversion pending) - JSON DBC: DETECTION (found, loading pending) --- src/pipeline/asset_manager.cpp | 21 +++++++++++++++++++++ src/rendering/terrain_manager.cpp | 17 +++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/pipeline/asset_manager.cpp b/src/pipeline/asset_manager.cpp index 8429bb5b..2bff1972 100644 --- a/src/pipeline/asset_manager.cpp +++ b/src/pipeline/asset_manager.cpp @@ -311,6 +311,27 @@ std::shared_ptr AssetManager::loadDBC(const std::string& name) { } } + // Check for JSON DBC from custom zones (wowee open format) + // JSON DBCs exported by the editor contain the same record data + // but the DBCFile::load() only handles binary — so JSON overrides + // are logged for now and will need a JSON→DBC converter in future. + if (dbcData.empty()) { + std::string baseName = name; + auto dot = baseName.rfind('.'); + if (dot != std::string::npos) baseName = baseName.substr(0, dot); + for (const std::string& dir : {"custom_zones", "output"}) { + if (!std::filesystem::exists(dir)) continue; + for (auto& entry : std::filesystem::directory_iterator(dir)) { + if (!entry.is_directory()) continue; + std::string jsonPath = entry.path().string() + "/data/" + baseName + ".json"; + if (std::filesystem::exists(jsonPath)) { + LOG_DEBUG("JSON DBC available (not yet loaded): ", jsonPath); + break; + } + } + } + } + // Fall back to expansion-specific CSV (e.g. Data/expansions/wotlk/db/Spell.csv) if (dbcData.empty() && !expansionDataPath_.empty()) { std::string baseName = name; diff --git a/src/rendering/terrain_manager.cpp b/src/rendering/terrain_manager.cpp index 460f67af..af2db97f 100644 --- a/src/rendering/terrain_manager.cpp +++ b/src/rendering/terrain_manager.cpp @@ -10,6 +10,7 @@ #include "core/coordinates.hpp" #include "pipeline/wowee_terrain_loader.hpp" #include "pipeline/wowee_model.hpp" +#include "pipeline/wowee_building.hpp" #include "core/memory_monitor.hpp" #include "core/profiler.hpp" #include "pipeline/asset_manager.hpp" @@ -594,6 +595,22 @@ std::shared_ptr TerrainManager::prepareTile(int x, int y) { if (placement.nameId >= pending->terrain.wmoNames.size()) continue; const std::string& wmoPath = pending->terrain.wmoNames[placement.nameId]; + + // Check for WOB open format first (custom zone buildings) + { + std::string wobBase = wmoPath; + auto wobDot = wobBase.rfind('.'); + if (wobDot != std::string::npos) wobBase = wobBase.substr(0, wobDot); + std::replace(wobBase.begin(), wobBase.end(), '\\', '/'); + std::vector wobPrefixes = {"custom_zones/buildings/", "output/" + mapName + "/buildings/"}; + for (const auto& prefix : wobPrefixes) { + if (pipeline::WoweeBuildingLoader::exists(prefix + wobBase)) { + LOG_INFO("WOB building found: ", prefix + wobBase, " (loading not yet implemented)"); + break; + } + } + } + std::vector wmoData = assetManager->readFile(wmoPath); if (wmoData.empty()) continue;