.entity enemy;
-vector WarpZoneLib_BoxTouchesBrush_mins;
-vector WarpZoneLib_BoxTouchesBrush_maxs;
-entity WarpZoneLib_BoxTouchesBrush_ent;
-entity WarpZoneLib_BoxTouchesBrush_ignore;
-float WarpZoneLib_BoxTouchesBrush_Recurse()
+float WarpZoneLib_BoxTouchesBrush_Recurse(vector mi, vector ma, entity e, entity ig)
{
- float s;
+ float f, s;
entity se;
- float f;
- tracebox('0 0 0', WarpZoneLib_BoxTouchesBrush_mins, WarpZoneLib_BoxTouchesBrush_maxs, '0 0 0', MOVE_NOMONSTERS, WarpZoneLib_BoxTouchesBrush_ignore);
+ tracebox('0 0 0', mi, ma, '0 0 0', MOVE_NOMONSTERS, ig);
#ifdef CSQC
if (trace_networkentity)
{
#endif
if (!trace_ent)
return 0;
- if (trace_ent == WarpZoneLib_BoxTouchesBrush_ent)
+ if (trace_ent == e)
return 1;
se = trace_ent;
s = se.solid;
se.solid = SOLID_NOT;
- f = WarpZoneLib_BoxTouchesBrush_Recurse();
+ f = WarpZoneLib_BoxTouchesBrush_Recurse(mi, ma, e, ig);
se.solid = s;
return f;
float WarpZoneLib_BoxTouchesBrush(vector mi, vector ma, entity e, entity ig)
{
- float f, s;
+ // bones_was_here: TODO: when findbox() builtin is available, use it to
+ // optimise this into a single non-recursive function that only calls tracebox once
- if(!e.modelindex || e.warpzone_isboxy)
- return 1;
+ float f, s;
- s = e.solid;
- e.solid = SOLID_BSP;
- WarpZoneLib_BoxTouchesBrush_mins = mi;
- WarpZoneLib_BoxTouchesBrush_maxs = ma;
- WarpZoneLib_BoxTouchesBrush_ent = e;
- WarpZoneLib_BoxTouchesBrush_ignore = ig;
- f = WarpZoneLib_BoxTouchesBrush_Recurse();
- e.solid = s;
+ if(!e.modelindex || e.warpzone_isboxy)
+ return 1;
+
+ s = e.solid;
+ e.solid = SOLID_BSP;
+ f = WarpZoneLib_BoxTouchesBrush_Recurse(mi, ma, e, ig);
+ e.solid = s;
- return f;
+ return f;
}
entity WarpZone_Find(vector mi, vector ma)
case "weaponentity":
case "exteriorweaponentity":
case "sprite_waypoint":
+ case "waypoint":
case "spawnfunc":
case "weaponchild":
case "chatbubbleentity":
bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher)
{
vector emin = toucher.absmin, emax = toucher.absmax;
- // the engine offsets 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';
+ 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);
}