feat: automatically load anims of weapons in t6

This commit is contained in:
Jan
2024-02-06 23:56:31 +01:00
parent 0a13281295
commit 2dd4eaf54f
6 changed files with 171 additions and 134 deletions

View File

@ -41,7 +41,7 @@ bool InfoStringToStructConverterBase::ParseAsArray(const std::string& value, std
return true;
}
bool InfoStringToStructConverterBase::ParseAsPairs(const std::string& value, std::vector<std::pair<std::string, std::string>>& valueArray) const
bool InfoStringToStructConverterBase::ParseAsPairs(const std::string& value, std::vector<std::pair<std::string, std::string>>& valueArray)
{
std::string key;
auto isKey = true;
@ -227,6 +227,7 @@ bool InfoStringToStructConverterBase::ConvertEnumInt(const std::string& value, c
std::vector<scr_string_t> InfoStringToStructConverterBase::GetUsedScriptStrings() const
{
std::vector<scr_string_t> scrStringList;
scrStringList.reserve(m_used_script_string_list.size());
for (auto scrStr : m_used_script_string_list)
{
scrStringList.push_back(scrStr);
@ -238,6 +239,7 @@ std::vector<scr_string_t> InfoStringToStructConverterBase::GetUsedScriptStrings(
std::vector<XAssetInfoGeneric*> InfoStringToStructConverterBase::GetDependencies() const
{
std::vector<XAssetInfoGeneric*> dependencyList;
dependencyList.reserve(m_dependencies.size());
for (auto* dependency : m_dependencies)
{
dependencyList.push_back(dependency);
@ -245,3 +247,15 @@ std::vector<XAssetInfoGeneric*> InfoStringToStructConverterBase::GetDependencies
return dependencyList;
}
std::vector<IndirectAssetReference> InfoStringToStructConverterBase::GetIndirectAssetReferences() const
{
std::vector<IndirectAssetReference> indirectAssetReferences;
indirectAssetReferences.reserve(m_indirect_asset_references.size());
for (auto& assetReference : m_indirect_asset_references)
{
indirectAssetReferences.emplace_back(assetReference);
}
return indirectAssetReferences;
}

View File

@ -17,11 +17,12 @@ protected:
ZoneScriptStrings& m_zone_script_strings;
std::unordered_set<scr_string_t> m_used_script_string_list;
std::unordered_set<XAssetInfoGeneric*> m_dependencies;
std::unordered_set<IndirectAssetReference> m_indirect_asset_references;
MemoryManager* m_memory;
void* m_structure;
static bool ParseAsArray(const std::string& value, std::vector<std::string>& valueArray);
bool ParseAsPairs(const std::string& value, std::vector<std::pair<std::string, std::string>>& valueArray) const;
static bool ParseAsPairs(const std::string& value, std::vector<std::pair<std::string, std::string>>& valueArray);
bool ConvertString(const std::string& value, size_t offset);
bool ConvertStringBuffer(const std::string& value, size_t offset, size_t bufferSize);
@ -45,4 +46,5 @@ public:
virtual bool Convert() = 0;
_NODISCARD std::vector<scr_string_t> GetUsedScriptStrings() const;
_NODISCARD std::vector<XAssetInfoGeneric*> GetDependencies() const;
_NODISCARD std::vector<IndirectAssetReference> GetIndirectAssetReferences() const;
};