diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-03 09:37:17 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-04 06:58:10 +0100 |
commit | 4011338e2911f70c426f3981b2afb18e0ebfcead (patch) | |
tree | 6588a4d608757e88b8bb60b1484c48322f282712 /src | |
parent | 89d90859bd9a6788528ca2b6dec342d22ccfb925 (diff) |
c
Diffstat (limited to 'src')
-rw-r--r-- | src/critter.hpp | 2 | ||||
-rw-r--r-- | src/global-coords.hpp | 1 | ||||
-rw-r--r-- | src/object.cpp | 2 | ||||
-rw-r--r-- | src/object.hpp | 3 | ||||
-rw-r--r-- | src/timer-ns.cpp | 3 |
5 files changed, 4 insertions, 7 deletions
diff --git a/src/critter.hpp b/src/critter.hpp index fc3e8f17..f3d7a316 100644 --- a/src/critter.hpp +++ b/src/critter.hpp @@ -35,7 +35,7 @@ struct critter final : object String name; float speed = 1; - Vector2us offset_frac; + Vector2us offset_frac; // todo! switch to Vector2ui due to `allocate_frame_time' bool b_L : 1 = false, b_R : 1 = false, b_U : 1 = false, b_D : 1 = false; bool playable : 1 = false; diff --git a/src/global-coords.hpp b/src/global-coords.hpp index ef571b18..031b84d7 100644 --- a/src/global-coords.hpp +++ b/src/global-coords.hpp @@ -1,6 +1,5 @@ #pragma once #include "local-coords.hpp" -#include "compat/assert.hpp" #include <Magnum/Magnum.h> #include <Magnum/Math/Vector2.h> #include <Magnum/Math/Vector3.h> diff --git a/src/object.cpp b/src/object.cpp index 82c79d7d..b825974f 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -296,7 +296,6 @@ uint32_t object::allocate_frame_time(Ns dt, uint16_t& accum, uint32_t hz, float fm_assert(hz > 0); fm_assert(dt >= Ns{0}); - //const auto count = Ns::Type{ns_in_sec / hz} + accum}; const auto from_accum = uint64_t{accum} * ns_in_sec / u16_max; const auto from_dt = Ns(uint64_t(ld(dt.stamp) * ld(speed))); fm_assert(from_dt <= Ns{uint64_t{1} << 54}); @@ -308,6 +307,7 @@ uint32_t object::allocate_frame_time(Ns dt, uint16_t& accum, uint32_t hz, float const auto new_accum = (uint16_t)Math::clamp(new_accum_, uint64_t{0}, u16_max); [[maybe_unused]] const auto old_accum = accum; accum = new_accum; + #if 0 DBG_nospace << "alloc-frame-time: " << "dt:" << fraction(Time::to_milliseconds(dt)) << "ms" diff --git a/src/object.hpp b/src/object.hpp index 9f029efa..3976088e 100644 --- a/src/object.hpp +++ b/src/object.hpp @@ -47,7 +47,8 @@ struct object const global_coords coord; const Vector2b offset, bbox_offset; const Vector2ub bbox_size; - uint16_t delta = 0, frame = 0; + uint16_t delta = 0; // todo! switch to Vector2ui due to `allocate_frame_time' + uint16_t frame = 0; const rotation r = rotation::N; // todo remove bitfield? const pass_mode pass = pass_mode::see_through; bool ephemeral : 1 = false; diff --git a/src/timer-ns.cpp b/src/timer-ns.cpp index 5bc302ff..2fd83968 100644 --- a/src/timer-ns.cpp +++ b/src/timer-ns.cpp @@ -8,7 +8,6 @@ namespace floormat { namespace { -#if 0 constexpr auto MAX = (uint64_t)-1, HALF = MAX/2; static_assert(MAX - (MAX-0) <= 0); @@ -22,8 +21,6 @@ static_assert(MAX - HALF <= HALF+1); //static_assert(MAX - (MAX-2) <= 1); // must fail //static_assert(MAX - HALF <= HALF); // must fail -#endif - } // namespace Debug& operator<<(Debug& dbg, const Ns& box) |