cvar_t snd_spatialization_max = {CVAR_SAVE, "snd_spatialization_max", "0.95", "maximum spatialization of sounds"};
cvar_t snd_spatialization_power = {CVAR_SAVE, "snd_spatialization_power", "0", "exponent of the spatialization falloff curve (0: logarithmic)"};
cvar_t snd_spatialization_control = {CVAR_SAVE, "snd_spatialization_control", "0", "enable spatialization control (headphone friendly mode)"};
+cvar_t snd_spatialization_occlusion = {CVAR_SAVE, "snd_spatialization_occlusion", "1", "enable occlusion testing on spatialized sounds, which simply quiets sounds that are blocked by the world"};
// Cvars declared in snd_main.h (shared with other snd_*.c files)
cvar_t _snd_mixahead = {CVAR_SAVE, "_snd_mixahead", "0.11", "how much sound to mix ahead of time"};
Cvar_RegisterVariable(&snd_spatialization_max);
Cvar_RegisterVariable(&snd_spatialization_power);
Cvar_RegisterVariable(&snd_spatialization_control);
+ Cvar_RegisterVariable(&snd_spatialization_occlusion);
Cvar_RegisterVariable(&snd_speed);
Cvar_RegisterVariable(&snd_width);
}
vol = intensity * max(0, source_vec[0] * snd_speakerlayout.listeners[i].dotscale + snd_speakerlayout.listeners[i].dotbias);
+
+ if (snd_spatialization_occlusion.integer)
+ {
+ if (cl.worldmodel
+ && cl.worldmodel->brush.TraceLineOfSight
+ && !cl.worldmodel->brush.TraceLineOfSight(cl.worldmodel, listener_origin, source_vec))
+ {
+ vol *= 0.5f;
+ }
+ }
+
ch->listener_volume[i] = (int)bound(0, vol, 255);
}
}