diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-20 06:29:31 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-20 07:54:17 +0100 |
commit | 1c13313ec845d43077bd7e78538358ca4e007f8a (patch) | |
tree | 95923091df12f95bae5049d88037c9c8ff39f07f /src/scenery.cpp | |
parent | 38a87664deaedacf0aa8e97d9b0aa46dfb6c8ae6 (diff) |
sort entities by id rather than draw order
Diffstat (limited to 'src/scenery.cpp')
-rw-r--r-- | src/scenery.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/scenery.cpp b/src/scenery.cpp index fe1618af..3253f623 100644 --- a/src/scenery.cpp +++ b/src/scenery.cpp @@ -23,18 +23,18 @@ bool scenery::can_activate(size_t) const return atlas && interactive; } -entity_update_status scenery::update(size_t, float dt) +bool scenery::update(size_t, float dt) { auto& s = *this; if (!s.active) - return entity_update_status::not_updated; + return false; switch (s.sc_type) { default: case scenery_type::none: case scenery_type::generic: - return entity_update_status::not_updated; + return false; case scenery_type::door: { fm_assert(atlas); auto& anim = *atlas; @@ -49,11 +49,11 @@ entity_update_status 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 entity_update_status::not_updated; + return false; const int8_t dir = s.closing ? 1 : -1; const int fr = s.frame + dir*n; s.active = fr > 0 && fr < nframes-1; - pass_mode old_pass = pass, p; + pass_mode p; if (fr <= 0) p = pass_mode::pass; else if (fr >= nframes-1) @@ -67,11 +67,10 @@ entity_update_status scenery::update(size_t, float dt) if (!s.active) s.delta = s.closing = 0; //if ((p == pass_mode::pass) != (old_pass == pass_mode::pass)) Debug{} << "update: need reposition" << (s.frame == 0 ? "-1" : "1"); - return (p == pass_mode::pass) != (old_pass == pass_mode::pass) - ? entity_update_status::updated_repositioning - : entity_update_status::updated; } } + + return false; } Vector2 scenery::ordinal_offset(Vector2b offset) const |