]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/buffs/all.qh
Merge branch 'master' into Mario/use1
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / buffs / all.qh
index db22d314115f510c7a58369af9c2c8b1d9678754..8e1319b39bdcfeb16e6b7f164735b773f7a71fde 100644 (file)
@@ -1,31 +1,21 @@
 #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)
@@ -43,8 +33,16 @@ CLASS(Buff, Pickup)
 #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;
+       // .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) { \