diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-23 12:04:56 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-23 12:04:56 +0100 |
commit | 2752606d3014e29eae4a522917b805d86b505400 (patch) | |
tree | e7329bf5613b27bc12ede0086504afff2fa72f1d | |
parent | 9ee762d7171b65d92fa937c4dcb2cef1ff88ed6c (diff) |
w
-rw-r--r-- | editor/tests/walk.cpp | 4 | ||||
-rw-r--r-- | src/critter.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/editor/tests/walk.cpp b/editor/tests/walk.cpp index 938c36d1..ea764a9e 100644 --- a/editor/tests/walk.cpp +++ b/editor/tests/walk.cpp @@ -216,7 +216,7 @@ void pf_test::update_pre(app& a, const Ns& dt) fm_assert(step.count > 0); const auto new_r = dir_from_step(step); using Frac = decltype(critter::offset_frac)::Type; - constexpr auto frac = float{limits<Frac>::max}; + constexpr auto frac = (float{limits<Frac>::max}+1)/2; constexpr auto inv_frac = 1 / frac; const auto mag = step_magnitude(step.direction); const auto vec = Vector2(step.direction) * mag; @@ -240,7 +240,7 @@ void pf_test::update_pre(app& a, const Ns& dt) } } else - C.offset_frac = Math::Vector2<Frac>(Math::min({1.f,1.f}, Math::abs(offset_)) * frac); + C.offset_frac = Math::Vector2<Frac>(Math::min({2.f,2.f}, Math::abs(offset_)) * frac); } if (!ok) [[unlikely]] diff --git a/src/critter.cpp b/src/critter.cpp index e335747b..318a5d53 100644 --- a/src/critter.cpp +++ b/src/critter.cpp @@ -194,7 +194,7 @@ void critter::update_movement(size_t i, const Ns& dt, rotation new_r) { const auto vec = rotation_to_vec(rotations[j]); using Frac = decltype(critter::offset_frac)::Type; - constexpr auto frac = float{limits<Frac>::max}; + constexpr auto frac = (float{limits<Frac>::max}+1)/2; constexpr auto inv_frac = 1 / frac; const auto sign_vec = Math::sign(vec); auto offset_ = vec + Vector2(offset_frac) * sign_vec * inv_frac; @@ -213,7 +213,7 @@ void critter::update_movement(size_t i, const Ns& dt, rotation new_r) else { can_move = true; - offset_frac = Math::Vector2<Frac>(Math::min({1.f,1.f}, Math::abs(offset_)) * frac); + offset_frac = Math::Vector2<Frac>(Math::min({2.f,2.f}, Math::abs(offset_)) * frac); break; } } |