14 WepSet WepSet_GetFromStat();
15 WepSet WepSet_GetFromStat_InMap();
37 #define WEPSET(id) (WEP_##id.m_wepset) 38 #define WepSet_FromWeapon(it) ((it).m_wepset) 41 #define DEFAULT_FILENAME "weapons_dump.cfg" 51 wep_config_alsoprint = -1;
52 string filename =
argv(1);
57 wep_config_alsoprint =
false;
59 else if(filename ==
"-")
62 wep_config_alsoprint =
true;
66 if(wep_config_file >= 0)
69 LOG_INFOF(
"Dumping weapons... File located in ^2data/data/%s^7.", filename);
72 wep_config_alsoprint = -1;
76 LOG_INFOF(
"^1Error: ^7Could not open file '%s'!", filename);
79 LOG_INFO(
"Weapons dump command only works with sv_cmd.");
87 LOG_HELP(
"Usage:^3 ", GetProgramCommandPrefix(),
" dumpweapons [<filename>]");
89 LOG_HELP(
" if supplied with '-' output to console as well as default,");
90 LOG_HELP(
" if left blank, it will only write to default.");
95 #undef DEFAULT_FILENAME 99 float autocvar_w_prop_interval = 5;
100 .void(
Weapon this,
int) wr_net;
101 void W_PROP_reload(
int chan,
entity to)
103 W_PROP_reloader.nextthink =
time + autocvar_w_prop_interval;
111 void W_PROP_think(
entity this)
123 #define REGISTER_WEAPON(...) EVAL_REGISTER_WEAPON(OVERLOAD(REGISTER_WEAPON, __VA_ARGS__)) 124 #define EVAL_REGISTER_WEAPON(...) __VA_ARGS__ 125 #define REGISTER_WEAPON_2(id, inst) REGISTER(Weapons, WEP, id, m_id, inst) 127 #define REGISTER_WEAPON_3(id, sname, inst) \ 128 REGISTER_WEAPON_2(id, inst); \ 129 [[alias("WEP_" #id)]] Weapon _wep_##sname 136 FOREACH(Weapons, it != WEP_Null && it.netname == s,
return it);
144 #define X(fld, T) .T fld; .T wepvar_##fld = fld; 145 X(switchdelay_drop,
float)
146 X(switchdelay_raise,
float)
147 X(weaponreplace,
string)
148 X(weaponstartoverride,
float)
149 X(weaponstart,
float)
150 X(weaponthrowable,
float)
152 X(reload_ammo,
float)
153 const .float reloading_ammo = reload_ammo;
163 #define W_PROPS(L, class, prefix) \ 164 L(W_PROP_BEGIN, W_PROP, W_PROP_END, class, prefix) \ 165 L(W_CONFIG_BEGIN, W_CONFIG, W_CONFIG_END, class, prefix) \ 166 L(W_UPDATE_BEGIN, W_UPDATE, W_UPDATE_END, class, prefix) \ 167 L(W_NET_BEGIN, W_NET, W_NET_END, class, prefix) \ 171 #define W_PROP(class, wepname, fld, T, m) W_PROP_##m(class, fld, T, wepname) 172 #define W_PROP_NONE(class, fld, T, wepname) _W_PROP(class, fld, T, wepname) 173 #define W_PROP_PRI(class, fld, T, wepname) _W_PROP(class, primary_##fld, T, wepname) 174 #define W_PROP_SEC(class, fld, T, wepname) _W_PROP(class, secondary_##fld, T, wepname) 175 #define W_PROP_BOTH(class, fld, T, wepname) \ 176 W_PROP_PRI(class, fld, T, wepname) \ 177 W_PROP_SEC(class, fld, T, wepname) 178 #define W_PROP_BEGIN(class) 180 #define _W_PROP(class, fld, T, wepname) \ 181 T _W_PROP_CVAR(wepname, fld); \ 182 ATTRIB(class, wepvar_##fld, T, _W_PROP_CVAR(wepname, fld)); 183 #define _W_PROP_CVAR(wepname, fld) autocvar_g_balance_##wepname##_##fld 185 #define _W_PROP(class, fld, T, wepname) 186 #define _W_PROP_CVAR(wepname, fld) 192 #define W_CONFIG(class, wepname, fld, T, m) W_CONFIG_##m(class, fld, T, wepname) 193 #define W_CONFIG_NONE(class, fld, T, wepname) _W_CONFIG(class, fld, T, wepname) 194 #define W_CONFIG_PRI(class, fld, T, wepname) _W_CONFIG(class, primary_##fld, T, wepname) 195 #define W_CONFIG_SEC(class, fld, T, wepname) _W_CONFIG(class, secondary_##fld, T, wepname) 196 #define W_CONFIG_BOTH(class, fld, T, wepname) \ 197 W_CONFIG_PRI(class, fld, T, wepname) \ 198 W_CONFIG_SEC(class, fld, T, wepname) 200 #define W_CONFIG_BEGIN(class) METHOD(class, wr_config, void(class this)) { 201 #define _W_CONFIG(class, fld, T, wepname) if (#wepname == this.netname) WEP_CONFIG_WRITE_CVARS(wepname, fld, T); 202 #define W_CONFIG_END() } 204 #define W_CONFIG_BEGIN(class) 205 #define _W_CONFIG(class, fld, T, wepname) 206 #define W_CONFIG_END() 210 #define W_UPDATE(class, wepname, fld, T, m) W_UPDATE_##m(class, fld, T, wepname) 211 #define W_UPDATE_NONE(class, fld, T, wepname) _W_UPDATE(class, fld, T, wepname) 212 #define W_UPDATE_PRI(class, fld, T, wepname) _W_UPDATE(class, primary_##fld, T, wepname) 213 #define W_UPDATE_SEC(class, fld, T, wepname) _W_UPDATE(class, secondary_##fld, T, wepname) 214 #define W_UPDATE_BOTH(class, fld, T, wepname) \ 215 W_UPDATE_PRI(class, fld, T, wepname) \ 216 W_UPDATE_SEC(class, fld, T, wepname) 218 .entity baseline, baseline_target;
219 #define W_UPDATE_BEGIN(class) \ 220 METHOD(class, wr_update, void(class this)) \ 222 noref entity b = this.baseline; \ 225 b = this.baseline = new_pure(baseline); \ 226 b.baseline_target = this; \ 229 #define _W_UPDATE(class, fld, T, wepname) \ 231 T it = _W_PROP_CVAR(wepname, fld); \ 232 b.wepvar_##fld = this.wepvar_##fld; \ 233 this.wepvar_##fld = it; \ 236 #define _W_UPDATE(class, fld, T, wepname) 238 #define W_UPDATE_END() } 240 #define W_UPDATE_BEGIN(class) 241 #define _W_UPDATE(class, fld, T, wepname) 242 #define W_UPDATE_END() 246 #define W_NET(class, wepname, fld, T, m) W_NET_##m(class, fld, T, wepname) 247 #define W_NET_NONE(class, fld, T, wepname) _W_NET(class, fld, T, wepname) 248 #define W_NET_PRI(class, fld, T, wepname) _W_NET(class, primary_##fld, T, wepname) 249 #define W_NET_SEC(class, fld, T, wepname) _W_NET(class, secondary_##fld, T, wepname) 250 #define W_NET_BOTH(class, fld, T, wepname) \ 251 W_NET_PRI(class, fld, T, wepname) \ 252 W_NET_SEC(class, fld, T, wepname) 255 #define W_NET_BEGIN(class) METHOD(class, wr_net, void(class this, int i)) { int n = 0; 256 #define _W_NET(class, fld, T, wepname) \ 258 if (++n == i) this.wepvar_##fld = Read_##T(); \ 260 .void(
Weapon this,
int i) wr_net;
264 for (
int i; (i = ReadByte()); )
270 #define W_NET_END() } 273 #define W_NET_BEGIN(class) \ 274 METHOD(class, wr_net, void(class this, int chan)) \ 276 bool commit = false; \ 278 #define _W_NET(class, fld, T, wepname) \ 281 T it = this.wepvar_##fld; \ 282 if (chan == MSG_ONE || it != this.baseline.wepvar_##fld) \ 284 if (!commit) { commit = true; WriteHeader(chan, WeaponUpdate); WriteByte(chan, this.m_id); } \ 285 WriteByte(chan, i); Write_##T(chan, it); \ 288 #define W_NET_END() if (commit) WriteByte(chan, 0); } 290 #define W_NET_BEGIN(class) 291 #define _W_NET(class, fld, T, wepname) 299 #define WEP_CVAR(wepname, name) (_wep_##wepname.wepvar_##name) 300 #define WEP_CVAR_PRI(wepname, name) WEP_CVAR(wepname, primary_##name) 301 #define WEP_CVAR_SEC(wepname, name) WEP_CVAR(wepname, secondary_##name) 302 #define WEP_CVAR_BOTH(wepname, isprimary, name) ((isprimary) ? WEP_CVAR_PRI(wepname, name) : WEP_CVAR_SEC(wepname, name)) 305 #define WEP_LAST (REGISTRY_COUNT(Weapons) - 1) 312 #define WEP_HARDCODED_IMPULSES 20 315 #define WEP_IMPULSE_BEGIN 230 316 #define WEP_IMPULSE_END bound(WEP_IMPULSE_BEGIN, WEP_IMPULSE_BEGIN + (REGISTRY_COUNT(Weapons) - 1) - 1, 253) 323 string inaccessible =
"";
328 if (it == WEP_Null)
continue;
331 localcmd(sprintf(
"alias weapon_%s \"impulse %d\"\n", it.netname, imp));
333 inaccessible =
strcat(inaccessible,
"\n", it.netname);
335 if (inaccessible &&
autocvar_developer > 0)
LOG_TRACEF(
"Impulse limit exceeded, weapon(s) will not be directly accessible: %s", inaccessible);
337 FOREACH(Weapons,
true, it.wr_init(it));
342 weaponorder_byid =
strcat(weaponorder_byid,
" ",
ftos(i));
349 .entity exteriorweaponentity;
364 .vector movedir_aligned;
372 .entity muzzle_flash;
377 CASE(WFRAME, DONTCHANGE)
387 string autocvar_g_shootfromfixedorigin;
388 #define G_SHOOTFROMFIXEDORIGIN autocvar_g_shootfromfixedorigin 390 string autocvar_cl_shootfromfixedorigin;
391 #define G_SHOOTFROMFIXEDORIGIN autocvar_cl_shootfromfixedorigin 394 vector shotorg_adjust_values(
vector vecs,
bool y_is_right,
bool visual,
int algn);
395 void CL_WeaponEntity_SetModel(
entity this,
string name,
bool _anim);
411 void wframe_send(
entity actor,
entity weaponentity,
int wepframe,
float attackrate,
bool restartanim);
415 string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(
entity this,
string wo);
#define REGISTER_WEAPON(...)
REGISTRY(Weapons, 72) STATIC_INIT(WeaponPickup)
WepSet WEPSET_SUPERWEAPONS
REPLICATE_INIT(float, cvar_cl_autotaunt)
#define WEP_IMPULSE_BEGIN
REGISTRY_SORT(Notifications)
STATIC_INIT_LATE(Notif_Choices)
const int CMD_REQUEST_USAGE
#define REGISTRY_GET(id, i)
#define REGISTRY_CHECK(id)
#define NET_HANDLE(id, param)
#define REGISTER_REGISTRY(id)
#define REGISTRY_DEFINE_GET(id, null)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
WepSet _WepSet_FromWeapon(int i)
const int CMD_REQUEST_COMMAND
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define ENUMCLASS_END(id)
string W_FixWeaponOrder_AllowIncomplete(entity this, string order)
STATIC_INIT(IMPULSES_renumber)
#define new_pure(class)
purely logical entities (.origin doesn't work)
noref int autocvar_developer
#define REGISTER_NET_TEMP(id)
GENERIC_COMMAND(dumpitems, "Dump all items to the console", false)
#define WEP_HARDCODED_IMPULSES
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Weapon Weapon_from_name(string s)
void(entity this) impulse_handle
#define FOREACH(list, cond, body)
void Dump_Weapon_Settings()
#define colormapPaletteColor(c, isPants)
const int WEP_FLAG_SUPERWEAPON