3 #include <common/teams.qh>
4 #include <common/util.qh>
7 REGISTER_WAYPOINT(Buff, _("Buff"), '1 0.5 0', 1);
8 REGISTER_RADARICON(Buff, 1);
11 REGISTRY(Buffs, BITS(5))
12 #define Buffs_from(i) _Buffs_from(i, BUFF_Null)
13 REGISTER_REGISTRY(Buffs)
16 #define REGISTER_BUFF(id) \
17 REGISTER(Buffs, BUFF_##id, m_id, NEW(Buff))
19 #include <common/items/item/pickup.qh>
22 ATTRIB(Buff, m_itemid, int, 0);
23 ATTRIB(Buff, m_name, string, "buff");
24 ATTRIB(Buff, m_color, vector, '1 1 1');
25 ATTRIB(Buff, m_prettyName, string, "Buff");
26 ATTRIB(Buff, m_skin, int, 0);
27 ATTRIB(Buff, m_sprite, string, "");
28 METHOD(Buff, display, void(entity this, void(string name, string icon) returns))
30 returns(this.m_prettyName, sprintf("/gfx/hud/%s/buff_%s", cvar_string("menu_skin"), this.m_name));
33 METHOD(Buff, m_time, float(Buff this))
35 return cvar(strcat("g_buffs_", this.netname, "_time"));
40 STATIC_INIT(REGISTER_BUFFS)
42 FOREACH(Buffs, true, {
43 it.netname = it.m_name; \
44 it.m_itemid = BIT(it.m_id - 1); \
45 it.m_sprite = strzone(strcat("buff-", it.m_name)); \
50 // .int buffs = _STAT(BUFFS);
51 void buff_Init(entity ent);
52 void buff_Init_Compat(entity ent, entity replacement);
53 #define BUFF_SPAWNFUNC(e, b, t) \
54 spawnfunc(item_buff_##e) \
56 this.buffs = b.m_itemid; \
60 #define BUFF_SPAWNFUNCS(e, b) \
61 BUFF_SPAWNFUNC(e, b, 0) \
62 BUFF_SPAWNFUNC(e##_team1, b, NUM_TEAM_1) \
63 BUFF_SPAWNFUNC(e##_team2, b, NUM_TEAM_2) \
64 BUFF_SPAWNFUNC(e##_team3, b, NUM_TEAM_3) \
65 BUFF_SPAWNFUNC(e##_team4, b, NUM_TEAM_4)
66 #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) \
69 buff_Init_Compat(this, r); \
72 #define BUFF_SPAWNFUNC(e, b, t)
73 #define BUFF_SPAWNFUNCS(e, b)
74 #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r)
77 string Buff_UndeprecateName(string buffname);
80 BUFF_SPAWNFUNCS(random, BUFF_Null)