fix(editor): override ADT internal coords with filename coords on load

Root cause of ADT loading failures: instanced maps (dungeons, raids)
have arbitrary internal coord values (e.g. tile 62,0 for a file named
_28_27.adt). The terrain mesh generator uses these coords to compute
world positions, resulting in chunks placed thousands of units away
from the camera → "Failed to upload terrain to GPU".

Fix: override terrain_.coord with the tileX/tileY from the filename
before mesh generation. This ensures chunks are positioned correctly
regardless of what the ADT file's internal header says.
This commit is contained in:
Kelsi 2026-05-05 08:49:26 -07:00
parent 79db38219f
commit 9c0bc5fbd1

View file

@ -552,6 +552,10 @@ void EditorApp::loadADT(const std::string& mapName, int tileX, int tileY) {
return;
}
// Override internal coords with what we know from the filename
// (instanced maps have arbitrary internal coord values)
terrain_.coord = {tileX, tileY};
terrainEditor_.setTerrain(&terrain_);
terrainEditor_.history().clear();
texturePainter_.setTerrain(&terrain_);