]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove legacy Quake bbox expansion: items (and buffs)
authorbones_was_here <bones_was_here@xonotic.au>
Sat, 15 Jul 2023 10:55:22 +0000 (20:55 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 14 Mar 2024 22:14:45 +0000 (08:14 +1000)
Adds a Small 48x48x48 item bbox which is used for 5 and 25 health and
armor items. This is the biggest horizontal size that fits in the 25h
alcove on finalrage.

Changes powerup, buff and mega pickups to all have the same height.
This will make it cheaper to network item bboxes to CSQC.

qcsrc/common/constants.qh
qcsrc/common/items/item.qh
qcsrc/common/items/item/armor.qh
qcsrc/common/items/item/health.qh
qcsrc/common/items/item/pickup.qh
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qh
qcsrc/common/mutators/mutator/powerups/powerups.qh
qcsrc/common/weapons/weapon/porto.qc
qcsrc/server/items/items.qc

index 18e4e6100142b9c4ee73c3fb27ab94ec61481db3..e3be1e1d002b3c22fccdc053f39d23ee9f2045c9 100644 (file)
@@ -72,7 +72,7 @@ const int FL_INWATER                          = 16; /* BIT(3) */      // for enter / leave water splash
 const int FL_MONSTER                           = 32; /* BIT(4) */
 const int FL_GODMODE                           = 64; /* BIT(5) */      // player cheat
 const int FL_NOTARGET                          = 128; /* BIT(6) */     // player cheat
-const int FL_ITEM                                      = 256; /* BIT(7) */     // extra wide size for bonus items
+const int FL_ITEM                                      = 256; /* BIT(7) */     // extra wide size for bonus items IF sv_legacy_bbox_expand is 1
 const int FL_ONGROUND                          = 512; /* BIT(8) */     // standing on something
 const int FL_PARTIALGROUND                     = 1024; /* BIT(9) */    // not all corners are valid
 const int FL_WATERJUMP                         = 2048; /* BIT(10) */   // player jumping out of water
index 4beeda8498a52a4056f5ba101d8797b25c021acc..deffed13da58e465f48238bd87daa02e5b5d6fbf 100644 (file)
@@ -67,6 +67,14 @@ const float IT_DESPAWNFX_TIME = 1.5;
 // FIXME but updating faster applies the kludge in Item_Think() sooner so it's less noticeable
 const float IT_UPDATE_INTERVAL = 0.0625;
 
+// item bboxes for sv_legacy_bbox_expand 0
+// Small, Default and Large (large maxs are used with default mins)
+const vector ITEM_S_MINS = '-24 -24 0';
+const vector ITEM_S_MAXS = '24 24 48';
+const vector ITEM_D_MINS = '-30 -30 0'; // 0.8.6 set '-16 -16 0' then DP subtracted '15 15 1' but NetRadiant used '-30 -30 0'
+const vector ITEM_D_MAXS = '30 30 48';  // 0.8.6 set '16 16 48' then DP added '15 15 1' but NetRadiant used '30 30 32'
+const vector ITEM_L_MAXS = '30 30 70';  // 0.8.6 set '16 16 80' for powerups, '16 16 70' for megas, '16 16 60' for buffs
+
 .float fade_start;
 .float fade_end;
 
index 341dfec7fa01ce6437df2155108b64193badfa7e..b8c3b408f942c6816e7d67c74680a712cc16a18c 100644 (file)
@@ -3,8 +3,6 @@
 #include "pickup.qh"
 CLASS(Armor, Pickup)
 #ifdef SVQC
-    ATTRIB(Armor, m_mins, vector, '-16 -16 0');
-    ATTRIB(Armor, m_maxs, vector, '16 16 48');
     ATTRIB(Armor, m_pickupevalfunc, float(entity player, entity item), healtharmor_pickupevalfunc);
     ATTRIB(Armor, m_botvalue, int, 5000);
 #endif
@@ -46,6 +44,8 @@ REGISTER_ITEM(ArmorSmall, Armor) {
         this.m_icon             =   "armor"; // compatible with Xonotic v0.8.2 or lower
 #endif
 #ifdef SVQC
+    this.m_mins                 =   ITEM_S_MINS;
+    this.m_maxs                 =   ITEM_S_MAXS;
     this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_armor_small);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_armor_small);
@@ -88,6 +88,8 @@ REGISTER_ITEM(ArmorMedium, Armor) {
         this.m_icon             =   "armor"; // compatible with Xonotic v0.8.2 or lower
 #endif
 #ifdef SVQC
+    this.m_mins                 =   ITEM_S_MINS;
+    this.m_maxs                 =   ITEM_S_MAXS;
     this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_armor_medium);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_armor_medium);
@@ -177,7 +179,7 @@ REGISTER_ITEM(ArmorMega, Armor) {
     this.m_waypoint             =   _("Mega armor");
     this.m_waypointblink        =   2;
 #ifdef SVQC
-    this.m_maxs                 =   '16 16 70';
+    this.m_maxs                 =   ITEM_L_MAXS;
     this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_armor_mega);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_armor_mega);
index a2664cc516b5bf0c6d7aeee46ec67e01509e6499..a028f28c33142b7a10136b015868ce05c2800bc0 100644 (file)
@@ -3,8 +3,6 @@
 #include "pickup.qh"
 CLASS(Health, Pickup)
 #ifdef SVQC
-    ATTRIB(Health, m_mins, vector, '-16 -16 0');
-    ATTRIB(Health, m_maxs, vector, '16 16 48');
     ATTRIB(Health, m_pickupevalfunc, float(entity player, entity item), healtharmor_pickupevalfunc);
     ATTRIB(Health, m_botvalue, int, 5000);
 #endif
@@ -46,6 +44,8 @@ REGISTER_ITEM(HealthSmall, Health) {
         this.m_icon             =   "health"; // compatible with Xonotic v0.8.2 or lower
 #endif
 #ifdef SVQC
+    this.m_mins                 =   ITEM_S_MINS;
+    this.m_maxs                 =   ITEM_S_MAXS;
     this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_health_small);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_health_small);
@@ -89,6 +89,8 @@ REGISTER_ITEM(HealthMedium, Health) {
         this.m_icon             =   "health"; // compatible with Xonotic v0.8.2 or lower
 #endif
 #ifdef SVQC
+    this.m_mins                 =   ITEM_S_MINS;
+    this.m_maxs                 =   ITEM_S_MAXS;
     this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_health_medium);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_health_medium);
@@ -178,7 +180,7 @@ REGISTER_ITEM(HealthMega, Health) {
     this.m_waypoint             =   _("Mega health");
     this.m_waypointblink        =   2;
 #ifdef SVQC
-    this.m_maxs                 =   '16 16 70';
+    this.m_maxs                 =   ITEM_L_MAXS;
     this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_health_mega);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_health_mega);
index 6df6baf83a90682dd37c3eecd92e9c9c8ca673ee..95c9d81a019eba844499bb714ad40d23ff326d21 100644 (file)
@@ -45,8 +45,8 @@ CLASS(Pickup, GameItem)
     }
     ATTRIB(Pickup, m_itemid, int, 0);
 #ifdef SVQC
-    ATTRIB(Pickup, m_mins, vector, '-16 -16 0');
-    ATTRIB(Pickup, m_maxs, vector, '16 16 48');
+    ATTRIB(Pickup, m_mins, vector, ITEM_D_MINS);
+    ATTRIB(Pickup, m_maxs, vector, ITEM_D_MAXS);
     ATTRIB(Pickup, m_botvalue, int, 0);
     ATTRIB(Pickup, m_itemflags, int, 0);
     float generic_pickupevalfunc(entity player, entity item);
index 5014aaed55f6fa7e9027e7964b91631b33d9ab43..e51c7cc9d6d97696511c6df3323ddbc8365aa62a 100644 (file)
@@ -314,7 +314,7 @@ void buff_Think(entity this)
                this.skin = buff.m_skin;
 
                setmodel(this, MDL_BUFF);
-               setsize(this, BUFF_MIN, BUFF_MAX);
+               setsize(this, ITEM_D_MINS, ITEM_L_MAXS);
 
                if(this.buff_waypoint)
                {
@@ -440,7 +440,7 @@ void buff_Init(entity this)
        setthink(this, buff_Think);
        settouch(this, buff_Touch);
        setmodel(this, MDL_BUFF);
-       setsize(this, BUFF_MIN, BUFF_MAX);
+       setsize(this, ITEM_D_MINS, ITEM_L_MAXS);
        this.reset = buff_Reset;
        this.nextthink = time + 0.1;
        this.gravity = 1;
index c8b2b363d12e6e704b214036e6cf33b44cfc0c09..c8281a003372bf8f909df8632c8e3f0d9323e6ee 100644 (file)
@@ -74,9 +74,6 @@ float autocvar_g_buffs_luck_damagemultiplier = 3;
 .float buff_shield; // delay for players to keep them from spamming buff pickups
 .entity buff_model; // controls effects (TODO: make csqc)
 
-const vector BUFF_MIN = ('-16 -16 0');
-const vector BUFF_MAX = ('16 16 60');
-
 float buff_Available(entity buff);
 
 void buff_RemoveAll(entity actor, int removal_type);
index 3a614e38829485e838a2fa8c54b5135080424219..ecd754672d3bbed1e9fbe544a71b4065e8b2bd2c 100644 (file)
@@ -3,8 +3,7 @@
 #include <common/items/item/pickup.qh>
 CLASS(Powerup, Pickup)
 #ifdef SVQC
-    ATTRIB(Powerup, m_mins, vector, '-16 -16 0');
-    ATTRIB(Powerup, m_maxs, vector, '16 16 80');
+    ATTRIB(Powerup, m_maxs, vector, ITEM_L_MAXS);
     ATTRIB(Powerup, m_botvalue, int, 11000);
     ATTRIB(Powerup, m_itemflags, int, FL_POWERUP);
     ATTRIB(Powerup, m_respawntime, float(), GET(g_pickup_respawntime_powerup));
index 9a1f7b26b5f4a023044d863bd1afea60a8f2fe7c..00999a03f7f1b575a90bfd1a18a485855ad2f834 100644 (file)
@@ -118,9 +118,10 @@ void W_Porto_Fail(entity this, float failhard)
 
        if(this.cnt < 0 && !failhard && this.realowner.playerid == this.playerid && !IS_DEAD(this.realowner) && !(STAT(WEAPONS, this.realowner) & WEPSET(PORTO)))
        {
-               setsize(this, '-16 -16 0', '16 16 48');
+               // FIXME: item properties should be obtained from the registry
+               setsize(this, ITEM_D_MINS, ITEM_D_MAXS);
                setorigin(this, this.origin + trace_plane_normal);
-               if(move_out_of_solid(this))
+               if(nudgeoutofsolid(this))
                {
                        this.flags = FL_ITEM;
                        IL_PUSH(g_items, this);
index d09ea81aa1b93ae4c89253049b3df251f4f6d575..fe83afbda38e6b03b5bdbadeaf14a0e913f5fe41 100644 (file)
@@ -1046,6 +1046,9 @@ void StartItem(entity this, entity def)
                        this.nextthink = max(this.strength_finished, this.invincible_finished, this.superweapons_finished);
                }
 
+               // most loot items have a bigger horizontal size than a player
+               nudgeoutofsolid(this);
+
                // don't drop if in a NODROP zone (such as lava)
                traceline(this.origin, this.origin, MOVE_NORMAL, this);
                if (trace_dpstartcontents & DPCONTENTS_NODROP)