fix(adt): MODF entry was 60 bytes but parser expects 64 — write nameSet+scale tail

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).
This commit is contained in:
Kelsi 2026-05-06 02:02:01 -07:00
parent 804c7d3d60
commit bbdd48a78a

View file

@ -154,6 +154,11 @@ void ADTWriter::writeMODF(std::vector<uint8_t>& 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);
}