]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
experimental warpzone fix for sniping a player who stands halfway in a warpzone ...
authorRudolf Polzer <divVerent@xonotic.org>
Mon, 22 Aug 2011 13:49:46 +0000 (15:49 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Mon, 22 Aug 2011 13:49:46 +0000 (15:49 +0200)
qcsrc/warpzonelib/common.qc

index 25a67a1731eaa9e3118dc69ae77674defbd28a35..0f1337d18fb614c447e8efbac9be7d5fc6645040 100644 (file)
@@ -300,6 +300,10 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
                // we hit a warpzone... so, let's perform the trace after the warp again
                org = WarpZone_TransformOrigin(wz, trace_endpos);
                end = WarpZone_TransformOrigin(wz, end);
+
+               // we got warped, so let's step back a bit
+               tracebox(org, mi, ma, org + normalize(org - end) * 32, nomonsters_adjusted, forent);
+               org = trace_endpos;
        }
        WarpZone_MakeAllOther();
 :fail
@@ -383,9 +387,9 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo
                tracetoss(e, forent);
                if(cb)
                        cb(e.origin, trace_endpos, trace_endpos);
-               e.origin = trace_endpos;
-               dt = vlen(e.origin - o0) / vlen(e.velocity);
+               dt = vlen(trace_endpos - e.origin) / vlen(e.velocity);
                WarpZone_tracetoss_time += dt;
+               e.origin = trace_endpos;
                e.velocity_z -= dt * g;
                if(trace_fraction >= 1)
                        break;
@@ -408,6 +412,14 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo
                // we hit a warpzone... so, let's perform the trace after the warp again
                e.origin = WarpZone_TransformOrigin(wz, e.origin);
                e.velocity = WarpZone_TransformVelocity(wz, e.velocity);
+
+               // we got warped, so let's step back a bit
+               e.velocity = -e.velocity;
+               tracetoss(e, forent);
+               dt = vlen(trace_endpos - e.origin) / vlen(e.velocity);
+               WarpZone_tracetoss_time -= dt;
+               e.origin = trace_endpos;
+               e.velocity = -e.velocity;
        }
        WarpZone_MakeAllOther();
 :fail