diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-25 19:37:06 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-25 19:37:06 +0100 |
commit | e46dd0f45d1cab35c7441d72f5dcac83720cc539 (patch) | |
tree | 1611ed041680e6dcccb115cbc7c99e098b809d33 /editor | |
parent | 1831d5d1eab5c9a607270a8a9b72a2ac1e6ce62a (diff) |
add scenery horizontal mirroring
Diffstat (limited to 'editor')
-rw-r--r-- | editor/draw.cpp | 6 | ||||
-rw-r--r-- | editor/update.cpp | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/editor/draw.cpp b/editor/draw.cpp index 17be7aeb..dd4cf96b 100644 --- a/editor/draw.cpp +++ b/editor/draw.cpp @@ -52,7 +52,11 @@ clickable_scenery* app::find_clickable_scenery(Vector2i pixel_) for (clickable_scenery& c : array) if (c.depth > depth && c.dest.contains(pixel)) { - const auto pos = pixel - c.dest.min() + c.src.min(); + + const auto pos_ = pixel - c.dest.min() + c.src.min(); + const auto pos = c.atlas.group(c.item.r).mirror_from.isEmpty() + ? pos_ + : Vector2ui(c.src.sizeX() - pos_[0], pos_[1]); const auto stride = c.atlas.info().pixel_size[0]; std::size_t idx = pos.y() * stride + pos.x(); fm_debug_assert(idx < c.bitmask.size()); diff --git a/editor/update.cpp b/editor/update.cpp index 9e479050..0c347f1d 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -31,7 +31,7 @@ void app::maybe_initialize_chunk_(const chunk_coords& pos, chunk& c) c[{K, K+1}].wall_north() = { _wall1, 0 }; c[{K+1, K }].wall_west() = { _wall2, 0 }; c[{K+3, K+1}].scenery() = { scenery::door, rotation::N, _door, false }; - c[{ 3, 4 }].scenery() = { scenery::generic, rotation::N, _table }; + c[{ 3, 4 }].scenery() = { scenery::generic, rotation::W, _table }; c[{K, K+1}].scenery() = { scenery::generic, rotation::N, _control_panel, true }; c.mark_modified(); } |