3 #include <common/resources/resources.qh>
4 #include <common/sounds/sound.qh>
6 float autocvar_g_balance_superweapons_time;
7 bool autocvar_g_fullbrightitems;
8 float autocvar_g_items_maxdist;
9 float autocvar_g_items_dropped_lifetime;
10 int autocvar_g_pickup_items;
11 bool autocvar_g_nodepthtestitems;
12 #define autocvar_g_weapon_stay cvar("g_weapon_stay")
14 void StartItem(entity this, entity a);
16 .int item_group_count;
18 float autocvar_sv_simple_items;
19 bool ItemSend(entity this, entity to, int sf);
21 const float ITEM_RESPAWN_TICKS = 10;
23 // string overrides entity
24 .string item_pickupsound;
25 .entity item_pickupsound_ent;
26 .entity item_model_ent;
28 .float max_armorvalue;
32 .float scheduledrespawntime;
34 .float respawntimejitter;
35 .float respawntimestart;
37 .float item_respawncounter;
39 .bool noalign; // if set to 1, the item or spawnpoint won't be dropped to the floor
41 .float superweapons_finished; // NOTE: this field is used only by map entities, it does not directly apply the superweapons stat
43 // delay before this item can be picked up
44 .float item_spawnshieldtime;
46 void Item_Show (entity e, int mode);
48 void Item_Respawn (entity this);
50 void Item_RespawnCountdown(entity this);
51 void Item_ScheduleRespawnIn(entity e, float t);
53 void Item_ScheduleRespawn(entity e);
55 void Item_ScheduleInitialRespawn(entity e);
57 /// \brief Give several random weapons and ammo to the entity.
58 /// \param[in,out] receiver Entity to give weapons to.
59 /// \param[in] num_weapons Number of weapons to give.
60 /// \param[in] weapon_names Names of weapons to give separated by spaces.
61 /// \param[in] ammo Entity containing the ammo amount for each possible weapon.
62 /// \return No return.
63 void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names, entity ammo_entity);
65 bool Item_GiveAmmoTo(entity item, entity player, Resource res_type, float ammomax);
67 bool Item_GiveTo(entity item, entity player);
69 void Item_Touch(entity this, entity toucher);
71 void Item_Reset(entity this);
73 void Item_FindTeam(entity this);
75 void Item_CopyFields(entity this, entity to);
77 bool ItemSend(entity this, entity to, int sf);
78 void ItemUpdate(entity this);
80 void UpdateItemAfterTeleport(entity this);
82 void RemoveItem(entity this);
84 // pickup evaluation functions
85 // these functions decide how desirable an item is to the bots
87 float generic_pickupevalfunc(entity player, entity item);// {return item.bot_pickupbasevalue;} // WEAPONTODO
89 float weapon_pickupevalfunc(entity player, entity item);
90 float ammo_pickupevalfunc(entity player, entity item);
91 float healtharmor_pickupevalfunc(entity player, entity item);
95 void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter);
97 void setItemGroup(entity this);
98 void setItemGroupCount();
100 float GiveWeapon(entity e, float wpn, float op, float val);
102 float GiveBit(entity e, .float fld, float bit, float op, float val);
104 float GiveValue(entity e, .float fld, float op, float val);
106 void GiveSound(entity e, float v0, float v1, float t, Sound snd_incr, Sound snd_decr);
108 void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .float regenfield, float regentime);
110 spawnfunc(target_items);
112 #define PREGIVE_WEAPONS(e) WepSet save_weapons; save_weapons = STAT(WEAPONS, e)
113 #define PREGIVE(e,f) float save_##f; save_##f = (e).f
114 #define PREGIVE_STATUSEFFECT(e,f) bool save_##f = StatusEffects_active(f, (e))
115 #define PREGIVE_RESOURCE(e,f) float save_##f = GetResource((e), (f))
116 #define POSTGIVE_WEAPON(e,b,snd_incr,snd_decr) GiveSound((e), !!(save_weapons & WepSet_FromWeapon(b)), !!(STAT(WEAPONS, e) & WepSet_FromWeapon(b)), 0, snd_incr, snd_decr)
117 #define POSTGIVE_BIT(e,f,b,snd_incr,snd_decr) GiveSound((e), save_##f & (b), (e).f & (b), 0, snd_incr, snd_decr)
118 #define POSTGIVE_STATUSEFFECT(e,f,snd_incr,snd_decr) GiveSound((e), save_##f, StatusEffects_active(f, (e)), 0, snd_incr, snd_decr)
119 #define POSTGIVE_RESOURCE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, GetResource((e), (f)), t, snd_incr, snd_decr)
120 #define POSTGIVE_RES_ROT(e,f,t,rotfield,rottime,regenfield,regentime,snd_incr,snd_decr) GiveRot((e),save_##f,GetResource((e),(f)),rotfield,rottime,regenfield,regentime);GiveSound((e),save_##f,GetResource((e),(f)),t,snd_incr,snd_decr)
121 #define POSTGIVE_VALUE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr)
122 #define POSTGIVE_VALUE_ROT(e,f,t,rotfield,rottime,regenfield,regentime,snd_incr,snd_decr) GiveRot((e), save_##f, (e).f, rotfield, rottime, regenfield, regentime); GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr)
124 float GiveItems(entity e, float beginarg, float endarg);
126 IntrusiveList g_items;
127 STATIC_INIT(g_items) { g_items = IL_NEW(); }
129 #define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
130 #define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER.m_id) || ((dt) == DEATH_SLIME.m_id) || ((dt) == DEATH_LAVA.m_id) || ((dt) == DEATH_SWAMP.m_id))