feat: client detects WOB buildings and JSON DBCs from custom zones

- 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)
This commit is contained in:
Kelsi 2026-05-05 12:00:31 -07:00
parent 71b06826b1
commit 2d417aa125
2 changed files with 38 additions and 0 deletions

View file

@ -311,6 +311,27 @@ std::shared_ptr<DBCFile> 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;

View file

@ -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<PendingTile> 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<std::string> 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<uint8_t> wmoData = assetManager->readFile(wmoPath);
if (wmoData.empty()) continue;