aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content_mapblock.cpp2
-rw-r--r--src/network/networkprotocol.h2
-rw-r--r--src/nodedef.cpp10
3 files changed, 9 insertions, 5 deletions
diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp
index 45822666f..9923647bc 100644
--- a/src/content_mapblock.cpp
+++ b/src/content_mapblock.cpp
@@ -1602,8 +1602,6 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
}
for (int i = 0; i < 4; i++) {
- vertices[i].Pos *= f.visual_scale;
- vertices[i].Pos.Y += BS/2 * (f.visual_scale - 1);
if (data->m_smooth_lighting)
vertices[i].Color = blendLight(frame, vertices[i].Pos, tile.color);
vertices[i].Pos += intToFloat(p, BS);
diff --git a/src/network/networkprotocol.h b/src/network/networkprotocol.h
index a511d169b..5301cc91c 100644
--- a/src/network/networkprotocol.h
+++ b/src/network/networkprotocol.h
@@ -146,6 +146,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
PROTOCOL VERSION 30:
New ContentFeatures serialization version
Add node and tile color and palette
+ Fix plantlike visual_scale being applied squared and add compatibility
+ with pre-30 clients by sending sqrt(visual_scale)
*/
#define LATEST_PROTOCOL_VERSION 30
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);