From: Rudolf Polzer Date: Sat, 4 Dec 2010 12:34:48 +0000 (+0100) Subject: also expose the last zone X-Git-Tag: xonotic-v0.1.0preview~65^2~15 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cc5c1bc7cac5740f36f9057a8c2aaaa89bb67fe6;p=xonotic%2Fxonotic-data.pk3dir.git also expose the last zone --- diff --git a/qcsrc/warpzonelib/common.qc b/qcsrc/warpzonelib/common.qc index 48f20982e..62e746820 100644 --- a/qcsrc/warpzonelib/common.qc +++ b/qcsrc/warpzonelib/common.qc @@ -192,6 +192,7 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end, vector vf, vr, vu; WarpZone_trace_firstzone = world; + WarpZone_trace_lastzone = world; WarpZone_Trace_InitTransform(); if(!warpzone_warpzones_exist) { @@ -236,6 +237,7 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end, if(wz) { WarpZone_trace_firstzone = wz; + WarpZone_trace_lastzone = wz; if(zone && wz != zone) { // we are in ANOTHER warpzone. This is bad. Make a zero length trace and return. @@ -289,7 +291,9 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end, break; } wz = trace_ent; - WarpZone_trace_firstzone = wz; + if(!WarpZone_trace_firstzone) + WarpZone_trace_firstzone = wz; + WarpZone_trace_lastzone = wz; if(zone && wz != zone) break; WarpZone_Trace_AddTransform(wz); @@ -326,8 +330,9 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo o0 = e.origin; v0 = e.velocity; - WarpZone_Trace_InitTransform(); WarpZone_trace_firstzone = world; + WarpZone_trace_lastzone = world; + WarpZone_Trace_InitTransform(); WarpZone_tracetoss_time = 0; if(!warpzone_warpzones_exist) { @@ -351,6 +356,7 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo if(wz) { WarpZone_trace_firstzone = wz; + WarpZone_trace_lastzone = wz; if(zone && wz != zone) { // we are in ANOTHER warpzone. This is bad. Make a zero length trace and return. @@ -393,7 +399,9 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo break; } wz = trace_ent; - WarpZone_trace_firstzone = wz; + if(!WarpZone_trace_firstzone) + WarpZone_trace_firstzone = wz; + WarpZone_trace_lastzone = wz; if(zone && wz != zone) break; WarpZone_Trace_AddTransform(wz); diff --git a/qcsrc/warpzonelib/common.qh b/qcsrc/warpzonelib/common.qh index fce538747..72485f25c 100644 --- a/qcsrc/warpzonelib/common.qh +++ b/qcsrc/warpzonelib/common.qh @@ -31,6 +31,7 @@ typedef void(vector start, vector hit, vector end) WarpZone_trace_callback_t; // const var WarpZone_trace_callback_t WarpZone_trace_callback_t_null; entity WarpZone_trace_transform; // transform accumulator during a trace entity WarpZone_trace_firstzone; // first warpzone hit by a trace (can differ from the requested zone in case of _ThroughZone, the trace is aborted then) +entity WarpZone_trace_lastzone; // first warpzone hit by a trace (can differ from the requested zone in case of _ThroughZone, the trace is aborted then) vector WarpZone_tracetoss_velocity; // ending velocity of a tracetoss (post-transform) float WarpZone_tracetoss_time; // duration of toss (approximate) void WarpZone_TraceBox(vector org, vector min, vector max, vector end, float nomonsters, entity forent);