From: Martin Taibr <taibr.martin@gmail.com>
Date: Mon, 15 Aug 2016 19:00:27 +0000 (+0200)
Subject: fix solidpenetration
X-Git-Tag: xonotic-v0.8.2~709^2~2
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=40c59ad07fa52fe99ede5da067b69ff0dd532934;p=xonotic%2Fxonotic-data.pk3dir.git

fix solidpenetration
---

diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc
index 85551aa2b3..eace8ce0c7 100644
--- a/qcsrc/server/weapons/tracing.qc
+++ b/qcsrc/server/weapons/tracing.qc
@@ -22,7 +22,7 @@
 // make sure you call makevectors first (FIXME?)
 void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vector s_forward, vector mi, vector ma, float antilag, float recoil, Sound snd, float chan, float maxdamage, float range)
 {
-    TC(Sound, snd);
+	TC(Sound, snd);
 	float nudge = 1; // added to traceline target and subtracted from result  TOOD(divVerent): do we still need this? Doesn't the engine do this now for us?
 	float oldsolid;
 	vector vecs, dv;
@@ -475,7 +475,8 @@ void fireBullet(entity this, vector start, vector dir, float spread, float max_s
 			break;
 
 		float dist_taken = max(autocvar_g_ballistics_mindistance, vlen(trace_endpos - start));
-		solid_penetration_left *= (dist_taken / maxdist);
+		solid_penetration_left -= (dist_taken / maxdist);
+		solid_penetration_left = max(solid_penetration_left, 0);
 
 		// Only show effect when going through a player (invisible otherwise)
 		if (hit && (hit.solid != SOLID_BSP))