summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/chunk-walls.cpp9
-rw-r--r--src/critter.cpp14
2 files changed, 8 insertions, 15 deletions
diff --git a/src/chunk-walls.cpp b/src/chunk-walls.cpp
index b759d465..3e708ee5 100644
--- a/src/chunk-walls.cpp
+++ b/src/chunk-walls.cpp
@@ -3,8 +3,6 @@
#include "quads.hpp"
#include "wall-atlas.hpp"
#include "tile-bbox.hpp"
-#include "compat/iota.hpp"
-#include "compat/map.hpp"
#include "compat/unroll.hpp"
#include "RTree-search.hpp"
#include "shaders/shader.hpp"
@@ -133,11 +131,6 @@ constexpr std::array<quad_table_entry, 4> make_quad_table_entry(Group_ G)
std::unreachable();
}
-constexpr auto quad_table = std::array{
- map(make_quad_table_entry<false>, iota_array<Group_, (size_t)Group_::COUNT>),
- map(make_quad_table_entry<true>, iota_array<Group_, (size_t)Group_::COUNT>),
-};
-
template<Group_ G, bool IsWest, typename F = float>
constexpr auto get_quadʹ(minmax_v<F, 3> bounds, F d)
{
@@ -151,7 +144,7 @@ constexpr auto get_quadʹ(minmax_v<F, 3> bounds, F d)
unroll<static_array_size<decltype(array)>>([&]<typename Index>(Index) {
constexpr size_t i = Index::value;
- constexpr auto table = quad_table[IsWest][(size_t)G];
+ constexpr auto table = make_quad_table_entry<IsWest>(G);
constexpr auto e = table[i];
array.data()[i] = { x[e.x] - dmx[e.dmx], y[e.y] - dmy[e.dmy], z[e.z], };
});
diff --git a/src/critter.cpp b/src/critter.cpp
index 5952bfd9..e99eb3a4 100644
--- a/src/critter.cpp
+++ b/src/critter.cpp
@@ -55,15 +55,15 @@ constexpr rotation arrows_to_dir_from_mask(unsigned mask)
fm_assert(false);
}
-constexpr auto arrows_to_dir_array = map(arrows_to_dir_from_mask, iota_array<uint8_t, 16>);
-
constexpr auto arrows_to_dir(bool left, bool right, bool up, bool down)
{
+ constexpr auto table = map(arrows_to_dir_from_mask, iota_array<uint8_t, 16>);
constexpr uint8_t L = 1 << 3, R = 1 << 2, U = 1 << 1, D = 1 << 0;
- const uint8_t bits = left*L | right*R | up*U | down*D;
constexpr uint8_t mask = L|R|U|D;
+
+ const uint8_t bits = left*L | right*R | up*U | down*D;
CORRADE_ASSUME((bits & mask) == bits);
- return arrows_to_dir_array.data()[bits];
+ return table.data()[bits];
}
#if 0
@@ -301,10 +301,10 @@ constexpr rotation dir_from_step_mask(uint8_t val)
}
}
-constexpr auto dir_from_step_array = map(dir_from_step_mask, iota_array<uint8_t, 1 << 4>);
-
constexpr rotation dir_from_step(step_s step)
{
+ constexpr auto table = map(dir_from_step_mask, iota_array<uint8_t, 1 << 4>);
+
if (step.direction.isZero()) [[unlikely]]
return rotation_COUNT;
@@ -312,7 +312,7 @@ constexpr rotation dir_from_step(step_s step)
auto y = uint8_t(step.direction.y() + 1);
//fm_debug_assert((x & 3) == x && (y & 3) == y);
auto val = uint8_t(x << 2 | y);
- return dir_from_step_array.data()[val];
+ return table.data()[val];
}
constexpr step_s next_step(point from, point to)