Exported S_IsActorPlayingSomething and S_GetMSLength to ZScript.

Added missing vm.h include, moved A_IsPlayingSound to p_actionfunctions.cpp.

- make A_IsPlayingSound ui only
This commit is contained in:
Marisa Kirisame 2018-01-07 00:42:37 +01:00 committed by Christoph Oelckers
parent d5d393aaf2
commit a01ca4c3a1
4 changed files with 17 additions and 0 deletions

View file

@ -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

View file

@ -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);
}
//==========================================================================
//

View file

@ -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<Actor> missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET);

View file

@ -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();