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 #include "registry.qh"
14 const int BUFFS_MAX = 16;
15 entity BUFFS[BUFFS_MAX], BUFFS_first, BUFFS_last;
17 #define REGISTER_BUFF(id) \
18 REGISTER(RegisterBuffs, BUFF, BUFFS, BUFFS_COUNT, id, m_id, NEW(Buff)); \
19 REGISTER_INIT_POST(BUFF, id) { \
20 this.netname = this.m_name; \
21 this.m_itemid = BIT(this.m_id - 1); \
22 this.m_sprite = strzone(strcat("buff-", this.m_name)); \
24 REGISTER_INIT(BUFF, id)
25 REGISTER_REGISTRY(RegisterBuffs)
27 #include "items/item/pickup.qh"
30 ATTRIB(Buff, m_itemid, int, 0)
31 ATTRIB(Buff, m_name, string, "buff")
32 ATTRIB(Buff, m_color, vector, '1 1 1')
33 ATTRIB(Buff, m_prettyName, string, "Buff")
34 ATTRIB(Buff, m_skin, int, 0)
35 ATTRIB(Buff, m_sprite, string, "")
37 METHOD(Buff, m_time, float(entity))
38 float Buff_m_time(entity this) { return cvar(strcat("g_buffs_", this.netname, "_time")); }
45 this.m_prettyName = _("Ammo");
48 this.m_color = '0.76 1 0.1';
51 REGISTER_BUFF(RESISTANCE) {
52 this.m_prettyName = _("Resistance");
53 this.m_name = "resistance";
55 this.m_color = '0.36 1 0.07';
58 REGISTER_BUFF(SPEED) {
59 this.m_prettyName = _("Speed");
60 this.m_name = "speed";
62 this.m_color = '0.1 1 0.84';
65 REGISTER_BUFF(MEDIC) {
66 this.m_prettyName = _("Medic");
67 this.m_name = "medic";
69 this.m_color = '1 0.12 0';
73 this.m_prettyName = _("Bash");
76 this.m_color = '1 0.39 0';
79 REGISTER_BUFF(VAMPIRE) {
80 this.m_prettyName = _("Vampire");
81 this.m_name = "vampire";
83 this.m_color = '1 0 0.24';
86 REGISTER_BUFF(DISABILITY) {
87 this.m_prettyName = _("Disability");
88 this.m_name = "disability";
90 this.m_color = '0.94 0.3 1';
93 REGISTER_BUFF(VENGEANCE) {
94 this.m_prettyName = _("Vengeance");
95 this.m_name = "vengeance";
97 this.m_color = '1 0.23 0.61';
100 REGISTER_BUFF(JUMP) {
101 this.m_prettyName = _("Jump");
102 this.m_name = "jump";
104 this.m_color = '0.24 0.78 1';
107 REGISTER_BUFF(FLIGHT) {
108 this.m_prettyName = _("Flight");
109 this.m_name = "flight";
111 this.m_color = '0.33 0.56 1';
114 REGISTER_BUFF(INVISIBLE) {
115 this.m_prettyName = _("Invisible");
116 this.m_name = "invisible";
118 this.m_color = '0.5 0.5 1';
121 REGISTER_BUFF(INFERNO) {
122 this.m_prettyName = _("Inferno");
123 this.m_name = "inferno";
125 this.m_color = '1 0.62 0';
128 REGISTER_BUFF(SWAPPER) {
129 this.m_prettyName = _("Swapper");
130 this.m_name = "swapper";
132 this.m_color = '0.63 0.36 1';
135 REGISTER_BUFF(MAGNET) {
136 this.m_prettyName = _("Magnet");
137 this.m_name = "magnet";
139 this.m_color = '1 0.95 0.18';
144 void buff_Init(entity ent);
145 void buff_Init_Compat(entity ent, entity replacement);
147 #define BUFF_SPAWNFUNC(e, b, t) void spawnfunc_item_buff_##e() { \
148 self.buffs = b.m_itemid; \
152 #define BUFF_SPAWNFUNCS(e, b) \
153 BUFF_SPAWNFUNC(e, b, 0) \
154 BUFF_SPAWNFUNC(e##_team1, b, NUM_TEAM_1) \
155 BUFF_SPAWNFUNC(e##_team2, b, NUM_TEAM_2) \
156 BUFF_SPAWNFUNC(e##_team3, b, NUM_TEAM_3) \
157 BUFF_SPAWNFUNC(e##_team4, b, NUM_TEAM_4)
158 #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) void spawnfunc_item_##o() { buff_Init_Compat(self, r); }
160 BUFF_SPAWNFUNCS(resistance, BUFF_RESISTANCE)
161 BUFF_SPAWNFUNCS(ammo, BUFF_AMMO)
162 BUFF_SPAWNFUNCS(speed, BUFF_SPEED)
163 BUFF_SPAWNFUNCS(medic, BUFF_MEDIC)
164 BUFF_SPAWNFUNCS(bash, BUFF_BASH)
165 BUFF_SPAWNFUNCS(vampire, BUFF_VAMPIRE)
166 BUFF_SPAWNFUNCS(disability, BUFF_DISABILITY)
167 BUFF_SPAWNFUNCS(vengeance, BUFF_VENGEANCE)
168 BUFF_SPAWNFUNCS(jump, BUFF_JUMP)
169 BUFF_SPAWNFUNCS(flight, BUFF_FLIGHT)
170 BUFF_SPAWNFUNCS(invisible, BUFF_INVISIBLE)
171 BUFF_SPAWNFUNCS(inferno, BUFF_INFERNO)
172 BUFF_SPAWNFUNCS(swapper, BUFF_SWAPPER)
173 BUFF_SPAWNFUNCS(magnet, BUFF_MAGNET)
174 BUFF_SPAWNFUNCS(random, BUFF_NULL)
176 BUFF_SPAWNFUNC_Q3TA_COMPAT(doubler, BUFF_MEDIC)
177 BUFF_SPAWNFUNC_Q3TA_COMPAT(resistance, BUFF_RESISTANCE)
178 BUFF_SPAWNFUNC_Q3TA_COMPAT(scout, BUFF_SPEED)
179 BUFF_SPAWNFUNC_Q3TA_COMPAT(ammoregen, BUFF_AMMO)
182 BUFF_SPAWNFUNC_Q3TA_COMPAT(haste, BUFF_SPEED)
183 BUFF_SPAWNFUNC_Q3TA_COMPAT(invis, BUFF_INVISIBLE)
184 BUFF_SPAWNFUNC_Q3TA_COMPAT(medic, BUFF_MEDIC)
186 #undef BUFF_SPAWNFUNC
187 #undef BUFF_SPAWNFUNC_Q3TA_COMPAT
188 #undef BUFF_SPAWNFUNCS