- 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.

This commit is contained in:
Christoph Oelckers 2017-02-14 22:51:53 +01:00
parent a6156297ce
commit c5204f34ca
4 changed files with 8 additions and 3 deletions

View file

@ -1021,7 +1021,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlaySound)
if (!looping) 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 else
{ {

View file

@ -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_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_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_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 // sound attenuation values
#define ATTN_NONE 0.f // full volume the entire level #define ATTN_NONE 0.f // full volume the entire level

View file

@ -413,7 +413,8 @@ enum ESoundFlags
CHAN_MAYBE_LOCAL = 16, CHAN_MAYBE_LOCAL = 16,
CHAN_UI = 32, CHAN_UI = 32,
CHAN_NOPAUSE = 64, CHAN_NOPAUSE = 64,
CHAN_PICKUP = (CHAN_ITEM|CHAN_MAYBE_LOCAL) CHAN_PICKUP = (CHAN_ITEM|CHAN_MAYBE_LOCAL),
CHAN_NOSTOP = 4096
}; };

View file

@ -124,7 +124,7 @@ class Lightning : Actor
if ((!thing.player && !thing.bBoss) || !(level.time&1)) if ((!thing.player && !thing.bBoss) || !(level.time&1))
{ {
thing.DamageMobj(self, target, 3, 'Electric'); 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) if (thing.bIsMonster && random[LightningHit]() < 64)
{ {
thing.Howl (); thing.Howl ();