- 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

@ -1194,7 +1194,7 @@ bool AActor::Grind(bool items)
SetState (state);
if (isgeneric) // Not a custom crush state, so colorize it appropriately.
{
S_Sound (this, CHAN_BODY, "misc/fallingsplat", 1, ATTN_IDLE);
S_Sound (this, CHAN_BODY, 0, "misc/fallingsplat", 1, ATTN_IDLE);
Translation = BloodTranslation;
}
return false;
@ -1238,7 +1238,7 @@ bool AActor::Grind(bool items)
gib->radius = 0;
gib->Translation = BloodTranslation;
}
S_Sound (this, CHAN_BODY, "misc/fallingsplat", 1, ATTN_IDLE);
S_Sound (this, CHAN_BODY, 0, "misc/fallingsplat", 1, ATTN_IDLE);
}
if (flags & MF_ICECORPSE)
{
@ -1437,7 +1437,7 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target, bool onsky, FNa
// play the sound before changing the state, so that AActor::OnDestroy can call S_RelinkSounds on it and the death state can override it.
if (mo->DeathSound)
{
S_Sound (mo, CHAN_VOICE, mo->DeathSound, 1,
S_Sound (mo, CHAN_VOICE, 0, mo->DeathSound, 1,
(mo->flags3 & MF3_FULLVOLDEATH) ? ATTN_NONE : ATTN_NORM);
}
@ -1501,15 +1501,15 @@ void AActor::PlayBounceSound(bool onfloor)
{
if (BounceFlags & BOUNCE_UseSeeSound)
{
S_Sound (this, CHAN_VOICE, SeeSound, 1, ATTN_IDLE);
S_Sound (this, CHAN_VOICE, 0, SeeSound, 1, ATTN_IDLE);
}
else if (onfloor || WallBounceSound <= 0)
{
S_Sound (this, CHAN_VOICE, BounceSound, 1, ATTN_IDLE);
S_Sound (this, CHAN_VOICE, 0, BounceSound, 1, ATTN_IDLE);
}
else
{
S_Sound (this, CHAN_VOICE, WallBounceSound, 1, ATTN_IDLE);
S_Sound (this, CHAN_VOICE, 0, WallBounceSound, 1, ATTN_IDLE);
}
}
}
@ -2786,14 +2786,14 @@ static void PlayerLandedOnThing (AActor *mo, AActor *onmobj)
// Why should this number vary by gravity?
if (mo->Vel.Z < -mo->player->mo->FloatVar(NAME_GruntSpeed))
{
S_Sound (mo, CHAN_VOICE, "*grunt", 1, ATTN_NORM);
S_Sound (mo, CHAN_VOICE, 0, "*grunt", 1, ATTN_NORM);
grunted = true;
}
if (onmobj != NULL || !Terrains[P_GetThingFloorType (mo)].IsLiquid)
{
if (!grunted || !S_AreSoundsEquivalent (mo, "*grunt", "*land"))
{
S_Sound (mo, CHAN_AUTO, "*land", 1, ATTN_NORM);
S_Sound (mo, CHAN_AUTO, 0, "*land", 1, ATTN_NORM);
}
}
}
@ -3107,7 +3107,7 @@ void AActor::Howl ()
FSoundID howl = SoundVar(NAME_HowlSound);
if (!S_IsActorPlayingSomething(this, CHAN_BODY, howl))
{
S_Sound (this, CHAN_BODY, howl, 1, ATTN_NORM);
S_Sound (this, CHAN_BODY, 0, howl, 1, ATTN_NORM);
}
}
@ -3267,7 +3267,7 @@ void AActor::PlayActiveSound ()
{
if (ActiveSound && !S_IsActorPlayingSomething (this, CHAN_VOICE, -1))
{
S_Sound (this, CHAN_VOICE, ActiveSound, 1,
S_Sound (this, CHAN_VOICE, 0, ActiveSound, 1,
(flags3 & MF3_FULLVOLACTIVE) ? ATTN_NONE : ATTN_IDLE);
}
}
@ -4353,7 +4353,7 @@ bool AActor::UpdateWaterLevel(bool dosplash)
if (oldlevel < 3 && waterlevel == 3)
{
// Our head just went under.
S_Sound(this, CHAN_VOICE, "*dive", 1, ATTN_NORM);
S_Sound(this, CHAN_VOICE, 0, "*dive", 1, ATTN_NORM);
}
else if (oldlevel == 3 && waterlevel < 3)
{
@ -4361,7 +4361,7 @@ bool AActor::UpdateWaterLevel(bool dosplash)
if (player->air_finished > Level->maptime)
{
// We hadn't run out of air yet.
S_Sound(this, CHAN_VOICE, "*surface", 1, ATTN_NORM);
S_Sound(this, CHAN_VOICE, 0, "*surface", 1, ATTN_NORM);
}
// If we were running out of air, then ResetAirSupply() will play *gasp.
}
@ -5669,11 +5669,11 @@ AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, const DVector3 &pos1
if ((flags & PF_HITTHING) && puff->SeeSound)
{ // Hit thing sound
S_Sound (puff, CHAN_BODY, puff->SeeSound, 1, ATTN_NORM);
S_Sound (puff, CHAN_BODY, 0, puff->SeeSound, 1, ATTN_NORM);
}
else if (puff->AttackSound)
{
S_Sound (puff, CHAN_BODY, puff->AttackSound, 1, ATTN_NORM);
S_Sound (puff, CHAN_BODY, 0, puff->AttackSound, 1, ATTN_NORM);
}
}
@ -6100,13 +6100,13 @@ foundone:
}
if (mo)
{
S_Sound(mo, CHAN_ITEM, smallsplash ?
S_Sound(mo, CHAN_ITEM, 0, smallsplash ?
splash->SmallSplashSound : splash->NormalSplashSound,
1, ATTN_IDLE);
}
else
{
S_Sound(thing->Level, pos, CHAN_ITEM, smallsplash ?
S_Sound(thing->Level, pos, CHAN_ITEM, 0, smallsplash ?
splash->SmallSplashSound : splash->NormalSplashSound,
1, ATTN_IDLE);
}
@ -6303,18 +6303,18 @@ void P_PlaySpawnSound(AActor *missile, AActor *spawner)
{
if (!(missile->flags & MF_SPAWNSOUNDSOURCE))
{
S_Sound (missile, CHAN_VOICE, missile->SeeSound, 1, ATTN_NORM);
S_Sound (missile, CHAN_VOICE, 0, missile->SeeSound, 1, ATTN_NORM);
}
else if (spawner != NULL)
{
S_Sound (spawner, CHAN_WEAPON, missile->SeeSound, 1, ATTN_NORM);
S_Sound (spawner, CHAN_WEAPON, 0, missile->SeeSound, 1, ATTN_NORM);
}
else
{
// If there is no spawner use the spawn position.
// But not in a silenced sector.
if (!(missile->Sector->Flags & SECF_SILENT))
S_Sound (missile->Level, missile->Pos(), CHAN_WEAPON, missile->SeeSound, 1, ATTN_NORM);
S_Sound (missile->Level, missile->Pos(), CHAN_WEAPON, 0, missile->SeeSound, 1, ATTN_NORM);
}
}
}