Removes duplication of the box + '1 1 1' and boxesoverlap code.
This is handled in WarpZoneLib_ExactTrigger_Touch().
{
FOREACH_ENTITY_RADIUS((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1, it.conveyor.active == ACTIVE_NOT && isPushable(it),
{
- vector emin = it.absmin;
- vector emax = it.absmax;
- if(this.solid == SOLID_BSP)
+ if (WarpZoneLib_ExactTrigger_Touch(this, it, false))
{
- emin -= '1 1 1';
- emax += '1 1 1';
+ if(!it.conveyor)
+ IL_PUSH(g_conveyed, it);
+ it.conveyor = this;
}
- if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
- if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, it)) // accurate
- {
- if(!it.conveyor)
- IL_PUSH(g_conveyed, it);
- it.conveyor = this;
- }
});
IL_EACH(g_conveyed, it.conveyor == this,
FOREACH_ENTITY_RADIUS((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1, !it.ladder_entity && IS_PLAYER(it) && it.move_movetype != MOVETYPE_NOCLIP && !IS_DEAD(it),
{
- vector emin = it.absmin;
- vector emax = it.absmax;
- if(this.solid == SOLID_BSP || (IS_CSQC && this.solid == SOLID_TRIGGER)) // CSQC doesn't expand properly
+ if (WarpZoneLib_ExactTrigger_Touch(this, it, false))
{
- emin -= '1 1 1';
- emax += '1 1 1';
- }
- if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
- {
- if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, it)) // accurate
- {
- if(!it.ladder_entity)
- IL_PUSH(g_ladderents, it);
- it.ladder_entity = this;
- }
+ if(!it.ladder_entity)
+ IL_PUSH(g_ladderents, it);
+ it.ladder_entity = this;
}
});
this.move_time = time;
this.entremove = func_ladder_remove;
- // NOTE: CSQC's version of setorigin doesn't expand
- this.absmin -= '1 1 1';
- this.absmax += '1 1 1';
-
return true;
}
#endif
{
FOREACH_ENTITY_RADIUS((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1, it.swampslug.active == ACTIVE_NOT && IS_PLAYER(it) && !IS_DEAD(it),
{
- vector emin = it.absmin;
- vector emax = it.absmax;
- if(this.solid == SOLID_BSP)
+ if (WarpZoneLib_ExactTrigger_Touch(this, it, false))
{
- emin -= '1 1 1';
- emax += '1 1 1';
+ if(!it.swampslug)
+ IL_PUSH(g_swamped, it);
+ it.swampslug = this;
}
- if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
- if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, it)) // accurate
- {
- if(!it.swampslug)
- IL_PUSH(g_swamped, it);
- it.swampslug = this;
- }
});
IL_EACH(g_swamped, it.swampslug == this,
#if 1
FOREACH_CLIENT(!it.viewloc && IS_PLAYER(it),
{
- vector emin = it.absmin;
- vector emax = it.absmax;
- if(this.solid == SOLID_BSP)
- {
- emin -= '1 1 1';
- emax += '1 1 1';
- }
- if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
- {
- if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, it)) // accurate
- it.viewloc = this;
- }
+ if (WarpZoneLib_ExactTrigger_Touch(this, it, false))
+ it.viewloc = this;
});
#else
-
- for(e = findradius((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1); e; e = e.chain)
- if(!e.viewloc)
- if(IS_PLAYER(e)) // should we support non-player entities with this?
- //if(!IS_DEAD(e)) // death view is handled separately, we can't override this just yet
- {
- vector emin = e.absmin;
- vector emax = e.absmax;
- if(this.solid == SOLID_BSP)
- {
- emin -= '1 1 1';
- emax += '1 1 1';
- }
- if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
- if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, e)) // accurate
- e.viewloc = this;
- }
+ for(e = findradius((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1); e; e = e.chain)
+ if(!e.viewloc)
+ if(IS_PLAYER(e)) // should we support non-player entities with this?
+ //if(!IS_DEAD(e)) // death view is handled separately, we can't override this just yet
+ if (WarpZoneLib_ExactTrigger_Touch(this, it, false))
+ e.viewloc = this;
#endif
this.nextthink = time;
bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher, bool touchfunc)
{
vector emin = toucher.absmin, emax = toucher.absmax;
- if(STAT(Q3COMPAT))
+ if (!Q3COMPAT_COMMON)
{
- // 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';
+ // Xonotic and Nexuiz maps assume triggers will be activated by adjacent players
+ // prior to sv_legacy_bbox_expand 0 DP always did this for SVQC and never for CSQC
+ emin -= '1 1 1';
+ emax += '1 1 1';
}
// if called from a touch func, we can assume the boxes do overlap