#include <common/util.qh>
REGISTRY(Weapons, 72) // Increase as needed. Can be up to 72.
-#define Weapons_from(i) _Weapons_from(i, WEP_Null)
REGISTER_REGISTRY(Weapons)
STATIC_INIT(WeaponPickup) { FOREACH(Weapons, true, it.m_pickup = NEW(WeaponPickup, it)); }
#define WepSet_FromWeapon(it) ((it).m_wepset)
WepSet _WepSet_FromWeapon(int i);
-GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") // WEAPONTODO: make this work with other progs than just server
+GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt", false) // WEAPONTODO: make this work with other progs than just server
{
switch(request)
{
[[alias("WEP_" #id)]] Weapon _wep_##sname
REGISTER_WEAPON(Null, NEW(Weapon));
+REGISTRY_DEFINE_GET(Weapons, WEP_Null)
-Weapon Weapons_fromstr(string s)
+Weapon Weapon_from_name(string s)
{
FOREACH(Weapons, it != WEP_Null && it.netname == s, return it);
return WEP_Null;
.void(Weapon this, int i) wr_net;
NET_HANDLE(WeaponUpdate, bool isnew)
{
- Weapon w = Weapons_from(ReadByte());
+ Weapon w = REGISTRY_GET(Weapons, ReadByte());
for (int i; (i = ReadByte()); )
{
w.wr_net(w, i);
#define WEP_CVAR_BOTH(wepname, isprimary, name) ((isprimary) ? WEP_CVAR_PRI(wepname, name) : WEP_CVAR_SEC(wepname, name))
const int WEP_FIRST = 1;
-#define WEP_LAST (Weapons_COUNT - 1)
+#define WEP_LAST (REGISTRY_COUNT(Weapons) - 1)
WepSet WEPSET_ALL;
WepSet WEPSET_SUPERWEAPONS;
// TODO: invert after 0.8.2. Will require moving 'best weapon' impulses
#define WEP_IMPULSE_BEGIN 230
-#define WEP_IMPULSE_END bound(WEP_IMPULSE_BEGIN, WEP_IMPULSE_BEGIN + (Weapons_COUNT - 1) - 1, 253)
+#define WEP_IMPULSE_END bound(WEP_IMPULSE_BEGIN, WEP_IMPULSE_BEGIN + (REGISTRY_COUNT(Weapons) - 1) - 1, 253)
REGISTRY_SORT(Weapons, WEP_HARDCODED_IMPULSES + 1)
REGISTRY_CHECK(Weapons)
FOREACH(Weapons, true, {
WepSet set = it.m_wepset = _WepSet_FromWeapon(it.m_id = i);
WEPSET_ALL |= set;
- if ((it.spawnflags) & WEP_FLAG_SUPERWEAPON) WEPSET_SUPERWEAPONS |= set;
+ if (it.spawnflags & WEP_FLAG_SUPERWEAPON) WEPSET_SUPERWEAPONS |= set;
if (it == WEP_Null) continue;
int imp = WEP_IMPULSE_BEGIN + it.m_id - 1;
if (imp <= WEP_IMPULSE_END)
FOREACH(Weapons, true, it.wr_init(it));
#endif
weaponorder_byid = "";
- for (int i = Weapons_MAX - 1; i >= 1; --i)
- if (Weapons_from(i))
+ for (int i = REGISTRY_MAX(Weapons) - 1; i >= 1; --i)
+ if (REGISTRY_GET(Weapons, i))
weaponorder_byid = strcat(weaponorder_byid, " ", ftos(i));
weaponorder_byid = strzone(substring(weaponorder_byid, 1, -1));
}
vector weaponentity_glowmod(Weapon wep, entity actor, int c, entity wepent)
{
vector g;
- if (!(g = wep.wr_glow(wep, actor, wepent))) g = colormapPaletteColor(c & 0x0F, true) * 2;
+ if (!(g = wep.wr_glow(wep, actor, wepent))) g = colormapPaletteColor(c & 0x0F, true);
return g;
}
vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn);
void CL_WeaponEntity_SetModel(entity this, string name, bool _anim);
+#ifdef CSQC
+bool cvar_cl_accuracy_data_share;
+REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share");
+bool cvar_cl_accuracy_data_receive;
+REPLICATE(cvar_cl_accuracy_data_receive, bool, "cl_accuracy_data_receive");
+#endif
+
#ifdef SVQC
-void wframe_send(entity actor, entity weaponentity, vector a, bool restartanim);
+void wframe_send(entity actor, entity weaponentity, int wepframe, float attackrate, bool restartanim);
#endif
#endif