X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fall.qh;h=9b9046aa4c668b126bb023f9ff157517f5b3d3c3;hb=61d746760851b92ea6124dcc179c0f5178b62169;hp=954c55473fa137ec3d2ffbe431c85aae1dbebd27;hpb=7f5ad47610dc8b5580cc96ae961a57cca96e6975;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index 954c55473..9b9046aa4 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -1,12 +1,12 @@ #ifndef WEAPONS_ALL_H #define WEAPONS_ALL_H -#include "../command/all.qh" -#include "../stats.qh" +#include +#include #include "config.qh" // weapon sets -typedef vector WepSet; +USING(WepSet, vector); #ifdef SVQC void WriteWepSet(float dest, WepSet w); #endif @@ -21,19 +21,19 @@ WepSet ReadWepSet(); #ifndef MENUQC #include "calculations.qh" -#include "../models/all.qh" +#include #endif -#include "../util.qh" +#include #ifdef SVQC -#include "../../server/bot/aim.qh" +#include #endif 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, LAMBDA(it.m_pickup = NEW(WeaponPickup, it))); } +STATIC_INIT(WeaponPickup) { FOREACH(Weapons, true, it.m_pickup = NEW(WeaponPickup, it)); } .WepSet m_wepset; #define WEPSET(id) (WEP_##id.m_wepset) @@ -95,7 +95,7 @@ GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") // WEAPON #ifdef SVQC entity W_PROP_reloader; -float autocvar_w_prop_interval = 0; +float autocvar_w_prop_interval = 5; .void(Weapon this, int) wr_net; void W_PROP_reload(int chan, entity to) { @@ -113,13 +113,14 @@ void W_PROP_think() } STATIC_INIT_LATE(W_PROP_reloader) { - entity e = W_PROP_reloader = new(W_PROP_reloader); - make_pure(e); - WITH(entity, self, e, (e.think = W_PROP_think)()); + SELFPARAM(); + entity e = W_PROP_reloader = new_pure(W_PROP_reloader); + WITHSELF(e, (e.think = W_PROP_think)()); } #endif -#define REGISTER_WEAPON(...) EVAL(OVERLOAD(REGISTER_WEAPON, __VA_ARGS__)) +#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) \ @@ -205,8 +206,7 @@ X(reload_time, float) noref entity b = this.baseline; \ if (!b) \ { \ - b = this.baseline = new(baseline); \ - make_pure(b); \ + b = this.baseline = new_pure(baseline); \ b.baseline_target = this; \ } #ifdef SVQC @@ -299,7 +299,7 @@ REGISTRY_CHECK(Weapons) STATIC_INIT(register_weapons_done) { - FOREACH(Weapons, true, LAMBDA( + 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; @@ -310,9 +310,9 @@ STATIC_INIT(register_weapons_done) localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", it.netname, imp)); else LOG_TRACEF("Impulse limit exceeded, weapon will not be directly accessible: %s\n", it.netname); - )); + }); #ifdef CSQC - FOREACH(Weapons, true, LAMBDA(it.wr_init(it))); + FOREACH(Weapons, true, it.wr_init(it)); #endif weaponorder_byid = ""; for (int i = Weapons_MAX - 1; i >= 1; --i) @@ -325,7 +325,12 @@ STATIC_INIT(register_weapons_done) .entity weaponchild; .entity exteriorweaponentity; -.vector weaponentity_glowmod; +vector weaponentity_glowmod(Weapon wep, int c) +{ + vector g; + if (!(g = wep.wr_glow(wep))) g = colormapPaletteColor(c & 0x0F, true) * 2; + return g; +} //.int weapon; // current weapon .string weaponname; // name of .weapon @@ -351,7 +356,7 @@ ENUMCLASS_END(WFRAME) .WFRAME wframe; vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn); -void CL_WeaponEntity_SetModel(entity this, string name); +void CL_WeaponEntity_SetModel(entity this, string name, bool _anim); #endif #endif