From d290b41a611f9f8ce8bdf9ff912d38043cbf4c6d Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Sun, 23 Jul 2023 19:00:05 +1000 Subject: [PATCH] Remove legacy Quake bbox expansion: physics --- qcsrc/common/physics/movetypes/movetypes.qc | 51 ++++++--------------- 1 file changed, 13 insertions(+), 38 deletions(-) diff --git a/qcsrc/common/physics/movetypes/movetypes.qc b/qcsrc/common/physics/movetypes/movetypes.qc index 651b6f3d6..df246c6cd 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qc +++ b/qcsrc/common/physics/movetypes/movetypes.qc @@ -472,10 +472,18 @@ void _Movetype_LinkEdict_TouchAreaGrid(entity this) // SV_LinkEdict_TouchAreaGr int save_trace_dphitq3surfaceflags = trace_dphitq3surfaceflags; string save_trace_dphittexturename = trace_dphittexturename; - FOREACH_ENTITY_RADIUS_ORDERED(0.5 * (this.absmin + this.absmax), 0.5 * vlen(this.absmax - this.absmin), true, { + vector emin = this.absmin, emax = this.absmax; + // 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 + // we also need this for zero-size bboxes because radius == 0 returns nothing + // see also: WarpZoneLib_ExactTrigger_Touch() + emin -= '1 1 1'; + emax += '1 1 1'; + + FOREACH_ENTITY_RADIUS_ORDERED(0.5 * (this.absmin + this.absmax), 0.5 * vlen(emin - emax), true, { if (it.solid == SOLID_TRIGGER && it != this) if (it.move_nomonsters != MOVE_NOMONSTERS && it.move_nomonsters != MOVE_WORLDONLY) - if (gettouch(it) && boxesoverlap(it.absmin, it.absmax, this.absmin, this.absmax)) + if (gettouch(it) && boxesoverlap(it.absmin, it.absmax, emin, emax)) { trace_allsolid = false; trace_startsolid = false; @@ -493,7 +501,7 @@ void _Movetype_LinkEdict_TouchAreaGrid(entity this) // SV_LinkEdict_TouchAreaGr gettouch(it)(it, this); } - }); + }); trace_allsolid = save_trace_allsolid; trace_startsolid = save_trace_startsolid; @@ -515,44 +523,11 @@ void _Movetype_LinkEdict(entity this, bool touch_triggers) // SV_LinkEdict { if(autocvar__movetype_debug) { - vector mi, ma; - if(this.solid == SOLID_BSP) - { - // TODO set the absolute bbox - mi = this.mins; - ma = this.maxs; - } - else - { - mi = this.mins; - ma = this.maxs; - } - mi += this.origin; - ma += this.origin; - - if(this.flags & FL_ITEM) - { - mi -= '15 15 1'; - ma += '15 15 1'; - } - else - { - mi -= '1 1 1'; - ma += '1 1 1'; - } - - this.absmin = mi; - this.absmax = ma; + this.absmin = this.origin + this.mins; + this.absmax = this.origin + this.maxs; } else - { setorigin(this, this.origin); // calls SV_LinkEdict - #ifdef CSQC - // NOTE: CSQC's version of setorigin doesn't expand - this.absmin -= '1 1 1'; - this.absmax += '1 1 1'; - #endif - } if(touch_triggers) _Movetype_LinkEdict_TouchAreaGrid(this); -- 2.39.2