From 9c0bc5fbd10bc90e8d0830b46df11841843dc763 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 5 May 2026 08:49:26 -0700 Subject: [PATCH] fix(editor): override ADT internal coords with filename coords on load MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tools/editor/editor_app.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/editor/editor_app.cpp b/tools/editor/editor_app.cpp index 64c8a7e6..b20d15c4 100644 --- a/tools/editor/editor_app.cpp +++ b/tools/editor/editor_app.cpp @@ -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_);