]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove legacy Quake bbox expansion: bmodel entities
authorbones_was_here <bones_was_here@xonotic.au>
Sun, 13 Aug 2023 17:49:43 +0000 (03:49 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 14 Mar 2024 22:14:44 +0000 (08:14 +1000)
Removes duplication of the box + '1 1 1' and boxesoverlap code.
This is handled in WarpZoneLib_ExactTrigger_Touch().

qcsrc/common/mapobjects/func/conveyor.qc
qcsrc/common/mapobjects/func/ladder.qc
qcsrc/common/mapobjects/trigger/swamp.qc
qcsrc/common/mapobjects/trigger/viewloc.qc
qcsrc/lib/warpzone/common.qc

index 3666dd337b2c56ffed1b03ca54d1339dfe98d4e8..724fb929072a11adb92d5eb7352a819a2ce61dbc 100644 (file)
@@ -21,20 +21,12 @@ void conveyor_think(entity this)
        {
                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,
index 3d94c1a2d13ecf51e87d1a7b3f9d8d66635d2710..a1b374b868dfe2878481f2ca36ad2246b055f2c5 100644 (file)
@@ -19,21 +19,11 @@ void func_ladder_think(entity 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;
                }
        });
 
@@ -178,10 +168,6 @@ NET_HANDLE(ENT_CLIENT_LADDER, bool isnew)
        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
index a54665962c975ea494677ac83c231c36f266a6bf..061c621313494256c7b4666bbb64d792ff769e3c 100644 (file)
@@ -31,20 +31,12 @@ void swamp_think(entity this)
        {
                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,
index eb3ae7f4b67e6ba3a07ee3b1d1c9d6dc271e7c8b..9efaf9588d55a17d03e9d8ee549034c0ddff132e 100644 (file)
@@ -32,37 +32,16 @@ void viewloc_think(entity 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;
index d9a12517d1512efa663e3d5234eae467156edaf8..3fe4d038486324b1f9e1b29d4e48a3eb04103c62 100644 (file)
@@ -811,12 +811,12 @@ entity WarpZone_RefSys_SpawnSameRefSys(entity me)
 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