diff --git a/engine/Quake/snd_fmod.c b/engine/Quake/snd_fmod.c index 23b5404..34c87e9 100644 --- a/engine/Quake/snd_fmod.c +++ b/engine/Quake/snd_fmod.c @@ -133,12 +133,6 @@ static float SND_FMOD_Attenuation(FMOD_CHANNELCONTROL *channelcontrol, float dis return 1.0f; } - // Anything coming from the view entity will always be full volume - if (userdata->entnum == cl.viewentity) - { - return 1.0f; - } - scale = 1.0f - (distance * userdata->dist_mult); if (scale < 0.0f) scale = 0.0f; @@ -234,7 +228,9 @@ void S_StartSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f FMOD_Channel_Set3DAttributes(channel, &position, NULL); FMOD_Channel_SetMode(channel, FMOD_LOOP_OFF); // TODO: some entity sounds do need to loop, e.g. moving elevators. How is this done? FMOD_Channel_SetVolume(channel, fvol); - FMOD_Channel_Set3DLevel(channel, entchannel < 0 ? 0.0f : 1.0f); // entchannel -1 is used for local sounds + + // Anything coming from the view entity will always be full volume, and entchannel -1 is used for local sounds (e.g. menu sounds) + FMOD_Channel_Set3DLevel(channel, entchannel < 0 || entnum == cl.viewentity ? 0.0f : 1.0f); // TODO: attenuation (this is just a quick hack to test) entchannel_t *userdata = (entchannel_t*)malloc(sizeof(entchannel_t)); // TODO: we REALLY need to allocate this properly, this is now a memory leak!!