From 083365191bd5f586edd850e0bd6a0190de782ab1 Mon Sep 17 00:00:00 2001 From: hop311 Date: Mon, 15 Apr 2024 00:13:46 +0100 Subject: Rework GFX::Actor Attachments and Animations --- src/openvic-simulation/interface/GFXObject.hpp | 42 ++++++++++++-------------- 1 file changed, 19 insertions(+), 23 deletions(-) (limited to 'src/openvic-simulation/interface/GFXObject.hpp') diff --git a/src/openvic-simulation/interface/GFXObject.hpp b/src/openvic-simulation/interface/GFXObject.hpp index 840e4a9..db15096 100644 --- a/src/openvic-simulation/interface/GFXObject.hpp +++ b/src/openvic-simulation/interface/GFXObject.hpp @@ -24,48 +24,44 @@ namespace OpenVic::GFX { friend std::unique_ptr std::make_unique(); public: - class Attachment : public Named<> { - friend class LoadBase; + class Attachment { + friend class Actor; - private: - std::string PROPERTY(node); - int32_t PROPERTY(attach_id); + public: + using attach_id_t = uint32_t; - protected: - Attachment(); + private: + std::string PROPERTY(actor_name); + std::string PROPERTY(attach_node); + attach_id_t PROPERTY(attach_id); - bool _fill_key_map(NodeTools::case_insensitive_key_map_t& key_map) override; + Attachment(std::string_view new_actor_name, std::string_view new_attach_node, attach_id_t new_attach_id); public: Attachment(Attachment&&) = default; - virtual ~Attachment() = default; }; - class Animation : public Named<> { - friend class LoadBase; + class Animation { + friend class Actor; std::string PROPERTY(file); - fixed_point_t PROPERTY(default_time); + fixed_point_t PROPERTY(scroll_time); - protected: - Animation(); - - bool _fill_key_map(NodeTools::case_insensitive_key_map_t& key_map) override; + Animation(std::string_view new_file, fixed_point_t new_scroll_time); public: Animation(Animation&&) = default; - virtual ~Animation() = default; }; private: - std::string PROPERTY(model_file); - std::string PROPERTY(idle_animation_file); - std::string PROPERTY(move_animation_file); - std::string PROPERTY(attack_animation_file); fixed_point_t PROPERTY(scale); + std::string PROPERTY(model_file); + std::optional PROPERTY(idle_animation); + std::optional PROPERTY(move_animation); + std::optional PROPERTY(attack_animation); + std::vector PROPERTY(attachments); - NamedRegistry IDENTIFIER_REGISTRY(attachment); - NamedRegistry IDENTIFIER_REGISTRY(animation); + bool _set_animation(std::string_view name, std::string_view file, fixed_point_t scroll_time); protected: Actor(); -- cgit v1.2.3-56-ga3b1