]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/items.qh
more refactor
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items.qh
index b2b1767a285e951290123d47fb726239c2537c68..b876329e77f27a6f621eb36c42eae4056747cf17 100644 (file)
@@ -95,9 +95,10 @@ float WEP_COUNT;
 float WEP_LAST;
 
 #if 1
+# define WEP_MAXCOUNT 24
 // default storage
 .float _WS_weapons;
-# define WEP_MAXCOUNT                   24
+# define WEPSET_BIT(a)                  power2of((a) - WEP_FIRST)
 # define WEPSET_DECLARE_A(a)            float _WS_##a
 # define WEPSET_CLEAR_E(e)              ((e)._WS_weapons = 0)
 # define WEPSET_CLEAR_A(a)              ((_WS_##a) = 0)
@@ -109,14 +110,77 @@ float WEP_LAST;
 # define WEPSET_OP2_EE(a,b,mergeop,x,y) ((a)._WS_weapons x (b)._WS_weapons y (a)._WS_weapons)
 # define WEPSET_OP1_EA(a,b,mergeop,x)   ((a)._WS_weapons x _WS_##b)
 # define WEPSET_OP2_EA(a,b,mergeop,x,y) ((a)._WS_weapons x _WS_##b y (a)._WS_weapons)
-# define WEPSET_OP1_EW(a,b,mergeop,x)   ((a)._WS_weapons x power2of((b) - WEP_FIRST))
-# define WEPSET_OP2_EW(a,b,mergeop,x,y) ((a)._WS_weapons x power2of((b) - WEP_FIRST) y (a)._WS_weapons)
+# define WEPSET_OP1_EW(a,b,mergeop,x)   ((a)._WS_weapons x WEPSET_BIT(b))
+# define WEPSET_OP2_EW(a,b,mergeop,x,y) ((a)._WS_weapons x WEPSET_BIT(b) y (a)._WS_weapons)
 # define WEPSET_OP1_AE(a,b,mergeop,x)   (_WS_##a x (b)._WS_weapons)
 # define WEPSET_OP2_AE(a,b,mergeop,x,y) (_WS_##a x (b)._WS_weapons y _WS_##a)
 # define WEPSET_OP1_AA(a,b,mergeop,x)   (_WS_##a x _WS_##b)
 # define WEPSET_OP2_AA(a,b,mergeop,x,y) (_WS_##a x _WS_##b y _WS_##a)
-# define WEPSET_OP1_AW(a,b,mergeop,x)   (_WS_##a x power2of((b) - WEP_FIRST))
-# define WEPSET_OP2_AW(a,b,mergeop,x,y) (_WS_##a x power2of((b) - WEP_FIRST) y _WS_##a)
+# define WEPSET_OP1_AW(a,b,mergeop,x)   (_WS_##a x WEPSET_BIT(b))
+# define WEPSET_OP2_AW(a,b,mergeop,x,y) (_WS_##a x WEPSET_BIT(b) y _WS_##a)
+#else
+/*
+-----BEGIN PGP MESSAGE-----
+Version: GnuPG v1.4.12 (GNU/Linux)
+
+hQQOA3jo81SSHof3EA//XCpTcmXeu0gaVIG9Iv/furnASpPnnbqXnnrpV/Ohoefa
+LY6Ul1pKGnnXtrbLz/Dofx7y3ynY8MIaOMyrWEqJrhweogkyTEPE6jA7VaeW0ata
+ZNU+M+BUfmPJeXEl/W/foSe9A2vRNCUdq4lzS9aZ+nFO4aWOpkH475sKf+rpZOlo
+PL3g7QgC6zsAaHqn8J6VMNKvKqsIy0HN9WTeFpiSbmrixb7NA47vyz6Bc3sS5IIi
+gnZeBJ6Em+47nbTJcFEld8ng2vmgL3OqPBGDjzNYTRW2Ef9mJN4+cb/NNPiIKOGf
+7gjvpCoeXN8Rf6XlHj8HEAzzoXN/RjalQy1KES4XkcUgNTdaaYWnWW6tQtHVyUyL
+wvLXzLQuYjiTB81ljTWpLNU4l/ZEX+ArnHNGa0FD+qmBz/9AxhUmAI5lCaybvUZ6
+/VD1mA2mc8zEhoiEZkSLevvkTqpp/siKwNYB2yZyFivyI0UMjfK/EjIJwir6LofE
+27DJtNLjgFcInXRluZmjI3BvNxIez0q91tQah1F+WD4+UT8siXuMpIjiJx390VJr
+i1eu5CpFoiWb2YbnF97WoyK39nIOqUPyM3H7YIXIXYWBfxN5UXBfRqorosa3WsGL
+6MGus1EqG2NOUXhCRtCgxS9ZRk/YuNb4cu5beP81VyPd05Ggzdh0Jmy8xvwqxMAP
++wS9MnlgLQCSKcIOZ2Bb1Yttw9+hktLjG0LE59w9qrBUyO0q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4oKqYGXgl6vfQN+Y51iuYzX9tZ4CINF363984s
+8WOhx8GNGeRF/lh3Chj3oODlXWCg22FLHXnKPi3prlsf40LmihfUi+K8TI6LsXZu
+S/gNLMLs6tPGjjYc8M0dDaHQtSY/ef5FbYCxlZsdvSAXdJVh5l0TF9tKUScH9K9r
+EFRxi+fs2oGwnUtvlon7pPudToU/KWaEfiMc9urXuuMr4rS1X/Y3gzxItzbjIhLw
+HZ2DCgyjw77Uk3tLIXQCV1ZvFEWg7K8wfubeux9K1X5otPzquj0Utxpyca17JeB1
++8ghTDPJLq8BRGjU4h1S0+ZXauLsSTo2BcAtciegZYE6iw10o5DsVQLof352APNB
+s6/2/MTkZMv/k1KCQ3kMwa+fzSNa1lj7G+FweUdbLzeuuOtyQAlRUn/J2OcUZGbl
+tU52Ds3N18ib+D1tthoVE9IsC4lM4qQqI/LnNtyCtd3415sXNTqRO54GQa4YfvJV
+dw/xOX4PipfpsSS5xdbLIdAtaAOqkJ8j4x7MXyykNcC2TayqL1nEFIteoCfVmlOq
+I7YaTGIsr4miVaIvZ+BC490dZrHkftuE6zjtEBfLk5WiW6xcCn8wqm5Rh4KC7U4y
+x562Rh2ZzVNi2Y46rIVimcBuz2vVeEridXW1dqK/eNFT5w==
+=/PJI
+-----END PGP MESSAGE-----
+*/
 #endif
 
 #define XX ,
@@ -167,8 +231,6 @@ float WEP_LAST;
 #define WEPSET_ANDNOT_AW(a,b)          WEPSET_OP1_AW(a,b,XX,&~=)
 #define WEPSET_CONTAINS_AW(a,b)     !!(WEPSET_OP1_AW(a,b,||,&))
 
-#undef XX
-
 WEPSET_DECLARE_A(WEPBIT_ALL);
 WEPSET_DECLARE_A(WEPBIT_SUPERWEAPONS);
 // note: the fabs call is just there to hide "if result is constant" warning