Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-lysiuk committed Dec 25, 2024
1 parent b0488aa commit 33971fa
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions Quake/ls_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,26 +349,6 @@ static int LS_value_sound_loopstart(lua_State* state)
return 0;
}

static int LS_MakeSoundSilent(lua_State* state)
{
if (const sfxcache_t* const cachedsound = LS_GetCachedSoundFromUserData(state))
{
byte* const sounddata = const_cast<sfxcache_t*>(cachedsound)->data;
memset(sounddata, 0, cachedsound->length);

lua_pushboolean(state, true);
return 1;
}

return 0;
}

static int LS_value_sound_makesilent(lua_State* state)
{
lua_pushcfunction(state, LS_MakeSoundSilent);
return 1;
}

static int LS_value_sound_name(lua_State* state)
{
if (const sfx_t* const sound = LS_GetSoundFromUserData(state))
Expand Down Expand Up @@ -425,6 +405,27 @@ static int LS_value_sound_tostring(lua_State* state)
return 1;
}

static int LS_MakeSoundSilent(lua_State* state)
{
if (const sfxcache_t* const cachedsound = LS_GetCachedSoundFromUserData(state))
{
byte* const sounddata = const_cast<sfxcache_t*>(cachedsound)->data;
const size_t size = LS_GetSoundSize(*cachedsound);
memset(sounddata, 0, size);

lua_pushboolean(state, true);
return 1;
}

return 0;
}

static int LS_value_sound_makesilent(lua_State* state)
{
lua_pushcfunction(state, LS_MakeSoundSilent);
return 1;
}


//
// Expose 'sounds' global table with related functions
Expand Down

0 comments on commit 33971fa

Please sign in to comment.