]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/warpzone/common.qc
Fix waypoints marked as pure but still linked to the world and with collision testing...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / warpzone / common.qc
index 25206fca863d3b6f19f17cccddb58e6e44182da8..0c85d4a088522cce87bbd09fa6b7a2f95ff4f60f 100644 (file)
@@ -1,7 +1,7 @@
 #include "common.qh"
 
 #if defined(CSQC)
-    #include <common/t_items.qh>
+    #include <client/items/items.qh>
 #elif defined(MENUQC)
 #elif defined(SVQC)
     #include <common/weapons/_all.qh>
@@ -571,13 +571,26 @@ vector WarpZoneLib_NearestPointOnBox(vector mi, vector ma, vector org)
        return nearest;
 }
 
+// blacklist of entities that WarpZone_FindRadius doesn't care about
 bool WarpZoneLib_BadEntity(entity e)
 {
        if (is_pure(e)) return true;
        string s = e.classname;
 
-       //if (s == "net_linked") return true; // actually some real entities are linked without classname, fail
-       if (s == "") return true;
+       switch(s)
+       {
+               case "weaponentity":
+               case "exteriorweaponentity":
+               case "sprite_waypoint":
+               case "waypoint":
+               case "spawnfunc":
+               case "weaponchild":
+               case "chatbubbleentity":
+               case "buff_model":
+               //case "net_linked": // actually some real entities are linked without classname, fail
+               case "":
+                       return true;
+       }
 
        if (startsWith(s, "target_")) return true;
 
@@ -778,21 +791,28 @@ void WarpZone_RefSys_Copy(entity me, entity from)
 }
 entity WarpZone_RefSys_SpawnSameRefSys(entity me)
 {
-       entity e;
-       e = spawn();
+       entity e = spawn();
        WarpZone_RefSys_Copy(e, me);
        return e;
 }
 
 bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher)
 {
-       return !WarpZoneLib_BoxTouchesBrush(toucher.absmin, toucher.absmax, this, toucher);
+       vector emin = toucher.absmin, emax = toucher.absmax;
+       if(STAT(Q3COMPAT))
+       {
+               // DP's tracebox enlarges absolute bounding boxes by a single quake unit
+               // we must undo that here to allow accurate touching
+               emin += '1 1 1';
+               emax -= '1 1 1';
+       }
+       return !WarpZoneLib_BoxTouchesBrush(emin, emax, this, toucher);
 }
 
 
 void WarpZoneLib_MoveOutOfSolid_Expand(entity e, vector by)
 {
-       float eps = 0.0625;
+       const float eps = 0.0625;
        tracebox(e.origin, e.mins - '1 1 1' * eps, e.maxs + '1 1 1' * eps, e.origin + by, MOVE_WORLDONLY, e);
        if (trace_startsolid)
                return;