From c5204f34ca18b03d3daf70f6cc51e582177a5b07 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 14 Feb 2017 22:51:53 +0100 Subject: [PATCH] - fixed: The code to play the mage lightning's attack sound was converted wrong, because it used the same structure as looping sounds normally so, but doesn't actually loop. --- src/p_actionfunctions.cpp | 5 ++++- src/s_sound.h | 1 + wadsrc/static/zscript/constants.txt | 3 ++- wadsrc/static/zscript/hexen/magelightning.txt | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 69ca13f16..40629bfcb 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -1021,7 +1021,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlaySound) if (!looping) { - S_PlaySound(self, channel, soundid, (float)volume, (float)attenuation, local); + if (!(channel & CHAN_NOSTOP) || !S_IsActorPlayingSomething(self, channel & 7, soundid)) + { + S_PlaySound(self, channel, soundid, (float)volume, (float)attenuation, local); + } } else { diff --git a/src/s_sound.h b/src/s_sound.h index d6d2a5403..00c7d0587 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -284,6 +284,7 @@ void S_PlaySound(AActor *a, int chan, FSoundID sid, float vol, float atten, bool #define CHAN_JUSTSTARTED 512 // internal: Sound has not been updated yet. #define CHAN_ABSTIME 1024// internal: Start time is absolute and does not depend on current time. #define CHAN_VIRTUAL 2048// internal: Channel is currently virtual +#define CHAN_NOSTOP 4096// only for A_PlaySound. Does not start if channel is playing something. // sound attenuation values #define ATTN_NONE 0.f // full volume the entire level diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index ef2c4521f..6996da6cc 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -413,7 +413,8 @@ enum ESoundFlags CHAN_MAYBE_LOCAL = 16, CHAN_UI = 32, CHAN_NOPAUSE = 64, - CHAN_PICKUP = (CHAN_ITEM|CHAN_MAYBE_LOCAL) + CHAN_PICKUP = (CHAN_ITEM|CHAN_MAYBE_LOCAL), + CHAN_NOSTOP = 4096 }; diff --git a/wadsrc/static/zscript/hexen/magelightning.txt b/wadsrc/static/zscript/hexen/magelightning.txt index 343c96012..d45162d49 100644 --- a/wadsrc/static/zscript/hexen/magelightning.txt +++ b/wadsrc/static/zscript/hexen/magelightning.txt @@ -124,7 +124,7 @@ class Lightning : Actor if ((!thing.player && !thing.bBoss) || !(level.time&1)) { thing.DamageMobj(self, target, 3, 'Electric'); - A_PlaySound(AttackSound, CHAN_WEAPON, 1, true); + A_PlaySound(AttackSound, CHAN_WEAPON|CHAN_NOSTOP, 1, false); if (thing.bIsMonster && random[LightningHit]() < 64) { thing.Howl ();