summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-04-06 23:42:15 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-04-06 23:49:50 +0200
commit24e66df509be980d333c12cbd9782396daac156b (patch)
tree4abd2e532df3909a7e734153c44896cc931070ca /src
parenta15e41368aad760f054c6e89dff8a9b16fe27f41 (diff)
src: add collision box for the stupid wall pillar
Diffstat (limited to 'src')
-rw-r--r--src/chunk-collision.cpp6
-rw-r--r--src/tile-bbox.hpp6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/chunk-collision.cpp b/src/chunk-collision.cpp
index bbbacaca..567be0ad 100644
--- a/src/chunk-collision.cpp
+++ b/src/chunk-collision.cpp
@@ -64,6 +64,12 @@ void chunk::ensure_passability() noexcept
auto [min, max] = wall_north(i, (float)atlas->info().depth);
auto id = make_id(collision_type::geometry, atlas->info().passability, TILE_COUNT+i+1);
_rtree->Insert(min.data(), max.data(), id);
+
+ if (tile.wall_west_atlas().get())
+ {
+ auto [min, max] = wall_pillar(i, (float)atlas->info().depth);
+ _rtree->Insert(min.data(), max.data(), id);
+ }
}
if (const auto* atlas = tile.wall_west_atlas().get())
{
diff --git a/src/tile-bbox.hpp b/src/tile-bbox.hpp
index c126184c..49163c5f 100644
--- a/src/tile-bbox.hpp
+++ b/src/tile-bbox.hpp
@@ -40,4 +40,10 @@ constexpr Pair<Vector2, Vector2> wall_west(size_t k, float wall_depth)
return { min, min + Vector2{wall_depth, TILE_SIZE2.y()} };
}
+constexpr Pair<Vector2, Vector2> wall_pillar(size_t k, float wall_depth)
+{
+ auto min = tile_start(k) - Vector2{wall_depth, 0};
+ return { min - Vector2{0, wall_depth}, min + Vector2{wall_depth, TILE_SIZE2.y()} };
+}
+
} // namespace floormat