From bbdd48a78a563236283e47a792c25398a77b7ae1 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 02:02:01 -0700 Subject: [PATCH] =?UTF-8?q?fix(adt):=20MODF=20entry=20was=2060=20bytes=20b?= =?UTF-8?q?ut=20parser=20expects=2064=20=E2=80=94=20write=20nameSet+scale?= =?UTF-8?q?=20tail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each MODF entry in ADT files is 64 bytes (per MODF spec). The writer was emitting only 60 bytes, missing the trailing nameSet(u16) + scale(u16). The loader uses entrySize=64 to advance per record, so any saved ADT with more than one WMO placement misaligned every subsequent record on reload. Now pads with nameSet=0 and scale=1024 (=1.0 fixed-point). --- tools/editor/adt_writer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/editor/adt_writer.cpp b/tools/editor/adt_writer.cpp index f43a40e5..1630341d 100644 --- a/tools/editor/adt_writer.cpp +++ b/tools/editor/adt_writer.cpp @@ -154,6 +154,11 @@ void ADTWriter::writeMODF(std::vector& buf, const pipeline::ADTTerrain& writeFloat(buf, p.extentUpper[2]); writeU16(buf, p.flags); writeU16(buf, p.doodadSet); + // MODF entry is 64 bytes total; we wrote 60, pad with nameSet(0) + scale(1024). + // Loader treats entrySize as 64, so missing trailing bytes mis-align the + // next entry. scale=1024 = 1.0 in MODF's fixed-point u16 encoding. + writeU16(buf, 0); + writeU16(buf, 1024); } patchSize(buf, start); }