diff --git a/tools/editor/editor_app.cpp b/tools/editor/editor_app.cpp index 0f64ebd4..99138f1e 100644 --- a/tools/editor/editor_app.cpp +++ b/tools/editor/editor_app.cpp @@ -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(wp.scale) / 1024.0f : 1.0f; obj.uniqueId = wp.uniqueId; objectPlacer_.getObjects().push_back(obj); } diff --git a/tools/editor/object_placer.cpp b/tools/editor/object_placer.cpp index 335e4d79..8b807114 100644 --- a/tools/editor/object_placer.cpp +++ b/tools/editor/object_placer.cpp @@ -388,6 +388,10 @@ void ObjectPlacer::syncToTerrain() { wp.rotation[2] = -obj.rotation.x; wp.flags = 0; wp.doodadSet = 0; + wp.nameSet = 0; + // MODF scale is fixed-point u16 (1024 = 1.0); cap to u16 max. + float s1024 = obj.scale * 1024.0f; + wp.scale = static_cast(std::clamp(s1024, 0.0f, 65535.0f)); terrain_->wmoPlacements.push_back(wp); } }