From 4b3ca26f6ebf79ef398a87b5d76383f9c59e3b70 Mon Sep 17 00:00:00 2001 From: pongo1231 Date: Sat, 18 Jan 2025 01:21:08 +0000 Subject: [PATCH] ChaosMod/EffectSound3D: Stop FollowEntity effect sounds on entity death by default --- ChaosMod/Components/EffectSound/EffectSound3D.cpp | 2 +- ChaosMod/Components/LuaScripts.cpp | 4 ++-- ChaosMod/Effects/EffectSoundPlayOptions.h | 4 ++-- ChaosMod/Effects/db/Peds/PedsSpawnAngryJesus.cpp | 4 +--- ChaosMod/Effects/db/Peds/PedsSpawnImpotentRage.cpp | 4 +--- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ChaosMod/Components/EffectSound/EffectSound3D.cpp b/ChaosMod/Components/EffectSound/EffectSound3D.cpp index 5fdbf95af..f7f13858e 100644 --- a/ChaosMod/Components/EffectSound/EffectSound3D.cpp +++ b/ChaosMod/Components/EffectSound/EffectSound3D.cpp @@ -106,7 +106,7 @@ void EffectSound3D::OnRun() case EffectSoundPlayType::FollowEntity: { if (!sound.PlayOptions.Entity || !DOES_ENTITY_EXIST(sound.PlayOptions.Entity) - || (sound.PlayOptions.PlayFlags & EffectSoundPlayFlags_StopOnEntityDeath + || (!(sound.PlayOptions.PlayFlags & EffectSoundPlayFlags_DontStopOnEntityDeath) && IS_ENTITY_DEAD(sound.PlayOptions.Entity, false))) { uninitSound(); diff --git a/ChaosMod/Components/LuaScripts.cpp b/ChaosMod/Components/LuaScripts.cpp index 39840fd5d..cdd17f6fe 100644 --- a/ChaosMod/Components/LuaScripts.cpp +++ b/ChaosMod/Components/LuaScripts.cpp @@ -852,8 +852,8 @@ LuaScripts::ParseScriptRaw(std::string scriptName, std::string_view script, Pars [effectId, getEffectSoundPlayOptions](const sol::this_state &lua, bool state) { auto soundPlayOptions = getEffectSoundPlayOptions(); - soundPlayOptions->PlayFlags = state ? soundPlayOptions->PlayFlags | EffectSoundPlayFlags_StopOnEntityDeath - : soundPlayOptions->PlayFlags & ~EffectSoundPlayFlags_StopOnEntityDeath; + soundPlayOptions->PlayFlags = state ? soundPlayOptions->PlayFlags & ~EffectSoundPlayFlags_DontStopOnEntityDeath + : soundPlayOptions->PlayFlags | EffectSoundPlayFlags_DontStopOnEntityDeath; }; EffectData effectData; diff --git a/ChaosMod/Effects/EffectSoundPlayOptions.h b/ChaosMod/Effects/EffectSoundPlayOptions.h index 9bfb02ad2..de82b5d5b 100644 --- a/ChaosMod/Effects/EffectSoundPlayOptions.h +++ b/ChaosMod/Effects/EffectSoundPlayOptions.h @@ -11,8 +11,8 @@ enum class EffectSoundPlayType enum EffectSoundPlayFlags { - EffectSoundPlayFlags_Looping = (1 << 0), - EffectSoundPlayFlags_StopOnEntityDeath = (1 << 1) + EffectSoundPlayFlags_Looping = (1 << 0), + EffectSoundPlayFlags_DontStopOnEntityDeath = (1 << 1) }; struct EffectSoundPlayOptions diff --git a/ChaosMod/Effects/db/Peds/PedsSpawnAngryJesus.cpp b/ChaosMod/Effects/db/Peds/PedsSpawnAngryJesus.cpp index 19844290d..398bbfb0d 100644 --- a/ChaosMod/Effects/db/Peds/PedsSpawnAngryJesus.cpp +++ b/ChaosMod/Effects/db/Peds/PedsSpawnAngryJesus.cpp @@ -19,9 +19,7 @@ static void OnStart() auto ped = CreatePoolPed(4, modelHash, playerPos.x, playerPos.y, playerPos.z, 0.f); CurrentEffect::SetEffectSoundPlayOptions( - { .PlayType = EffectSoundPlayType::FollowEntity, - .PlayFlags = EffectSoundPlayFlags_Looping | EffectSoundPlayFlags_StopOnEntityDeath, - .Entity = ped }); + { .PlayType = EffectSoundPlayType::FollowEntity, .PlayFlags = EffectSoundPlayFlags_Looping, .Entity = ped }); if (IS_PED_IN_ANY_VEHICLE(playerPed, false)) SET_PED_INTO_VEHICLE(ped, GET_VEHICLE_PED_IS_IN(playerPed, false), -2); diff --git a/ChaosMod/Effects/db/Peds/PedsSpawnImpotentRage.cpp b/ChaosMod/Effects/db/Peds/PedsSpawnImpotentRage.cpp index 6c17714c0..4625c32e9 100644 --- a/ChaosMod/Effects/db/Peds/PedsSpawnImpotentRage.cpp +++ b/ChaosMod/Effects/db/Peds/PedsSpawnImpotentRage.cpp @@ -19,9 +19,7 @@ static void OnStart() Ped ped = CreatePoolPed(4, model, playerPos.x, playerPos.y, playerPos.z, GET_ENTITY_HEADING(playerPed)); CurrentEffect::SetEffectSoundPlayOptions( - { .PlayType = EffectSoundPlayType::FollowEntity, - .PlayFlags = EffectSoundPlayFlags_Looping | EffectSoundPlayFlags_StopOnEntityDeath, - .Entity = ped }); + { .PlayType = EffectSoundPlayType::FollowEntity, .PlayFlags = EffectSoundPlayFlags_Looping, .Entity = ped }); SET_ENTITY_HEALTH(ped, 1000, 0); SET_PED_ARMOUR(ped, 1000);