mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Disable NOHUD/INLEVEL checks on Lua sound functions
None of these are implicitly sync-safe anyway, and most have no need to be walled off from HUD code or intermission thinkers.
This commit is contained in:
parent
0770f77371
commit
283bb52e7d
1 changed files with 17 additions and 19 deletions
|
@ -1675,8 +1675,8 @@ static int lib_pPlayVictorySound(lua_State *L)
|
||||||
static int lib_pPlayLivesJingle(lua_State *L)
|
static int lib_pPlayLivesJingle(lua_State *L)
|
||||||
{
|
{
|
||||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
NOHUD
|
//NOHUD
|
||||||
INLEVEL
|
//INLEVEL
|
||||||
if (!player)
|
if (!player)
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
P_PlayLivesJingle(player);
|
P_PlayLivesJingle(player);
|
||||||
|
@ -2342,7 +2342,7 @@ static int lib_sStartSound(lua_State *L)
|
||||||
const void *origin = NULL;
|
const void *origin = NULL;
|
||||||
sfxenum_t sound_id = luaL_checkinteger(L, 2);
|
sfxenum_t sound_id = luaL_checkinteger(L, 2);
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
//NOHUD // kys @whoever did this.
|
//NOHUD
|
||||||
if (sound_id >= NUMSFX)
|
if (sound_id >= NUMSFX)
|
||||||
return luaL_error(L, "sfx %d out of range (0 - %d)", sound_id, NUMSFX-1);
|
return luaL_error(L, "sfx %d out of range (0 - %d)", sound_id, NUMSFX-1);
|
||||||
if (!lua_isnil(L, 1))
|
if (!lua_isnil(L, 1))
|
||||||
|
@ -2373,7 +2373,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
|
||||||
sfxenum_t sound_id = luaL_checkinteger(L, 2);
|
sfxenum_t sound_id = luaL_checkinteger(L, 2);
|
||||||
INT32 volume = (INT32)luaL_checkinteger(L, 3);
|
INT32 volume = (INT32)luaL_checkinteger(L, 3);
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
NOHUD
|
//NOHUD
|
||||||
|
|
||||||
if (!lua_isnil(L, 1))
|
if (!lua_isnil(L, 1))
|
||||||
{
|
{
|
||||||
|
@ -2397,7 +2397,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
|
||||||
static int lib_sStopSound(lua_State *L)
|
static int lib_sStopSound(lua_State *L)
|
||||||
{
|
{
|
||||||
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
NOHUD
|
//NOHUD
|
||||||
if (!origin)
|
if (!origin)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
S_StopSound(origin);
|
S_StopSound(origin);
|
||||||
|
@ -2414,7 +2414,7 @@ static int lib_sChangeMusic(lua_State *L)
|
||||||
boolean looping;
|
boolean looping;
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
UINT16 music_flags = 0;
|
UINT16 music_flags = 0;
|
||||||
NOHUD
|
//NOHUD
|
||||||
|
|
||||||
if (lua_isnumber(L, 1))
|
if (lua_isnumber(L, 1))
|
||||||
{
|
{
|
||||||
|
@ -2443,7 +2443,7 @@ static int lib_sChangeMusic(lua_State *L)
|
||||||
boolean looping = (boolean)lua_opttrueboolean(L, 2);
|
boolean looping = (boolean)lua_opttrueboolean(L, 2);
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
UINT16 music_flags = 0;
|
UINT16 music_flags = 0;
|
||||||
NOHUD
|
//NOHUD
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||||
|
@ -2474,7 +2474,7 @@ static int lib_sSpeedMusic(lua_State *L)
|
||||||
fixed_t fixedspeed = luaL_checkfixed(L, 1);
|
fixed_t fixedspeed = luaL_checkfixed(L, 1);
|
||||||
float speed = FIXED_TO_FLOAT(fixedspeed);
|
float speed = FIXED_TO_FLOAT(fixedspeed);
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
NOHUD
|
//NOHUD
|
||||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||||
{
|
{
|
||||||
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||||
|
@ -2489,7 +2489,7 @@ static int lib_sSpeedMusic(lua_State *L)
|
||||||
static int lib_sStopMusic(lua_State *L)
|
static int lib_sStopMusic(lua_State *L)
|
||||||
{
|
{
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
NOHUD
|
//NOHUD
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||||
{
|
{
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
@ -2505,7 +2505,7 @@ static int lib_sSetInternalMusicVolume(lua_State *L)
|
||||||
{
|
{
|
||||||
UINT32 volume = (UINT32)luaL_checkinteger(L, 1);
|
UINT32 volume = (UINT32)luaL_checkinteger(L, 1);
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
NOHUD
|
//NOHUD
|
||||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||||
{
|
{
|
||||||
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||||
|
@ -2525,7 +2525,7 @@ static int lib_sSetInternalMusicVolume(lua_State *L)
|
||||||
static int lib_sStopFadingMusic(lua_State *L)
|
static int lib_sStopFadingMusic(lua_State *L)
|
||||||
{
|
{
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
NOHUD
|
//NOHUD
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||||
{
|
{
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
@ -2548,7 +2548,7 @@ static int lib_sFadeMusic(lua_State *L)
|
||||||
UINT32 ms;
|
UINT32 ms;
|
||||||
INT32 source_volume;
|
INT32 source_volume;
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
NOHUD
|
//NOHUD
|
||||||
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||||
{
|
{
|
||||||
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
|
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
|
||||||
|
@ -2576,8 +2576,6 @@ static int lib_sFadeMusic(lua_State *L)
|
||||||
ms = (UINT32)luaL_checkinteger(L, 3);
|
ms = (UINT32)luaL_checkinteger(L, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
NOHUD
|
|
||||||
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
if (!player || P_IsLocalPlayer(player))
|
||||||
lua_pushboolean(L, S_FadeMusicFromVolume(target_volume, source_volume, ms));
|
lua_pushboolean(L, S_FadeMusicFromVolume(target_volume, source_volume, ms));
|
||||||
else
|
else
|
||||||
|
@ -2589,7 +2587,7 @@ static int lib_sFadeOutStopMusic(lua_State *L)
|
||||||
{
|
{
|
||||||
UINT32 ms = (UINT32)luaL_checkinteger(L, 1);
|
UINT32 ms = (UINT32)luaL_checkinteger(L, 1);
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
NOHUD
|
//NOHUD
|
||||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||||
{
|
{
|
||||||
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||||
|
@ -2608,7 +2606,7 @@ static int lib_sFadeOutStopMusic(lua_State *L)
|
||||||
static int lib_sOriginPlaying(lua_State *L)
|
static int lib_sOriginPlaying(lua_State *L)
|
||||||
{
|
{
|
||||||
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
NOHUD
|
//NOHUD
|
||||||
INLEVEL
|
INLEVEL
|
||||||
if (!origin)
|
if (!origin)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
@ -2619,7 +2617,7 @@ static int lib_sOriginPlaying(lua_State *L)
|
||||||
static int lib_sIdPlaying(lua_State *L)
|
static int lib_sIdPlaying(lua_State *L)
|
||||||
{
|
{
|
||||||
sfxenum_t id = luaL_checkinteger(L, 1);
|
sfxenum_t id = luaL_checkinteger(L, 1);
|
||||||
NOHUD
|
//NOHUD
|
||||||
if (id >= NUMSFX)
|
if (id >= NUMSFX)
|
||||||
return luaL_error(L, "sfx %d out of range (0 - %d)", id, NUMSFX-1);
|
return luaL_error(L, "sfx %d out of range (0 - %d)", id, NUMSFX-1);
|
||||||
lua_pushboolean(L, S_IdPlaying(id));
|
lua_pushboolean(L, S_IdPlaying(id));
|
||||||
|
@ -2630,7 +2628,7 @@ static int lib_sSoundPlaying(lua_State *L)
|
||||||
{
|
{
|
||||||
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
sfxenum_t id = luaL_checkinteger(L, 2);
|
sfxenum_t id = luaL_checkinteger(L, 2);
|
||||||
NOHUD
|
//NOHUD
|
||||||
INLEVEL
|
INLEVEL
|
||||||
if (!origin)
|
if (!origin)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
@ -2648,7 +2646,7 @@ static int lib_sStartMusicCaption(lua_State *L)
|
||||||
const char *caption = luaL_checkstring(L, 1);
|
const char *caption = luaL_checkstring(L, 1);
|
||||||
UINT16 lifespan = (UINT16)luaL_checkinteger(L, 2);
|
UINT16 lifespan = (UINT16)luaL_checkinteger(L, 2);
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
INLEVEL
|
//INLEVEL
|
||||||
|
|
||||||
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue