fix(editor): ADT doodad/WMO coordinate conversion, auto-find tile on map select

- ADT doodad/WMO positions now converted from ADT space to render coords
  via core::coords::adtToWorld() — fixes objects appearing at wrong positions
  when loading existing WoW maps
- Selecting a map in the Load dialog now auto-finds the first valid tile
  (no more clicking "Find Tile" manually — it's automatic)
- Better error messages with toast for failed terrain loads
- Validates mesh has valid chunks before attempting GPU upload
This commit is contained in:
Kelsi 2026-05-05 08:55:09 -07:00
parent 9c0bc5fbd1
commit 61f0f39611
2 changed files with 31 additions and 4 deletions

View file

@ -383,8 +383,27 @@ void EditorUI::renderLoadDialog(EditorApp& app) {
for (const auto& m : maps) {
if (!filter.empty() && m.find(filter) == std::string::npos) continue;
bool selected = (m == std::string(loadMapNameBuf_));
if (ImGui::Selectable(m.c_str(), selected))
if (ImGui::Selectable(m.c_str(), selected)) {
std::strncpy(loadMapNameBuf_, m.c_str(), sizeof(loadMapNameBuf_) - 1);
// Auto-find first valid tile for this map
std::string ml = m;
bool found = false;
for (int x = 25; x < 45 && !found; x++)
for (int y = 25; y < 45 && !found; y++) {
std::string tp = "world\\maps\\" + ml + "\\" + ml + "_" +
std::to_string(x) + "_" + std::to_string(y) + ".adt";
if (app.getAssetManager()->getManifest().hasEntry(tp))
{ loadTileX_ = x; loadTileY_ = y; found = true; }
}
if (!found)
for (int x = 0; x < 64 && !found; x++)
for (int y = 0; y < 64 && !found; y++) {
std::string tp = "world\\maps\\" + ml + "\\" + ml + "_" +
std::to_string(x) + "_" + std::to_string(y) + ".adt";
if (app.getAssetManager()->getManifest().hasEntry(tp))
{ loadTileX_ = x; loadTileY_ = y; found = true; }
}
}
}
ImGui::EndChild();