From: divverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Sat, 8 Oct 2011 18:12:33 +0000 (+0000)
Subject: add a TODO comment about sound falloff curve, needs research
X-Git-Tag: xonotic-v0.6.0~163^2~160
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f400985e6de180cce8374bcc3eecdfa1a28844ca;p=xonotic%2Fdarkplaces.git

add a TODO comment about sound falloff curve, needs research

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11394 d7cf8633-e32d-0410-b094-e92efae38249
---

diff --git a/snd_main.c b/snd_main.c
index 88e43d94..d0d7cfd2 100644
--- a/snd_main.c
+++ b/snd_main.c
@@ -1450,7 +1450,13 @@ void SND_Spatialize_WithSfx(channel_t *ch, qboolean isstatic, sfx_t *sfx)
 		// calculate stereo seperation and distance attenuation
 		VectorSubtract(listener_origin, ch->origin, source_vec);
 		dist = VectorLength(source_vec);
-		intensity = mastervol * (1.0f - dist * ch->distfade);
+		f = dist * ch->distfade;
+
+		// TODO falloff formulas
+		f = (1.0 - f); // Quake
+		//f = (1.0 - f) / (1.0 + f * f); // same as rtlights use
+
+		intensity = mastervol * f;
 		if (intensity > 0)
 		{
 			qboolean occluded = false;