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 24, 2024
1 parent 5505e32 commit 382413a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Quake/ls_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,26 @@ 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 @@ -429,6 +449,7 @@ static int LS_global_sounds_index(lua_State* state)
{ "framerate", LS_value_sound_framerate },
{ "framecount", LS_value_sound_framecount },
{ "loopstart", LS_value_sound_loopstart },
{ "makesilent", LS_value_sound_makesilent },
{ "name", LS_value_sound_name },
{ "samplesize", LS_value_sound_samplesize },
{ "size", LS_value_sound_size },
Expand Down

0 comments on commit 382413a

Please sign in to comment.