]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
items: Apply vertical offset on Q3 maps to match Q3 bbox floor height
authorbones_was_here <bones_was_here@xonotic.au>
Sat, 22 Jul 2023 19:43:21 +0000 (05:43 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Tue, 12 Mar 2024 01:28:59 +0000 (11:28 +1000)
The lack of this caused high-placed items to be stuck in a "ceiling"
brush in a few cases (problematic for droptofloor). It also meant
suspended items were too high, causing cases where a jump pad sent the
player slightly under the item, with nothing they could do to reach it.

qcsrc/server/items/items.qc

index 23e11ec0098fd2187a863371593fed2f9de3c1c2..d09ea81aa1b93ae4c89253049b3df251f4f6d575 100644 (file)
@@ -1082,11 +1082,19 @@ void StartItem(entity this, entity def)
                if(this.angles != '0 0 0')
                        this.SendFlags |= ISF_ANGLES;
 
-               if(q3compat && !this.team)
+               if(q3compat)
                {
-                       string t = GetField_fullspawndata(this, "team");
-                       // bones_was_here: this hack is cheaper than changing to a .string strcmp()
-                       if(t) this.team = crc16(false, t);
+                       if (!this.team)
+                       {
+                               string t = GetField_fullspawndata(this, "team");
+                               // bones_was_here: this hack is cheaper than changing to a .string strcmp()
+                               if(t) this.team = crc16(false, t);
+                       }
+
+                       // In Q3 the origin is in the middle of the bbox ("radius" 15), in Xon it's at the bottom
+                       // so we need to offset vertically (only for items placed by the mapper).
+                       this.origin.z += -15 - this.mins.z;
+                       setorigin(this, this.origin);
                }
 
                // it's a level item