From d08bb93b84b9f52cd1801d5372b0f8ba99b45491 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 30 Dec 2019 09:47:25 +0100 Subject: [PATCH] - elimintated all cases from the ZScript code where channel indices and flags were combined into one parameter and removed all remnants of CHAN_PICKUP. --- src/sound/backend/i_soundinternal.h | 2 -- src/sound/s_soundinternal.h | 1 - wadsrc/static/zscript/actors/hexen/magelightning.zs | 2 +- wadsrc/static/zscript/actors/inventory/inventory.zs | 9 ++++++--- wadsrc/static/zscript/constants.zs | 11 ++++++++++- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/sound/backend/i_soundinternal.h b/src/sound/backend/i_soundinternal.h index 08dd311a2b..823f672b7b 100644 --- a/src/sound/backend/i_soundinternal.h +++ b/src/sound/backend/i_soundinternal.h @@ -20,8 +20,6 @@ enum EChanFlag CHANF_AREA = 128, // Sound plays from all around. Only valid with sector sounds. CHANF_LOOP = 256, - CHANF_PICKUP = CHANF_MAYBE_LOCAL, - CHANF_NONE = 0, CHANF_IS3D = 1, // internal: Sound is 3D. CHANF_EVICTED = 2, // internal: Sound was evicted. diff --git a/src/sound/s_soundinternal.h b/src/sound/s_soundinternal.h index 2865e766b2..09cffbcf96 100644 --- a/src/sound/s_soundinternal.h +++ b/src/sound/s_soundinternal.h @@ -192,7 +192,6 @@ struct FSoundChan : public FISoundChannel // CHAN_VOICE is for oof, sight, or other voice sounds // CHAN_ITEM is for small things and item pickup // CHAN_BODY is for generic body sounds -// CHAN_PICKUP can optionally be set as a local sound only for "compatibility" enum EChannel { diff --git a/wadsrc/static/zscript/actors/hexen/magelightning.zs b/wadsrc/static/zscript/actors/hexen/magelightning.zs index 5ece4fd80f..f68defe9d8 100644 --- a/wadsrc/static/zscript/actors/hexen/magelightning.zs +++ b/wadsrc/static/zscript/actors/hexen/magelightning.zs @@ -124,7 +124,7 @@ class Lightning : Actor if ((!thing.player && !thing.bBoss) || !(Level.maptime & 1)) { thing.DamageMobj(self, target, 3, 'Electric'); - A_PlaySound(AttackSound, CHAN_WEAPON|CHAN_NOSTOP, 1, false); + A_StartSound(AttackSound, CHAN_WEAPON, CHANF_NOSTOP, 1, false); if (thing.bIsMonster && random[LightningHit]() < 64) { thing.Howl (); diff --git a/wadsrc/static/zscript/actors/inventory/inventory.zs b/wadsrc/static/zscript/actors/inventory/inventory.zs index 98db7e9aaa..ca6d48de28 100644 --- a/wadsrc/static/zscript/actors/inventory/inventory.zs +++ b/wadsrc/static/zscript/actors/inventory/inventory.zs @@ -1046,6 +1046,7 @@ class Inventory : Actor { double atten; int chan; + int flags = 0; if (bNoAttenPickupSound) { @@ -1065,13 +1066,15 @@ class Inventory : Actor if (toucher != NULL && toucher.CheckLocalView()) { - chan = CHAN_PICKUP|CHAN_NOPAUSE; + chan = CHAN_ITEM; + flags = CHANF_NOPAUSE | CHANF_MAYBE_LOCAL; } else { - chan = CHAN_PICKUP; + chan = CHAN_ITEM; + flags = CHANF_MAYBE_LOCAL; } - toucher.A_PlaySound(PickupSound, chan, 1, false, atten); + toucher.A_StartSound(PickupSound, chan, flags, 1, false, atten); } //=========================================================================== diff --git a/wadsrc/static/zscript/constants.zs b/wadsrc/static/zscript/constants.zs index 2b299e7778..bd6207dc3f 100644 --- a/wadsrc/static/zscript/constants.zs +++ b/wadsrc/static/zscript/constants.zs @@ -418,10 +418,19 @@ enum ESoundFlags CHAN_UI = 32, CHAN_NOPAUSE = 64, CHAN_LOOP = 256, - CHAN_PICKUP = (CHAN_ITEM|CHAN_MAYBE_LOCAL), + CHAN_PICKUP = (CHAN_ITEM|CHAN_MAYBE_LOCAL), // Do not use this with A_StartSound! It would not do what is expected. CHAN_NOSTOP = 4096, CHAN_OVERLAP = 8192, + // Same as above, with an F appended to allow better distinction of channel and channel flags. + CHANF_LISTENERZ = 8, + CHANF_MAYBE_LOCAL = 16, + CHANF_UI = 32, + CHANF_NOPAUSE = 64, + CHANF_LOOP = 256, + CHANF_NOSTOP = 4096, + CHANF_OVERLAP = 8192, + }; // sound attenuation values