mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
Added A_StopAllSounds.
This commit is contained in:
parent
3a2eaf2bfd
commit
55284d46bf
7 changed files with 47 additions and 1 deletions
|
@ -142,6 +142,14 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_StopSound, NativeStopSound)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_StopAllSounds, S_StopAllActorSounds)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
S_StopAllActorSounds(self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_SoundPitch, S_ChangeActorSoundPitch)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
|
|
@ -498,6 +498,18 @@ void S_StopSound (AActor *actor, int channel)
|
|||
soundEngine->StopSound(SOURCE_Actor, actor, (compatflags & COMPATF_MAGICSILENCE) ? -1 : channel);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_StopAllActorSounds
|
||||
//
|
||||
// Stops all sounds on an actor.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void S_StopAllActorSounds(AActor *actor)
|
||||
{
|
||||
soundEngine->StopAllActorSounds(SOURCE_Actor, actor);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -35,6 +35,7 @@ void S_PlaySound(AActor *a, int chan, EChanFlags flags, FSoundID sid, float vol,
|
|||
void S_StopSound (AActor *ent, int channel);
|
||||
void S_StopSound (const sector_t *sec, int channel);
|
||||
void S_StopSound (const FPolyObj *poly, int channel);
|
||||
void S_StopAllActorSounds(AActor *actor);
|
||||
|
||||
// Moves all sounds from one mobj to another
|
||||
void S_RelinkSound (AActor *from, AActor *to);
|
||||
|
|
|
@ -904,6 +904,29 @@ void SoundEngine::StopSound(int sourcetype, const void* actor, int channel, int
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_StopAllActorSounds
|
||||
//
|
||||
// Stops all sounds on an actor.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void SoundEngine::StopAllActorSounds(int sourcetype, const void* actor)
|
||||
{
|
||||
FSoundChan* chan = Channels;
|
||||
while (chan != nullptr)
|
||||
{
|
||||
FSoundChan* next = chan->NextChan;
|
||||
if (chan->SourceType == sourcetype &&
|
||||
chan->Source == actor)
|
||||
{
|
||||
StopChannel(chan);
|
||||
}
|
||||
chan = next;
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_StopAllChannels
|
||||
|
|
|
@ -307,6 +307,7 @@ public:
|
|||
void StopSoundID(int sound_id);
|
||||
void StopSound(int channel, int sound_id = -1);
|
||||
void StopSound(int sourcetype, const void* actor, int channel, int sound_id = -1);
|
||||
void StopAllActorSounds(int sourcetype, const void* actor);
|
||||
|
||||
void RelinkSound(int sourcetype, const void* from, const void* to, const FVector3* optpos);
|
||||
void ChangeSoundVolume(int sourcetype, const void* source, int channel, double dvolume);
|
||||
|
|
|
@ -1060,6 +1060,7 @@ class Actor : Thinker native
|
|||
native void A_SoundPitch(int slot, double pitch);
|
||||
deprecated("2.3") void A_PlayWeaponSound(sound whattoplay) { A_StartSound(whattoplay, CHAN_WEAPON); }
|
||||
native void A_StopSound(int slot = CHAN_VOICE); // Bad default but that's what is originally was...
|
||||
native void A_StopAllSounds();
|
||||
deprecated("2.3") native void A_PlaySoundEx(sound whattoplay, name slot, bool looping = false, int attenuation = 0);
|
||||
deprecated("2.3") native void A_StopSoundEx(name slot);
|
||||
native clearscope bool IsActorPlayingSound(int channel, Sound snd = 0);
|
||||
|
|
|
@ -326,7 +326,7 @@ class Inventory : Actor
|
|||
bIsMonster = false;
|
||||
ChangeStatNum(STAT_INVENTORY);
|
||||
// stop all sounds this item is playing.
|
||||
for(int i = 1;i<=7;i++) A_StopSound(i);
|
||||
A_StopAllSounds();
|
||||
SetState (FindState("Held"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue