diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-02-11 17:53:05 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-02-11 17:59:32 +0100 |
commit | fbb2582a66be0b98166e1f6ac21eb218aefd82e1 (patch) | |
tree | e87a7be1b82d544e9692c0fc86dc4eebc8979dc3 /serialize | |
parent | ada0f5e07d1a67d5067d44e48806a25db30c6135 (diff) |
src/scenery, save: store dt as 16-bit fixed point
Bump save proto version.
Diffstat (limited to 'serialize')
-rw-r--r-- | serialize/world-impl.hpp | 2 | ||||
-rw-r--r-- | serialize/world-reader.cpp | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/serialize/world-impl.hpp b/serialize/world-impl.hpp index e74ebda2..59c57e78 100644 --- a/serialize/world-impl.hpp +++ b/serialize/world-impl.hpp @@ -33,7 +33,7 @@ template<typename T> constexpr inline T int_max = std::numeric_limits<T>::max(); constexpr inline std::size_t atlas_name_max = 128; constexpr inline auto null_atlas = (atlasid)-1LL; -constexpr inline proto_t proto_version = 3; +constexpr inline proto_t proto_version = 4; constexpr inline proto_t min_proto_version = 1; constexpr inline auto chunk_magic = (std::uint16_t)~0xc0d3; constexpr inline auto scenery_magic = (std::uint16_t)~0xb00b; diff --git a/serialize/world-reader.cpp b/serialize/world-reader.cpp index f5459203..4d27c27f 100644 --- a/serialize/world-reader.cpp +++ b/serialize/world-reader.cpp @@ -173,7 +173,12 @@ void reader_state::read_chunks(reader_t& s) else sc.frame.frame << s; if (sc.frame.active) - sc.frame.delta << s; + { + if (PROTO >= 4) [[likely]] + sc.frame.delta << s; + else + sc.frame.delta = (std::uint16_t)Math::clamp(int(s.read<float>() * 65535), 0, 65535); + } } t.scenery() = sc; } |