]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove legacy Quake bbox expansion: physics
authorbones_was_here <bones_was_here@xonotic.au>
Sun, 23 Jul 2023 09:00:05 +0000 (19:00 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 14 Mar 2024 22:14:45 +0000 (08:14 +1000)
qcsrc/common/physics/movetypes/movetypes.qc

index 651b6f3d642e7f861fe1cb4adcb439b5a7d6a8e3..df246c6cd40f89dea1e186cc5e1ba3c14e9aca63 100644 (file)
@@ -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);