- play both land and grunt sound if not the same, even if grunted (emulates pre-virtual behavior)

This commit is contained in:
Rachael Alexanderson 2022-02-17 01:36:38 -05:00
parent 28d9fe68ae
commit c926b7533f
2 changed files with 21 additions and 0 deletions

View file

@ -198,6 +198,22 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_StartSound, A_StartSound)
return 0; return 0;
} }
DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_StartSoundIfNotSame, A_StartSound)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_SOUND(soundid);
PARAM_SOUND(checksoundid);
PARAM_INT(channel);
PARAM_INT(flags);
PARAM_FLOAT(volume);
PARAM_FLOAT(attenuation);
PARAM_FLOAT(pitch);
PARAM_FLOAT(startTime);
if (!S_AreSoundsEquivalent (self, soundid, checksoundid))
A_StartSound(self, soundid, channel, flags, volume, attenuation, pitch, startTime);
return 0;
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, IsActorPlayingSound, S_IsActorPlayingSomething) DEFINE_ACTION_FUNCTION_NATIVE(AActor, IsActorPlayingSound, S_IsActorPlayingSomething)
{ {
PARAM_SELF_PROLOGUE(AActor); PARAM_SELF_PROLOGUE(AActor);

View file

@ -1089,6 +1089,7 @@ class Actor : Thinker native
native void A_WolfAttack(int flags = 0, sound whattoplay = "weapons/pistol", double snipe = 1.0, int maxdamage = 64, int blocksize = 128, int pointblank = 2, int longrange = 4, double runspeed = 160.0, class<Actor> pufftype = "BulletPuff"); native void A_WolfAttack(int flags = 0, sound whattoplay = "weapons/pistol", double snipe = 1.0, int maxdamage = 64, int blocksize = 128, int pointblank = 2, int longrange = 4, double runspeed = 160.0, class<Actor> pufftype = "BulletPuff");
deprecated("4.3", "Use A_StartSound() instead") native clearscope void A_PlaySound(sound whattoplay = "weapons/pistol", int slot = CHAN_BODY, double volume = 1.0, bool looping = false, double attenuation = ATTN_NORM, bool local = false, double pitch = 0.0); deprecated("4.3", "Use A_StartSound() instead") native clearscope void A_PlaySound(sound whattoplay = "weapons/pistol", int slot = CHAN_BODY, double volume = 1.0, bool looping = false, double attenuation = ATTN_NORM, bool local = false, double pitch = 0.0);
native clearscope void A_StartSound(sound whattoplay, int slot = CHAN_BODY, int flags = 0, double volume = 1.0, double attenuation = ATTN_NORM, double pitch = 0.0, double startTime = 0.0); native clearscope void A_StartSound(sound whattoplay, int slot = CHAN_BODY, int flags = 0, double volume = 1.0, double attenuation = ATTN_NORM, double pitch = 0.0, double startTime = 0.0);
native clearscope void A_StartSoundIfNotSame(sound whattoplay, sound checkagainst, int slot = CHAN_BODY, int flags = 0, double volume = 1.0, double attenuation = ATTN_NORM, double pitch = 0.0, double startTime = 0.0);
native void A_SoundVolume(int slot, double volume); native void A_SoundVolume(int slot, double volume);
native void A_SoundPitch(int slot, double pitch); native void A_SoundPitch(int slot, double pitch);
deprecated("2.3", "Use A_StartSound(<sound>, CHAN_WEAPON) instead") void A_PlayWeaponSound(sound whattoplay, bool fullvol = false) { A_StartSound(whattoplay, CHAN_WEAPON, 0, 1, fullvol? ATTN_NONE : ATTN_NORM); } deprecated("2.3", "Use A_StartSound(<sound>, CHAN_WEAPON) instead") void A_PlayWeaponSound(sound whattoplay, bool fullvol = false) { A_StartSound(whattoplay, CHAN_WEAPON, 0, 1, fullvol? ATTN_NONE : ATTN_NORM); }
@ -1307,6 +1308,10 @@ class Actor : Thinker native
{ {
A_StartSound("*land", CHAN_AUTO); A_StartSound("*land", CHAN_AUTO);
} }
else
{
A_StartSoundIfNotSame("*land", "*grunt", CHAN_AUTO);
}
} }
} }
} }