From 04acdc2f1f8da78130f943ce45db8c35ccb36225 Mon Sep 17 00:00:00 2001 From: div0 Date: Sat, 26 Jan 2008 09:53:47 +0000 Subject: [PATCH] keep shot origin at least 1qu away from walls git-svn-id: svn://svn.icculus.org/nexuiz/trunk/data@3278 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- qcsrc/server/cl_weaponsystem.qc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index a1b1d4ca0..668fef2d4 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -24,6 +24,7 @@ vector w_shotdir; // make sure you call makevectors first (FIXME?) void(entity ent, vector vecs, float antilag, float recoil, string snd) W_SetupShot = { + float nudge = 1; local vector trueaimpoint; traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * MAX_SHOT_DISTANCE, MOVE_NOMONSTERS, self); trueaimpoint = trace_endpos; @@ -35,8 +36,8 @@ void(entity ent, vector vecs, float antilag, float recoil, string snd) W_SetupSh else 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_hitcorpse(self, w_shotorg, w_shotorg + v_forward * vecs_x, MOVE_NORMAL, self); - w_shotorg = trace_endpos; + traceline_hitcorpse(self, w_shotorg, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, self); + w_shotorg = trace_endpos - v_forward * nudge; // calculate the shotdir from the chosen shotorg w_shotdir = normalize(trueaimpoint - w_shotorg); -- 2.39.2