s = PRVM_G_STRING(OFS_PARM0);
PRVM_G_INT(OFS_RETURN) = PRVM_G_INT(OFS_PARM0);
- VM_CheckEmptyString(s);
+ //VM_CheckEmptyString(s);
if(snd_initialized.integer && !S_PrecacheSound(s, true, true))
{
S_FindName
==================
*/
+sfx_t changevolume_sfx = {""};
sfx_t *S_FindName (const char *name)
{
sfx_t *sfx;
if (!snd_initialized.integer)
return NULL;
+ if(!strcmp(name, changevolume_sfx.name))
+ return &changevolume_sfx;
+
if (strlen (name) >= sizeof (sfx->name))
{
Con_Printf ("S_FindName: sound name too long (%s)\n", name);
*/
qboolean S_IsSoundPrecached (const sfx_t *sfx)
{
- return (sfx != NULL && sfx->fetcher != NULL);
+ return (sfx != NULL && sfx->fetcher != NULL) || (sfx == &changevolume_sfx);
}
/*
int S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation)
{
- channel_t *target_chan, *check;
+ channel_t *target_chan, *check, *ch;
int ch_idx;
if (snd_renderbuffer == NULL || sfx == NULL || nosound.integer)
return -1;
+ if(sfx == &changevolume_sfx)
+ {
+ if(entchannel == 0)
+ return -1;
+ for (ch_idx=NUM_AMBIENTS ; ch_idx < NUM_AMBIENTS + MAX_DYNAMIC_CHANNELS ; ch_idx++)
+ {
+ ch = &channels[ch_idx];
+ if (ch->entnum == entnum && (ch->entchannel == entchannel || entchannel == -1) )
+ {
+ S_SetChannelVolume(ch_idx, fvol);
+ ch->dist_mult = attenuation / (64.0f * snd_soundradius.value);
+ return ch_idx;
+ }
+ }
+ return -1;
+ }
+
if (sfx->fetcher == NULL)
return -1;