#pragma once #include #include #include #include "types.h" #include "animations.h" #include "content.h" #include "info.h" namespace anm2ed::anm2 { struct Reference { int animationIndex{-1}; Type itemType{NONE}; int itemID{-1}; int frameIndex{-1}; auto operator<=>(const Reference&) const = default; }; class Anm2 { public: bool isValid{true}; Info info{}; Content content{}; Animations animations{}; Anm2(); tinyxml2::XMLElement* to_element(tinyxml2::XMLDocument&, Flags = 0); bool serialize(const std::filesystem::path&, std::string* = nullptr, Flags = 0); std::string to_string(Flags = 0); Anm2(const std::filesystem::path&, std::string* = nullptr); uint64_t hash(); Spritesheet* spritesheet_get(int); bool spritesheet_add(const std::filesystem::path&, const std::filesystem::path&, int&); bool spritesheet_pack(int, int); bool regions_trim(int, const std::set&); std::vector spritesheet_labels_get(); std::vector spritesheet_ids_get(); std::set spritesheets_unused(); bool spritesheets_merge(const std::set&, SpritesheetMergeOrigin, bool, origin::Type); bool spritesheets_deserialize(const std::string&, const std::filesystem::path&, types::merge::Type type, std::string*); std::vector region_labels_get(Spritesheet&); std::vector region_ids_get(Spritesheet&); std::set regions_unused(Spritesheet&); void scan_and_set_regions(); void layer_add(int&); std::set layers_unused(); std::set layers_unused(Animation&); bool layers_deserialize(const std::string&, types::merge::Type, std::string*); void null_add(int&); std::set nulls_unused(); std::set nulls_unused(Animation&); bool nulls_deserialize(const std::string&, types::merge::Type, std::string*); void event_add(int&); std::vector event_labels_get(); std::vector event_ids_get(); std::set events_unused(); bool events_deserialize(const std::string&, types::merge::Type, std::string*); bool sound_add(const std::filesystem::path& directory, const std::filesystem::path& path, int& id); std::vector sound_labels_get(); std::vector sound_ids_get(); std::set sounds_unused(); bool sounds_deserialize(const std::string&, const std::filesystem::path&, types::merge::Type, std::string*); Animation* animation_get(int); std::vector animation_labels_get(); int animations_merge(int, std::set&, types::merge::Type = types::merge::APPEND, bool = true); bool animations_deserialize(const std::string&, int, std::set&, std::string* = nullptr); Item* item_get(int, Type, int = -1); Reference layer_animation_add(Reference = {}, std::string = {}, int = 0, types::destination::Type = types::destination::ALL); Reference null_animation_add(Reference = {}, std::string = {}, bool = false, types::destination::Type = types::destination::ALL); Frame* frame_get(int, Type, int, int = -1); void merge(const Anm2&, const std::filesystem::path&, const std::filesystem::path&); }; }