- separated the channel number from the flags in the sound interface so that the 8 channel limit can be eliminated.

- added Marisa Kirisame's CHAN_OVERLAP flag.
- exported S_IsActorPlayingSomething to ZScript.

The sound API change required deprecating A_PlaySound and S_Sound. There are now new variants S_StartSound and A_StartSound which have two distinct parameters for channel and flags.
This commit is contained in:
Christoph Oelckers 2019-12-16 23:52:39 +01:00
commit e82565373f
43 changed files with 339 additions and 280 deletions

View file

@ -118,7 +118,7 @@ public:
void Serialize(FSerializer &arc);
void MakeSound(int loop, FSoundID id)
{
S_Sound(m_Actor, CHAN_BODY|loop, id, clamp(m_Volume, 0.f, 1.f), m_Atten);
S_Sound(m_Actor, CHAN_BODY, EChanFlags::FromInt(loop), id, clamp(m_Volume, 0.f, 1.f), m_Atten);
}
bool IsPlaying()
{
@ -146,7 +146,7 @@ public:
void Serialize(FSerializer &arc);
void MakeSound(int loop, FSoundID id)
{
S_Sound (m_Poly, CHAN_BODY|loop, id, clamp(m_Volume, 0.f, 1.f), m_Atten);
S_Sound (m_Poly, CHAN_BODY, EChanFlags::FromInt(loop), id, clamp(m_Volume, 0.f, 1.f), m_Atten);
}
bool IsPlaying()
{
@ -174,8 +174,8 @@ public:
void Serialize(FSerializer &arc);
void MakeSound(int loop, FSoundID id)
{
Channel = (Channel & 7) | CHAN_AREA | loop;
S_Sound(m_Sector, Channel, id, clamp(m_Volume, 0.f, 1.f), m_Atten);
// The Channel here may have CHANF_LOOP encoded into it.
S_Sound(m_Sector, Channel & 7, CHANF_AREA | EChanFlags::FromInt(loop| (Channel & ~7)), id, clamp(m_Volume, 0.f, 1.f), m_Atten);
}
bool IsPlaying()
{
@ -1162,7 +1162,7 @@ bool SN_IsMakingLoopingSound (sector_t *sector)
DSeqNode *next = node->NextSequence();
if (node->Source() == (void *)sector)
{
return !!(static_cast<DSeqSectorNode *>(node)->Channel & CHAN_LOOP);
return !!(static_cast<DSeqSectorNode *>(node)->Channel & CHANF_LOOP);
}
node = next;
}
@ -1222,7 +1222,7 @@ void DSeqNode::Tick ()
{
// Does not advance sequencePtr, so it will repeat as necessary.
m_CurrentSoundID = FSoundID(GetData(*m_SequencePtr));
MakeSound (CHAN_LOOP, m_CurrentSoundID);
MakeSound (CHANF_LOOP, m_CurrentSoundID);
}
return;