From 1de08e196182498a931b496f79b1c1eaf3de7ca4 Mon Sep 17 00:00:00 2001 From: paramat Date: Fri, 10 Feb 2017 17:15:22 +0000 Subject: Plantlike: Fix visual_scale being applied squared This re-applies 2 commits that were reverted. Visual_scale was applied twice to plantlike by accident sometime between 2011 and 2013, squaring the requested scale value. Visual_scale is correctly applied once in it's other uses in signlike and torchlike. Two lines of code are removed, they also had no effect for the vast majority of nodes with the default visual_scale of 1.0. The texture continues to have it's base at ground level. Send sqrt(visual_scale) to old clients. Keep compatibility with protocol < 30 clients now that visual_scale is no longer applied twice to plantlike drawtype and mods are being updated to a new value. --- src/nodedef.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/nodedef.cpp') diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 0bb150267..c717b62b9 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -1611,6 +1611,10 @@ void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version) const compatible_param_type_2 = CPT2_WALLMOUNTED; } + float compatible_visual_scale = visual_scale; + if (protocol_version < 30 && drawtype == NDT_PLANTLIKE) + compatible_visual_scale = sqrt(visual_scale); + if (protocol_version == 13) { writeU8(os, 5); // version @@ -1622,7 +1626,7 @@ void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version) const writeS16(os, i->second); } writeU8(os, drawtype); - writeF1000(os, visual_scale); + writeF1000(os, compatible_visual_scale); writeU8(os, 6); for (u32 i = 0; i < 6; i++) tiledef[i].serialize(os, protocol_version); @@ -1670,7 +1674,7 @@ void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version) const writeS16(os, i->second); } writeU8(os, drawtype); - writeF1000(os, visual_scale); + writeF1000(os, compatible_visual_scale); writeU8(os, 6); for (u32 i = 0; i < 6; i++) tiledef[i].serialize(os, protocol_version); @@ -1724,7 +1728,7 @@ void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version) const writeS16(os, i->second); } writeU8(os, drawtype); - writeF1000(os, visual_scale); + writeF1000(os, compatible_visual_scale); writeU8(os, 6); for (u32 i = 0; i < 6; i++) tiledef[i].serialize(os, protocol_version); -- cgit v1.2.3