diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 1abe2c93908..c6a6b20f4db 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -988,6 +988,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_SoundVolume) return 0; } +DEFINE_ACTION_FUNCTION(AActor, A_IsPlayingSound) +{ + PARAM_SELF_PROLOGUE(AActor); + PARAM_INT(channel); + PARAM_SOUND(sound); + ACTION_RETURN_BOOL(S_IsActorPlayingSomething(self,channel,sound)); +} + //========================================================================== // // These come from a time when DECORATE constants did not exist yet and diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index 5aa52981d0b..85db21c4b1a 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -53,6 +53,7 @@ #include "serializer.h" #include "v_text.h" #include "g_levellocals.h" +#include "vm.h" // MACROS ------------------------------------------------------------------ @@ -491,6 +492,12 @@ unsigned int S_GetMSLength(FSoundID sound) else return 0; } +DEFINE_ACTION_FUNCTION(DObject,S_GetLength) +{ + PARAM_PROLOGUE; + PARAM_SOUND(sound_id); + ACTION_RETURN_FLOAT(S_GetMSLength(sound_id)/1000.0); +} //========================================================================== // diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 4d61435a667..1dde5793790 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -1010,6 +1010,7 @@ class Actor : Thinker native native void A_StopSound(int slot = CHAN_VOICE); // Bad default but that's what is originally was... 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 ui bool A_IsPlayingSound(int channel = 0, sound sound_id = ""); native void A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10); native action state A_Jump(int chance, statelabel label, ...); native Actor A_SpawnProjectile(class missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET); diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index fe776fcbc1c..804bc7c499d 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -354,6 +354,7 @@ class Object native native static void S_PauseSound (bool notmusic, bool notsfx); native static void S_ResumeSound (bool notsfx); native static bool S_ChangeMusic(String music_name, int order = 0, bool looping = true, bool force = false); + native static float S_GetLength(Sound sound_id); native static uint BAM(double angle); native static void SetMusicVolume(float vol); native static uint MSTime();