]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/warpzone/common.qc
Add an intrusive list for warpzones
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / warpzone / common.qc
index 704feeb7e7c8b84a60bef620a15aa7505965be37..5a3929e1e92d58ecd6520f0bbb05d68499e61f73 100644 (file)
@@ -4,7 +4,7 @@
     #include <common/t_items.qh>
 #elif defined(MENUQC)
 #elif defined(SVQC)
-    #include <common/weapons/all.qh>
+    #include <common/weapons/_all.qh>
 #endif
 
 void WarpZone_Accumulator_Clear(entity acc)
@@ -54,7 +54,7 @@ vector WarpZone_camera_transform(entity this, vector org, vector ang)
        vr = WarpZone_TransformVelocity(this, vr);
        vu = WarpZone_TransformVelocity(this, vu);
        if(autocvar_cl_warpzone_usetrace)
-               traceline(this.warpzone_targetorigin, org, MOVE_NOMONSTERS, world);
+               traceline(this.warpzone_targetorigin, org, MOVE_NOMONSTERS, NULL);
        else
                trace_endpos = this.warpzone_targetorigin;
        v_forward = vf;
@@ -112,7 +112,7 @@ float WarpZoneLib_BoxTouchesBrush_Recurse()
 #ifdef CSQC
        if (trace_networkentity)
        {
-               LOG_TRACE("hit a network ent, cannot continue WarpZoneLib_BoxTouchesBrush\n");
+               LOG_TRACE("hit a network ent, cannot continue WarpZoneLib_BoxTouchesBrush");
                // we cannot continue, as a player blocks us...
                // so, abort
                return 0;
@@ -154,31 +154,33 @@ float WarpZoneLib_BoxTouchesBrush(vector mi, vector ma, entity e, entity ig)
 entity WarpZone_Find(vector mi, vector ma)
 {
        // if we are near any warpzone planes - MOVE AWAY (work around nearclip)
-       entity e;
        if(!warpzone_warpzones_exist)
-               return world;
-       for(e = world; (e = find(e, classname, "trigger_warpzone")); )
-               if(WarpZoneLib_BoxTouchesBrush(mi, ma, e, world))
-                       return e;
-       return world;
+               return NULL;
+       IL_EACH(g_warpzones, WarpZoneLib_BoxTouchesBrush(mi, ma, it, NULL),
+       {
+               return it;
+       });
+       return NULL;
 }
 
 void WarpZone_MakeAllSolid()
 {
-       entity e;
        if(!warpzone_warpzones_exist)
                return;
-       for(e = world; (e = find(e, classname, "trigger_warpzone")); )
-               e.solid = SOLID_BSP;
+       IL_EACH(g_warpzones, true,
+       {
+               it.solid = SOLID_BSP;
+       });
 }
 
 void WarpZone_MakeAllOther()
 {
-       entity e;
        if(!warpzone_warpzones_exist)
                return;
-       for(e = world; (e = find(e, classname, "trigger_warpzone")); )
-               e.solid = SOLID_TRIGGER;
+       IL_EACH(g_warpzones, true,
+       {
+               it.solid = SOLID_TRIGGER;
+       });
 }
 
 void WarpZone_Trace_InitTransform()
@@ -204,8 +206,8 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
        vector vf, vr, vu;
 
        WarpZone_trace_forent = forent;
-       WarpZone_trace_firstzone = world;
-       WarpZone_trace_lastzone = world;
+       WarpZone_trace_firstzone = NULL;
+       WarpZone_trace_lastzone = NULL;
        WarpZone_Trace_InitTransform();
        if(!warpzone_warpzones_exist)
        {
@@ -271,8 +273,8 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
        {
                if(--i < 1)
                {
-                       LOG_TRACE("Too many warpzones in sequence, aborting trace.\n");
-                       trace_ent = world;
+                       LOG_TRACE("Too many warpzones in sequence, aborting trace.");
+                       trace_ent = NULL;
                        break;
                }
                tracebox(org, mi, ma, end, nomonsters_adjusted, WarpZone_trace_forent);
@@ -299,8 +301,8 @@ 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?
-                       LOG_TRACE("I transformed into the same zone again, wtf, aborting the trace\n");
-                       trace_ent = world;
+                       LOG_TRACE("I transformed into the same zone again, wtf, aborting the trace");
+                       trace_ent = NULL;
                        break;
                }
                wz = trace_ent;
@@ -330,7 +332,7 @@ LABEL(fail)
 
 void WarpZone_TraceBox(vector org, vector mi, vector ma, vector end, float nomonsters, entity forent)
 {
-       WarpZone_TraceBox_ThroughZone(org, mi, ma, end, nomonsters, forent, world, WarpZone_trace_callback_t_null);
+       WarpZone_TraceBox_ThroughZone(org, mi, ma, end, nomonsters, forent, NULL, WarpZone_trace_callback_t_null);
 }
 
 void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent)
@@ -349,8 +351,8 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo
        g = cvar("sv_gravity") * e.gravity;
 
        WarpZone_trace_forent = forent;
-       WarpZone_trace_firstzone = world;
-       WarpZone_trace_lastzone = world;
+       WarpZone_trace_firstzone = NULL;
+       WarpZone_trace_lastzone = NULL;
        WarpZone_Trace_InitTransform();
        WarpZone_tracetoss_time = 0;
        if(!warpzone_warpzones_exist)
@@ -395,8 +397,8 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo
        {
                if(--i < 1)
                {
-                       LOG_TRACE("Too many warpzones in sequence, aborting trace.\n");
-                       trace_ent = world;
+                       LOG_TRACE("Too many warpzones in sequence, aborting trace.");
+                       trace_ent = NULL;
                        break;
                }
                tracetoss(e, WarpZone_trace_forent);
@@ -413,8 +415,8 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo
                if(trace_ent == wz)
                {
                        // FIXME can this check be removed? Do we really need it?
-                       LOG_TRACE("I transformed into the same zone again, wtf, aborting the trace\n");
-                       trace_ent = world;
+                       LOG_TRACE("I transformed into the same zone again, wtf, aborting the trace");
+                       trace_ent = NULL;
                        break;
                }
                wz = trace_ent;
@@ -449,7 +451,7 @@ LABEL(fail)
 
 void WarpZone_TraceToss(entity e, entity forent)
 {
-       WarpZone_TraceToss_ThroughZone(e, forent, world, WarpZone_trace_callback_t_null);
+       WarpZone_TraceToss_ThroughZone(e, forent, NULL, WarpZone_trace_callback_t_null);
 }
 
 entity WarpZone_TrailParticles_trace_callback_own;
@@ -463,7 +465,7 @@ void WarpZone_TrailParticles(entity own, float eff, vector org, vector end)
 {
        WarpZone_TrailParticles_trace_callback_own = own;
        WarpZone_TrailParticles_trace_callback_eff = eff;
-       WarpZone_TraceBox_ThroughZone(org, '0 0 0', '0 0 0', end, MOVE_NOMONSTERS, world, world, WarpZone_TrailParticles_trace_callback);
+       WarpZone_TraceBox_ThroughZone(org, '0 0 0', '0 0 0', end, MOVE_NOMONSTERS, NULL, NULL, WarpZone_TrailParticles_trace_callback);
 }
 
 #ifdef CSQC
@@ -480,7 +482,7 @@ void WarpZone_TrailParticles_WithMultiplier(entity own, float eff, vector org, v
        WarpZone_TrailParticles_trace_callback_eff = eff;
        WarpZone_TrailParticles_trace_callback_f = f;
        WarpZone_TrailParticles_trace_callback_flags = boxflags | PARTICLES_DRAWASTRAIL;
-       WarpZone_TraceBox_ThroughZone(org, '0 0 0', '0 0 0', end, MOVE_NOMONSTERS, world, world, WarpZone_TrailParticles_WithMultiplier_trace_callback);
+       WarpZone_TraceBox_ThroughZone(org, '0 0 0', '0 0 0', end, MOVE_NOMONSTERS, NULL, NULL, WarpZone_TrailParticles_WithMultiplier_trace_callback);
 }
 #endif
 
@@ -671,7 +673,7 @@ void WarpZone_RefSys_GC(entity this)
        // garbage collect unused reference systems
        this.nextthink = time + 1;
        if(this.owner.WarpZone_refsys != this)
-               remove(this);
+               delete(this);
 }
 void WarpZone_RefSys_CheckCreate(entity me)
 {
@@ -688,8 +690,8 @@ void WarpZone_RefSys_Clear(entity me)
 {
        if(me.WarpZone_refsys)
        {
-               remove(me.WarpZone_refsys);
-               me.WarpZone_refsys = world;
+               delete(me.WarpZone_refsys);
+               me.WarpZone_refsys = NULL;
        }
 }
 void WarpZone_RefSys_AddTransform(entity me, vector t, vector s)
@@ -801,7 +803,7 @@ void WarpZoneLib_MoveOutOfSolid_Expand(entity e, vector by)
        {
                // hit something
                // adjust origin in the other direction...
-               setorigin(e,e.origin - by * (1 - trace_fraction));
+               setorigin(e, e.origin - by * (1 - trace_fraction));
        }
 }