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
// 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;
#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
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);
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);
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);
#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
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);
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);
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);
}
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);
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)
{
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;
.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);
#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));
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);
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)