From 9c9d02e674231dca8f9b75ea23a0efa0b28f970b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 29 Oct 2022 02:33:29 +0200 Subject: a --- serialize/world-reader.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'serialize/world-reader.cpp') diff --git a/serialize/world-reader.cpp b/serialize/world-reader.cpp index b999b5d4..6172703b 100644 --- a/serialize/world-reader.cpp +++ b/serialize/world-reader.cpp @@ -65,19 +65,23 @@ void reader_state::read_chunks(reader_t& s) for (std::size_t i = 0; i < TILE_COUNT; i++) { const tilemeta flags = s.read(); + tile& t = chunk[i]; + using uchar = std::uint8_t; const auto make_atlas = [&]() -> tile_image { - auto atlas = lookup_atlas(s.read()); - auto id = s.read(); - fm_assert(id < atlas->num_tiles()); - return { atlas, id }; + auto id = flags & meta_short_atlasid ? (atlasid)(s.read()) : s.read(); + auto v = flags & meta_short_variant ? (varid) (s.read()) : s.read(); + auto atlas = lookup_atlas(id); + fm_assert(v < atlas->num_tiles()); + return { atlas, v }; }; - tile& t = chunk[i]; + if (flags & meta_ground) t.ground = make_atlas(); if (flags & meta_wall_n) t.wall_north = make_atlas(); if (flags & meta_wall_w) t.wall_west = make_atlas(); + switch (auto x = flags & pass_mask) { case tile::pass_shoot_through: -- cgit v1.2.3