summaryrefslogtreecommitdiffhomepage
path: root/src/entity.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-03-26 00:16:10 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-03-26 00:16:10 +0100
commit50273c040e605b6dbee3389c0c2adce2b8d85701 (patch)
tree2fc25c2acbad8f03e7cf25f02dc2a3ac70e981ec /src/entity.cpp
parentd4f254dc95a7e103e593f7f7af508de3f9137a10 (diff)
a
Diffstat (limited to 'src/entity.cpp')
-rw-r--r--src/entity.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/entity.cpp b/src/entity.cpp
index e0c060ff..b0d12d12 100644
--- a/src/entity.cpp
+++ b/src/entity.cpp
@@ -4,6 +4,7 @@
#include "anim-atlas.hpp"
#include "src/RTree-search.hpp"
#include "compat/exception.hpp"
+#include "shaders/tile.hpp"
#include <cmath>
#include <algorithm>
@@ -54,10 +55,9 @@ float entity::ordinal() const
float entity::ordinal(local_coords xy, Vector2b offset, Vector2s z_offset) const
{
constexpr auto inv_tile_size = 1.f/TILE_SIZE2;
- constexpr float width = TILE_MAX_DIM+1;
auto offset_ = ordinal_offset(offset);
- auto vec = Vector2(xy) + offset_*inv_tile_size + Vector2(z_offset)*inv_tile_size;
- return vec[1]*width + vec[0];
+ auto vec = Vector2(xy) + offset_*inv_tile_size;
+ return vec[0] + vec[1] + Vector2(z_offset).sum();
}
struct chunk& entity::chunk() const