Skip to content

Commit

Permalink
Exported S_IsActorPlayingSomething and S_GetMSLength to ZScript.
Browse files Browse the repository at this point in the history
Added missing vm.h include, moved A_IsPlayingSound to p_actionfunctions.cpp.

- make A_IsPlayingSound ui only
  • Loading branch information
Marisa Kirisame authored and coelckers committed Jan 20, 2018
1 parent d5d393a commit a01ca4c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/p_actionfunctions.cpp
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/s_advsound.cpp
Expand Up @@ -53,6 +53,7 @@
#include "serializer.h"
#include "v_text.h"
#include "g_levellocals.h"
#include "vm.h"

// MACROS ------------------------------------------------------------------

Expand Down Expand Up @@ -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);
}

//==========================================================================
//
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/actor.txt
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/base.txt
Expand Up @@ -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();
Expand Down

0 comments on commit a01ca4c

Please sign in to comment.