3 // Welcome to the stuff behind the scenes
4 // Below, you will find the list of buffs
6 // Note: Buffs also need spawnfuncs, which are set below
11 REGISTRY(Buffs, BIT(4))
12 REGISTER_REGISTRY(RegisterBuffs)
14 #define REGISTER_BUFF(id) \
15 REGISTER(RegisterBuffs, BUFF, Buffs, id, m_id, NEW(Buff)); \
16 REGISTER_INIT_POST(BUFF, id) { \
17 this.netname = this.m_name; \
18 this.m_itemid = BIT(this.m_id - 1); \
19 this.m_sprite = strzone(strcat("buff-", this.m_name)); \
21 REGISTER_INIT(BUFF, id)
23 #include "../items/item/pickup.qh"
26 ATTRIB(Buff, m_itemid, int, 0)
27 ATTRIB(Buff, m_name, string, "buff")
28 ATTRIB(Buff, m_color, vector, '1 1 1')
29 ATTRIB(Buff, m_prettyName, string, "Buff")
30 ATTRIB(Buff, m_skin, int, 0)
31 ATTRIB(Buff, m_sprite, string, "")
32 METHOD(Buff, display, void(entity this, void(string name, string icon) returns)) {
33 returns(this.m_prettyName, sprintf("/gfx/hud/%s/buff_%s", cvar_string("menu_skin"), this.m_name));
36 METHOD(Buff, m_time, float(entity));
37 float Buff_m_time(entity this) { return cvar(strcat("g_buffs_", this.netname, "_time")); }
43 void buff_Init(entity ent);
44 void buff_Init_Compat(entity ent, entity replacement);
45 #define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \
46 self.buffs = b.m_itemid; \
50 #define BUFF_SPAWNFUNCS(e, b) \
51 BUFF_SPAWNFUNC(e, b, 0) \
52 BUFF_SPAWNFUNC(e##_team1, b, NUM_TEAM_1) \
53 BUFF_SPAWNFUNC(e##_team2, b, NUM_TEAM_2) \
54 BUFF_SPAWNFUNC(e##_team3, b, NUM_TEAM_3) \
55 BUFF_SPAWNFUNC(e##_team4, b, NUM_TEAM_4)
56 #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) spawnfunc(item_##o) { buff_Init_Compat(self, r); }
58 #define BUFF_SPAWNFUNC(e, b, t)
59 #define BUFF_SPAWNFUNCS(e, b)
60 #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r)
64 BUFF_SPAWNFUNCS(random, BUFF_Null)