diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-12 16:57:47 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-12 16:57:47 +0200 |
commit | 945dbbf8070ace647bb94da16c2c9f56690287be (patch) | |
tree | dfaea763a7e3c6abd0d37fd6de6b1532ca4c5c48 | |
parent | 506f87c554153eb0bbc3bc9e4fb0f26792f8bfca (diff) |
a
-rw-r--r-- | editor/update.cpp | 5 | ||||
-rw-r--r-- | main/draw.cpp | 8 | ||||
-rw-r--r-- | src/scenery.cpp | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/editor/update.cpp b/editor/update.cpp index b4c70211..5b5d6662 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -7,6 +7,7 @@ #include "floormat/main.hpp" #include "src/character.hpp" #include "src/tile-iterator.hpp" +#include "keys.hpp" #include <cmath> namespace floormat { @@ -104,7 +105,9 @@ void app::do_mouse_up_down(uint8_t button, bool is_down, int mods) void app::do_mouse_scroll(int offset) { - _z_level = (int8_t)Math::clamp(_z_level + offset, 0, (int)chunk_z_max); + auto mods = get_key_modifiers(); + int min_z = mods & kmod_ctrl ? chunk_z_min : std::max(0, (int)chunk_z_min); + _z_level = (int8_t)Math::clamp(_z_level + offset, min_z, (int)chunk_z_max); } void app::do_rotate(bool backward) diff --git a/main/draw.cpp b/main/draw.cpp index 063da14d..db3bbd0c 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -130,8 +130,8 @@ void main_impl::draw_world() noexcept { GL::Renderer::setDepthMask(true); - for (int16_t y = miny; y <= maxy; y++) - for (int16_t x = minx; x <= maxx; x++) + for (int16_t y = maxy; y >= miny; y--) + for (int16_t x = maxx; x >= minx; x--) { const chunk_coords_ pos{x, y, z}; auto* c_ = _world.at(pos); @@ -148,8 +148,8 @@ void main_impl::draw_world() noexcept GL::Renderer::setDepthMask(false); - for (int16_t y = miny; y <= maxy; y++) - for (int16_t x = minx; x <= maxx; x++) + for (int16_t y = maxy; y >= miny; y--) + for (int16_t x = maxx; x >= minx; x--) { const chunk_coords_ pos{x, y, z}; auto* c_ = _world.at(pos); diff --git a/src/scenery.cpp b/src/scenery.cpp index a07a69a5..d6b9fb22 100644 --- a/src/scenery.cpp +++ b/src/scenery.cpp @@ -96,7 +96,7 @@ Vector2 scenery::depth_offset() const if (sc_type == scenery_type::door) { const bool is_open = frame != atlas->info().nframes-1; - constexpr auto off_opened = Vector2(-1, 0) + Vector2(); + constexpr auto off_opened = Vector2(-1, 0); constexpr auto off_closed = Vector2(0, 0); const auto vec = is_open ? off_opened : off_closed; const auto offset = rotate_point(vec, rotation::N, r); |