summaryrefslogtreecommitdiffhomepage
path: root/src/chunk-collision.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-06-10 06:46:49 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-06-10 06:46:49 +0200
commitf7898053802ea38630f93034d0cd1555492fbc56 (patch)
treef81955574f7ecc24ff26ee770c45768a366d0202 /src/chunk-collision.cpp
parentdc913f11422e002059029cac8da2d6b9a725656a (diff)
wip
Diffstat (limited to 'src/chunk-collision.cpp')
-rw-r--r--src/chunk-collision.cpp36
1 files changed, 1 insertions, 35 deletions
diff --git a/src/chunk-collision.cpp b/src/chunk-collision.cpp
index 49b7bc7d..7cf436a0 100644
--- a/src/chunk-collision.cpp
+++ b/src/chunk-collision.cpp
@@ -3,6 +3,7 @@
#include "entity.hpp"
#include "src/RTree-search.hpp"
#include "src/chunk-scenery.hpp"
+#include "src/tile-bbox.hpp"
#include <bit>
#include <Corrade/Containers/PairStl.h>
@@ -12,41 +13,6 @@ chunk::RTree* chunk::rtree() noexcept { ensure_passability(); return &_rtree; }
namespace {
-constexpr float wall_depth = 8, wall_depth_2 = wall_depth*.5f;
-
-constexpr Vector2 tile_start(size_t k)
-{
- constexpr auto half_tile = Vector2(TILE_SIZE2)/2;
- const local_coords coord{k};
- return TILE_SIZE2 * Vector2(coord) - half_tile;
-}
-
-Pair<Vector2i, Vector2i> scenery_tile(local_coords local, Vector2b offset, Vector2b bbox_offset, Vector2ub bbox_size)
-{
- auto center = iTILE_SIZE2 * Vector2i(local) + Vector2i(offset) + Vector2i(bbox_offset);
- auto min = center - Vector2i(bbox_size/2);
- auto size = Vector2i(bbox_size);
- return { min, min + size, };
-}
-
-constexpr Pair<Vector2, Vector2> whole_tile(size_t k)
-{
- auto min = tile_start(k);
- return { min, min + TILE_SIZE2, };
-}
-
-constexpr Pair<Vector2, Vector2> wall_north(size_t k)
-{
- auto min = tile_start(k) - Vector2(0, wall_depth_2);
- return { min, min + Vector2(TILE_SIZE2[0], wall_depth), };
-}
-
-constexpr Pair<Vector2, Vector2> wall_west(size_t k)
-{
- auto min = tile_start(k) - Vector2(wall_depth_2, 0);
- return { min, min + Vector2(wall_depth, TILE_SIZE2[1]), };
-}
-
constexpr object_id make_id(collision_type type, pass_mode p, object_id id)
{
return std::bit_cast<object_id>(collision_data { (object_id)type, (object_id)p, id });