[nexuiz-commits] r6435 - in trunk/data: qcsrc/client qcsrc/server scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Apr 5 14:17:13 EDT 2009


Author: div0
Date: 2009-04-05 14:17:13 -0400 (Sun, 05 Apr 2009)
New Revision: 6435

Modified:
   trunk/data/qcsrc/client/particles.qc
   trunk/data/qcsrc/server/g_triggers.qc
   trunk/data/qcsrc/server/miscfunctions.qc
   trunk/data/scripts/entities.def
Log:
support settable attenuation for pointparticles


Modified: trunk/data/qcsrc/client/particles.qc
===================================================================
--- trunk/data/qcsrc/client/particles.qc	2009-04-05 17:23:26 UTC (rev 6434)
+++ trunk/data/qcsrc/client/particles.qc	2009-04-05 18:17:13 UTC (rev 6435)
@@ -45,6 +45,8 @@
 .float glow_color; // palette color
 .float impulse; // density
 .string noise; // sound
+.float atten;
+.float volume;
 .float absolute;
 .vector movedir; // trace direction
 
@@ -79,7 +81,7 @@
 			if(self.noise != "")
 			{
 				self.origin = p;
-				sound(self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
+				sound(self, CHAN_AUTO, self.noise, VOL_BASE * self.volume, self.atten);
 			}
 		}
 		else if(self.absolute)
@@ -143,6 +145,11 @@
 		if(self.noise)
 			strunzone(self.noise);
 		self.noise = strzone(ReadString());
+		if(self.noise != "")
+		{
+			self.atten = ReadByte() / 64.0;
+			self.volume = ReadByte() / 255.0;
+		}
 	}
 
 	if(f & 2)

Modified: trunk/data/qcsrc/server/g_triggers.qc
===================================================================
--- trunk/data/qcsrc/server/g_triggers.qc	2009-04-05 17:23:26 UTC (rev 6434)
+++ trunk/data/qcsrc/server/g_triggers.qc	2009-04-05 18:17:13 UTC (rev 6435)
@@ -597,6 +597,11 @@
 		WriteCoord(MSG_ENTITY, self.count);
 		WriteByte(MSG_ENTITY, self.glow_color);
 		WriteString(MSG_ENTITY, self.noise);
+		if(self.noise != "")
+		{
+			WriteByte(MSG_ENTITY, floor(self.atten * 64));
+			WriteByte(MSG_ENTITY, floor(self.volume * 255));
+		}
 	}
 	return 1;
 }
@@ -632,6 +637,13 @@
 	if(self.noise != "")
 		precache_sound (self.noise);
 
+	if(!self.atten)
+		self.atten = ATTN_NORM;
+	else if(self.atten < 0)
+		self.atten = 0;
+	if(!self.volume)
+		self.volume = 1;
+
 	if(!self.modelindex)
 	{
 		setorigin(self, self.origin + self.mins);

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2009-04-05 17:23:26 UTC (rev 6434)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2009-04-05 18:17:13 UTC (rev 6435)
@@ -1175,7 +1175,7 @@
 	WriteByte(dest, SVC_SOUND);
 	WriteByte(dest, sflags);
 	if(sflags & SND_VOLUME)
-		WriteByte(dest, vol * 255);
+		WriteByte(dest, vol);
 	if(sflags & SND_ATTENUATION)
 		WriteByte(dest, atten);
 	if(sflags & SND_LARGEENTITY)

Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def	2009-04-05 17:23:26 UTC (rev 6434)
+++ trunk/data/scripts/entities.def	2009-04-05 18:17:13 UTC (rev 6435)
@@ -1144,6 +1144,8 @@
 movedir: when set, trace direction (particles will then be emitted from the surface the trace hits); the length of the vector is used as strength of taking the normal of the trace into account
 glow_color: particle palette color
 noise: sound to play when the particle is emitted
+atten: distance attenuation of the sound (a value from 0.1 to 3.9), default is 0.5; set to -1 for no attenuation (global sound)
+volume: volume of the sound
 targetname: name to target this (then its state is toggled)
 -------- SPAWNFLAGS --------
 START_ON: when targeted, the particle emitter will start switched on



More information about the nexuiz-commits mailing list