diff options
Diffstat (limited to 'serialize')
| -rw-r--r-- | serialize/world-impl.hpp | 3 | ||||
| -rw-r--r-- | serialize/world-reader.cpp | 13 | ||||
| -rw-r--r-- | serialize/world-writer.cpp | 2 |
3 files changed, 14 insertions, 4 deletions
diff --git a/serialize/world-impl.hpp b/serialize/world-impl.hpp index f6e856f5..d56c432c 100644 --- a/serialize/world-impl.hpp +++ b/serialize/world-impl.hpp @@ -28,6 +28,7 @@ * 13) Entity counter initialized to 1024. * 14) Always store entity offset, rework how sc_exact works. * 15) Add light alpha. + * 16) One more bit for light falloff enum. */ namespace floormat { @@ -48,7 +49,7 @@ template<typename T> constexpr inline T int_max = std::numeric_limits<T>::max(); #define file_magic ".floormat.save" -constexpr inline proto_t proto_version = 15; +constexpr inline proto_t proto_version = 16; constexpr inline size_t atlas_name_max = 128; constexpr inline auto null_atlas = (atlasid)-1LL; diff --git a/serialize/world-reader.cpp b/serialize/world-reader.cpp index c6b23999..f1492161 100644 --- a/serialize/world-reader.cpp +++ b/serialize/world-reader.cpp @@ -338,8 +338,17 @@ void reader_state::read_chunks(reader_t& s) uint8_t flags; flags << s; const bool exact = flags & 1; proto.r = rotation((flags >> 1) & lowbits<rotation_BITS>); - proto.falloff = light_falloff((flags >> 4) & lowbits<light_falloff_BITS>); - const bool enabled = (flags >> 6) & 1; + bool enabled; + if (PROTO >= 16) [[likely]] + { + proto.falloff = light_falloff((flags >> 4) & lowbits<light_falloff_BITS>); + enabled = (flags >> 7) & 1; + } + else + { + proto.falloff = light_falloff((flags >> 4) & lowbits<2>); + enabled = (flags >> 6) & 1; + } s >> proto.max_distance; for (auto i = 0uz; i < 3; i++) diff --git a/serialize/world-writer.cpp b/serialize/world-writer.cpp index 86f05b91..b07de09a 100644 --- a/serialize/world-writer.cpp +++ b/serialize/world-writer.cpp @@ -414,7 +414,7 @@ void writer_state::serialize_scenery(const chunk& c, writer_t& s) flags |= (uint8_t)exact; // 1 bit flags |= ((uint8_t)L.r & lowbits<rotation_BITS>) << 1; // 3 bits flags |= ((uint8_t)L.falloff & lowbits<light_falloff_BITS>) << 4; // 2 bits - flags |= (uint8_t)!!L.enabled << 6; // 1 bit + flags |= (uint8_t)!!L.enabled << 7; // 1 bit s << flags; } { |
