feat(editor): preserve WMO instance scale across ADT load/save

The MODF scale field (u16 / 1024 = float) is now propagated in both
directions: load reads wp.scale -> obj.scale, syncToTerrain converts
obj.scale * 1024 -> wp.scale (clamped to u16). Combined with the prior
loader/writer changes this means non-1.0 WMO scales (used by some
WotLK content) survive a save/reload cycle.
This commit is contained in:
Kelsi 2026-05-06 03:40:03 -07:00
parent db1968f2cc
commit f856a90281
2 changed files with 7 additions and 1 deletions

View file

@ -981,7 +981,9 @@ void EditorApp::loadADT(const std::string& mapName, int tileX, int tileY) {
obj.path = terrain_.wmoNames[wp.nameId];
obj.position = core::coords::adtToWorld(wp.position[0], wp.position[1], wp.position[2]);
obj.rotation = glm::vec3(-wp.rotation[2], -wp.rotation[0], wp.rotation[1] + 180.0f);
obj.scale = 1.0f;
// MODF scale is fixed-point u16 (1024 = 1.0); fall back to 1.0
// for older expansions where the scale slot was always 0.
obj.scale = wp.scale > 0 ? static_cast<float>(wp.scale) / 1024.0f : 1.0f;
obj.uniqueId = wp.uniqueId;
objectPlacer_.getObjects().push_back(obj);
}