fixed event handling and a lot of ID stuff OOPS
This commit is contained in:
@@ -40,6 +40,7 @@ namespace anm2ed::anm2
|
||||
Spritesheet* spritesheet_get(int);
|
||||
bool spritesheet_add(const std::filesystem::path&, const std::filesystem::path&, int&);
|
||||
std::vector<std::string> spritesheet_labels_get();
|
||||
std::vector<int> spritesheet_ids_get();
|
||||
std::set<int> spritesheets_unused();
|
||||
bool spritesheets_deserialize(const std::string&, const std::filesystem::path&, types::merge::Type type,
|
||||
std::string*);
|
||||
@@ -56,11 +57,13 @@ namespace anm2ed::anm2
|
||||
|
||||
void event_add(int&);
|
||||
std::vector<std::string> event_labels_get();
|
||||
std::vector<int> event_ids_get();
|
||||
std::set<int> 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<std::string> sound_labels_get();
|
||||
std::vector<int> sound_ids_get();
|
||||
std::set<int> sounds_unused();
|
||||
bool sounds_deserialize(const std::string&, const std::filesystem::path&, types::merge::Type, std::string*);
|
||||
|
||||
|
||||
@@ -25,6 +25,15 @@ namespace anm2ed::anm2
|
||||
return labels;
|
||||
}
|
||||
|
||||
std::vector<int> Anm2::event_ids_get()
|
||||
{
|
||||
std::vector<int> ids{};
|
||||
ids.emplace_back(-1);
|
||||
for (auto& id : content.events | std::views::keys)
|
||||
ids.emplace_back(id);
|
||||
return ids;
|
||||
}
|
||||
|
||||
std::set<int> Anm2::events_unused()
|
||||
{
|
||||
std::set<int> used{};
|
||||
|
||||
@@ -29,6 +29,15 @@ namespace anm2ed::anm2
|
||||
return labels;
|
||||
}
|
||||
|
||||
std::vector<int> Anm2::sound_ids_get()
|
||||
{
|
||||
std::vector<int> ids{};
|
||||
ids.emplace_back(-1);
|
||||
for (auto& [id, sound] : content.sounds)
|
||||
ids.emplace_back(id);
|
||||
return ids;
|
||||
}
|
||||
|
||||
std::set<int> Anm2::sounds_unused()
|
||||
{
|
||||
std::set<int> used;
|
||||
|
||||
@@ -47,6 +47,14 @@ namespace anm2ed::anm2
|
||||
return labels;
|
||||
}
|
||||
|
||||
std::vector<int> Anm2::spritesheet_ids_get()
|
||||
{
|
||||
std::vector<int> ids{};
|
||||
for (auto& [id, spritesheet] : content.spritesheets)
|
||||
ids.emplace_back(id);
|
||||
return ids;
|
||||
}
|
||||
|
||||
bool Anm2::spritesheets_deserialize(const std::string& string, const std::filesystem::path& directory,
|
||||
merge::Type type, std::string* errorString)
|
||||
{
|
||||
|
||||
+2
-1
@@ -103,10 +103,11 @@ namespace anm2ed::anm2
|
||||
element->SetAttribute("Interpolated", isInterpolated);
|
||||
break;
|
||||
case TRIGGER:
|
||||
element->SetAttribute("EventId", eventID);
|
||||
if (eventID != -1) element->SetAttribute("EventId", eventID);
|
||||
|
||||
for (auto& id : soundIDs)
|
||||
{
|
||||
if (id == -1) continue;
|
||||
auto soundChild = element->InsertNewChildElement("Sound");
|
||||
soundChild->SetAttribute("Id", id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user