From 3e9b05d8cefe37943d0f411d77e0f1dc30ce5620 Mon Sep 17 00:00:00 2001 From: rackover Date: Tue, 13 Apr 2021 19:54:09 +0200 Subject: [PATCH] Load bounce sounds, better soundalias structure --- src/Components/Modules/AssetInterfaces/IWeapon.cpp | 9 +++++++-- .../Modules/AssetInterfaces/Isnd_alias_list_t.cpp | 12 +++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Components/Modules/AssetInterfaces/IWeapon.cpp b/src/Components/Modules/AssetInterfaces/IWeapon.cpp index cf98af0a..350006d9 100644 --- a/src/Components/Modules/AssetInterfaces/IWeapon.cpp +++ b/src/Components/Modules/AssetInterfaces/IWeapon.cpp @@ -170,8 +170,13 @@ namespace Assets LoadWeapSound(putawaySoundPlayer); LoadWeapSound(scanSound); - // No idea how to handle this! - //if (asset->weapDef->bounceSound && *asset->weapDef->bounceSound) builder->loadAsset(Game::XAssetType::ASSET_TYPE_SOUND, *asset->weapDef->bounceSound); + if (asset->weapDef->bounceSound) + { + for (size_t i = 0; i < 31; i++) + { + LoadWeapSound(bounceSound[i]); + } + } LoadWeapSound(projExplosionSound); LoadWeapSound(projDudSound); diff --git a/src/Components/Modules/AssetInterfaces/Isnd_alias_list_t.cpp b/src/Components/Modules/AssetInterfaces/Isnd_alias_list_t.cpp index 02966b04..f14e00b5 100644 --- a/src/Components/Modules/AssetInterfaces/Isnd_alias_list_t.cpp +++ b/src/Components/Modules/AssetInterfaces/Isnd_alias_list_t.cpp @@ -34,7 +34,7 @@ namespace Assets return; } - aliasList->aliasName = builder->getAllocator()->duplicateString(infoData["aliasName"].string_value().c_str()); + aliasList->aliasName = builder->getAllocator()->duplicateString(name.c_str()); for (size_t i = 0; i < aliasList->count; i++) { @@ -79,6 +79,7 @@ namespace Assets auto envelopMax = head["envelopMax"]; auto envelopPercentage = head["envelopPercentage"]; auto speakerMap = head["speakerMap"]; + auto aliasName = head["aliasName"]; // Fix casing if (soundFile.is_null()) @@ -109,6 +110,11 @@ namespace Assets Components::Logger::Print("%s is not string but %d (%s)\n", "subtitle", subtitle.type(), subtitle.dump().c_str()); } + if (!CHECK(aliasName, string)) + { + Components::Logger::Print("%s is not string but %d (%s)\n", "aliasName", aliasName.type(), aliasName.dump().c_str()); + } + if (!CHECK(secondaryAliasName, string)) { Components::Logger::Print("%s is not string but %d (%s)\n", "secondaryAliasName", secondaryAliasName.type(), secondaryAliasName.dump().c_str()); @@ -195,7 +201,7 @@ namespace Assets } - if (CHECK(type, number) && CHECK(subtitle, string) && CHECK(secondaryAliasName, string) && CHECK(chainAliasName, string) && + if (CHECK(type, number) && CHECK(aliasName, string) && CHECK(subtitle, string) && CHECK(secondaryAliasName, string) && CHECK(chainAliasName, string) && CHECK(soundFile, string) && CHECK(sequence, number) && CHECK(volMin, number) && CHECK(volMax, number) && CHECK(pitchMin, number) && CHECK(pitchMax, number) && CHECK(distMin, number) && CHECK(distMax, number) && CHECK(flags, number) && CHECK(slavePercentage, number) && CHECK(probability, number) && CHECK(lfePercentage, number) && CHECK(centerPercentage, number) && CHECK(startDelay, number) && @@ -204,7 +210,7 @@ namespace Assets { alias->soundFile->exists = true; - alias->aliasName = aliasList->aliasName; + alias->aliasName = builder->getAllocator()->duplicateString(aliasName.string_value().c_str()); if (subtitle.is_string()) {