#ifndef BUFFS_ALL_H
#define BUFFS_ALL_H
-// Welcome to the stuff behind the scenes
-// Below, you will find the list of buffs
-// Add new buffs here!
-// Note: Buffs also need spawnfuncs, which are set below
-#include "../../../teams.qh"
-#include "../../../util.qh"
+#include <common/teams.qh>
+#include <common/util.qh>
REGISTER_WAYPOINT(Buff, _("Buff"), '1 0.5 0', 1);
REGISTER_RADARICON(Buff, 1);
-REGISTRY(Buffs, BITS(4))
+REGISTRY(Buffs, BITS(5))
#define Buffs_from(i) _Buffs_from(i, BUFF_Null)
REGISTER_REGISTRY(Buffs)
REGISTRY_CHECK(Buffs)
#define REGISTER_BUFF(id) \
- REGISTER(Buffs, BUFF_##id, m_id, NEW(Buff)); \
- REGISTER_INIT_POST(BUFF_##id) { \
- this.netname = this.m_name; \
- this.m_itemid = BIT(this.m_id - 1); \
- this.m_sprite = strzone(strcat("buff-", this.m_name)); \
- } \
- REGISTER_INIT(BUFF_##id)
+ REGISTER(Buffs, BUFF_##id, m_id, NEW(Buff))
-#include "../../../items/item/pickup.qh"
+#include <common/items/item/pickup.qh>
CLASS(Buff, Pickup)
/** bit index */
- ATTRIB(Buff, m_itemid, int, 0)
- ATTRIB(Buff, m_name, string, "buff")
- ATTRIB(Buff, m_color, vector, '1 1 1')
- ATTRIB(Buff, m_prettyName, string, "Buff")
- ATTRIB(Buff, m_skin, int, 0)
- ATTRIB(Buff, m_sprite, string, "")
+ ATTRIB(Buff, m_itemid, int, 0);
+ ATTRIB(Buff, m_name, string, "buff");
+ ATTRIB(Buff, m_color, vector, '1 1 1');
+ ATTRIB(Buff, m_prettyName, string, "Buff");
+ ATTRIB(Buff, m_skin, int, 0);
+ ATTRIB(Buff, m_sprite, string, "");
METHOD(Buff, display, void(entity this, void(string name, string icon) returns)) {
returns(this.m_prettyName, sprintf("/gfx/hud/%s/buff_%s", cvar_string("menu_skin"), this.m_name));
}
#endif
ENDCLASS(Buff)
+STATIC_INIT(REGISTER_BUFFS) {
+ FOREACH(Buffs, true, {
+ it.netname = it.m_name; \
+ it.m_itemid = BIT(it.m_id - 1); \
+ it.m_sprite = strzone(strcat("buff-", it.m_name)); \
+ });
+}
+
#ifdef SVQC
// .int buffs = _STAT(BUFFS);
void buff_Init(entity ent);
void buff_Init_Compat(entity ent, entity replacement);
#define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \
- self.buffs = b.m_itemid; \
- self.team = t; \
- buff_Init(self); \
+ this.buffs = b.m_itemid; \
+ this.team = t; \
+ buff_Init(this); \
}
#define BUFF_SPAWNFUNCS(e, b) \
BUFF_SPAWNFUNC(e, b, 0) \
BUFF_SPAWNFUNC(e##_team2, b, NUM_TEAM_2) \
BUFF_SPAWNFUNC(e##_team3, b, NUM_TEAM_3) \
BUFF_SPAWNFUNC(e##_team4, b, NUM_TEAM_4)
- #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) spawnfunc(item_##o) { buff_Init_Compat(self, r); }
+ #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) spawnfunc(item_##o) { buff_Init_Compat(this, r); }
#else
#define BUFF_SPAWNFUNC(e, b, t)
#define BUFF_SPAWNFUNCS(e, b)