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
12 const int BUFFS_MAX = 16;
13 entity BUFFS[BUFFS_MAX], BUFFS_first, BUFFS_last;
15 #define REGISTER_BUFF(id) \
16 REGISTER(RegisterBuffs, BUFF, BUFFS, BUFFS_COUNT, id, m_id, NEW(Buff)); \
17 REGISTER_INIT_POST(BUFF, id) { \
18 this.netname = this.m_name; \
19 this.m_itemid = BIT(this.m_id - 1); \
20 this.m_sprite = strzone(strcat("buff-", this.m_name)); \
22 REGISTER_INIT(BUFF, id)
23 REGISTER_REGISTRY(RegisterBuffs)
25 #include "items/item/pickup.qh"
28 ATTRIB(Buff, m_itemid, int, 0)
29 ATTRIB(Buff, m_name, string, "buff")
30 ATTRIB(Buff, m_color, vector, '1 1 1')
31 ATTRIB(Buff, m_prettyName, string, "Buff")
32 ATTRIB(Buff, m_skin, int, 0)
33 ATTRIB(Buff, m_sprite, string, "")
34 METHOD(Buff, display, void(entity this, void(string name, string icon) returns)) {
35 returns(this.m_prettyName, sprintf("/gfx/hud/%s/buff_%s", cvar_string("menu_skin"), this.m_name));
38 METHOD(Buff, m_time, float(entity));
39 float Buff_m_time(entity this) { return cvar(strcat("g_buffs_", this.netname, "_time")); }
46 this.m_prettyName = _("Ammo");
49 this.m_color = '0.76 1 0.1';
52 REGISTER_BUFF(RESISTANCE) {
53 this.m_prettyName = _("Resistance");
54 this.m_name = "resistance";
56 this.m_color = '0.36 1 0.07';
59 REGISTER_BUFF(SPEED) {
60 this.m_prettyName = _("Speed");
61 this.m_name = "speed";
63 this.m_color = '0.1 1 0.84';
66 REGISTER_BUFF(MEDIC) {
67 this.m_prettyName = _("Medic");
68 this.m_name = "medic";
70 this.m_color = '1 0.12 0';
74 this.m_prettyName = _("Bash");
77 this.m_color = '1 0.39 0';
80 REGISTER_BUFF(VAMPIRE) {
81 this.m_prettyName = _("Vampire");
82 this.m_name = "vampire";
84 this.m_color = '1 0 0.24';
87 REGISTER_BUFF(DISABILITY) {
88 this.m_prettyName = _("Disability");
89 this.m_name = "disability";
91 this.m_color = '0.94 0.3 1';
94 REGISTER_BUFF(VENGEANCE) {
95 this.m_prettyName = _("Vengeance");
96 this.m_name = "vengeance";
98 this.m_color = '1 0.23 0.61';
101 REGISTER_BUFF(JUMP) {
102 this.m_prettyName = _("Jump");
103 this.m_name = "jump";
105 this.m_color = '0.24 0.78 1';
108 REGISTER_BUFF(FLIGHT) {
109 this.m_prettyName = _("Flight");
110 this.m_name = "flight";
112 this.m_color = '0.33 0.56 1';
115 REGISTER_BUFF(INVISIBLE) {
116 this.m_prettyName = _("Invisible");
117 this.m_name = "invisible";
119 this.m_color = '0.5 0.5 1';
122 REGISTER_BUFF(INFERNO) {
123 this.m_prettyName = _("Inferno");
124 this.m_name = "inferno";
126 this.m_color = '1 0.62 0';
129 REGISTER_BUFF(SWAPPER) {
130 this.m_prettyName = _("Swapper");
131 this.m_name = "swapper";
133 this.m_color = '0.63 0.36 1';
136 REGISTER_BUFF(MAGNET) {
137 this.m_prettyName = _("Magnet");
138 this.m_name = "magnet";
140 this.m_color = '1 0.95 0.18';
145 void buff_Init(entity ent);
146 void buff_Init_Compat(entity ent, entity replacement);
148 #define BUFF_SPAWNFUNC(e, b, t) void spawnfunc_item_buff_##e() { \
149 self.buffs = b.m_itemid; \
153 #define BUFF_SPAWNFUNCS(e, b) \
154 BUFF_SPAWNFUNC(e, b, 0) \
155 BUFF_SPAWNFUNC(e##_team1, b, NUM_TEAM_1) \
156 BUFF_SPAWNFUNC(e##_team2, b, NUM_TEAM_2) \
157 BUFF_SPAWNFUNC(e##_team3, b, NUM_TEAM_3) \
158 BUFF_SPAWNFUNC(e##_team4, b, NUM_TEAM_4)
159 #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) void spawnfunc_item_##o() { buff_Init_Compat(self, r); }
161 BUFF_SPAWNFUNCS(resistance, BUFF_RESISTANCE)
162 BUFF_SPAWNFUNCS(ammo, BUFF_AMMO)
163 BUFF_SPAWNFUNCS(speed, BUFF_SPEED)
164 BUFF_SPAWNFUNCS(medic, BUFF_MEDIC)
165 BUFF_SPAWNFUNCS(bash, BUFF_BASH)
166 BUFF_SPAWNFUNCS(vampire, BUFF_VAMPIRE)
167 BUFF_SPAWNFUNCS(disability, BUFF_DISABILITY)
168 BUFF_SPAWNFUNCS(vengeance, BUFF_VENGEANCE)
169 BUFF_SPAWNFUNCS(jump, BUFF_JUMP)
170 BUFF_SPAWNFUNCS(flight, BUFF_FLIGHT)
171 BUFF_SPAWNFUNCS(invisible, BUFF_INVISIBLE)
172 BUFF_SPAWNFUNCS(inferno, BUFF_INFERNO)
173 BUFF_SPAWNFUNCS(swapper, BUFF_SWAPPER)
174 BUFF_SPAWNFUNCS(magnet, BUFF_MAGNET)
175 BUFF_SPAWNFUNCS(random, BUFF_NULL)
177 BUFF_SPAWNFUNC_Q3TA_COMPAT(doubler, BUFF_MEDIC)
178 BUFF_SPAWNFUNC_Q3TA_COMPAT(resistance, BUFF_RESISTANCE)
179 BUFF_SPAWNFUNC_Q3TA_COMPAT(scout, BUFF_SPEED)
180 BUFF_SPAWNFUNC_Q3TA_COMPAT(ammoregen, BUFF_AMMO)
183 BUFF_SPAWNFUNC_Q3TA_COMPAT(haste, BUFF_SPEED)
184 BUFF_SPAWNFUNC_Q3TA_COMPAT(invis, BUFF_INVISIBLE)
185 BUFF_SPAWNFUNC_Q3TA_COMPAT(medic, BUFF_MEDIC)
187 #undef BUFF_SPAWNFUNC
188 #undef BUFF_SPAWNFUNC_Q3TA_COMPAT
189 #undef BUFF_SPAWNFUNCS