mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-09-12 19:47:27 +00:00
feat: load iw4 weapons from raw
This commit is contained in:
@@ -178,21 +178,16 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
|
||||
{
|
||||
if (value.empty())
|
||||
{
|
||||
*reinterpret_cast<void**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset) = nullptr;
|
||||
reinterpret_cast<SndAliasCustom*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset)->name = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
auto* sound = m_loading_manager->LoadDependency(ASSET_TYPE_SOUND, value);
|
||||
auto* name = static_cast<snd_alias_list_name*>(m_memory->Alloc(sizeof(snd_alias_list_name)));
|
||||
name->soundName = m_memory->Dup(value.c_str());
|
||||
|
||||
if (sound == nullptr)
|
||||
{
|
||||
std::cout << "Failed to load sound asset \"" << value << "\"\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_dependencies.emplace(sound);
|
||||
*reinterpret_cast<void**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset) = sound->m_ptr;
|
||||
reinterpret_cast<SndAliasCustom*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset)->name = name;
|
||||
|
||||
m_indirect_asset_references.emplace(ASSET_TYPE_SOUND, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user