From 38b7a0ae1ee5cd58a35e54d8ea6dc853ad744b89 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 23 Mar 2024 19:05:04 +0100 Subject: a --- src/critter.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/critter.cpp b/src/critter.cpp index 9a310955..ef3fd2a2 100644 --- a/src/critter.cpp +++ b/src/critter.cpp @@ -130,13 +130,27 @@ bool update_movement_body(size_t& i, critter& C, const anim_def& info) } template -CORRADE_ALWAYS_INLINE -bool update_movement_3way(size_t& index, critter& C, const anim_def& info) +CORRADE_NEVER_INLINE +bool update_movement_2(size_t& index, critter& C, const anim_def& info) { constexpr auto vec = rotation_to_vec(r); return update_movement_body(index, C, info); } +template +CORRADE_ALWAYS_INLINE +bool update_movement_3way(size_t i, critter& C, const anim_def& info) +{ + constexpr auto rotations = rotation_to_similar(r); + if (update_movement_2(i, C, info)) + return true; + if (update_movement_2(i, C, info)) + return true; + if (update_movement_2(i, C, info)) + return true; + return false; +} + template CORRADE_NEVER_INLINE bool update_movement_1(critter& C, size_t& i, const anim_def& info, uint32_t nframes) @@ -145,13 +159,8 @@ bool update_movement_1(critter& C, size_t& i, const anim_def& info, uint32_t nfr if constexpr(Diagonal) { for (auto k = 0u; k < nframes; k++) - { - constexpr auto rotations = rotation_to_similar(new_r); - if (update_movement_3way(i, C, info)) continue; - if (update_movement_3way(i, C, info)) continue; - if (update_movement_3way(i, C, info)) continue; - return false; - } + if (!update_movement_3way(i, C, info)) + return false; } else { -- cgit v1.2.3