From: bones_was_here Date: Sat, 15 Jul 2023 10:55:22 +0000 (+1000) Subject: Remove legacy Quake bbox expansion: items (and buffs) X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b46379e6cac0154c099d239b35521943129a1574;p=xonotic%2Fxonotic-data.pk3dir.git Remove legacy Quake bbox expansion: items (and buffs) 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. --- diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 18e4e6100..e3be1e1d0 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -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 diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index 4beeda849..deffed13d 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -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; diff --git a/qcsrc/common/items/item/armor.qh b/qcsrc/common/items/item/armor.qh index 341dfec7f..b8c3b408f 100644 --- a/qcsrc/common/items/item/armor.qh +++ b/qcsrc/common/items/item/armor.qh @@ -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); diff --git a/qcsrc/common/items/item/health.qh b/qcsrc/common/items/item/health.qh index a2664cc51..a028f28c3 100644 --- a/qcsrc/common/items/item/health.qh +++ b/qcsrc/common/items/item/health.qh @@ -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); diff --git a/qcsrc/common/items/item/pickup.qh b/qcsrc/common/items/item/pickup.qh index 6df6baf83..95c9d81a0 100644 --- a/qcsrc/common/items/item/pickup.qh +++ b/qcsrc/common/items/item/pickup.qh @@ -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); diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 5014aaed5..e51c7cc9d 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -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; diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh index c8b2b363d..c8281a003 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh @@ -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); diff --git a/qcsrc/common/mutators/mutator/powerups/powerups.qh b/qcsrc/common/mutators/mutator/powerups/powerups.qh index 3a614e388..ecd754672 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerups.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerups.qh @@ -3,8 +3,7 @@ #include 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)); diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index 9a1f7b26b..00999a03f 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -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); diff --git a/qcsrc/server/items/items.qc b/qcsrc/server/items/items.qc index d09ea81aa..fe83afbda 100644 --- a/qcsrc/server/items/items.qc +++ b/qcsrc/server/items/items.qc @@ -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)