From 1fe241c7e5007dd2fa2f6a460fb1b4fb8f7c034c Mon Sep 17 00:00:00 2001 From: rackover Date: Tue, 13 Apr 2021 10:28:10 +0200 Subject: [PATCH] Load weapon sounds with zonebuilder --- .../Modules/AssetInterfaces/IWeapon.cpp | 78 +++++++++++++++++-- 1 file changed, 73 insertions(+), 5 deletions(-) diff --git a/src/Components/Modules/AssetInterfaces/IWeapon.cpp b/src/Components/Modules/AssetInterfaces/IWeapon.cpp index c325e8e7..cf98af0a 100644 --- a/src/Components/Modules/AssetInterfaces/IWeapon.cpp +++ b/src/Components/Modules/AssetInterfaces/IWeapon.cpp @@ -15,9 +15,9 @@ namespace Assets } } - void IWeapon::mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) - { - Game::WeaponCompleteDef* asset = header.weapon; + void IWeapon::mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) + { + Game::WeaponCompleteDef* asset = header.weapon; // convert all script strings if (asset->hideTags) @@ -64,7 +64,7 @@ namespace Assets builder->addScriptString(asset->weapDef->notetrackRumbleMapValues[i]); } } - + // now load all sub-assets properly if (asset->killIcon) builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->killIcon); @@ -119,7 +119,75 @@ namespace Assets if (asset->weapDef->projBeaconEffect) builder->loadAsset(Game::XAssetType::ASSET_TYPE_FX, asset->weapDef->projBeaconEffect); if (asset->weapDef->projIgnitionEffect) builder->loadAsset(Game::XAssetType::ASSET_TYPE_FX, asset->weapDef->projIgnitionEffect); if (asset->weapDef->turretOverheatEffect) builder->loadAsset(Game::XAssetType::ASSET_TYPE_FX, asset->weapDef->turretOverheatEffect); - } + +#define LoadWeapSound(sound) if (asset->weapDef->##sound##) builder->loadAsset(Game::XAssetType::ASSET_TYPE_SOUND, asset->weapDef->##sound##) + + LoadWeapSound(pickupSound); + LoadWeapSound(pickupSoundPlayer); + LoadWeapSound(ammoPickupSound); + LoadWeapSound(ammoPickupSoundPlayer); + LoadWeapSound(projectileSound); + LoadWeapSound(pullbackSound); + LoadWeapSound(pullbackSoundPlayer); + LoadWeapSound(fireSound); + LoadWeapSound(fireSoundPlayer); + LoadWeapSound(fireSoundPlayerAkimbo); + LoadWeapSound(fireLoopSound); + LoadWeapSound(fireLoopSoundPlayer); + LoadWeapSound(fireStopSound); + LoadWeapSound(fireStopSoundPlayer); + LoadWeapSound(fireLastSound); + LoadWeapSound(fireLastSoundPlayer); + LoadWeapSound(emptyFireSound); + LoadWeapSound(emptyFireSoundPlayer); + LoadWeapSound(meleeSwipeSound); + LoadWeapSound(meleeSwipeSoundPlayer); + LoadWeapSound(meleeHitSound); + LoadWeapSound(meleeMissSound); + LoadWeapSound(rechamberSound); + LoadWeapSound(rechamberSoundPlayer); + LoadWeapSound(reloadSound); + LoadWeapSound(reloadSoundPlayer); + LoadWeapSound(reloadEmptySound); + LoadWeapSound(reloadEmptySoundPlayer); + LoadWeapSound(reloadStartSound); + LoadWeapSound(reloadStartSoundPlayer); + LoadWeapSound(reloadEndSound); + LoadWeapSound(reloadEndSoundPlayer); + LoadWeapSound(detonateSound); + LoadWeapSound(detonateSoundPlayer); + LoadWeapSound(nightVisionWearSound); + LoadWeapSound(nightVisionWearSoundPlayer); + LoadWeapSound(nightVisionRemoveSound); + LoadWeapSound(nightVisionRemoveSoundPlayer); + LoadWeapSound(altSwitchSound); + LoadWeapSound(altSwitchSoundPlayer); + LoadWeapSound(raiseSound); + LoadWeapSound(raiseSoundPlayer); + LoadWeapSound(firstRaiseSound); + LoadWeapSound(firstRaiseSoundPlayer); + LoadWeapSound(putawaySound); + 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); + + LoadWeapSound(projExplosionSound); + LoadWeapSound(projDudSound); + LoadWeapSound(projIgnitionSound); + LoadWeapSound(turretOverheatSound); + LoadWeapSound(turretBarrelSpinMaxSnd); + + for (size_t i = 0; i < 4; i++) + { + LoadWeapSound(turretBarrelSpinUpSnd[i]); + LoadWeapSound(turretBarrelSpinDownSnd[i]); + } + + LoadWeapSound(missileConeSoundAlias); + LoadWeapSound(missileConeSoundAliasAtBase); + } void IWeapon::writeWeaponDef(Game::WeaponDef* def, Components::ZoneBuilder::Zone* builder, Utils::Stream* buffer) {