r3243 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Jan 23 14:53:29 EST 2008


Author: lordhavoc
Date: 2008-01-23 14:53:28 -0500 (Wed, 23 Jan 2008)
New Revision: 3243

Modified:
   trunk/data/qcsrc/server/cl_weaponsystem.qc
Log:
fix bug where you could shoot through someone if you were too close


Modified: trunk/data/qcsrc/server/cl_weaponsystem.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weaponsystem.qc	2008-01-23 18:14:32 UTC (rev 3242)
+++ trunk/data/qcsrc/server/cl_weaponsystem.qc	2008-01-23 19:53:28 UTC (rev 3243)
@@ -25,15 +25,19 @@
 void(entity ent, vector vecs, float antilag, float recoil, string snd) W_SetupShot =
 {
 	local vector trueaimpoint;
-	traceline_hitcorpse(self, self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * MAX_SHOT_DISTANCE, MOVE_NOMONSTERS, self);
+	traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * MAX_SHOT_DISTANCE, MOVE_NOMONSTERS, self);
 	trueaimpoint = trace_endpos;
 
 	if (cvar("g_shootfromeye"))
-		w_shotorg = ent.origin + ent.view_ofs + v_forward * vecs_x;
+		w_shotorg = ent.origin + ent.view_ofs;
 	else if (cvar("g_shootfromcenter"))
-		w_shotorg = ent.origin + ent.view_ofs + v_forward * vecs_x + '0 0 1' * vecs_z;
+		w_shotorg = ent.origin + ent.view_ofs + '0 0 1' * vecs_z;
 	else
-		w_shotorg = ent.origin + ent.view_ofs + v_forward * vecs_x + v_right * vecs_y + v_up * vecs_z;
+		w_shotorg = ent.origin + ent.view_ofs + v_right * vecs_y + v_up * vecs_z;
+	// now move the shotorg forward as much as requested if possible
+	traceline(w_shotorg, w_shotorg + v_forward * vecs_x, MOVE_NOMONSTERS, self);
+	w_shotorg = trace_endpos;
+	// calculate the shotdir from the chosen shotorg
 	w_shotdir = normalize(trueaimpoint - w_shotorg);
 
 	// explanation of g_antilag:




More information about the nexuiz-commits mailing list