From: bones_was_here Date: Sun, 13 Aug 2023 17:49:43 +0000 (+1000) Subject: Remove legacy Quake bbox expansion: bmodel entities X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=7c72d5214331a45148f67dd8ca3f66ce1767d7d2;p=xonotic%2Fxonotic-data.pk3dir.git Remove legacy Quake bbox expansion: bmodel entities Removes duplication of the box + '1 1 1' and boxesoverlap code. This is handled in WarpZoneLib_ExactTrigger_Touch(). --- diff --git a/qcsrc/common/mapobjects/func/conveyor.qc b/qcsrc/common/mapobjects/func/conveyor.qc index 3666dd337..724fb9290 100644 --- a/qcsrc/common/mapobjects/func/conveyor.qc +++ b/qcsrc/common/mapobjects/func/conveyor.qc @@ -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, diff --git a/qcsrc/common/mapobjects/func/ladder.qc b/qcsrc/common/mapobjects/func/ladder.qc index 3d94c1a2d..a1b374b86 100644 --- a/qcsrc/common/mapobjects/func/ladder.qc +++ b/qcsrc/common/mapobjects/func/ladder.qc @@ -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 diff --git a/qcsrc/common/mapobjects/trigger/swamp.qc b/qcsrc/common/mapobjects/trigger/swamp.qc index a54665962..061c62131 100644 --- a/qcsrc/common/mapobjects/trigger/swamp.qc +++ b/qcsrc/common/mapobjects/trigger/swamp.qc @@ -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, diff --git a/qcsrc/common/mapobjects/trigger/viewloc.qc b/qcsrc/common/mapobjects/trigger/viewloc.qc index eb3ae7f4b..9efaf9588 100644 --- a/qcsrc/common/mapobjects/trigger/viewloc.qc +++ b/qcsrc/common/mapobjects/trigger/viewloc.qc @@ -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; diff --git a/qcsrc/lib/warpzone/common.qc b/qcsrc/lib/warpzone/common.qc index d9a12517d..3fe4d0384 100644 --- a/qcsrc/lib/warpzone/common.qc +++ b/qcsrc/lib/warpzone/common.qc @@ -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