From 1bb2be007fb9eb2bb9f8aada2781c9f975f9627e Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 2 Feb 2025 13:48:11 +0500 Subject: feat: wall building --- src/level.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/level.cpp b/src/level.cpp index efc2038..4fc7d2c 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -48,6 +49,17 @@ namespace silly::editor { for (auto it = layer.tiles.begin(); it != layer.tiles.end(); ++it) { if (it->position != position) continue; + float r = it->rotation; + + if (rotation == 270.0f && r == 0.0f) { + r = 360.0f; + } + + // wall building + if (it->tile->type == TILE_WALL && std::abs(r - rotation) == 90.0f) { + break; + } + it->rotation = rotation; it->tile = tile; placed = true; -- cgit v1.2.3