summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-24 16:53:57 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-24 16:53:57 +0100
commite06df4dce05c8dd2ebd340ee1abcc8556f328d73 (patch)
tree77d8abd10607d4b9454c92fe756331f02db4c5bc /src
parenteb4922fc429764504a7e94e8c712c368c51685f2 (diff)
only show hand cursor over interactible scenery
Diffstat (limited to 'src')
-rw-r--r--src/scenery.cpp13
-rw-r--r--src/scenery.hpp3
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);
};