From: Rudolf Polzer Date: Sat, 4 Dec 2010 12:33:16 +0000 (+0100) Subject: warpzonelib: expose WarpZone_trace_firstzone X-Git-Tag: xonotic-v0.1.0preview~65^2~16 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ed8788b2cfc2099073b7dd4e25fe245524d3a87b;p=xonotic%2Fxonotic-data.pk3dir.git warpzonelib: expose WarpZone_trace_firstzone --- diff --git a/qcsrc/warpzonelib/common.qc b/qcsrc/warpzonelib/common.qc index e76bc0eb9..48f20982e 100644 --- a/qcsrc/warpzonelib/common.qc +++ b/qcsrc/warpzonelib/common.qc @@ -191,6 +191,7 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end, entity wz; vector vf, vr, vu; + WarpZone_trace_firstzone = world; WarpZone_Trace_InitTransform(); if(!warpzone_warpzones_exist) { @@ -234,6 +235,7 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end, wz = WarpZone_Find(org + mi, org + ma); if(wz) { + WarpZone_trace_firstzone = wz; if(zone && wz != zone) { // we are in ANOTHER warpzone. This is bad. Make a zero length trace and return. @@ -281,11 +283,13 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end, } if(trace_ent == wz) { + // FIXME can this check be removed? Do we really need it? dprint("I transformed into the same zone again, wtf, aborting the trace\n"); trace_ent = world; break; } wz = trace_ent; + WarpZone_trace_firstzone = wz; if(zone && wz != zone) break; WarpZone_Trace_AddTransform(wz); @@ -323,6 +327,7 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo v0 = e.velocity; WarpZone_Trace_InitTransform(); + WarpZone_trace_firstzone = world; WarpZone_tracetoss_time = 0; if(!warpzone_warpzones_exist) { @@ -345,6 +350,7 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo wz = WarpZone_Find(e.origin + e.mins, e.origin + e.maxs); if(wz) { + WarpZone_trace_firstzone = wz; if(zone && wz != zone) { // we are in ANOTHER warpzone. This is bad. Make a zero length trace and return. @@ -381,11 +387,13 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo break; if(trace_ent == wz) { + // FIXME can this check be removed? Do we really need it? dprint("I transformed into the same zone again, wtf, aborting the trace\n"); trace_ent = world; break; } wz = trace_ent; + WarpZone_trace_firstzone = wz; if(zone && wz != zone) break; WarpZone_Trace_AddTransform(wz); diff --git a/qcsrc/warpzonelib/common.qh b/qcsrc/warpzonelib/common.qh index 1b594d96d..fce538747 100644 --- a/qcsrc/warpzonelib/common.qh +++ b/qcsrc/warpzonelib/common.qh @@ -30,6 +30,7 @@ void WarpZone_MakeAllOther(); typedef void(vector start, vector hit, vector end) WarpZone_trace_callback_t; // called on every elementary trace 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) 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);