Fix snd/sndcurve not using original assets as fallback, bump IW4Of (#791)

This commit is contained in:
Louve 2023-02-22 10:03:35 +01:00 committed by GitHub
parent 1d59a63c71
commit 7cf8f14f49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 3 deletions

@ -1 +1 @@
Subproject commit f25d31a8946a259d96cbed2e0e432e649f3d24cf
Subproject commit c517856ce3db12557cf77bf53e27d7a411f03e12

View File

@ -8,6 +8,8 @@ namespace Assets
if (!header->data) this->loadEfx(header, name, builder); // Check if we have an editor fx
if (!header->data) this->loadFromIW4OF(header, name, builder); // Check if we need to import a new one into the game
if (!header->data /*&& !builder->isPrimaryAsset()*/) this->loadNative(header, name, builder); // Check if there is a native one
assert(header->data);
}
void IFxEffectDef::loadFxElemVisuals(Game::FxElemVisuals* visuals, char elemType, Components::ZoneBuilder::Zone* builder, Utils::Stream::Reader* reader)

View File

@ -12,7 +12,10 @@ namespace Assets
if (!header->data) this->loadFromDisk(header, name, builder); // Check if we need to import a new one into the game
if (!header->data) this->loadNative(header, name, builder); // Check if there is a native one
assert(header->data);
if (!header->data)
{
AssertUnreachable;
}
}
void IMaterialTechniqueSet::loadNative(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* /*builder*/)

View File

@ -26,5 +26,10 @@ namespace Assets
void ISndCurve::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
{
header->sndCurve = builder->getIW4OfApi()->read<Game::SndCurve>(Game::XAssetType::ASSET_TYPE_SOUND_CURVE, name);
if (!header->sndCurve)
{
header->sndCurve = Components::AssetHandler::FindOriginalAsset(Game::XAssetType::ASSET_TYPE_SOUND_CURVE, name.data()).sndCurve;
}
}
}

View File

@ -8,6 +8,11 @@ namespace Assets
void Isnd_alias_list_t::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
{
header->sound = builder->getIW4OfApi()->read<Game::snd_alias_list_t>(Game::XAssetType::ASSET_TYPE_SOUND, name);
if (!header->sound)
{
header->sound = Components::AssetHandler::FindOriginalAsset(Game::XAssetType::ASSET_TYPE_SOUND_CURVE, name.data()).sound;
}
}
void Isnd_alias_list_t::mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)

View File

@ -761,7 +761,9 @@ namespace Components
iw4of::params_t ZoneBuilder::Zone::getIW4OfApiParams()
{
iw4of::params_t params;
iw4of::params_t params{};
params.write_only_once = true;
params.find_other_asset = [this](int type, const std::string& name) -> void*
{