r4210 - in trunk/data/qcsrc: client server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Aug 26 13:40:32 EDT 2008


Author: div0
Date: 2008-08-26 13:40:32 -0400 (Tue, 26 Aug 2008)
New Revision: 4210

Modified:
   trunk/data/qcsrc/client/particles.qc
   trunk/data/qcsrc/server/g_triggers.qc
Log:
allow func_pointparticles to move


Modified: trunk/data/qcsrc/client/particles.qc
===================================================================
--- trunk/data/qcsrc/client/particles.qc	2008-08-26 17:31:30 UTC (rev 4209)
+++ trunk/data/qcsrc/client/particles.qc	2008-08-26 17:40:32 UTC (rev 4210)
@@ -103,12 +103,15 @@
 		if(!self.absolute)
 			self.impulse *= -self.maxs_x * self.maxs_y * self.maxs_z / 262144; // relative: particles per 64^3 cube
 	}
-	if(f & 1)
+	if(f & 4)
 	{
-		self.modelindex = ReadShort();
 		self.origin_x = ReadCoord();
 		self.origin_y = ReadCoord();
 		self.origin_z = ReadCoord();
+	}
+	if(f & 1)
+	{
+		self.modelindex = ReadShort();
 		if(self.modelindex)
 		{
 			self.mins_x = ReadCoord();
@@ -120,12 +123,10 @@
 		}
 		else
 		{
+			self.mins    = '0 0 0';
 			self.maxs_x = ReadCoord();
 			self.maxs_y = ReadCoord();
 			self.maxs_z = ReadCoord();
-			self.mins    = -0.5 * self.maxs;
-			self.maxs    =  0.5 * self.maxs;
-			self.origin  = self.origin - self.mins;
 		}
 
 		self.cnt = ReadShort(); // effect number

Modified: trunk/data/qcsrc/server/g_triggers.qc
===================================================================
--- trunk/data/qcsrc/server/g_triggers.qc	2008-08-26 17:31:30 UTC (rev 4209)
+++ trunk/data/qcsrc/server/g_triggers.qc	2008-08-26 17:40:32 UTC (rev 4210)
@@ -496,14 +496,17 @@
 		else
 			WriteCoord(MSG_ENTITY, 0); // off
 	}
+	if(fl & 4)
+	{
+		WriteCoord(MSG_ENTITY, self.origin_x);
+		WriteCoord(MSG_ENTITY, self.origin_y);
+		WriteCoord(MSG_ENTITY, self.origin_z);
+	}
 	if(fl & 1)
 	{
 		if(self.modelindex != 4.2)
 		{
 			WriteShort(MSG_ENTITY, self.modelindex);
-			WriteCoord(MSG_ENTITY, self.origin_x);
-			WriteCoord(MSG_ENTITY, self.origin_y);
-			WriteCoord(MSG_ENTITY, self.origin_z);
 			WriteCoord(MSG_ENTITY, self.mins_x);
 			WriteCoord(MSG_ENTITY, self.mins_y);
 			WriteCoord(MSG_ENTITY, self.mins_z);
@@ -514,12 +517,9 @@
 		else
 		{
 			WriteShort(MSG_ENTITY, 0);
-			WriteCoord(MSG_ENTITY, self.origin_x + self.mins_x);
-			WriteCoord(MSG_ENTITY, self.origin_y + self.mins_y);
-			WriteCoord(MSG_ENTITY, self.origin_z + self.mins_z);
-			WriteCoord(MSG_ENTITY, self.maxs_x - self.mins_x);
-			WriteCoord(MSG_ENTITY, self.maxs_y - self.mins_y);
-			WriteCoord(MSG_ENTITY, self.maxs_z - self.mins_z);
+			WriteCoord(MSG_ENTITY, self.maxs_x);
+			WriteCoord(MSG_ENTITY, self.maxs_y);
+			WriteCoord(MSG_ENTITY, self.maxs_z);
 		}
 		WriteShort(MSG_ENTITY, self.cnt);
 		WriteShort(MSG_ENTITY, compressShortVector(self.velocity));
@@ -538,6 +538,15 @@
 	self.SendFlags |= 2;
 }
 
+void pointparticles_think()
+{
+	if(self.origin != self.oldorigin)
+	{
+		self.SendFlags |= 4;
+		self.oldorigin = self.origin;
+	}
+}
+
 void spawnfunc_func_pointparticles()
 {
 	if(self.model != "")
@@ -549,7 +558,11 @@
 	self.SendEntity = pointparticles_SendEntity;
 	self.SendFlags = 3;
 	if(!self.modelindex)
+	{
 		self.modelindex = 4.2;
+		self.origin += self.mins;
+		self.maxs -= self.mins;
+	}
 	self.model = "net_entity";
 	if(!self.cnt)
 		self.cnt = particleeffectnum(self.mdl);
@@ -563,6 +576,8 @@
 	}
 	else
 		self.state = 1;
+	self.think = pointparticles_think;
+	self.nextthink = time;
 }
 
 void spawnfunc_func_sparks()
@@ -1041,21 +1056,21 @@
 
 void follow_think()
 {
-	entity source, dest;
-	source = find(world, targetname, self.killtarget);
-	dest = find(world, targetname, self.target);
+	entity src, dst;
+	src = find(world, targetname, self.killtarget);
+	dst = find(world, targetname, self.target);
 
-	if(!source || !dest)
+	if(!src || !dst)
 	{
 		objerror("follow: could not find target/killtarget");
 		return;
 	}
 
-	dest.movetype = MOVETYPE_FOLLOW;
-	dest.aiment = source;
-	dest.punchangle = source.angles;
-	dest.view_ofs = dest.origin - source.origin;
-	dest.v_angle = dest.angles - source.angles;
+	dst.movetype = MOVETYPE_FOLLOW;
+	dst.aiment = src;
+	dst.punchangle = src.angles;
+	dst.view_ofs = dst.origin - src.origin;
+	dst.v_angle = dst.angles - src.angles;
 
 	remove(self);
 }




More information about the nexuiz-commits mailing list