[nexuiz-commits] r6223 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Mar 19 10:20:04 EDT 2009


Author: div0
Date: 2009-03-19 10:20:03 -0400 (Thu, 19 Mar 2009)
New Revision: 6223

Modified:
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/cl_weaponsystem.qc
   trunk/data/qcsrc/server/defs.qh
Log:
weapon system: fix "" errors
dragcursor: fix dragging already attached entities


Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2009-03-19 12:39:52 UTC (rev 6222)
+++ trunk/data/qcsrc/server/cl_client.qc	2009-03-19 14:20:03 UTC (rev 6223)
@@ -2446,6 +2446,9 @@
 					if(!self.cursor_trace_ent.tag_index)
 					{
 						self.dragentity = self.cursor_trace_ent;
+						if(self.dragentity.tag_entity)
+							detach_sameorigin(self.dragentity);
+						self.dragentity.draggedby = self;
 						self.dragcursor = spawn();
 						self.dragcursor.owner = self;
 						self.dragcursor.think = DragCursor_Think;
@@ -2455,7 +2458,7 @@
 						self.dragentity.effects |= EF_FLAME;
 					}
 	
-	if(self.dragentity)
+	if(self.dragentity.draggedby == self)
 	{
 		if(self.BUTTON_DRAG)
 		{

Modified: trunk/data/qcsrc/server/cl_weaponsystem.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weaponsystem.qc	2009-03-19 12:39:52 UTC (rev 6222)
+++ trunk/data/qcsrc/server/cl_weaponsystem.qc	2009-03-19 14:20:03 UTC (rev 6223)
@@ -346,8 +346,18 @@
 				self.weaponentity.model = "";
 			setmodel(self, strcat("models/weapons/v_", self.owner.weaponname, ".md3")); // precision set below
 			v_shot_idx = gettagindex(self, "shot"); // used later
-			if(!qcweaponanimation)
+
+			if(qcweaponanimation)
 			{
+				self.angles = '0 0 0';
+				makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0' + self.angles_z * '0 0 1');
+				self.movedir = weapon_offset_x * v_forward - weapon_offset_y * v_right + weapon_offset_z * v_up + weapon_adjust;
+				self.movedir_x += 32;
+				self.spawnorigin = self.movedir;
+				// oldorigin - not calculated here
+			}
+			else
+			{
 				setmodel(self, strcat("models/weapons/h_", self.owner.weaponname, ".dpm")); // precision set below
 				animfilename = strcat("models/weapons/h_", self.owner.weaponname, ".dpm.animinfo");
 				animfile = fopen(animfilename, FILE_READ);
@@ -383,78 +393,73 @@
 						remove(self.weaponentity);
 					self.weaponentity = world;
 				}
-			}
-		}
-		else
-		{
-			self.model = "";
-			if(self.weaponentity)
-				remove(self.weaponentity);
-			self.weaponentity = world;
-		}
 
-		if(qcweaponanimation)
-		{
-			self.angles = '0 0 0';
-			makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0' + self.angles_z * '0 0 1');
-			self.movedir = weapon_offset_x * v_forward - weapon_offset_y * v_right + weapon_offset_z * v_up + weapon_adjust;
-			self.movedir_x += 32;
-			self.spawnorigin = self.movedir;
-			// oldorigin - not calculated here
-		}
-		else
-		{
-			self.origin = '0 0 0';
-			self.angles = '0 0 0';
-			self.frame = 0;
-			self.viewmodelforclient = world;
+				self.origin = '0 0 0';
+				self.angles = '0 0 0';
+				self.frame = 0;
+				self.viewmodelforclient = world;
 
-			float idx;
-			idx = gettagindex(self, "shot");
-			if(idx)
-			{
-				self.movedir = gettaginfo(self, idx);
-			}
-			else
-			{
-				print("WARNING: weapon model ", self.model, " does not support the 'shot' tag, will display shots TOTALLY wrong\n");
-				self.movedir = '0 0 0';
-			}
+				float idx;
+				idx = gettagindex(self, "shot");
+				if(idx)
+				{
+					self.movedir = gettaginfo(self, idx);
+				}
+				else
+				{
+					print("WARNING: weapon model ", self.model, " does not support the 'shot' tag, will display shots TOTALLY wrong\n");
+					self.movedir = '0 0 0';
+				}
 
-			idx = gettagindex(self, "shell");
-			if(idx)
-			{
-				self.spawnorigin = gettaginfo(self, idx);
-			}
-			else
-			{
-				print("WARNING: weapon model ", self.model, " does not support the 'shell' tag, will display casings wrong\n");
-				self.spawnorigin = self.movedir;
-			}
-
-			if(v_shot_idx)
-			{
-				self.oldorigin = '0 0 0';
-			}
-			else
-			{
-				if(self.weaponentity)
-					idx = gettagindex(self, "weapon");
-				else
-					idx = gettagindex(self, "handle");
+				idx = gettagindex(self, "shell");
 				if(idx)
 				{
-					self.oldorigin = self.movedir - gettaginfo(self, idx);
+					self.spawnorigin = gettaginfo(self, idx);
 				}
 				else
 				{
-					print("WARNING: weapon model ", self.model, " does not support the 'handle' tag and neither does the v_ model support the 'shot' tag, will display muzzle flashes TOTALLY wrong\n");
-					self.oldorigin = '0 0 0'; // there is no way to recover from this
+					print("WARNING: weapon model ", self.model, " does not support the 'shell' tag, will display casings wrong\n");
+					self.spawnorigin = self.movedir;
 				}
+
+				if(v_shot_idx)
+				{
+					self.oldorigin = '0 0 0';
+				}
+				else
+				{
+					if(self.weaponentity)
+						idx = gettagindex(self, "weapon");
+					else
+						idx = gettagindex(self, "handle");
+					if(idx)
+					{
+						self.oldorigin = self.movedir - gettaginfo(self, idx);
+					}
+					else
+					{
+						print("WARNING: weapon model ", self.model, " does not support the 'handle' tag and neither does the v_ model support the 'shot' tag, will display muzzle flashes TOTALLY wrong\n");
+						self.oldorigin = '0 0 0'; // there is no way to recover from this
+					}
+				}
+
+				self.viewmodelforclient = self.owner;
 			}
-
-			self.viewmodelforclient = self.owner;
 		}
+		else
+		{
+			self.model = "";
+			if(self.weaponentity)
+				remove(self.weaponentity);
+			self.weaponentity = world;
+			self.movedir = '0 0 0';
+			self.spawnorigin = '0 0 0';
+			self.oldorigin = '0 0 0';
+			self.anim_fire1  = '0 1 0.01';
+			self.anim_fire2  = '0 1 0.01';
+			self.anim_idle   = '0 1 0.01';
+			self.anim_reload = '0 1 0.01';
+		}
 
 		self.view_ofs = '0 0 0';
 

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2009-03-19 12:39:52 UTC (rev 6222)
+++ trunk/data/qcsrc/server/defs.qh	2009-03-19 14:20:03 UTC (rev 6223)
@@ -556,3 +556,4 @@
 .entity dragentity;
 .float dragspeed;
 .entity dragcursor;
+.entity draggedby;



More information about the nexuiz-commits mailing list