]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/buffs/buffs.qh
Merge branch 'master' into bones_was_here/q3compat
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / buffs / buffs.qh
index 7d4e583675b812169ee16ebc076b57f3973ee7e3..f88cda3a24d229ac7902be9cae9f632ef77487ea 100644 (file)
@@ -3,13 +3,16 @@
 #include <common/teams.qh>
 #include <common/util.qh>
 
+#ifdef GAMEQC
+#include <common/mutators/mutator/waypoints/all.qh>
+#endif
+
 #ifdef GAMEQC
 REGISTER_WAYPOINT(Buff, _("Buff"), "", '1 0.5 0', 1);
 REGISTER_RADARICON(Buff, 1);
 #endif
 
 REGISTRY(Buffs, BITS(5))
-#define Buffs_from(i) _Buffs_from(i, BUFF_Null)
 REGISTER_REGISTRY(Buffs)
 REGISTRY_CHECK(Buffs)
 
@@ -35,10 +38,10 @@ CLASS(Buff, Pickup)
 ENDCLASS(Buff)
 
 STATIC_INIT(REGISTER_BUFFS) {
-    FOREACH(Buffs, true, {
-        it.m_itemid = BIT(it.m_id - 1); \
-        it.m_sprite = strzone(strcat("buff-", it.netname)); \
-    });
+       FOREACH(Buffs, true, {
+               it.m_itemid = BIT(it.m_id - 1);
+               it.m_sprite = strzone(strcat("buff-", it.netname));
+       });
 }
 
 #ifdef SVQC
@@ -46,7 +49,8 @@ STATIC_INIT(REGISTER_BUFFS) {
        void buff_Init_Compat(entity ent, entity replacement);
        #define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \
                STAT(BUFFS, this) = b.m_itemid; \
-               this.team = t; \
+               if(teamplay) \
+                       this.team_forced = t; \
                buff_Init(this); \
        }
        #define BUFF_SPAWNFUNCS(e, b)                       \
@@ -55,11 +59,11 @@ STATIC_INIT(REGISTER_BUFFS) {
                        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(this, r); }
+       #define BUFF_SPAWNFUNC_Q3COMPAT(o, r) spawnfunc(o) { buff_Init_Compat(this, r); }
 #else
        #define BUFF_SPAWNFUNC(e, b, t)
        #define BUFF_SPAWNFUNCS(e, b)
-       #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r)
+       #define BUFF_SPAWNFUNC_Q3COMPAT(o, r)
 #endif
 
 string Buff_UndeprecateName(string buffname);
@@ -68,4 +72,5 @@ entity buff_FirstFromFlags(int _buffs);
 REGISTER_BUFF(Null);
 BUFF_SPAWNFUNCS(random, BUFF_Null)
 
+REGISTRY_DEFINE_GET(Buffs, BUFF_Null)
 #include "all.inc"