From: Rudolf Polzer Date: Mon, 22 Aug 2011 13:49:46 +0000 (+0200) Subject: experimental warpzone fix for sniping a player who stands halfway in a warpzone ... X-Git-Tag: xonotic-v0.5.0~87 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4b8d70c6e3bc2fa5f5cfeaf2f78e92e1b9617582;p=xonotic%2Fxonotic-data.pk3dir.git experimental warpzone fix for sniping a player who stands halfway in a warpzone (not tested) --- diff --git a/qcsrc/warpzonelib/common.qc b/qcsrc/warpzonelib/common.qc index 25a67a173..0f1337d18 100644 --- a/qcsrc/warpzonelib/common.qc +++ b/qcsrc/warpzonelib/common.qc @@ -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