From c526cc5da29b234f1d613c3c931e970346d95195 Mon Sep 17 00:00:00 2001 From: NepDisk <16447892+NepDisk@users.noreply.github.com> Date: Tue, 22 Oct 2024 17:50:15 -0400 Subject: [PATCH] use saturn behaviour for lib_sStopSoundByID --- src/lua_baselib.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 5fc282401..e87fdd950 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2562,16 +2562,11 @@ static int lib_sStopSound(lua_State *L) static int lib_sStopSoundByID(lua_State *L) { - void *origin = NULL; + void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); sfxenum_t sound_id = luaL_checkinteger(L, 2); - //NOHUD - - if (sound_id >= NUMSFX) - return luaL_error(L, "sfx %d out of range (0 - %d)", sound_id, NUMSFX-1); - if (!lua_isnil(L, 1)) - if (!GetValidSoundOrigin(L, &origin)) - return LUA_ErrInvalid(L, "mobj_t/sector_t"); - + NOHUD + if (!origin) + return LUA_ErrInvalid(L, "mobj_t"); S_StopSoundByID(origin, sound_id); return 0; }