r4186 - trunk/data/qcsrc/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Aug 26 04:29:44 EDT 2008


Author: div0
Date: 2008-08-26 04:29:28 -0400 (Tue, 26 Aug 2008)
New Revision: 4186

Modified:
   trunk/data/qcsrc/client/particles.qc
Log:
pointparticles: negative "impulse" is particles per 64^3 cube, instead of absolute particle count


Modified: trunk/data/qcsrc/client/particles.qc
===================================================================
--- trunk/data/qcsrc/client/particles.qc	2008-08-26 08:18:30 UTC (rev 4185)
+++ trunk/data/qcsrc/client/particles.qc	2008-08-26 08:29:28 UTC (rev 4186)
@@ -42,17 +42,19 @@
 .float glow_color; // palette color
 .float impulse; // density
 .string noise; // sound
+.float absolute;
 
 void Draw_PointParticles()
 {
-	float n, i;
+	float n, i, fail;
 	vector p;
 	vector sz;
 	vector o;
 	o = self.origin;
 	sz = self.maxs - self.mins;
 	n = self.impulse * drawframetime;
-	for(i = random(); i <= n; ++i)
+	fail = 0;
+	for(i = random(); i <= n && fail <= 64*n; ++i)
 	{
 		p = o + self.mins;
 		p_x += random() * sz_x;
@@ -67,16 +69,15 @@
 				sound(self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
 			}
 		}
+		else if(self.absolute)
+		{
+			++fail;
+			--i;
+		}
 	}
 	self.origin = o;
 }
 
-.vector velocity; // particle velocity
-.float waterlevel; // direction jitter
-.float count; // count multiplier
-.float glow_color; // palette color
-.float impulse; // density
-.string noise; // sound
 void Ent_PointParticles()
 {
 	self.modelindex = ReadShort();
@@ -100,8 +101,9 @@
 		strunzone(self.noise);
 	self.noise = strzone(ReadString());
 
-	if(self.impulse < 0) // negative = volume weighted: impulse = particles/100qu^3 cube
-		self.impulse *= -(self.maxs_x * self.maxs_y * self.maxs_z) / 1000000;
+	self.absolute = (self.impulse >= 0);
+	if(!self.absolute)
+		self.impulse *= -self.maxs_x * self.maxs_y * self.maxs_z / 262144; // relative: particles per 64^3 cube
 
 	self.mins    = -0.5 * self.maxs;
 	self.maxs    =  0.5 * self.maxs;




More information about the nexuiz-commits mailing list