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

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Apr 16 07:03:44 EDT 2009


Author: div0
Date: 2009-04-16 07:03:40 -0400 (Thu, 16 Apr 2009)
New Revision: 6503

Modified:
   trunk/data/qcsrc/client/particles.qc
   trunk/data/qcsrc/server/g_triggers.qc
Log:
remove pointparticles glow_color (does not work anyway)


Modified: trunk/data/qcsrc/client/particles.qc
===================================================================
--- trunk/data/qcsrc/client/particles.qc	2009-04-16 10:03:36 UTC (rev 6502)
+++ trunk/data/qcsrc/client/particles.qc	2009-04-16 11:03:40 UTC (rev 6503)
@@ -42,12 +42,11 @@
 .vector velocity; // particle velocity
 .float waterlevel; // direction jitter
 .float count; // count multiplier
-.float glow_color; // palette color
 .float impulse; // density
 .string noise; // sound
 .float atten;
 .float volume;
-.float absolute;
+.float absolute; // 1 = count per second is absolute, 2 = only spawn at toggle
 .vector movedir; // trace direction
 .string bgmscript;
 .float bgmscriptdecay;
@@ -163,12 +162,22 @@
 	vector o;
 	o = self.origin;
 	sz = self.maxs - self.mins;
-	n = self.impulse * drawframetime;
-	n *= PointparticlesScript(self);
+	n = PointparticlesScript(self);
+	if(self.absolute == 2)
+	{
+		n = self.just_toggled ? self.impulse : 0;
+	}
+	else
+	{
+		n *= self.impulse * drawframetime;
+		if(self.just_toggled)
+			if(n < 1)
+				n = 1;
+	}
 	if(n == 0)
 		return;
 	fail = 0;
-	for(i = random(); (self.just_toggled || i <= n) && fail <= 64*n; ++i)
+	for(i = random(); i <= n && fail <= 64*n; ++i)
 	{
 		p = o + self.mins;
 		p_x += random() * sz_x;
@@ -180,10 +189,12 @@
 			{
 				traceline(p, p + normalize(self.movedir) * 4096, 0, world);
 				p = trace_endpos;
-				pointparticles(self.cnt, p, trace_plane_normal * vlen(self.movedir) + self.velocity + randomvec() * self.waterlevel, self.count, self.glow_color);
+				pointparticles(self.cnt, p, trace_plane_normal * vlen(self.movedir) + self.velocity + randomvec() * self.waterlevel, self.count);
 			}
 			else
-				pointparticles(self.cnt, p, self.velocity + randomvec() * self.waterlevel, self.count, self.glow_color);
+			{
+				pointparticles(self.cnt, p, self.velocity + randomvec() * self.waterlevel, self.count);
+			}
 			if(self.noise != "")
 			{
 				self.origin = p;
@@ -270,34 +281,26 @@
 		{
 			self.waterlevel = ReadShort() / 16.0;
 			self.count = ReadByte() / 16.0;
-			self.glow_color = ReadByte();
 		}
 		else
 		{
-			self.waterlevel = self.glow_color = 0;
+			self.waterlevel = 0;
 			self.count = 1;
 		}
 		if(self.noise)
 			strunzone(self.noise);
 		if(self.bgmscript)
 			strunzone(self.bgmscript);
-		if(f & 0x10)
+		self.noise = strzone(ReadString());
+		if(self.noise != "")
 		{
-			self.noise = strzone(ReadString());
-			if(self.noise != "")
-			{
-				self.atten = ReadByte() / 64.0;
-				self.volume = ReadByte() / 255.0;
-			}
-			self.bgmscript = strzone(ReadString());
-			if(self.bgmscript != "")
-				self.bgmscriptdecay = ReadByte() / 255.0;
-			PointparticlesScript_InitEntity(self);
+			self.atten = ReadByte() / 64.0;
+			self.volume = ReadByte() / 255.0;
 		}
-		else
-		{
-			self.noise = self.bgmscript = string_null;
-		}
+		self.bgmscript = strzone(ReadString());
+		if(self.bgmscript != "")
+			self.bgmscriptdecay = ReadByte() / 255.0;
+		PointparticlesScript_InitEntity(self);
 	}
 
 	if(f & 2)
@@ -310,6 +313,9 @@
 		}
 	}
 
+	if(f & 0x10)
+		self.absolute = 2;
+
 	setorigin(self, self.origin);
 	setsize(self, self.mins, self.maxs);
 	self.solid = SOLID_NOT;
@@ -317,6 +323,7 @@
 	self.entremove = Ent_PointParticles_Remove;
 }
 
+.float glow_color; // palette index
 void Draw_Rain()
 {
     te_particlerain(self.origin + self.mins, self.origin + self.maxs, self.velocity, self.count * drawframetime, self.glow_color);

Modified: trunk/data/qcsrc/server/g_triggers.qc
===================================================================
--- trunk/data/qcsrc/server/g_triggers.qc	2009-04-16 10:03:36 UTC (rev 6502)
+++ trunk/data/qcsrc/server/g_triggers.qc	2009-04-16 11:03:40 UTC (rev 6503)
@@ -562,11 +562,11 @@
 
 	// optional features to save space
 	fl = fl & 0x0F;
-	if(self.noise || self.bgmscript)
-		fl |= 0x10; // 2 bytes
+	if(self.spawnflags & 1)
+		fl |= 0x10; // absolute count on toggle-on
 	if(self.movedir != '0 0 0' || self.velocity != '0 0 0')
 		fl |= 0x20; // 4 bytes - saves CPU
-	if(self.glow_color || self.waterlevel || self.count != 1)
+	if(self.waterlevel || self.count != 1)
 		fl |= 0x40; // 4 bytes - obscure features almost never used
 	if(self.mins != '0 0 0' || self.maxs != '0 0 0')
 		fl |= 0x80; // 14 bytes - saves lots of space
@@ -620,20 +620,16 @@
 		{
 			WriteShort(MSG_ENTITY, self.waterlevel * 16.0);
 			WriteByte(MSG_ENTITY, self.count * 16.0);
-			WriteByte(MSG_ENTITY, self.glow_color);
 		}
-		if(fl & 0x10)
+		WriteString(MSG_ENTITY, self.noise);
+		if(self.noise != "")
 		{
-			WriteString(MSG_ENTITY, self.noise);
-			if(self.noise != "")
-			{
-				WriteByte(MSG_ENTITY, floor(self.atten * 64));
-				WriteByte(MSG_ENTITY, floor(self.volume * 255));
-			}
-			WriteString(MSG_ENTITY, self.bgmscript);
-			if(self.bgmscript != "")
-				WriteByte(MSG_ENTITY, floor(self.bgmscriptdecay * 255));
+			WriteByte(MSG_ENTITY, floor(self.atten * 64));
+			WriteByte(MSG_ENTITY, floor(self.volume * 255));
 		}
+		WriteString(MSG_ENTITY, self.bgmscript);
+		if(self.bgmscript != "")
+			WriteByte(MSG_ENTITY, floor(self.bgmscriptdecay * 255));
 	}
 	return 1;
 }
@@ -677,6 +673,8 @@
 		self.volume = 1;
 	if(!self.count)
 		self.count = 1;
+	if(!self.impulse)
+		self.impulse = 1;
 
 	if(!self.modelindex)
 	{



More information about the nexuiz-commits mailing list