diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/scenery.cpp | 13 | ||||
-rw-r--r-- | src/scenery.hpp | 3 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/scenery.cpp b/src/scenery.cpp index 4eed262f..7c3001b0 100644 --- a/src/scenery.cpp +++ b/src/scenery.cpp @@ -54,6 +54,19 @@ scenery::scenery(float dt, frame_t frame, rotation r, bool passable, scenery_typ delta{dt}, frame{frame}, r{r}, passable{passable}, type{type} {} +bool scenery::can_activate() const noexcept +{ + switch (type) + { + default: + return false; + case scenery_type::door: + return !active; + case scenery_type::object: + return true; + } +} + void scenery::update(float dt, const anim_atlas& anim) { if (!active) diff --git a/src/scenery.hpp b/src/scenery.hpp index b6468ebe..aabf7315 100644 --- a/src/scenery.hpp +++ b/src/scenery.hpp @@ -13,7 +13,7 @@ enum class rotation : std::uint8_t { constexpr inline rotation rotation_COUNT = rotation{8}; enum class scenery_type : std::uint8_t { - none, generic, door, + none, generic, door, object, }; struct scenery final @@ -43,6 +43,7 @@ struct scenery final scenery(door_tag_t, rotation r, const anim_atlas& atlas, bool is_open = false); scenery(float dt, frame_t frame, rotation r, bool passable, scenery_type type); + bool can_activate() const noexcept; bool activate(const anim_atlas& atlas); void update(float dt, const anim_atlas& anim); }; |