}
#endif
- #define REGISTER_WEAPON(...) EVAL_REGISTER_WEAPON(OVERLOAD(REGISTER_WEAPON, __VA_ARGS__))
- #define EVAL_REGISTER_WEAPON(...) __VA_ARGS__
- #define REGISTER_WEAPON_2(id, inst) REGISTER(Weapons, WEP, id, m_id, inst)
- /** TODO: deprecated - remove */
- #define REGISTER_WEAPON_3(id, sname, inst) \
- REGISTER_WEAPON_2(id, inst); \
- [[alias("WEP_" #id)]] Weapon _wep_##sname
+ #define REGISTER_WEAPON(id, inst) REGISTER(Weapons, WEP, id, m_id, inst)
-REGISTER_WEAPON(Null, NEW(Weapon));
+CLASS(NullWeapon, Weapon)
+ ATTRIB(NullWeapon, m_hidden, bool, true);
+ENDCLASS(NullWeapon)
+REGISTER_WEAPON(Null, NEW(NullWeapon));
REGISTRY_DEFINE_GET(Weapons, WEP_Null)
Weapon Weapon_from_name(string s)
STATIC_INIT(register_weapons_done)
{
string inaccessible = "";
- 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 == WEP_Null) continue;
- int imp = WEP_IMPULSE_BEGIN + it.m_id - 1;
- if (imp <= WEP_IMPULSE_END)
- localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", it.netname, imp));
- else
- inaccessible = strcat(inaccessible, "\n", it.netname);
- });
- if (inaccessible != "" && autocvar_developer > 0) LOG_TRACEF("Impulse limit exceeded, weapon(s) will not be directly accessible: %s", inaccessible);
- #ifdef CSQC
- FOREACH(Weapons, true, it.wr_init(it));
- #endif
- #ifdef MENUQC
- FOREACH(Weapons, (it.spawnflags & WEP_FLAG_HIDDEN) && (it.spawnflags & WEP_FLAG_SPECIALATTACK), it.m_hidden = true); // TODO: should "hidden" weapons like the tuba actually be hidden?
- #endif
- weaponorder_byid = "";
- 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));
+ 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 == WEP_Null) continue;
+ int imp = WEP_IMPULSE_BEGIN + it.m_id - 1;
+ if (imp <= WEP_IMPULSE_END)
+ localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", it.netname, imp));
+ else
+ inaccessible = strcat(inaccessible, "\n", it.netname);
+ });
+ if (inaccessible != "" && autocvar_developer > 0) LOG_TRACEF("Impulse limit exceeded, weapon(s) will not be directly accessible: %s", inaccessible);
+ #ifdef CSQC
+ FOREACH(Weapons, true, it.wr_init(it));
+ #endif
++ #ifdef MENUQC
++ FOREACH(Weapons, (it.spawnflags & WEP_FLAG_HIDDEN) && (it.spawnflags & WEP_FLAG_SPECIALATTACK), it.m_hidden = true); // TODO: should "hidden" weapons like the tuba actually be hidden?
++ #endif
+ weaponorder_byid = "";
+ 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));
}
#ifdef GAMEQC