mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- PlayMusic script function.
This commit is contained in:
parent
d98a567597
commit
b2545f8042
3 changed files with 15 additions and 5 deletions
|
@ -1014,6 +1014,20 @@ DEFINE_ACTION_FUNCTION_NATIVE(_System, StopAllSounds, StopAllSounds)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int PlayMusic(const FString& musname, int order, int looped)
|
||||
{
|
||||
return S_ChangeMusic(musname, order, !!looped, true);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_System, PlayMusic, PlayMusic)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_STRING(name);
|
||||
PARAM_INT(order);
|
||||
PARAM_BOOL(looped);
|
||||
ACTION_RETURN_BOOL(PlayMusic(name, order, looped));
|
||||
}
|
||||
|
||||
static void Mus_Stop()
|
||||
{
|
||||
S_StopMusic(true);
|
||||
|
|
|
@ -190,14 +190,9 @@ static FString LookupMusicCB(const char* musicname, int& order)
|
|||
}
|
||||
|
||||
|
||||
static FString lastMusic;
|
||||
int Mus_Play(const char *fn, bool loop)
|
||||
{
|
||||
if (mus_blocked) return 1; // Caller should believe it succeeded.
|
||||
if (*fn == '/') fn++;
|
||||
// Store the requested names for resuming.
|
||||
lastMusic = fn;
|
||||
|
||||
return S_ChangeMusic(fn, 0, loop, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -188,6 +188,7 @@ struct _ native // These are the global variables, the struct is only here to av
|
|||
|
||||
struct System native
|
||||
{
|
||||
native static void PlayMusic(String mus, int order = 0, bool looped = true);
|
||||
native static void StopMusic();
|
||||
native static void StopAllSounds();
|
||||
native static bool SoundEnabled();
|
||||
|
|
Loading…
Reference in a new issue