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)) {
29 returns(this.m_prettyName, sprintf("/gfx/hud/%s/buff_%s", cvar_string("menu_skin"), this.m_name));
32 METHOD(Buff, m_time, float(Buff this))
33 { return cvar(strcat("g_buffs_", this.netname, "_time")); }
37 STATIC_INIT(REGISTER_BUFFS) {
38 FOREACH(Buffs, true, {
39 it.netname = it.m_name; \
40 it.m_itemid = BIT(it.m_id - 1); \
41 it.m_sprite = strzone(strcat("buff-", it.m_name)); \
46 // .int buffs = _STAT(BUFFS);
47 void buff_Init(entity ent);
48 void buff_Init_Compat(entity ent, entity replacement);
49 #define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \
50 this.buffs = b.m_itemid; \
54 #define BUFF_SPAWNFUNCS(e, b) \
55 BUFF_SPAWNFUNC(e, b, 0) \
56 BUFF_SPAWNFUNC(e##_team1, b, NUM_TEAM_1) \
57 BUFF_SPAWNFUNC(e##_team2, b, NUM_TEAM_2) \
58 BUFF_SPAWNFUNC(e##_team3, b, NUM_TEAM_3) \
59 BUFF_SPAWNFUNC(e##_team4, b, NUM_TEAM_4)
60 #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) spawnfunc(item_##o) { buff_Init_Compat(this, r); }
62 #define BUFF_SPAWNFUNC(e, b, t)
63 #define BUFF_SPAWNFUNCS(e, b)
64 #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r)
68 BUFF_SPAWNFUNCS(random, BUFF_Null)