mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-20 08:20:52 +00:00
Lua funcs MidiPlaying/MusicPlaying
This commit is contained in:
parent
d47d18998b
commit
c6f63d9e9b
1 changed files with 32 additions and 0 deletions
|
@ -2270,6 +2270,36 @@ static int lib_sStopMusic(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_sMidiPlaying(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
lua_pushboolean(L, S_MIDIPlaying());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sMusicPlaying(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
lua_pushboolean(L, S_MusicPlaying());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sOriginPlaying(lua_State *L)
|
||||
{
|
||||
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
|
@ -2648,6 +2678,8 @@ static luaL_Reg lib[] = {
|
|||
{"S_ChangeMusic",lib_sChangeMusic},
|
||||
{"S_SpeedMusic",lib_sSpeedMusic},
|
||||
{"S_StopMusic",lib_sStopMusic},
|
||||
{"S_MidiPlaying",lib_sMidiPlaying},
|
||||
{"S_MusicPlaying",lib_sMusicPlaying},
|
||||
{"S_OriginPlaying",lib_sOriginPlaying},
|
||||
{"S_IdPlaying",lib_sIdPlaying},
|
||||
{"S_SoundPlaying",lib_sSoundPlaying},
|
||||
|
|
Loading…
Reference in a new issue