Cleanup & handle flag conversion in iw3xport
This commit is contained in:
parent
eebc48ab7c
commit
eebd0ae1da
@ -7,12 +7,13 @@ namespace Assets
|
|||||||
void IFxEffectDef::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
|
void IFxEffectDef::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
|
||||||
{
|
{
|
||||||
if (!header->data) this->loadEfx(header, name, builder); // Check if we have an editor fx
|
if (!header->data) this->loadEfx(header, name, builder); // Check if we have an editor fx
|
||||||
if (!header->data /*&& !builder->isPrimaryAsset()*/) this->loadNative(header, name, builder); // Check if there is a native one
|
|
||||||
if (!header->data) this->loadBinary(header, name, builder); // Check if we need to import a new one into the game
|
if (!header->data) this->loadBinary(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
|
||||||
}
|
}
|
||||||
|
|
||||||
void IFxEffectDef::loadFxElemVisuals(Game::FxElemVisuals* visuals, char elemType, Components::ZoneBuilder::Zone* builder, Utils::Stream::Reader* reader)
|
void IFxEffectDef::loadFxElemVisuals(Game::FxElemVisuals* visuals, char elemType, Components::ZoneBuilder::Zone* builder, Utils::Stream::Reader* reader)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (elemType)
|
switch (elemType)
|
||||||
{
|
{
|
||||||
case Game::FX_ELEM_TYPE_MODEL:
|
case Game::FX_ELEM_TYPE_MODEL:
|
||||||
@ -34,10 +35,7 @@ namespace Assets
|
|||||||
if (visuals->soundName)
|
if (visuals->soundName)
|
||||||
{
|
{
|
||||||
visuals->soundName = reader->readCString();
|
visuals->soundName = reader->readCString();
|
||||||
visuals->soundName = "null";
|
|
||||||
Components::Logger::Print("Unable to load sounds yet!\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,22 +298,15 @@ namespace Assets
|
|||||||
alias->volumeFalloffCurve = curve;
|
alias->volumeFalloffCurve = curve;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear the flags from type
|
if (static_cast<Game::snd_alias_type_t>(type.number_value()) == Game::snd_alias_type_t::SAT_LOADED) // Loaded
|
||||||
alias->flags &= ~(0b111 << 7);
|
|
||||||
|
|
||||||
if (type.number_value() == Game::snd_alias_type_t::SAT_LOADED) // Loaded
|
|
||||||
{
|
{
|
||||||
alias->soundFile->type = Game::SAT_LOADED;
|
alias->soundFile->type = Game::SAT_LOADED;
|
||||||
alias->soundFile->u.loadSnd = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, soundFile.string_value().c_str(), builder).loadSnd;
|
alias->soundFile->u.loadSnd = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_LOADED_SOUND, soundFile.string_value().c_str(), builder).loadSnd;
|
||||||
|
|
||||||
// Set the type
|
|
||||||
alias->flags |= (Game::SAT_LOADED & 0b111) << 7;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (type.number_value() == Game::snd_alias_type_t::SAT_STREAMED) // Streamed
|
else if (static_cast<Game::snd_alias_type_t>(type.number_value()) == Game::snd_alias_type_t::SAT_STREAMED) // Streamed
|
||||||
{
|
{
|
||||||
alias->soundFile->type = Game::SAT_STREAMED;
|
alias->soundFile->type = Game::SAT_STREAMED;
|
||||||
alias->flags |= (Game::SAT_STREAMED & 0b111) << 7;
|
|
||||||
std::string streamedFile = soundFile.string_value();
|
std::string streamedFile = soundFile.string_value();
|
||||||
std::string directory = ""s;
|
std::string directory = ""s;
|
||||||
int split = streamedFile.find_last_of('/');
|
int split = streamedFile.find_last_of('/');
|
||||||
@ -363,10 +356,15 @@ namespace Assets
|
|||||||
|
|
||||||
if (alias->volumeFalloffCurve)
|
if (alias->volumeFalloffCurve)
|
||||||
{
|
{
|
||||||
|
if (!builder->loadAsset(Game::XAssetType::ASSET_TYPE_SOUND_CURVE, alias->volumeFalloffCurve))
|
||||||
|
{
|
||||||
|
// (Should never happen, but just in case)
|
||||||
|
alias->volumeFalloffCurve->filename = "$default";
|
||||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_SOUND_CURVE, alias->volumeFalloffCurve);
|
builder->loadAsset(Game::XAssetType::ASSET_TYPE_SOUND_CURVE, alias->volumeFalloffCurve);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Isnd_alias_list_t::save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
void Isnd_alias_list_t::save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user