]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix of fix for #1738
authorMartin Taibr <taibr.martin@gmail.com>
Mon, 15 Aug 2016 21:50:21 +0000 (23:50 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Mon, 15 Aug 2016 21:50:21 +0000 (23:50 +0200)
qcsrc/server/weapons/tracing.qc

index eace8ce0c79b086d8107488b274890e198bd3960..a12ea2d9e181cfac81a2841b90781fc91a34b6f7 100644 (file)
@@ -475,8 +475,9 @@ 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 = max(solid_penetration_left, 0);
+               // fraction_used_of_what_is_left = dist_taken / maxdist
+               // solid_penetration_left = solid_penetration_left - solid_penetration_left * fraction_used_of_what_is_left
+               solid_penetration_left *= 1 - dist_taken / maxdist;
 
                // Only show effect when going through a player (invisible otherwise)
                if (hit && (hit.solid != SOLID_BSP))