summaryrefslogtreecommitdiff
path: root/src/object_properties.cpp
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2017-11-20 01:45:57 +0000
committerparamat <mat.gregory@virginmedia.com>2017-12-04 02:25:10 +0000
commitf470cb7270560a26afff0a0eadfc69070236c109 (patch)
tree045b3cac767dfae7fffc02258d02cbaf7978a96f /src/object_properties.cpp
parent2507d32afe05c73bb27ed221c2a592b0894fdc68 (diff)
downloadminetest-f470cb7270560a26afff0a0eadfc69070236c109.tar.gz
minetest-f470cb7270560a26afff0a0eadfc69070236c109.tar.bz2
minetest-f470cb7270560a26afff0a0eadfc69070236c109.zip
Zoom: Set zoom FOV per-player using a player object property
Remove player object property 'can zoom'. Add player object property 'zoom fov'. Remove clientside setting for 'zoom fov'. Object property default is 15 degrees in creative mode, zoom disabled in survival mode. Needed due to zoom now loading and/or generating distant world according to zoom FOV. Update object properties serialisation version to 3.
Diffstat (limited to 'src/object_properties.cpp')
-rw-r--r--src/object_properties.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/object_properties.cpp b/src/object_properties.cpp
index ffb1ecb43..26a19a082 100644
--- a/src/object_properties.cpp
+++ b/src/object_properties.cpp
@@ -65,15 +65,15 @@ std::string ObjectProperties::dump()
<< "," << nametag_color.getGreen() << "," << nametag_color.getBlue() << "\" ";
os << ", selectionbox=" << PP(selectionbox.MinEdge) << "," << PP(selectionbox.MaxEdge);
os << ", pointable=" << pointable;
- os << ", can_zoom=" << can_zoom;
os << ", static_save=" << static_save;
os << ", eye_height=" << eye_height;
+ os << ", zoom_fov=" << zoom_fov;
return os.str();
}
void ObjectProperties::serialize(std::ostream &os) const
{
- writeU8(os, 2); // version, protocol_version >= 36
+ writeU8(os, 3); // version, protocol_version >= 36
writeS16(os, hp_max);
writeU8(os, physical);
writeF1000(os, weight);
@@ -109,10 +109,10 @@ void ObjectProperties::serialize(std::ostream &os) const
writeF1000(os, automatic_face_movement_max_rotation_per_sec);
os << serializeString(infotext);
os << serializeString(wield_item);
- writeU8(os, can_zoom);
writeS8(os, glow);
writeU16(os, breath_max);
writeF1000(os, eye_height);
+ writeF1000(os, zoom_fov);
// Add stuff only at the bottom.
// Never remove anything, because we don't want new versions of this
@@ -121,7 +121,7 @@ void ObjectProperties::serialize(std::ostream &os) const
void ObjectProperties::deSerialize(std::istream &is)
{
int version = readU8(is);
- if (version != 2)
+ if (version != 3)
throw SerializationError("unsupported ObjectProperties version");
hp_max = readS16(is);
@@ -159,11 +159,8 @@ void ObjectProperties::deSerialize(std::istream &is)
automatic_face_movement_max_rotation_per_sec = readF1000(is);
infotext = deSerializeString(is);
wield_item = deSerializeString(is);
- can_zoom = readU8(is);
-
- try {
- glow = readS8(is);
- breath_max = readU16(is);
- eye_height = readF1000(is);
- } catch (SerializationError &e) {}
+ glow = readS8(is);
+ breath_max = readU16(is);
+ eye_height = readF1000(is);
+ zoom_fov = readF1000(is);
}