]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
warpzonelib: expose WarpZone_trace_firstzone
authorRudolf Polzer <divverent@alientrap.org>
Sat, 4 Dec 2010 12:33:16 +0000 (13:33 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 4 Dec 2010 12:33:16 +0000 (13:33 +0100)
qcsrc/warpzonelib/common.qc
qcsrc/warpzonelib/common.qh

index e76bc0eb96761c5efa52f02a07400b51fa28cdaa..48f20982e7e53fca4f29d39e8b0698a62a0b22d4 100644 (file)
@@ -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);
index 1b594d96d73b7c9da95404ad43e73185a1f66ba6..fce538747dffdb6c1ff8bd77e0fb434be4530720 100644 (file)
@@ -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);