diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/character.cpp | 11 | ||||
| -rw-r--r-- | src/character.hpp | 2 | ||||
| -rw-r--r-- | src/entity.hpp | 2 | ||||
| -rw-r--r-- | src/light.cpp | 2 | ||||
| -rw-r--r-- | src/light.hpp | 2 | ||||
| -rw-r--r-- | src/scenery.cpp | 10 | ||||
| -rw-r--r-- | src/scenery.hpp | 2 |
7 files changed, 13 insertions, 18 deletions
diff --git a/src/character.cpp b/src/character.cpp index 88a575f9..b05d8093 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -143,19 +143,19 @@ Vector2 character::ordinal_offset(Vector2b offset) const return Vector2(offset); } -bool character::update(size_t i, float dt) +void character::update(size_t i, float dt) { const auto new_r = arrows_to_dir(b_L, b_R, b_U, b_D); if (new_r == rotation{rotation_COUNT}) { delta = 0; - return false; + return; } int nframes = allocate_frame_time(dt); if (nframes == 0) - return false; + return; auto [_0, _1, _2] = rotation_to_similar(r); const Vector2 move_vecs[] = { @@ -164,7 +164,6 @@ bool character::update(size_t i, float dt) move_vec(rotation_to_vec(_2)), }; - bool ret = false; if (r != new_r) if (is_dynamic()) @@ -184,7 +183,7 @@ bool character::update(size_t i, float dt) auto off_i = Vector2i(offset_); if (can_move_to(off_i)) { - ret |= move_to(i, off_i, new_r); + move_to(i, off_i, new_r); ++frame %= atlas->info().nframes; goto done; } @@ -194,8 +193,6 @@ bool character::update(size_t i, float dt) done: (void)0; } - - return ret; } entity_type character::type() const noexcept { return entity_type::character; } diff --git a/src/character.hpp b/src/character.hpp index 8a45ce10..06833f75 100644 --- a/src/character.hpp +++ b/src/character.hpp @@ -26,7 +26,7 @@ struct character final : entity entity_type type() const noexcept override; explicit operator character_proto() const; - bool update(size_t i, float dt) override; + void update(size_t i, float dt) override; void set_keys(bool L, bool R, bool U, bool D); Vector2 ordinal_offset(Vector2b offset) const override; float depth_offset() const override; diff --git a/src/entity.hpp b/src/entity.hpp index af57abba..e332c93a 100644 --- a/src/entity.hpp +++ b/src/entity.hpp @@ -66,7 +66,7 @@ struct entity virtual entity_type type() const noexcept = 0; virtual bool can_activate(size_t i) const; virtual bool activate(size_t i); - virtual bool update(size_t i, float dt) = 0; + virtual void update(size_t i, float dt) = 0; virtual void rotate(size_t i, rotation r); virtual bool can_rotate(global_coords coord, rotation new_r, rotation old_r, Vector2b offset, Vector2b bbox_offset, Vector2ub bbox_size); virtual bool can_move_to(Vector2i delta, global_coords coord, Vector2b offset, Vector2b bbox_offset, Vector2ub bbox_aize); diff --git a/src/light.cpp b/src/light.cpp index 0159a80b..58246d94 100644 --- a/src/light.cpp +++ b/src/light.cpp @@ -55,7 +55,7 @@ light::operator light_proto() const } entity_type light::type() const noexcept { return entity_type::light; } -bool light::update(size_t, float) { return false; } +void light::update(size_t, float) {} bool light::is_dynamic() const { return true; } bool light::is_virtual() const { return true; } diff --git a/src/light.hpp b/src/light.hpp index 45c8390e..a58e0221 100644 --- a/src/light.hpp +++ b/src/light.hpp @@ -33,7 +33,7 @@ struct light final : entity Vector2 ordinal_offset(Vector2b offset) const override; float depth_offset() const override; entity_type type() const noexcept override; - bool update(size_t i, float dt) override; + void update(size_t i, float dt) override; bool is_dynamic() const override; bool is_virtual() const override; diff --git a/src/scenery.cpp b/src/scenery.cpp index ee774282..c5435137 100644 --- a/src/scenery.cpp +++ b/src/scenery.cpp @@ -24,18 +24,18 @@ bool scenery::can_activate(size_t) const return atlas && interactive; } -bool scenery::update(size_t, float dt) +void scenery::update(size_t, float dt) { auto& s = *this; if (!s.active) - return false; + return; switch (s.sc_type) { default: case scenery_type::none: case scenery_type::generic: - return false; + return; case scenery_type::door: { fm_assert(atlas); auto& anim = *atlas; @@ -50,7 +50,7 @@ bool scenery::update(size_t, float dt) s.delta = (uint16_t)std::clamp(delta_ - frame_time*n, 0, 65535); fm_debug_assert(s.delta >= 0); if (n == 0) - return false; + return; const int8_t dir = s.closing ? 1 : -1; const int fr = s.frame + dir*n; s.active = fr > 0 && fr < nframes-1; @@ -70,8 +70,6 @@ bool scenery::update(size_t, float dt) //if ((p == pass_mode::pass) != (old_pass == pass_mode::pass)) Debug{} << "update: need reposition" << (s.frame == 0 ? "-1" : "1"); } } - - return false; } Vector2 scenery::ordinal_offset(Vector2b offset) const diff --git a/src/scenery.hpp b/src/scenery.hpp index 7a03fc87..17fdad66 100644 --- a/src/scenery.hpp +++ b/src/scenery.hpp @@ -40,7 +40,7 @@ struct scenery final : entity unsigned char closing : 1 = false; unsigned char interactive : 1 = false; - bool update(size_t i, float dt) override; + void update(size_t i, float dt) override; Vector2 ordinal_offset(Vector2b offset) const override; float depth_offset() const override; bool can_activate(size_t i) const override; |
