From 85d11eca681e61767edfdacd84a4e845f6b96cec Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 6 Mar 2024 00:53:28 +0100 Subject: test/critter: fix the case of: 0 < accel < 1 --- src/critter.cpp | 5 +---- src/object.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/critter.cpp b/src/critter.cpp index f9de8638..abb80865 100644 --- a/src/critter.cpp +++ b/src/critter.cpp @@ -159,11 +159,7 @@ void critter::update_movement(size_t i, Ns dt, rotation new_r) const auto hz = atlas->info().fps; const auto nframes = alloc_frame_time(dt, delta, hz, speed); if (nframes == 0) - { - //static unsigned foo; - //Debug{} << ++foo << "stopped"; return; - } const auto rotations = rotation_to_similar(new_r); const unsigned nvecs = (int)new_r & 1 ? 3 : 1; @@ -197,6 +193,7 @@ void critter::update_movement(size_t i, Ns dt, rotation new_r) } else { + can_move = true; offset_frac = Vector2us(Math::abs(Math::min({1.f,1.f}, offset_)) * frac); break; } diff --git a/src/object.cpp b/src/object.cpp index 5fd29d29..72d922fc 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -311,10 +311,10 @@ uint32_t object::alloc_frame_time(Ns dt, T& accum, uint32_t hz, float speed) #if 0 DBG_nospace << "alloc-frame-time: " << "dt:" << fraction(Time::to_milliseconds(dt)) << "ms" - << ", secs:" << fraction(Time::to_milliseconds(Ns{nsecs}), 1) << " ms" - << ", frames:" << frames - << ", acc:" << new_accum_ - << ", rem:" << rem; + << " ticks:" << ticks + << " frames:" << nframes + << " acc:" << new_accum_ + << " rem:" << rem; #endif fm_assert(nframes < 1 << 12); return nframes; -- cgit v1.2.3