From 726c004ad919db0e359d1176827c5f39c2071045 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 22 Jun 2018 12:09:48 +1000 Subject: [PATCH] Correctly link the entity with the area grid in QC movetype code --- qcsrc/common/physics/movetypes/movetypes.qc | 57 +++++++++++++-------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/qcsrc/common/physics/movetypes/movetypes.qc b/qcsrc/common/physics/movetypes/movetypes.qc index 3fe280858..ca43d803b 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qc +++ b/qcsrc/common/physics/movetypes/movetypes.qc @@ -351,37 +351,50 @@ void _Movetype_LinkEdict_TouchAreaGrid(entity this) // SV_LinkEdict_TouchAreaGr }); } +bool autocvar__movetype_debug = false; void _Movetype_LinkEdict(entity this, bool touch_triggers) // SV_LinkEdict { - vector mi, ma; - if(this.solid == SOLID_BSP) + if(autocvar__movetype_debug) { - // TODO set the absolute bbox - mi = this.mins; - ma = this.maxs; - } - else - { - mi = this.mins; - ma = this.maxs; - } - mi += this.origin; - ma += this.origin; + 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'; + 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; } else { - mi -= '1 1 1'; - ma += '1 1 1'; + 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 } - this.absmin = mi; - this.absmax = ma; - if(touch_triggers) _Movetype_LinkEdict_TouchAreaGrid(this); } -- 2.39.2