diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-02-25 21:23:01 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-02-25 21:23:01 +0100 |
commit | 6a4ac0dc015106801d79cc258b06f896ea0e2716 (patch) | |
tree | 6b43962db0ae82a26b38785e14ac3de0a1ceb441 /src | |
parent | 0b694f21edc97bd95faa65197bdda6b440479df3 (diff) |
a
Diffstat (limited to 'src')
-rw-r--r-- | src/chunk-collision.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/chunk-collision.cpp b/src/chunk-collision.cpp index 80436ad2..de4f484e 100644 --- a/src/chunk-collision.cpp +++ b/src/chunk-collision.cpp @@ -13,15 +13,15 @@ namespace { constexpr Vector2 tile_start(std::size_t k) { - const auto i = std::uint8_t(k); - const local_coords coord{i}; - return TILE_SIZE2 * Vector2(coord.x, coord.y) - TILE_SIZE2*.5f; + constexpr auto half_tile = Vector2(TILE_SIZE2)/2; + const local_coords coord{k}; + return TILE_SIZE2 * Vector2(coord.x, coord.y) - half_tile; } constexpr Pair<Vector2, Vector2> scenery_tile(std::size_t k, const scenery& sc) { - constexpr auto half = Vector2(TILE_SIZE2)/2; - auto center = tile_start(k) + Vector2(sc.bbox_offset) + half; + const local_coords coord{k}; + auto center = TILE_SIZE2 * Vector2(coord.x, coord.y) + Vector2(sc.offset) + Vector2(sc.bbox_offset); auto start = center - Vector2(sc.bbox_size); auto size = Vector2(sc.bbox_size)*2; return { start, start + size, }; |