]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Weapons: network balance changes
authorTimePath <andrew.hardaker1995@gmail.com>
Thu, 10 Dec 2015 02:09:27 +0000 (13:09 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Thu, 10 Dec 2015 02:09:27 +0000 (13:09 +1100)
29 files changed:
qcsrc/client/autocvars.qh
qcsrc/common/effects/qc/globalsound.qc
qcsrc/common/mutators/mutator/overkill/hmg.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/config.qh
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/lib/net.qh
qcsrc/lib/oo.qh

index 919cf031ebed7ab7b412eb2b54e623500d5ac7e9..4697319d154e31fa392500aad1bbfa0167edb6b8 100644 (file)
@@ -153,10 +153,6 @@ float autocvar_crosshair_size;
 int autocvar_ekg;
 float autocvar_fov;
 float autocvar_g_balance_damagepush_speedfactor;
-float autocvar_g_balance_tuba_attenuation;
-float autocvar_g_balance_tuba_fadetime;
-float autocvar_g_balance_tuba_volume;
-int autocvar_g_balance_tuba_pitchstep;
 float autocvar_g_warmup_limit;
 bool autocvar_hud_cursormode = true;
 float autocvar_hud_colorflash_alpha;
index 71f6a2a267a340ae55bb0565e207884aaaa5cde6..9f530b9ea7478faf858c35257024e80dd18d4e65 100644 (file)
@@ -1,6 +1,6 @@
 #include "globalsound.qh"
 
-#include "../common/ent_cs.qh"
+#include "../../ent_cs.qh"
 
 #ifdef IMPLEMENTATION
        #include "../../animdecide.qh"
index 6112f89ddfe17e29098150044d4094fe3da8235d..e78e9110a70baa56ddf36004fbb89a60a6fa83fb 100644 (file)
@@ -14,31 +14,32 @@ CLASS(HeavyMachineGun, Weapon)
 /* wepimg    */ ATTRIB(HeavyMachineGun, model2, string, "weaponhmg");
 /* refname   */ ATTRIB(HeavyMachineGun, netname, string, "hmg");
 /* wepname   */ ATTRIB(HeavyMachineGun, m_name, string, _("Heavy Machine Gun"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, NONE) \
+               P(class, prefix, damage, float, NONE) \
+               P(class, prefix, force, float, NONE) \
+               P(class, prefix, refire, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, solidpenetration, float, NONE) \
+               P(class, prefix, spread_add, float, NONE) \
+               P(class, prefix, spread_max, float, NONE) \
+               P(class, prefix, spread_min, float, NONE) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, weaponreplace, string, NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+    END()
+    W_PROPS(X, HeavyMachineGun, hmg)
+#undef X
+
 ENDCLASS(HeavyMachineGun)
-REGISTER_WEAPON(HMG, NEW(HeavyMachineGun));
-
-#define HMG_SETTINGS(w_cvar,w_prop) HMG_SETTINGS_LIST(w_cvar, w_prop, HMG, hmg)
-#define HMG_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, spread_min) \
-       w_cvar(id, sn, NONE, spread_max) \
-       w_cvar(id, sn, NONE, spread_add) \
-       w_cvar(id, sn, NONE, solidpenetration) \
-       w_cvar(id, sn, NONE, damage) \
-       w_cvar(id, sn, NONE, force) \
-       w_cvar(id, sn, NONE, refire) \
-       w_cvar(id, sn, NONE, ammo) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(HMG, hmg, NEW(HeavyMachineGun));
 
-#ifdef SVQC
-HMG_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
@@ -118,10 +119,6 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
                                }
                        }
                }
-               METHOD(HeavyMachineGun, wr_init, void(entity thiswep))
-               {
-                       HMG_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep))
                {
                        float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
@@ -140,10 +137,6 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
 
                        return ammo_amount;
                }
-               METHOD(HeavyMachineGun, wr_config, void(entity thiswep))
-               {
-                       HMG_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(HeavyMachineGun, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, WEP_CVAR(hmg, ammo), SND(RELOAD));
index 94f1bd10cf5ba38bf4242ec4a0564e083377a0f1..0b0a85a3ad4c8711061cb1d4e79fcdc8b851678e 100644 (file)
@@ -14,36 +14,37 @@ CLASS(RocketPropelledChainsaw, Weapon)
 /* wepimg    */ ATTRIB(RocketPropelledChainsaw, model2, string, "weaponrpc");
 /* refname   */ ATTRIB(RocketPropelledChainsaw, netname, string, "rpc");
 /* wepname   */ ATTRIB(RocketPropelledChainsaw, m_name, string, _("Rocket Propelled Chainsaw"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, NONE) \
+               P(class, prefix, animtime, float, NONE) \
+               P(class, prefix, damage2, float, NONE) \
+               P(class, prefix, damageforcescale, float, NONE) \
+               P(class, prefix, damage, float, NONE) \
+               P(class, prefix, edgedamage, float, NONE) \
+               P(class, prefix, force, float, NONE) \
+               P(class, prefix, health, float, NONE) \
+               P(class, prefix, lifetime, float, NONE) \
+               P(class, prefix, radius, float, NONE) \
+               P(class, prefix, refire, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, speedaccel, float, NONE) \
+               P(class, prefix, speed, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+    END()
+    W_PROPS(X, RocketPropelledChainsaw, rpc)
+#undef X
+
 ENDCLASS(RocketPropelledChainsaw)
-REGISTER_WEAPON(RPC, NEW(RocketPropelledChainsaw));
-
-#define RPC_SETTINGS(w_cvar,w_prop) RPC_SETTINGS_LIST(w_cvar, w_prop, RPC, rpc)
-#define RPC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, ammo) \
-       w_cvar(id, sn, NONE, animtime) \
-       w_cvar(id, sn, NONE, damage) \
-       w_cvar(id, sn, NONE, damage2) \
-       w_cvar(id, sn, NONE, damageforcescale) \
-       w_cvar(id, sn, NONE, edgedamage) \
-       w_cvar(id, sn, NONE, force) \
-       w_cvar(id, sn, NONE, health) \
-       w_cvar(id, sn, NONE, lifetime) \
-       w_cvar(id, sn, NONE, radius) \
-       w_cvar(id, sn, NONE, refire) \
-       w_cvar(id, sn, NONE, speed) \
-       w_cvar(id, sn, NONE, speedaccel) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(RPC, rpc, NEW(RocketPropelledChainsaw));
 
-#ifdef SVQC
-RPC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
@@ -174,10 +175,6 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
                                }
                        }
                }
-               METHOD(RocketPropelledChainsaw, wr_init, void(entity thiswep))
-               {
-                       RPC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep))
                {
                        float ammo_amount = self.WEP_AMMO(RPC) >= WEP_CVAR(rpc, ammo);
@@ -188,10 +185,6 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
                {
                        return false;
                }
-               METHOD(RocketPropelledChainsaw, wr_config, void(entity thiswep))
-               {
-                       RPC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, WEP_CVAR(rpc, ammo), SND(RELOAD));
index 197a6c7bbbf6cb140060e1257361b1da57a45c87..429dfbd792d4a9f23d402f3d2d5bc559b498b5b2 100644 (file)
@@ -39,10 +39,7 @@ STATIC_INIT(WeaponPickup) { FOREACH(Weapons, true, LAMBDA(it.m_pickup = NEW(Weap
 #define WEPSET(id) (WEP_##id.m_wepset)
 #define WepSet_FromWeapon(it) ((it).m_wepset)
 WepSet _WepSet_FromWeapon(int i);
-STATIC_INIT(WepSets)
-{
-    FOREACH(Weapons, true, LAMBDA(it.m_wepset = _WepSet_FromWeapon(it.m_id)));
-}
+STATIC_INIT(WepSets) { FOREACH(Weapons, true, LAMBDA(it.m_wepset = _WepSet_FromWeapon(it.m_id))); }
 
 GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") // WEAPONTODO: make this work with other progs than just server
 {
@@ -97,43 +94,195 @@ GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") // WEAPON
     }
 }
 
-#define REGISTER_WEAPON(id, inst) \
-    /* WepSet WEPSET_##id; */ \
-    REGISTER(Weapons, WEP, id, m_id, inst)
+#ifdef SVQC
+entity W_PROP_reloader;
+float autocvar_w_prop_interval = 0;
+.void(Weapon this) wr_net;
+void W_PROP_reload()
+{
+    SELFPARAM();
+    this.nextthink = time + autocvar_w_prop_interval;
+    FOREACH(Weapons, true, {
+        it.wr_update(it);
+        void(Weapon) f = it.wr_net;
+        if (f) f(it);
+    });
+}
+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_reload)());
+}
+#endif
 
-// create cvars for weapon settings
-#define WEP_ADD_CVAR_NONE(wepname,name) [[last]] float autocvar_g_balance_##wepname##_##name;
+#define REGISTER_WEAPON(...) EVAL(OVERLOAD(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 WEP_ADD_CVAR_PRI(wepname,name) WEP_ADD_CVAR_NONE(wepname, primary_##name)
-#define WEP_ADD_CVAR_SEC(wepname,name) WEP_ADD_CVAR_NONE(wepname, secondary_##name)
-#define WEP_ADD_CVAR_BOTH(wepname,name) \
-    WEP_ADD_CVAR_PRI(wepname, name) \
-    WEP_ADD_CVAR_SEC(wepname, name)
+REGISTER_WEAPON(Null, NEW(Weapon));
 
-#define WEP_ADD_CVAR(wepid,wepname,mode,name) WEP_ADD_CVAR_##mode(wepname, name)
 
-// create properties for weapon settings
-#define WEP_ADD_PROP(wepid,wepname,type,prop,name) \
-    .type prop; \
-    [[last]] type autocvar_g_balance_##wepname##_##name;
 
-// read cvars from weapon settings
-#define WEP_CVAR(wepname,name) autocvar_g_balance_##wepname##_##name
-#define WEP_CVAR_PRI(wepname,name) WEP_CVAR(wepname, primary_##name)
-#define WEP_CVAR_SEC(wepname,name) WEP_CVAR(wepname, secondary_##name)
-#define WEP_CVAR_BOTH(wepname,isprimary,name) ((isprimary) ? WEP_CVAR_PRI(wepname, name) : WEP_CVAR_SEC(wepname, name))
+// legacy w_prop mappings
+#define X(fld, T) .T fld; .T wepvar_##fld = fld;
+X(switchdelay_drop, float)
+X(switchdelay_raise, float)
+X(weaponreplace, string)
+X(weaponstartoverride, float)
+X(weaponstart, float)
+X(weaponthrowable, float)
+X(reload_ammo, float)
+.float reloading_ammo = reload_ammo;
+X(reload_time, float)
+.float reloading_time = reload_time;
+#undef X
+
+
+
+#define W_PROPS(L, class, prefix) \
+    L(W_PROP_BEGIN, W_PROP, W_PROP_END, class, prefix) \
+    L(W_CONFIG_BEGIN, W_CONFIG, W_CONFIG_END, class, prefix) \
+    L(W_UPDATE_BEGIN, W_UPDATE, W_UPDATE_END, class, prefix) \
+    L(W_NET_BEGIN, W_NET, W_NET_END, class, prefix) \
+    /**/ \
+
+
+    #define W_PROP(class, wepname, fld, T, m)       W_PROP_##m(class, fld, T, wepname)
+    #define W_PROP_NONE(class, fld, T, wepname)     _W_PROP(class, fld, T, wepname)
+    #define W_PROP_PRI(class, fld, T, wepname)      _W_PROP(class, primary_##fld, T, wepname)
+    #define W_PROP_SEC(class, fld, T, wepname)      _W_PROP(class, secondary_##fld, T, wepname)
+    #define W_PROP_BOTH(class, fld, T, wepname) \
+            W_PROP_PRI(class, fld, T, wepname) \
+            W_PROP_SEC(class, fld, T, wepname)
+    #define W_PROP_BEGIN(class)
+        #define _W_PROP(class, fld, T, wepname) \
+            /* static */ T _W_PROP_CVAR(wepname, fld); \
+            ATTRIB(class, wepvar_##fld, T, _W_PROP_CVAR(wepname, fld));
+        #define _W_PROP_CVAR(wepname, fld) autocvar_g_balance_##wepname##_##fld
+    #define W_PROP_END()
+
+
+
+    #define W_CONFIG(class, wepname, fld, T, m)     W_CONFIG_##m(class, fld, T, wepname)
+    #define W_CONFIG_NONE(class, fld, T, wepname)   _W_CONFIG(class, fld, T, wepname)
+    #define W_CONFIG_PRI(class, fld, T, wepname)    _W_CONFIG(class, primary_##fld, T, wepname)
+    #define W_CONFIG_SEC(class, fld, T, wepname)    _W_CONFIG(class, secondary_##fld, T, wepname)
+    #define W_CONFIG_BOTH(class, fld, T, wepname) \
+            W_CONFIG_PRI(class, fld, T, wepname) \
+            W_CONFIG_SEC(class, fld, T, wepname)
+    #define W_CONFIG_BEGIN(class) METHOD(class, wr_config, void(class this)) {
+        #ifdef SVQC
+            #define _W_CONFIG(class, fld, T, wepname) if (#wepname == this.netname) WEP_CONFIG_WRITE_CVARS(wepname, fld, T);
+        #else
+            #define _W_CONFIG(class, fld, T, wepname)
+        #endif
+    #define W_CONFIG_END() }
+
+
+    #define W_UPDATE(class, wepname, fld, T, m)     W_UPDATE_##m(class, fld, T, wepname)
+    #define W_UPDATE_NONE(class, fld, T, wepname)   _W_UPDATE(class, fld, T, wepname)
+    #define W_UPDATE_PRI(class, fld, T, wepname)    _W_UPDATE(class, primary_##fld, T, wepname)
+    #define W_UPDATE_SEC(class, fld, T, wepname)    _W_UPDATE(class, secondary_##fld, T, wepname)
+    #define W_UPDATE_BOTH(class, fld, T, wepname) \
+            W_UPDATE_PRI(class, fld, T, wepname) \
+            W_UPDATE_SEC(class, fld, T, wepname)
+    .entity baseline, baseline_target;
+    #define W_UPDATE_BEGIN(class) \
+        METHOD(class, wr_update, void(class this)) \
+        { \
+            noref entity b = this.baseline; \
+            if (!b) \
+            { \
+                b = this.baseline = new(baseline); \
+                make_pure(b); \
+                b.baseline_target = this; \
+            }
+        #ifdef SVQC
+            #define _W_UPDATE(class, fld, T, wepname) \
+                { \
+                    T it = _W_PROP_CVAR(wepname, fld); \
+                    b.wepvar_##fld = this.wepvar_##fld; \
+                    this.wepvar_##fld = it; \
+                }
+        #else
+            #define _W_UPDATE(class, fld, T, wepname)
+        #endif
+    #define W_UPDATE_END() }
+
+
+    #define W_NET(class, wepname, fld, T, m)     W_NET_##m(class, fld, T, wepname)
+    #define W_NET_NONE(class, fld, T, wepname)   _W_NET(class, fld, T, wepname)
+    #define W_NET_PRI(class, fld, T, wepname)    _W_NET(class, primary_##fld, T, wepname)
+    #define W_NET_SEC(class, fld, T, wepname)    _W_NET(class, secondary_##fld, T, wepname)
+    #define W_NET_BOTH(class, fld, T, wepname) \
+            W_NET_PRI(class, fld, T, wepname) \
+            W_NET_SEC(class, fld, T, wepname)
+    REGISTER_NET_TEMP(WeaponUpdate)
+    #if defined(CSQC)
+        #define W_NET_BEGIN(class) METHOD(class, wr_net, void(class this, int i)) { int n = 0;
+            #define _W_NET(class, fld, T, wepname) \
+            { \
+                if (++n == i) this.wepvar_##fld = Read_##T(); \
+            }
+            .void(Weapon this, int i) wr_net;
+            NET_HANDLE(WeaponUpdate, bool isnew)
+            {
+                Weapon w = Weapons_from(ReadByte());
+                for (int i; (i = ReadByte()); )
+                {
+                    w.wr_net(w, i);
+                }
+                return true;
+            }
+        #define W_NET_END() }
+    #elif defined(SVQC)
+        #define W_NET_BEGIN(class) \
+            METHOD(class, wr_net, void(class this)) \
+            { \
+                int chan = MSG_INIT; \
+                for (;;) \
+                { \
+                    bool commit = false; \
+                    int i = 0;
+        #define _W_NET(class, fld, T, wepname) \
+                    { \
+                        ++i; \
+                        T it = this.wepvar_##fld; \
+                        if (it != this.baseline.wepvar_##fld) \
+                        { \
+                            if (!commit) { commit = true; WriteHeader(chan, WeaponUpdate); WriteByte(chan, this.m_id); } \
+                            WriteByte(chan, i); Write_##T(chan, it); \
+                        } \
+                    }
+        #define W_NET_END() \
+                    if (commit) WriteByte(chan, 0); \
+                    if (chan == MSG_INIT) chan = MSG_ALL; \
+                    else break; \
+                } \
+            }
+    #else
+        #define W_NET_BEGIN(class)
+            #define _W_NET(class, fld, T, wepname)
+        #define W_NET_END()
+    #endif
 
-// set initialization values for weapon settings
-#define WEP_SKIP_CVAR(unuseda,unusedb,unusedc,unusedd) /* skip cvars */
-#define WEP_SET_PROP(wepid,wepname,type,prop,name) WEP_##wepid.prop = autocvar_g_balance_##wepname##_##name;
+
+
+// read cvars from weapon settings
+#define WEP_CVAR(wepname, name) (_wep_##wepname.wepvar_##name)
+#define WEP_CVAR_PRI(wepname, name) WEP_CVAR(wepname, primary_##name)
+#define WEP_CVAR_SEC(wepname, name) WEP_CVAR(wepname, secondary_##name)
+#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)
 WepSet WEPSET_ALL;
 WepSet WEPSET_SUPERWEAPONS;
 
-REGISTER_WEAPON(Null, NEW(Weapon));
-
 #include "all.inc"
 
 // TODO: remove after 0.8.2. Retains impulse number compatibility because 0.8.1 clients don't reload the weapons.cfg
index b232bbcda358bf977b87e21cc75ee8e8a1b0bdc0..05294b355e09dfbe1cbeae1ea5b7efd714dbd779 100644 (file)
@@ -23,29 +23,18 @@ string wep_config_queue[MAX_WEP_CONFIG];
        if(wep_config_alsoprint) { LOG_INFO(a); } \
 } while(0)
 
-#define WEP_CONFIG_WRITE_CVARS_NONE(wepname,name) \
-       { WEP_CONFIG_QUEUE( \
-               sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \
-               cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) }
-
-#define WEP_CONFIG_WRITE_CVARS_PRI(wepname,name) WEP_CONFIG_WRITE_CVARS_NONE(wepname, primary_##name)
-#define WEP_CONFIG_WRITE_CVARS_SEC(wepname,name) WEP_CONFIG_WRITE_CVARS_NONE(wepname, secondary_##name)
-#define WEP_CONFIG_WRITE_CVARS_BOTH(wepname,name) \
-       WEP_CONFIG_WRITE_CVARS_PRI(wepname, name) \
-       WEP_CONFIG_WRITE_CVARS_SEC(wepname, name)
 
-#define WEP_CONFIG_WRITE_CVARS(wepid,wepname,mode,name) WEP_CONFIG_WRITE_CVARS_##mode(wepname, name)
+#define WEP_CONFIG_WRITE_CVARS(wepname, name, T) WEP_CONFIG_WRITE_PROPS_##T(wepname, name)
 
-#define WEP_CONFIG_WRITE_PROPS_string(wepname,name) \
+#define WEP_CONFIG_WRITE_PROPS_string(wepname, name) \
        { WEP_CONFIG_QUEUE( \
                sprintf("set g_balance_%s_%s \"%s\"\n", #wepname, #name, \
                cvar_string(sprintf("g_balance_%s_%s", #wepname, #name)))) }
 
-#define WEP_CONFIG_WRITE_PROPS_float(wepname,name) \
+#define WEP_CONFIG_WRITE_PROPS_float(wepname, name) \
        { WEP_CONFIG_QUEUE( \
                sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \
                cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) }
 
-#define WEP_CONFIG_WRITE_PROPS(wepid,wepname,type,prop,name) WEP_CONFIG_WRITE_PROPS_##type(wepname,name)
 #endif
 #endif
index bc98da4330f81278254b76c9296d1a4b12f24552..a0f9dd48a743fec4ea591d19f899c953fab281fd 100644 (file)
@@ -124,7 +124,8 @@ CLASS(Weapon, Object)
     METHOD(Weapon, wr_drop, void(Weapon this)) {}
     /** (SERVER) a weapon is picked up */
     METHOD(Weapon, wr_pickup, void(Weapon this)) {}
-
+    /** (SERVER) update cvar based properties */
+    METHOD(Weapon, wr_update, void(Weapon this)) {}
        METHOD(Weapon, display, void(entity this, void(string name, string icon) returns)) {
                returns(this.m_name, this.model2 ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.model2) : string_null);
        }
index 4a15cc6c7f1a90bc0af1fd2bfccd8cafda7db1d5..5d468785060e5163ad093c37e8aea24ceb4c8790 100644 (file)
@@ -14,47 +14,52 @@ CLASS(Arc, Weapon)
 /* wepimg    */ ATTRIB(Arc, model2, string, "weaponarc");
 /* refname   */ ATTRIB(Arc, netname, string, "arc");
 /* wepname   */ ATTRIB(Arc, m_name, string, _("Arc"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, beam_ammo, float, NONE) \
+        P(class, prefix, beam_animtime, float, NONE) \
+        P(class, prefix, beam_botaimlifetime, float, NONE) \
+        P(class, prefix, beam_botaimspeed, float, NONE) \
+        P(class, prefix, beam_damage, float, NONE) \
+        P(class, prefix, beam_degreespersegment, float, NONE) \
+        P(class, prefix, beam_distancepersegment, float, NONE) \
+        P(class, prefix, beam_falloff_halflifedist, float, NONE) \
+        P(class, prefix, beam_falloff_maxdist, float, NONE) \
+        P(class, prefix, beam_falloff_mindist, float, NONE) \
+        P(class, prefix, beam_force, float, NONE) \
+        P(class, prefix, beam_healing_amax, float, NONE) \
+        P(class, prefix, beam_healing_aps, float, NONE) \
+        P(class, prefix, beam_healing_hmax, float, NONE) \
+        P(class, prefix, beam_healing_hps, float, NONE) \
+        P(class, prefix, beam_heat, float, NONE) /* heat increase per second (primary) */ \
+        P(class, prefix, beam_maxangle, float, NONE) \
+        P(class, prefix, beam_nonplayerdamage, float, NONE) \
+        P(class, prefix, beam_range, float, NONE) \
+        P(class, prefix, beam_refire, float, NONE) \
+        P(class, prefix, beam_returnspeed, float, NONE) \
+        P(class, prefix, beam_tightness, float, NONE) \
+        P(class, prefix, burst_ammo, float, NONE) \
+        P(class, prefix, burst_damage, float, NONE) \
+        P(class, prefix, burst_healing_aps, float, NONE) \
+        P(class, prefix, burst_healing_hps, float, NONE) \
+        P(class, prefix, burst_heat, float, NONE) /* heat increase per second (secondary) */ \
+        P(class, prefix, cooldown, float, NONE) /* heat decrease per second when resting */ \
+        P(class, prefix, overheat_max, float, NONE) /* maximum heat before jamming */ \
+        P(class, prefix, overheat_min, float, NONE) /* minimum heat to wait for cooldown */ \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+    END()
+    W_PROPS(X, Arc, arc)
+#undef X
+
 ENDCLASS(Arc)
-REGISTER_WEAPON(ARC, NEW(Arc));
-
-#define ARC_SETTINGS(w_cvar,w_prop) ARC_SETTINGS_LIST(w_cvar, w_prop, ARC, arc)
-#define ARC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, beam_ammo) \
-       w_cvar(id, sn, NONE, beam_animtime) \
-       w_cvar(id, sn, NONE, beam_botaimspeed) \
-       w_cvar(id, sn, NONE, beam_botaimlifetime) \
-       w_cvar(id, sn, NONE, beam_damage) \
-       w_cvar(id, sn, NONE, beam_degreespersegment) \
-       w_cvar(id, sn, NONE, beam_distancepersegment) \
-       w_cvar(id, sn, NONE, beam_falloff_halflifedist) \
-       w_cvar(id, sn, NONE, beam_falloff_maxdist) \
-       w_cvar(id, sn, NONE, beam_falloff_mindist) \
-       w_cvar(id, sn, NONE, beam_force) \
-       w_cvar(id, sn, NONE, beam_healing_amax) \
-       w_cvar(id, sn, NONE, beam_healing_aps) \
-       w_cvar(id, sn, NONE, beam_healing_hmax) \
-       w_cvar(id, sn, NONE, beam_healing_hps) \
-       w_cvar(id, sn, NONE, beam_maxangle) \
-       w_cvar(id, sn, NONE, beam_nonplayerdamage) \
-       w_cvar(id, sn, NONE, beam_range) \
-       w_cvar(id, sn, NONE, beam_refire) \
-       w_cvar(id, sn, NONE, beam_returnspeed) \
-       w_cvar(id, sn, NONE, beam_tightness) \
-       w_cvar(id, sn, NONE, burst_ammo) \
-       w_cvar(id, sn, NONE, burst_damage) \
-       w_cvar(id, sn, NONE, burst_healing_aps) \
-       w_cvar(id, sn, NONE, burst_healing_hps) \
-       w_cvar(id, sn, NONE, overheat_max)/* maximum heat before jamming */ \
-       w_cvar(id, sn, NONE, overheat_min)/* minimum heat to wait for cooldown */ \
-       w_cvar(id, sn, NONE, beam_heat)   /* heat increase per second (primary) */ \
-       w_cvar(id, sn, NONE, burst_heat)  /* heat increase per second (secondary) */ \
-       w_cvar(id, sn, NONE, cooldown)    /* heat decrease per second when resting */ \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(ARC, arc, NEW(Arc));
+
 
 #ifndef MENUQC
 const float ARC_MAX_SEGMENTS = 20;
@@ -82,7 +87,6 @@ const int ARC_SF_BEAMTYPE =    BIT(4);
 const int ARC_SF_LOCALMASK =   ARC_SF_START | ARC_SF_WANTDIR | ARC_SF_BEAMDIR;
 #endif
 #ifdef SVQC
-ARC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .entity arc_beam;
 .bool arc_BUTTON_ATCK_prev; // for better animation control
 .float beam_prev;
@@ -719,7 +723,6 @@ void Arc_Smoke()
                                arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
                                arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
                        }
-                       ARC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
                }
                METHOD(Arc, wr_checkammo1, bool(entity thiswep))
                {
@@ -732,10 +735,6 @@ void Arc_Smoke()
                        return WEP_CVAR(arc, overheat_max) > 0 &&
                                ((!WEP_CVAR(arc, burst_ammo)) || (self.WEP_AMMO(ARC) > 0));
                }
-               METHOD(Arc, wr_config, void(entity thiswep))
-               {
-                       ARC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Arc, wr_killmessage, int(entity thiswep))
                {
                        return WEAPON_ARC_MURDER;
index 23ea7e1c8cb1d2c2d9739eb9495b6272fc8f32af..1063a9c66ef111d167723360fef49fd085499ca1 100644 (file)
@@ -14,33 +14,36 @@ CLASS(Blaster, Weapon)
 /* wepimg    */ ATTRIB(Blaster, model2, string, "weaponlaser");
 /* refname   */ ATTRIB(Blaster, netname, string, "blaster");
 /* wepname   */ ATTRIB(Blaster, m_name, string, _("Blaster"));
-ENDCLASS(Blaster)
-REGISTER_WEAPON(BLASTER, NEW(Blaster));
 
-#define BLASTER_SETTINGS(w_cvar,w_prop) BLASTER_SETTINGS_LIST(w_cvar, w_prop, BLASTER, blaster)
-#define BLASTER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, delay) \
-       w_cvar(id, sn, BOTH, edgedamage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, force_zscale) \
-       w_cvar(id, sn, BOTH, lifetime) \
-       w_cvar(id, sn, BOTH, radius) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, shotangle) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, delay, float, BOTH) \
+               P(class, prefix, edgedamage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, force_zscale, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, radius, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, shotangle, float, BOTH) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, spread, float, BOTH) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Blaster, blaster)
+#undef X
+
+ENDCLASS(Blaster)
+REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster));
 
 #ifdef SVQC
-BLASTER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float blaster_damage;
 .float blaster_edgedamage;
 .float blaster_radius;
@@ -219,11 +222,6 @@ void W_Blaster_Attack(
                        }
                }
 
-               METHOD(Blaster, wr_init, void(entity thiswep))
-               {
-                       BLASTER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
-
                METHOD(Blaster, wr_setup, void(entity thiswep))
                {
                        self.ammo_field = ammo_none;
@@ -239,11 +237,6 @@ void W_Blaster_Attack(
                        return true; // blaster has infinite ammo
                }
 
-               METHOD(Blaster, wr_config, void(entity thiswep))
-               {
-                       BLASTER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
-
                METHOD(Blaster, wr_suicidemessage, int(entity thiswep))
                {
                        return WEAPON_BLASTER_SUICIDE;
index 300622289b8af9656fcab2214a3c61239140c946..eb4dbdd87bf1ac079c8f0fd8c28598ef14bbd4a8 100644 (file)
@@ -14,48 +14,51 @@ CLASS(Crylink, Weapon)
 /* wepimg    */ ATTRIB(Crylink, model2, string, "weaponcrylink");
 /* refname   */ ATTRIB(Crylink, netname, string, "crylink");
 /* wepname   */ ATTRIB(Crylink, m_name, string, _("Crylink"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+        P(class, prefix, animtime, float, BOTH) \
+        P(class, prefix, bouncedamagefactor, float, BOTH) \
+        P(class, prefix, bounces, float, BOTH) \
+        P(class, prefix, damage, float, BOTH) \
+        P(class, prefix, edgedamage, float, BOTH) \
+        P(class, prefix, force, float, BOTH) \
+        P(class, prefix, joindelay, float, BOTH) \
+        P(class, prefix, joinexplode, float, BOTH) \
+        P(class, prefix, joinexplode_damage, float, BOTH) \
+        P(class, prefix, joinexplode_edgedamage, float, BOTH) \
+        P(class, prefix, joinexplode_force, float, BOTH) \
+        P(class, prefix, joinexplode_radius, float, BOTH) \
+        P(class, prefix, joinspread, float, BOTH) \
+        P(class, prefix, linkexplode, float, BOTH) \
+        P(class, prefix, middle_fadetime, float, BOTH) \
+        P(class, prefix, middle_lifetime, float, BOTH) \
+        P(class, prefix, other_fadetime, float, BOTH) \
+        P(class, prefix, other_lifetime, float, BOTH) \
+        P(class, prefix, radius, float, BOTH) \
+        P(class, prefix, refire, float, BOTH) \
+        P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, secondary, float, NONE) \
+        P(class, prefix, shots, float, BOTH) \
+        P(class, prefix, speed, float, BOTH) \
+        P(class, prefix, spreadtype, float, SEC) \
+        P(class, prefix, spread, float, BOTH) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Crylink, crylink)
+#undef X
+
 ENDCLASS(Crylink)
-REGISTER_WEAPON(CRYLINK, NEW(Crylink));
-
-#define CRYLINK_SETTINGS(w_cvar,w_prop) CRYLINK_SETTINGS_LIST(w_cvar, w_prop, CRYLINK, crylink)
-#define CRYLINK_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, edgedamage) \
-       w_cvar(id, sn, BOTH, radius) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, shots) \
-       w_cvar(id, sn, BOTH, bounces) \
-       w_cvar(id, sn, BOTH, bouncedamagefactor) \
-       w_cvar(id, sn, BOTH, middle_lifetime) \
-       w_cvar(id, sn, BOTH, middle_fadetime) \
-       w_cvar(id, sn, BOTH, other_lifetime) \
-       w_cvar(id, sn, BOTH, other_fadetime) \
-       w_cvar(id, sn, BOTH, linkexplode) \
-       w_cvar(id, sn, BOTH, joindelay) \
-       w_cvar(id, sn, BOTH, joinspread) \
-       w_cvar(id, sn, BOTH, joinexplode) \
-       w_cvar(id, sn, BOTH, joinexplode_damage) \
-       w_cvar(id, sn, BOTH, joinexplode_edgedamage) \
-       w_cvar(id, sn, BOTH, joinexplode_radius) \
-       w_cvar(id, sn, BOTH, joinexplode_force) \
-       w_cvar(id, sn, SEC,  spreadtype) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(CRYLINK, crylink, NEW(Crylink));
 
 #ifdef SVQC
-CRYLINK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float gravity;
 .float crylink_waitrelease;
 .entity crylink_lastgroup;
@@ -628,10 +631,6 @@ void W_Crylink_Attack2(Weapon thiswep)
                                }
                        }
                }
-               METHOD(Crylink, wr_init, void(entity thiswep))
-               {
-                       CRYLINK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Crylink, wr_checkammo1, bool(entity thiswep))
                {
                        SELFPARAM();
@@ -654,10 +653,6 @@ void W_Crylink_Attack2(Weapon thiswep)
                        ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
                        return ammo_amount;
                }
-               METHOD(Crylink, wr_config, void(entity thiswep))
-               {
-                       CRYLINK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Crylink, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
index 6a841c9eb4186eac9cd17a2b64afb7a67a0d0a87..25a823788a69bc4338e3074b1ba7d4694c5f40c6 100644 (file)
@@ -14,50 +14,53 @@ CLASS(Devastator, Weapon)
 /* wepimg    */ ATTRIB(Devastator, model2, string, "weaponrocketlauncher");
 /* refname   */ ATTRIB(Devastator, netname, string, "devastator");
 /* wepname   */ ATTRIB(Devastator, m_name, string, _("Devastator"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, NONE) \
+        P(class, prefix, animtime, float, NONE) \
+        P(class, prefix, damageforcescale, float, NONE) \
+        P(class, prefix, damage, float, NONE) \
+        P(class, prefix, detonatedelay, float, NONE) \
+        P(class, prefix, edgedamage, float, NONE) \
+        P(class, prefix, force, float, NONE) \
+        P(class, prefix, guidedelay, float, NONE) \
+        P(class, prefix, guidegoal, float, NONE) \
+        P(class, prefix, guideratedelay, float, NONE) \
+        P(class, prefix, guiderate, float, NONE) \
+        P(class, prefix, guidestop, float, NONE) \
+        P(class, prefix, health, float, NONE) \
+        P(class, prefix, lifetime, float, NONE) \
+        P(class, prefix, radius, float, NONE) \
+        P(class, prefix, refire, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, remote_damage, float, NONE) \
+        P(class, prefix, remote_edgedamage, float, NONE) \
+        P(class, prefix, remote_force, float, NONE) \
+        P(class, prefix, remote_jump_damage, float, NONE) \
+        P(class, prefix, remote_jump_radius, float, NONE) \
+        P(class, prefix, remote_jump_velocity_z_add, float, NONE) \
+        P(class, prefix, remote_jump_velocity_z_max, float, NONE) \
+        P(class, prefix, remote_jump_velocity_z_min, float, NONE) \
+        P(class, prefix, remote_radius, float, NONE) \
+        P(class, prefix, speedaccel, float, NONE) \
+        P(class, prefix, speedstart, float, NONE) \
+        P(class, prefix, speed, float, NONE) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, weaponreplace, string,NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Devastator, devastator)
+#undef X
+
 ENDCLASS(Devastator)
-REGISTER_WEAPON(DEVASTATOR, NEW(Devastator));
-
-#define DEVASTATOR_SETTINGS(w_cvar,w_prop) DEVASTATOR_SETTINGS_LIST(w_cvar, w_prop, DEVASTATOR, devastator)
-#define DEVASTATOR_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, ammo) \
-       w_cvar(id, sn, NONE, animtime) \
-       w_cvar(id, sn, NONE, damage) \
-       w_cvar(id, sn, NONE, damageforcescale) \
-       w_cvar(id, sn, NONE, detonatedelay) \
-       w_cvar(id, sn, NONE, edgedamage) \
-       w_cvar(id, sn, NONE, force) \
-       w_cvar(id, sn, NONE, guidedelay) \
-       w_cvar(id, sn, NONE, guidegoal) \
-       w_cvar(id, sn, NONE, guiderate) \
-       w_cvar(id, sn, NONE, guideratedelay) \
-       w_cvar(id, sn, NONE, guidestop) \
-       w_cvar(id, sn, NONE, health) \
-       w_cvar(id, sn, NONE, lifetime) \
-       w_cvar(id, sn, NONE, radius) \
-       w_cvar(id, sn, NONE, refire) \
-       w_cvar(id, sn, NONE, remote_damage) \
-       w_cvar(id, sn, NONE, remote_edgedamage) \
-       w_cvar(id, sn, NONE, remote_force) \
-       w_cvar(id, sn, NONE, remote_jump_damage) \
-       w_cvar(id, sn, NONE, remote_jump_radius) \
-       w_cvar(id, sn, NONE, remote_jump_velocity_z_add) \
-       w_cvar(id, sn, NONE, remote_jump_velocity_z_max) \
-       w_cvar(id, sn, NONE, remote_jump_velocity_z_min) \
-       w_cvar(id, sn, NONE, remote_radius) \
-       w_cvar(id, sn, NONE, speed) \
-       w_cvar(id, sn, NONE, speedaccel) \
-       w_cvar(id, sn, NONE, speedstart) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(DEVASTATOR, devastator, NEW(Devastator));
 
 #ifdef SVQC
-DEVASTATOR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float rl_release;
 .float rl_detonate_later;
 #endif
@@ -559,10 +562,6 @@ void W_Devastator_Attack(Weapon thiswep)
                                }
                        }
                }
-               METHOD(Devastator, wr_init, void(entity thiswep))
-               {
-                       DEVASTATOR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Devastator, wr_setup, void(entity thiswep))
                {
                        self.rl_release = 1;
@@ -607,10 +606,6 @@ void W_Devastator_Attack(Weapon thiswep)
                {
                        return false;
                }
-               METHOD(Devastator, wr_config, void(entity thiswep))
-               {
-                       DEVASTATOR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Devastator, wr_resetplayer, void(entity thiswep))
                {
                        self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
index 30dd6d74a3813394a268c59532577ed099d5fd65..f43ce3bbd0558555969b164c523b33a051aa7252 100644 (file)
@@ -14,54 +14,58 @@ CLASS(Electro, Weapon)
 /* wepimg    */ ATTRIB(Electro, model2, string, "weaponelectro");
 /* refname   */ ATTRIB(Electro, netname, string, "electro");
 /* wepname   */ ATTRIB(Electro, m_name, string, _("Electro"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bouncefactor, float, SEC) \
+               P(class, prefix, bouncestop, float, SEC) \
+               P(class, prefix, comboradius, float, PRI) \
+               P(class, prefix, combo_comboradius, float, NONE) \
+               P(class, prefix, combo_comboradius_thruwall, float, NONE) \
+               P(class, prefix, combo_damage, float, NONE) \
+               P(class, prefix, combo_edgedamage, float, NONE) \
+               P(class, prefix, combo_force, float, NONE) \
+               P(class, prefix, combo_radius, float, NONE) \
+               P(class, prefix, combo_safeammocheck, float, NONE) \
+               P(class, prefix, combo_speed, float, NONE) \
+               P(class, prefix, count, float, SEC) \
+               P(class, prefix, damagedbycontents, float, SEC) \
+               P(class, prefix, damageforcescale, float, SEC) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, edgedamage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, health, float, SEC) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, midaircombo_explode, float, PRI) \
+               P(class, prefix, midaircombo_interval, float, PRI) \
+               P(class, prefix, midaircombo_radius, float, PRI) \
+               P(class, prefix, radius, float, BOTH) \
+               P(class, prefix, refire2, float, SEC) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, speed_up, float, SEC) \
+               P(class, prefix, speed_z, float, SEC) \
+               P(class, prefix, spread, float, BOTH) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, touchexplode, float, SEC) \
+               P(class, prefix, weaponreplace, string,NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Electro, electro)
+#undef X
+
 ENDCLASS(Electro)
-REGISTER_WEAPON(ELECTRO, NEW(Electro));
-
-#define ELECTRO_SETTINGS(w_cvar,w_prop) ELECTRO_SETTINGS_LIST(w_cvar, w_prop, ELECTRO, electro)
-#define ELECTRO_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, edgedamage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, radius) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, BOTH, lifetime) \
-       w_cvar(id, sn, PRI,  comboradius) \
-       w_cvar(id, sn, PRI,  midaircombo_explode) \
-       w_cvar(id, sn, PRI,  midaircombo_interval) \
-       w_cvar(id, sn, PRI,  midaircombo_radius) \
-       w_cvar(id, sn, SEC,  bouncefactor) \
-       w_cvar(id, sn, SEC,  bouncestop) \
-       w_cvar(id, sn, SEC,  count) \
-       w_cvar(id, sn, SEC,  damageforcescale) \
-       w_cvar(id, sn, SEC,  damagedbycontents) \
-       w_cvar(id, sn, SEC,  health) \
-       w_cvar(id, sn, SEC,  refire2) \
-       w_cvar(id, sn, SEC,  speed_up) \
-       w_cvar(id, sn, SEC,  speed_z) \
-       w_cvar(id, sn, SEC,  touchexplode) \
-       w_cvar(id, sn, NONE, combo_comboradius) \
-       w_cvar(id, sn, NONE, combo_comboradius_thruwall) \
-       w_cvar(id, sn, NONE, combo_damage) \
-       w_cvar(id, sn, NONE, combo_edgedamage) \
-       w_cvar(id, sn, NONE, combo_force) \
-       w_cvar(id, sn, NONE, combo_radius) \
-       w_cvar(id, sn, NONE, combo_speed) \
-       w_cvar(id, sn, NONE, combo_safeammocheck) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(ELECTRO, electro, NEW(Electro));
+
 
 #ifdef SVQC
-ELECTRO_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float electro_count;
 .float electro_secondarytime;
 void W_Electro_ExplodeCombo();
@@ -486,10 +490,6 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
                                }
                        }
                }
-               METHOD(Electro, wr_init, void(entity thiswep))
-               {
-                       ELECTRO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Electro, wr_checkammo1, bool(entity thiswep))
                {
                        float ammo_amount = self.WEP_AMMO(ELECTRO) >= WEP_CVAR_PRI(electro, ammo);
@@ -511,10 +511,6 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
                        }
                        return ammo_amount;
                }
-               METHOD(Electro, wr_config, void(entity thiswep))
-               {
-                       ELECTRO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Electro, wr_resetplayer, void(entity thiswep))
                {
                        self.electro_secondarytime = time;
index 7b96971e9247e1178f975d4297e4a10f322512a4..2beeb69a12dbc75c174a76c307cca254939b0e7e 100644 (file)
@@ -14,42 +14,45 @@ CLASS(Fireball, Weapon)
 /* wepimg    */ ATTRIB(Fireball, model2, string, "weaponfireball");
 /* refname   */ ATTRIB(Fireball, netname, string, "fireball");
 /* wepname   */ ATTRIB(Fireball, m_name, string, _("Fireball"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bfgdamage, float, PRI) \
+               P(class, prefix, bfgforce, float, PRI) \
+               P(class, prefix, bfgradius, float, PRI) \
+               P(class, prefix, damageforcescale, float, BOTH) \
+               P(class, prefix, damagetime, float, SEC) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, edgedamage, float, PRI) \
+               P(class, prefix, force, float, PRI) \
+               P(class, prefix, health, float, PRI) \
+               P(class, prefix, laserburntime, float, BOTH) \
+               P(class, prefix, laserdamage, float, BOTH) \
+               P(class, prefix, laseredgedamage, float, BOTH) \
+               P(class, prefix, laserradius, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, radius, float, PRI) \
+               P(class, prefix, refire2, float, PRI) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, speed_up, float, SEC) \
+               P(class, prefix, speed_z, float, SEC) \
+               P(class, prefix, spread, float, BOTH) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, weaponreplace, string,NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Fireball, fireball)
+#undef X
+
 ENDCLASS(Fireball)
-REGISTER_WEAPON(FIREBALL, NEW(Fireball));
-
-#define FIREBALL_SETTINGS(w_cvar,w_prop) FIREBALL_SETTINGS_LIST(w_cvar, w_prop, FIREBALL, fireball)
-#define FIREBALL_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, damageforcescale) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, BOTH, lifetime) \
-       w_cvar(id, sn, BOTH, laserburntime) \
-       w_cvar(id, sn, BOTH, laserdamage) \
-       w_cvar(id, sn, BOTH, laseredgedamage) \
-       w_cvar(id, sn, BOTH, laserradius) \
-       w_cvar(id, sn, PRI,  edgedamage) \
-       w_cvar(id, sn, PRI,  force) \
-       w_cvar(id, sn, PRI,  radius) \
-       w_cvar(id, sn, PRI,  health) \
-       w_cvar(id, sn, PRI,  refire2) \
-       w_cvar(id, sn, PRI,  bfgdamage) \
-       w_cvar(id, sn, PRI,  bfgforce) \
-       w_cvar(id, sn, PRI,  bfgradius) \
-       w_cvar(id, sn, SEC,  damagetime) \
-       w_cvar(id, sn, SEC,  speed_up) \
-       w_cvar(id, sn, SEC,  speed_z) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(FIREBALL, fireball, NEW(Fireball));
 
 #ifdef SVQC
-FIREBALL_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float bot_primary_fireballmooth; // whatever a mooth is
 .vector fireball_impactvec;
 .float fireball_primarytime;
@@ -389,10 +392,6 @@ void W_Fireball_Attack2()
                                }
                        }
                }
-               METHOD(Fireball, wr_init, void(entity thiswep))
-               {
-                       FIREBALL_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Fireball, wr_setup, void(entity thiswep))
                {
                        self.ammo_field = ammo_none;
@@ -405,10 +404,6 @@ void W_Fireball_Attack2()
                {
                        return true; // fireball has infinite ammo
                }
-               METHOD(Fireball, wr_config, void(entity thiswep))
-               {
-                       FIREBALL_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Fireball, wr_resetplayer, void(entity thiswep))
                {
                        self.fireball_primarytime = time;
index a5066017a974855caeeb9b7994c79b40ca572e61..17d0cee06d780da328d5b515bc289724463c2025 100644 (file)
@@ -14,47 +14,48 @@ CLASS(Hagar, Weapon)
 /* wepimg    */ ATTRIB(Hagar, model2, string, "weaponhagar");
 /* refname   */ ATTRIB(Hagar, netname, string, "hagar");
 /* wepname   */ ATTRIB(Hagar, m_name, string, _("Hagar"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+        P(class, prefix, damageforcescale, float, BOTH) \
+        P(class, prefix, damage, float, BOTH) \
+        P(class, prefix, edgedamage, float, BOTH) \
+        P(class, prefix, force, float, BOTH) \
+        P(class, prefix, health, float, BOTH) \
+        P(class, prefix, lifetime, float, PRI) \
+        P(class, prefix, lifetime_min, float, SEC) \
+        P(class, prefix, lifetime_rand, float, SEC) \
+        P(class, prefix, load, float, SEC) \
+        P(class, prefix, load_abort, float, SEC) \
+        P(class, prefix, load_animtime, float, SEC) \
+        P(class, prefix, load_hold, float, SEC) \
+        P(class, prefix, load_linkexplode, float, SEC) \
+        P(class, prefix, load_max, float, SEC) \
+        P(class, prefix, load_releasedeath, float, SEC) \
+        P(class, prefix, load_speed, float, SEC) \
+        P(class, prefix, load_spread, float, SEC) \
+        P(class, prefix, load_spread_bias, float, SEC) \
+        P(class, prefix, radius, float, BOTH) \
+        P(class, prefix, refire, float, BOTH) \
+        P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, secondary, float, NONE) \
+        P(class, prefix, speed, float, BOTH) \
+        P(class, prefix, spread, float, BOTH) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string,NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Hagar, hagar)
+#undef X
+
 ENDCLASS(Hagar)
-REGISTER_WEAPON(HAGAR, NEW(Hagar));
-
-#define HAGAR_SETTINGS(w_cvar,w_prop) HAGAR_SETTINGS_LIST(w_cvar, w_prop, HAGAR, hagar)
-#define HAGAR_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, edgedamage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, radius) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, BOTH, damageforcescale) \
-       w_cvar(id, sn, BOTH, health) \
-       w_cvar(id, sn, PRI,  lifetime) \
-       w_cvar(id, sn, SEC,  load) \
-       w_cvar(id, sn, SEC,  load_max) \
-       w_cvar(id, sn, SEC,  load_abort) \
-       w_cvar(id, sn, SEC,  load_animtime) \
-       w_cvar(id, sn, SEC,  load_hold) \
-       w_cvar(id, sn, SEC,  load_speed) \
-       w_cvar(id, sn, SEC,  load_releasedeath) \
-       w_cvar(id, sn, SEC,  load_spread) \
-       w_cvar(id, sn, SEC,  load_spread_bias) \
-       w_cvar(id, sn, SEC,  load_linkexplode) \
-       w_cvar(id, sn, SEC,  lifetime_min) \
-       w_cvar(id, sn, SEC,  lifetime_rand) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(HAGAR, hagar, NEW(Hagar));
 
-#ifdef SVQC
-HAGAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
@@ -439,10 +440,6 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
                                W_Hagar_Attack2_Load_Release(weaponentity);
                        }
                }
-               METHOD(Hagar, wr_init, void(entity thiswep))
-               {
-                       HAGAR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Hagar, wr_setup, void(entity thiswep))
                {
                        self.hagar_loadblock = false;
@@ -465,10 +462,6 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
                        ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
                        return ammo_amount;
                }
-               METHOD(Hagar, wr_config, void(entity thiswep))
-               {
-                       HAGAR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Hagar, wr_resetplayer, void(entity thiswep))
                {
                        self.hagar_load = 0;
index 3f52224897196c305fd57c956f8586b575d7f692..cebe69450a00386ea084593587299cc29851126c 100644 (file)
@@ -14,39 +14,41 @@ CLASS(HLAC, Weapon)
 /* wepimg    */ ATTRIB(HLAC, model2, string, "weaponhlac");
 /* refname   */ ATTRIB(HLAC, netname, string, "hlac");
 /* wepname   */ ATTRIB(HLAC, m_name, string, _("Heavy Laser Assault Cannon"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, edgedamage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, radius, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, shots, float, SEC) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, spread, float, SEC) \
+               P(class, prefix, spread_add, float, PRI) \
+               P(class, prefix, spread_crouchmod, float, BOTH) \
+               P(class, prefix, spread_max, float, PRI) \
+               P(class, prefix, spread_min, float, PRI) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, weaponreplace, string,NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, HLAC, hlac)
+#undef X
+
 ENDCLASS(HLAC)
-REGISTER_WEAPON(HLAC, NEW(HLAC));
-
-#define HLAC_SETTINGS(w_cvar,w_prop) HLAC_SETTINGS_LIST(w_cvar, w_prop, HLAC, hlac)
-#define HLAC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, edgedamage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, lifetime) \
-       w_cvar(id, sn, BOTH, radius) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, spread_crouchmod) \
-       w_cvar(id, sn, PRI,  spread_add) \
-       w_cvar(id, sn, PRI,  spread_max) \
-       w_cvar(id, sn, PRI,  spread_min) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_cvar(id, sn, SEC,  shots) \
-       w_cvar(id, sn, SEC,  spread) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(HLAC, hlac, NEW(HLAC));
+
 
-#ifdef SVQC
-HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
@@ -232,10 +234,6 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
                                }
                        }
                }
-               METHOD(HLAC, wr_init, void(entity thiswep))
-               {
-                       HLAC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(HLAC, wr_checkammo1, bool(entity thiswep))
                {
                        float ammo_amount = self.WEP_AMMO(HLAC) >= WEP_CVAR_PRI(hlac, ammo);
@@ -248,10 +246,6 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
                        ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
                        return ammo_amount;
                }
-               METHOD(HLAC, wr_config, void(entity thiswep))
-               {
-                       HLAC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(HLAC, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
index 3cc55e2ae31363058062379191415df3dc5caef9..1b6fe5e3dac56f40a3f26af5f718170cb3076e41 100644 (file)
@@ -15,8 +15,38 @@ CLASS(Hook, Weapon)
 /* refname   */ ATTRIB(Hook, netname, string, "hook");
 /* wepname   */ ATTRIB(Hook, m_name, string, _("Grappling Hook"));
        ATTRIB(Hook, ammo_factor, float, 1)
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, PRI) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, damageforcescale, float, SEC) \
+               P(class, prefix, damage, float, SEC) \
+               P(class, prefix, duration, float, SEC) \
+               P(class, prefix, edgedamage, float, SEC) \
+               P(class, prefix, force, float, SEC) \
+               P(class, prefix, gravity, float, SEC) \
+               P(class, prefix, health, float, SEC) \
+               P(class, prefix, hooked_ammo, float, PRI) \
+               P(class, prefix, hooked_time_free, float, PRI) \
+               P(class, prefix, hooked_time_max, float, PRI) \
+               P(class, prefix, lifetime, float, SEC) \
+               P(class, prefix, power, float, SEC) \
+               P(class, prefix, radius, float, SEC) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, speed, float, SEC) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Hook, hook)
+#undef X
+
 ENDCLASS(Hook)
-REGISTER_WEAPON(HOOK, NEW(Hook));
+REGISTER_WEAPON(HOOK, hook, NEW(Hook));
 
 CLASS(OffhandHook, OffhandWeapon)
 #ifdef SVQC
@@ -30,34 +60,7 @@ CLASS(OffhandHook, OffhandWeapon)
 ENDCLASS(OffhandHook)
 OffhandHook OFFHAND_HOOK; STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(OffhandHook); }
 
-#define HOOK_SETTINGS(w_cvar,w_prop) HOOK_SETTINGS_LIST(w_cvar, w_prop, HOOK, hook)
-#define HOOK_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, PRI,  ammo) \
-       w_cvar(id, sn, PRI,  hooked_ammo) \
-       w_cvar(id, sn, PRI,  hooked_time_free) \
-       w_cvar(id, sn, PRI,  hooked_time_max) \
-       w_cvar(id, sn, SEC,  damage) \
-       w_cvar(id, sn, SEC,  duration) \
-       w_cvar(id, sn, SEC,  edgedamage) \
-       w_cvar(id, sn, SEC,  force) \
-       w_cvar(id, sn, SEC,  gravity) \
-       w_cvar(id, sn, SEC,  lifetime) \
-       w_cvar(id, sn, SEC,  power) \
-       w_cvar(id, sn, SEC,  radius) \
-       w_cvar(id, sn, SEC,  speed) \
-       w_cvar(id, sn, SEC,  health) \
-       w_cvar(id, sn, SEC,  damageforcescale) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
-
 #ifdef SVQC
-HOOK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 
 .float dmg;
 .float dmg_edge;
@@ -269,10 +272,6 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
                                actor.hook_state &= ~HOOK_REMOVING;
                        }
                }
-               METHOD(Hook, wr_init, void(entity thiswep))
-               {
-                       HOOK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Hook, wr_setup, void(entity thiswep))
                {
                        self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
@@ -290,10 +289,6 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
                        // infinite ammo for now
                        return true; // self.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
                }
-               METHOD(Hook, wr_config, void(entity thiswep))
-               {
-                       HOOK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Hook, wr_resetplayer, void(entity thiswep))
                {
                        RemoveGrapplingHook(self);
index 1f8273748c47b1145bcd5c148b5d0df817193715..7805feda829f579bd17b57cb3775cefbf0a42402 100644 (file)
@@ -14,45 +14,47 @@ CLASS(MachineGun, Weapon)
 /* wepimg    */ ATTRIB(MachineGun, model2, string, "weaponuzi");
 /* refname   */ ATTRIB(MachineGun, netname, string, "machinegun");
 /* wepname   */ ATTRIB(MachineGun, m_name, string, _("MachineGun"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, burst, float, NONE) \
+               P(class, prefix, burst_ammo, float, NONE) \
+               P(class, prefix, burst_animtime, float, NONE) \
+               P(class, prefix, burst_refire2, float, NONE) \
+               P(class, prefix, burst_refire, float, NONE) \
+               P(class, prefix, burst_speed, float, NONE) \
+               P(class, prefix, first, float, NONE) \
+               P(class, prefix, first_ammo, float, NONE) \
+               P(class, prefix, first_damage, float, NONE) \
+               P(class, prefix, first_force, float, NONE) \
+               P(class, prefix, first_refire, float, NONE) \
+               P(class, prefix, first_spread, float, NONE) \
+               P(class, prefix, mode, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, solidpenetration, float, NONE) \
+               P(class, prefix, spread_add, float, NONE) \
+               P(class, prefix, spread_max, float, NONE) \
+               P(class, prefix, spread_min, float, NONE) \
+               P(class, prefix, sustained_ammo, float, NONE) \
+               P(class, prefix, sustained_damage, float, NONE) \
+               P(class, prefix, sustained_force, float, NONE) \
+               P(class, prefix, sustained_refire, float, NONE) \
+               P(class, prefix, sustained_spread, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string,NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, MachineGun, machinegun)
+#undef X
+
 ENDCLASS(MachineGun)
-REGISTER_WEAPON(MACHINEGUN, NEW(MachineGun));
-
-#define MACHINEGUN_SETTINGS(w_cvar,w_prop) MACHINEGUN_SETTINGS_LIST(w_cvar, w_prop, MACHINEGUN, machinegun)
-#define MACHINEGUN_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, spread_min) \
-       w_cvar(id, sn, NONE, spread_max) \
-       w_cvar(id, sn, NONE, spread_add) \
-       w_cvar(id, sn, NONE, mode) \
-       w_cvar(id, sn, NONE, first) \
-       w_cvar(id, sn, NONE, first_damage) \
-       w_cvar(id, sn, NONE, first_force) \
-       w_cvar(id, sn, NONE, first_refire) \
-       w_cvar(id, sn, NONE, first_spread) \
-       w_cvar(id, sn, NONE, first_ammo) \
-       w_cvar(id, sn, NONE, solidpenetration) \
-       w_cvar(id, sn, NONE, sustained_damage) \
-       w_cvar(id, sn, NONE, sustained_force) \
-       w_cvar(id, sn, NONE, sustained_refire) \
-       w_cvar(id, sn, NONE, sustained_spread) \
-       w_cvar(id, sn, NONE, sustained_ammo) \
-       w_cvar(id, sn, NONE, burst) \
-       w_cvar(id, sn, NONE, burst_refire) \
-       w_cvar(id, sn, NONE, burst_refire2) \
-       w_cvar(id, sn, NONE, burst_animtime) \
-       w_cvar(id, sn, NONE, burst_speed) \
-       w_cvar(id, sn, NONE, burst_ammo) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(MACHINEGUN, machinegun, NEW(MachineGun));
+
 
-#ifdef SVQC
-MACHINEGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
@@ -298,10 +300,6 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
                                }
                        }
                }
-               METHOD(MachineGun, wr_init, void(entity thiswep))
-               {
-                       MACHINEGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(MachineGun, wr_checkammo1, bool(entity thiswep))
                {
                        float ammo_amount;
@@ -336,10 +334,6 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
                        }
                        return ammo_amount;
                }
-               METHOD(MachineGun, wr_config, void(entity thiswep))
-               {
-                       MACHINEGUN_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(MachineGun, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
index 2f1459f83d4735ba6e9a75934a7b0ebfb932e71f..0b069ca89578b87557d7b024f381b3c0bce777cd 100644 (file)
@@ -14,43 +14,45 @@ CLASS(MineLayer, Weapon)
 /* wepimg    */ ATTRIB(MineLayer, model2, string, "weaponminelayer");
 /* refname   */ ATTRIB(MineLayer, netname, string, "minelayer");
 /* wepname   */ ATTRIB(MineLayer, m_name, string, _("Mine Layer"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, NONE) \
+               P(class, prefix, animtime, float, NONE) \
+               P(class, prefix, damageforcescale, float, NONE) \
+               P(class, prefix, damage, float, NONE) \
+               P(class, prefix, detonatedelay, float, NONE) \
+               P(class, prefix, edgedamage, float, NONE) \
+               P(class, prefix, force, float, NONE) \
+               P(class, prefix, health, float, NONE) \
+               P(class, prefix, lifetime, float, NONE) \
+               P(class, prefix, lifetime_countdown, float, NONE) \
+               P(class, prefix, limit, float, NONE) \
+               P(class, prefix, protection, float, NONE) \
+               P(class, prefix, proximityradius, float, NONE) \
+               P(class, prefix, radius, float, NONE) \
+               P(class, prefix, refire, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, remote_damage, float, NONE) \
+               P(class, prefix, remote_edgedamage, float, NONE) \
+               P(class, prefix, remote_force, float, NONE) \
+               P(class, prefix, remote_radius, float, NONE) \
+               P(class, prefix, speed, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, time, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, MineLayer, minelayer)
+#undef X
 ENDCLASS(MineLayer)
-REGISTER_WEAPON(MINE_LAYER, NEW(MineLayer));
-
-#define MINELAYER_SETTINGS(w_cvar,w_prop) MINELAYER_SETTINGS_LIST(w_cvar, w_prop, MINE_LAYER, minelayer)
-#define MINELAYER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, ammo) \
-       w_cvar(id, sn, NONE, animtime) \
-       w_cvar(id, sn, NONE, damage) \
-       w_cvar(id, sn, NONE, damageforcescale) \
-       w_cvar(id, sn, NONE, detonatedelay) \
-       w_cvar(id, sn, NONE, edgedamage) \
-       w_cvar(id, sn, NONE, force) \
-       w_cvar(id, sn, NONE, health) \
-       w_cvar(id, sn, NONE, lifetime) \
-       w_cvar(id, sn, NONE, lifetime_countdown) \
-       w_cvar(id, sn, NONE, limit) \
-       w_cvar(id, sn, NONE, protection) \
-       w_cvar(id, sn, NONE, proximityradius) \
-       w_cvar(id, sn, NONE, radius) \
-       w_cvar(id, sn, NONE, refire) \
-       w_cvar(id, sn, NONE, remote_damage) \
-       w_cvar(id, sn, NONE, remote_edgedamage) \
-       w_cvar(id, sn, NONE, remote_force) \
-       w_cvar(id, sn, NONE, remote_radius) \
-       w_cvar(id, sn, NONE, speed) \
-       w_cvar(id, sn, NONE, time) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(MINE_LAYER, minelayer, NEW(MineLayer));
 
 #ifdef SVQC
-MINELAYER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 void W_MineLayer_Think();
 .float minelayer_detonate, mine_explodeanyway;
 .float mine_time;
@@ -524,10 +526,6 @@ float W_MineLayer_PlacedMines(float detonate)
                                        sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
                        }
                }
-               METHOD(MineLayer, wr_init, void(entity thiswep))
-               {
-                       MINELAYER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(MineLayer, wr_checkammo1, bool(entity thiswep))
                {
                        int slot = 0; // TODO: unhardcode
@@ -547,10 +545,6 @@ float W_MineLayer_PlacedMines(float detonate)
                        else
                                return false;
                }
-               METHOD(MineLayer, wr_config, void(entity thiswep))
-               {
-                       MINELAYER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(MineLayer, wr_resetplayers, void(entity thiswep))
                {
                        self.minelayer_mines = 0;
index 223d13ffb2dbb6a1452f672659c850d78e88e39d..6a479c20a82e119c3eef0a9e465206bbf1da4b7f 100644 (file)
@@ -14,43 +14,46 @@ CLASS(Mortar, Weapon)
 /* wepimg    */ ATTRIB(Mortar, model2, string, "weapongrenadelauncher");
 /* refname   */ ATTRIB(Mortar, netname, string, "mortar");
 /* wepname   */ ATTRIB(Mortar, m_name, string, _("Mortar"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bouncefactor, float, NONE) \
+               P(class, prefix, bouncestop, float, NONE) \
+               P(class, prefix, damageforcescale, float, BOTH) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, edgedamage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, health, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, lifetime_bounce, float, SEC) \
+               P(class, prefix, lifetime_stick, float, BOTH) \
+               P(class, prefix, radius, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, remote_detonateprimary, float, SEC) \
+               P(class, prefix, remote_minbouncecnt, float, PRI) \
+               P(class, prefix, speed, float, BOTH) \
+               P(class, prefix, speed_up, float, BOTH) \
+               P(class, prefix, speed_z, float, BOTH) \
+               P(class, prefix, spread, float, BOTH) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, type, float, BOTH) \
+               P(class, prefix, weaponreplace, string, NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Mortar, mortar)
+#undef X
 ENDCLASS(Mortar)
-REGISTER_WEAPON(MORTAR, NEW(Mortar));
-
-#define MORTAR_SETTINGS(w_cvar,w_prop) MORTAR_SETTINGS_LIST(w_cvar, w_prop, MORTAR, mortar)
-#define MORTAR_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, NONE, bouncefactor) \
-       w_cvar(id, sn, NONE, bouncestop) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, damageforcescale) \
-       w_cvar(id, sn, BOTH, edgedamage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, health) \
-       w_cvar(id, sn, BOTH, lifetime) \
-       w_cvar(id, sn, SEC,  lifetime_bounce) \
-       w_cvar(id, sn, BOTH, lifetime_stick) \
-       w_cvar(id, sn, BOTH, radius) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, SEC,  remote_detonateprimary) \
-       w_cvar(id, sn, PRI,  remote_minbouncecnt) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, BOTH, speed_up) \
-       w_cvar(id, sn, BOTH, speed_z) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, BOTH, type) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(MORTAR, mortar, NEW(Mortar));
+
 
 #ifdef SVQC
-MORTAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float gl_detonate_later;
 .float gl_bouncecnt;
 #endif
@@ -368,10 +371,6 @@ void W_Mortar_Attack2(Weapon thiswep)
                                }
                        }
                }
-               METHOD(Mortar, wr_init, void(entity thiswep))
-               {
-                       MORTAR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Mortar, wr_checkammo1, bool(entity thiswep))
                {
                        float ammo_amount = self.WEP_AMMO(MORTAR) >= WEP_CVAR_PRI(mortar, ammo);
@@ -384,10 +383,6 @@ void W_Mortar_Attack2(Weapon thiswep)
                        ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
                        return ammo_amount;
                }
-               METHOD(Mortar, wr_config, void(entity thiswep))
-               {
-                       MORTAR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Mortar, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
index b8c54c4165af491c655055e9c2a886a2c16a4b05..f992e31bda17a915172665ee8250635c5acf1647 100644 (file)
@@ -14,25 +14,27 @@ CLASS(PortoLaunch, Weapon)
 /* wepimg    */ ATTRIB(PortoLaunch, model2, string, "weaponporto");
 /* refname   */ ATTRIB(PortoLaunch, netname, string, "porto");
 /* wepname   */ ATTRIB(PortoLaunch, m_name, string, _("Port-O-Launch"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, speed, float, BOTH) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string,NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, PortoLaunch, porto)
+#undef X
 ENDCLASS(PortoLaunch)
-REGISTER_WEAPON(PORTO, NEW(PortoLaunch));
-
-#define PORTO_SETTINGS(w_cvar,w_prop) PORTO_SETTINGS_LIST(w_cvar, w_prop, PORTO, porto)
-#define PORTO_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, lifetime) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, speed) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(PORTO, porto, NEW(PortoLaunch));
 
 #ifdef SVQC
-PORTO_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .entity porto_current;
 .vector porto_v_angle; // holds "held" view angles
 .float porto_v_angle_held;
@@ -301,10 +303,6 @@ void W_Porto_Attack(float type)
                                if(bot_aim(WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false))
                                        self.BUTTON_ATCK = true;
                }
-               METHOD(PortoLaunch, wr_config, void(entity this))
-               {
-                       PORTO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if(WEP_CVAR(porto, secondary))
@@ -371,10 +369,6 @@ void W_Porto_Attack(float type)
                        // always allow infinite ammo
                        return true;
                }
-               METHOD(PortoLaunch, wr_init, void(entity this))
-               {
-                       PORTO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(PortoLaunch, wr_setup, void(entity thiswep))
                {
                        SELFPARAM();
index a639747db7f2c9493bec6be49ab50e7136d88bad..59e254990d0db400d2ef69efed698aff4f7dffc4 100644 (file)
@@ -14,36 +14,39 @@ CLASS(Rifle, Weapon)
 /* wepimg    */ ATTRIB(Rifle, model2, string, "weaponrifle");
 /* refname   */ ATTRIB(Rifle, netname, string, "rifle");
 /* wepname   */ ATTRIB(Rifle, m_name, string, _("Rifle"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bullethail, float, BOTH) \
+               P(class, prefix, burstcost, float, BOTH) \
+               P(class, prefix, bursttime, float, NONE) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload, float, SEC) \
+               P(class, prefix, reload_ammo, float, NONE) \
+       P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, shots, float, BOTH) \
+               P(class, prefix, solidpenetration, float, BOTH) \
+               P(class, prefix, spread, float, BOTH) \
+       P(class, prefix, switchdelay_drop, float, NONE) \
+       P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, tracer, float, BOTH) \
+       P(class, prefix, weaponreplace, string, NONE) \
+       P(class, prefix, weaponstartoverride, float, NONE) \
+       P(class, prefix, weaponstart, float, NONE) \
+       P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Rifle, rifle)
+#undef X
 ENDCLASS(Rifle)
-REGISTER_WEAPON(RIFLE, NEW(Rifle));
+REGISTER_WEAPON(RIFLE, rifle, NEW(Rifle));
 
-#define RIFLE_SETTINGS(w_cvar,w_prop) RIFLE_SETTINGS_LIST(w_cvar, w_prop, RIFLE, rifle)
-#define RIFLE_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, bullethail) \
-       w_cvar(id, sn, BOTH, burstcost) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, BOTH, shots) \
-       w_cvar(id, sn, BOTH, solidpenetration) \
-       w_cvar(id, sn, BOTH, spread) \
-       w_cvar(id, sn, BOTH, tracer) \
-       w_cvar(id, sn, NONE, bursttime) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_cvar(id, sn, SEC,  reload) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
 
 #ifdef SVQC
-RIFLE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float rifle_accumulator;
 #endif
 #endif
@@ -193,10 +196,6 @@ void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFR
                                }
                        }
                }
-               METHOD(Rifle, wr_init, void(entity thiswep))
-               {
-                       RIFLE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Rifle, wr_checkammo1, bool(entity thiswep))
                {
                        float ammo_amount = self.WEP_AMMO(RIFLE) >= WEP_CVAR_PRI(rifle, ammo);
@@ -209,10 +208,6 @@ void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFR
                        ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
                        return ammo_amount;
                }
-               METHOD(Rifle, wr_config, void(entity thiswep))
-               {
-                       RIFLE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Rifle, wr_resetplayer, void(entity thiswep))
                {
                        self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
index 01c7feb887848f1ce0c157e2f19fd33c048323d0..ae6b736df96e68ab8fc018da9967164dac264beb 100644 (file)
@@ -14,72 +14,75 @@ CLASS(Seeker, Weapon)
 /* wepimg    */ ATTRIB(Seeker, model2, string, "weaponseeker");
 /* refname   */ ATTRIB(Seeker, netname, string, "seeker");
 /* wepname   */ ATTRIB(Seeker, m_name, string, _("T.A.G. Seeker"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+       P(class, prefix, flac_ammo, float, NONE) \
+       P(class, prefix, flac_animtime, float, NONE) \
+       P(class, prefix, flac_damage, float, NONE) \
+       P(class, prefix, flac_edgedamage, float, NONE) \
+       P(class, prefix, flac_force, float, NONE) \
+       P(class, prefix, flac_lifetime, float, NONE) \
+       P(class, prefix, flac_lifetime_rand, float, NONE) \
+       P(class, prefix, flac_radius, float, NONE) \
+       P(class, prefix, flac_refire, float, NONE) \
+       P(class, prefix, flac_speed, float, NONE) \
+       P(class, prefix, flac_speed_up, float, NONE) \
+       P(class, prefix, flac_speed_z, float, NONE) \
+       P(class, prefix, flac_spread, float, NONE) \
+       P(class, prefix, missile_accel, float, NONE) \
+       P(class, prefix, missile_ammo, float, NONE) \
+       P(class, prefix, missile_animtime, float, NONE) \
+       P(class, prefix, missile_count, float, NONE) \
+       P(class, prefix, missile_damageforcescale, float, NONE) \
+       P(class, prefix, missile_damage, float, NONE) \
+       P(class, prefix, missile_decel, float, NONE) \
+       P(class, prefix, missile_delay, float, NONE) \
+       P(class, prefix, missile_edgedamage, float, NONE) \
+       P(class, prefix, missile_force, float, NONE) \
+       P(class, prefix, missile_health, float, NONE) \
+       P(class, prefix, missile_lifetime, float, NONE) \
+       P(class, prefix, missile_proxy, float, NONE) \
+       P(class, prefix, missile_proxy_delay, float, NONE) \
+       P(class, prefix, missile_proxy_maxrange, float, NONE) \
+       P(class, prefix, missile_radius, float, NONE) \
+       P(class, prefix, missile_refire, float, NONE) \
+       P(class, prefix, missile_smart, float, NONE) \
+       P(class, prefix, missile_smart_mindist, float, NONE) \
+       P(class, prefix, missile_smart_trace_max, float, NONE) \
+       P(class, prefix, missile_smart_trace_min, float, NONE) \
+       P(class, prefix, missile_speed, float, NONE) \
+       P(class, prefix, missile_speed_max, float, NONE) \
+       P(class, prefix, missile_speed_up, float, NONE) \
+       P(class, prefix, missile_speed_z, float, NONE) \
+       P(class, prefix, missile_spread, float, NONE) \
+       P(class, prefix, missile_turnrate, float, NONE) \
+       P(class, prefix, reload_ammo, float, NONE) \
+               P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+       P(class, prefix, tag_ammo, float, NONE) \
+       P(class, prefix, tag_animtime, float, NONE) \
+       P(class, prefix, tag_damageforcescale, float, NONE) \
+       P(class, prefix, tag_health, float, NONE) \
+       P(class, prefix, tag_lifetime, float, NONE) \
+       P(class, prefix, tag_refire, float, NONE) \
+       P(class, prefix, tag_speed, float, NONE) \
+       P(class, prefix, tag_spread, float, NONE) \
+       P(class, prefix, tag_tracker_lifetime, float, NONE) \
+               P(class, prefix, type, float, NONE) \
+               P(class, prefix, weaponreplace, string, NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+       W_PROPS(X, Seeker, seeker)
+#undef X
 ENDCLASS(Seeker)
-REGISTER_WEAPON(SEEKER, NEW(Seeker));
-
-#define SEEKER_SETTINGS(w_cvar,w_prop) SEEKER_SETTINGS_LIST(w_cvar, w_prop, SEEKER, seeker)
-#define SEEKER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, type) \
-       w_cvar(id, sn, NONE, flac_ammo) \
-       w_cvar(id, sn, NONE, flac_animtime) \
-       w_cvar(id, sn, NONE, flac_damage) \
-       w_cvar(id, sn, NONE, flac_edgedamage) \
-       w_cvar(id, sn, NONE, flac_force) \
-       w_cvar(id, sn, NONE, flac_lifetime) \
-       w_cvar(id, sn, NONE, flac_lifetime_rand) \
-       w_cvar(id, sn, NONE, flac_radius) \
-       w_cvar(id, sn, NONE, flac_refire) \
-       w_cvar(id, sn, NONE, flac_speed) \
-       w_cvar(id, sn, NONE, flac_speed_up) \
-       w_cvar(id, sn, NONE, flac_speed_z) \
-       w_cvar(id, sn, NONE, flac_spread) \
-       w_cvar(id, sn, NONE, missile_accel) \
-       w_cvar(id, sn, NONE, missile_ammo) \
-       w_cvar(id, sn, NONE, missile_animtime) \
-       w_cvar(id, sn, NONE, missile_count) \
-       w_cvar(id, sn, NONE, missile_damage) \
-       w_cvar(id, sn, NONE, missile_damageforcescale) \
-       w_cvar(id, sn, NONE, missile_decel) \
-       w_cvar(id, sn, NONE, missile_delay) \
-       w_cvar(id, sn, NONE, missile_edgedamage) \
-       w_cvar(id, sn, NONE, missile_force) \
-       w_cvar(id, sn, NONE, missile_health) \
-       w_cvar(id, sn, NONE, missile_lifetime) \
-       w_cvar(id, sn, NONE, missile_proxy) \
-       w_cvar(id, sn, NONE, missile_proxy_delay) \
-       w_cvar(id, sn, NONE, missile_proxy_maxrange) \
-       w_cvar(id, sn, NONE, missile_radius) \
-       w_cvar(id, sn, NONE, missile_refire) \
-       w_cvar(id, sn, NONE, missile_smart) \
-       w_cvar(id, sn, NONE, missile_smart_mindist) \
-       w_cvar(id, sn, NONE, missile_smart_trace_max) \
-       w_cvar(id, sn, NONE, missile_smart_trace_min) \
-       w_cvar(id, sn, NONE, missile_speed) \
-       w_cvar(id, sn, NONE, missile_speed_max) \
-       w_cvar(id, sn, NONE, missile_speed_up) \
-       w_cvar(id, sn, NONE, missile_speed_z) \
-       w_cvar(id, sn, NONE, missile_spread) \
-       w_cvar(id, sn, NONE, missile_turnrate) \
-       w_cvar(id, sn, NONE, tag_ammo) \
-       w_cvar(id, sn, NONE, tag_animtime) \
-       w_cvar(id, sn, NONE, tag_damageforcescale) \
-       w_cvar(id, sn, NONE, tag_health) \
-       w_cvar(id, sn, NONE, tag_lifetime) \
-       w_cvar(id, sn, NONE, tag_refire) \
-       w_cvar(id, sn, NONE, tag_speed) \
-       w_cvar(id, sn, NONE, tag_spread) \
-       w_cvar(id, sn, NONE, tag_tracker_lifetime) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(SEEKER, seeker, NEW(Seeker));
+
 
 #ifdef SVQC
-SEEKER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .entity tag_target, wps_tag_tracker;
 .float tag_time;
 #endif
@@ -648,10 +651,6 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
                                }
                        }
                }
-               METHOD(Seeker, wr_init, void(entity thiswep))
-               {
-                       SEEKER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Seeker, wr_checkammo1, bool(entity thiswep))
                {
                        float ammo_amount;
@@ -682,10 +681,6 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
                        }
                        return ammo_amount;
                }
-               METHOD(Seeker, wr_config, void(entity thiswep))
-               {
-                       SEEKER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Seeker, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
index 43a207e9686d0eff9c6da2f577c0b196305dd6d7..bc1d768d20ca085595841fc5e57670e781b06112 100644 (file)
@@ -14,64 +14,66 @@ CLASS(Shockwave, Weapon)
 /* wepimg    */ ATTRIB(Shockwave, model2, string, "weaponshotgun");
 /* refname   */ ATTRIB(Shockwave, netname, string, "shockwave");
 /* wepname   */ ATTRIB(Shockwave, m_name, string, _("Shockwave"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, blast_animtime, float, NONE) \
+               P(class, prefix, blast_damage, float, NONE) \
+               P(class, prefix, blast_distance, float, NONE) \
+               P(class, prefix, blast_edgedamage, float, NONE) \
+               P(class, prefix, blast_force, float, NONE) \
+               P(class, prefix, blast_force_forwardbias, float, NONE) \
+               P(class, prefix, blast_force_zscale, float, NONE) \
+               P(class, prefix, blast_jump_damage, float, NONE) \
+               P(class, prefix, blast_jump_edgedamage, float, NONE) \
+               P(class, prefix, blast_jump_force, float, NONE) \
+               P(class, prefix, blast_jump_force_velocitybias, float, NONE) \
+               P(class, prefix, blast_jump_force_zscale, float, NONE) \
+               P(class, prefix, blast_jump_multiplier_accuracy, float, NONE) \
+               P(class, prefix, blast_jump_multiplier_distance, float, NONE) \
+               P(class, prefix, blast_jump_multiplier_min, float, NONE) \
+               P(class, prefix, blast_jump_radius, float, NONE) \
+               P(class, prefix, blast_multiplier_accuracy, float, NONE) \
+               P(class, prefix, blast_multiplier_distance, float, NONE) \
+               P(class, prefix, blast_multiplier_min, float, NONE) \
+               P(class, prefix, blast_refire, float, NONE) \
+               P(class, prefix, blast_splash_damage, float, NONE) \
+               P(class, prefix, blast_splash_edgedamage, float, NONE) \
+               P(class, prefix, blast_splash_force, float, NONE) \
+               P(class, prefix, blast_splash_force_forwardbias, float, NONE) \
+               P(class, prefix, blast_splash_multiplier_accuracy, float, NONE) \
+               P(class, prefix, blast_splash_multiplier_distance, float, NONE) \
+               P(class, prefix, blast_splash_multiplier_min, float, NONE) \
+               P(class, prefix, blast_splash_radius, float, NONE) \
+               P(class, prefix, blast_spread_max, float, NONE) \
+               P(class, prefix, blast_spread_min, float, NONE) \
+               P(class, prefix, melee_animtime, float, NONE) \
+               P(class, prefix, melee_damage, float, NONE) \
+               P(class, prefix, melee_delay, float, NONE) \
+               P(class, prefix, melee_force, float, NONE) \
+               P(class, prefix, melee_multihit, float, NONE) \
+               P(class, prefix, melee_no_doubleslap, float, NONE) \
+               P(class, prefix, melee_nonplayerdamage, float, NONE) \
+               P(class, prefix, melee_range, float, NONE) \
+               P(class, prefix, melee_refire, float, NONE) \
+               P(class, prefix, melee_swing_side, float, NONE) \
+               P(class, prefix, melee_swing_up, float, NONE) \
+               P(class, prefix, melee_time, float, NONE) \
+               P(class, prefix, melee_traces, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Shockwave, shockwave)
+#undef X
+
 ENDCLASS(Shockwave)
-REGISTER_WEAPON(SHOCKWAVE, NEW(Shockwave));
-
-#define SHOCKWAVE_SETTINGS(w_cvar,w_prop) SHOCKWAVE_SETTINGS_LIST(w_cvar, w_prop, SHOCKWAVE, shockwave)
-#define SHOCKWAVE_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, blast_animtime) \
-       w_cvar(id, sn, NONE, blast_damage) \
-       w_cvar(id, sn, NONE, blast_distance) \
-       w_cvar(id, sn, NONE, blast_edgedamage) \
-       w_cvar(id, sn, NONE, blast_force) \
-       w_cvar(id, sn, NONE, blast_force_forwardbias) \
-       w_cvar(id, sn, NONE, blast_force_zscale) \
-       w_cvar(id, sn, NONE, blast_jump_damage) \
-       w_cvar(id, sn, NONE, blast_jump_edgedamage) \
-       w_cvar(id, sn, NONE, blast_jump_force) \
-       w_cvar(id, sn, NONE, blast_jump_force_velocitybias) \
-       w_cvar(id, sn, NONE, blast_jump_force_zscale) \
-       w_cvar(id, sn, NONE, blast_jump_multiplier_accuracy) \
-       w_cvar(id, sn, NONE, blast_jump_multiplier_distance) \
-       w_cvar(id, sn, NONE, blast_jump_multiplier_min) \
-       w_cvar(id, sn, NONE, blast_jump_radius) \
-       w_cvar(id, sn, NONE, blast_multiplier_accuracy) \
-       w_cvar(id, sn, NONE, blast_multiplier_distance) \
-       w_cvar(id, sn, NONE, blast_multiplier_min) \
-       w_cvar(id, sn, NONE, blast_refire) \
-       w_cvar(id, sn, NONE, blast_splash_damage) \
-       w_cvar(id, sn, NONE, blast_splash_edgedamage) \
-       w_cvar(id, sn, NONE, blast_splash_force) \
-       w_cvar(id, sn, NONE, blast_splash_force_forwardbias) \
-       w_cvar(id, sn, NONE, blast_splash_multiplier_accuracy) \
-       w_cvar(id, sn, NONE, blast_splash_multiplier_distance) \
-       w_cvar(id, sn, NONE, blast_splash_multiplier_min) \
-       w_cvar(id, sn, NONE, blast_splash_radius) \
-       w_cvar(id, sn, NONE, blast_spread_max) \
-       w_cvar(id, sn, NONE, blast_spread_min) \
-       w_cvar(id, sn, NONE, melee_animtime) \
-       w_cvar(id, sn, NONE, melee_damage) \
-       w_cvar(id, sn, NONE, melee_delay) \
-       w_cvar(id, sn, NONE, melee_force) \
-       w_cvar(id, sn, NONE, melee_multihit) \
-       w_cvar(id, sn, NONE, melee_no_doubleslap) \
-       w_cvar(id, sn, NONE, melee_nonplayerdamage) \
-       w_cvar(id, sn, NONE, melee_range) \
-       w_cvar(id, sn, NONE, melee_refire) \
-       w_cvar(id, sn, NONE, melee_swing_side) \
-       w_cvar(id, sn, NONE, melee_swing_up) \
-       w_cvar(id, sn, NONE, melee_time) \
-       w_cvar(id, sn, NONE, melee_traces) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(SHOCKWAVE, shockwave, NEW(Shockwave));
+
 
-#ifdef SVQC
-SHOCKWAVE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #ifdef CSQC
 void Net_ReadShockwaveParticle();
 .vector sw_shotorg;
@@ -702,10 +704,6 @@ void W_Shockwave_Attack()
                                }
                        }
                }
-               METHOD(Shockwave, wr_init, void(entity thiswep))
-               {
-                       SHOCKWAVE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Shockwave, wr_checkammo1, bool(entity thiswep))
                {
                        return true; // infinite ammo
@@ -715,10 +713,6 @@ void W_Shockwave_Attack()
                        // shockwave has infinite ammo
                        return true;
                }
-               METHOD(Shockwave, wr_config, void(entity thiswep))
-               {
-                       SHOCKWAVE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Shockwave, wr_suicidemessage, int(entity thiswep))
                {
                        return WEAPON_THINKING_WITH_PORTALS;
index 27dfe4e4f6e096b0e191198c2cddb104eefb496a..7b710b21fffdf311aab1dece3f0363dbf2c46d11 100644 (file)
@@ -14,43 +14,45 @@ CLASS(Shotgun, Weapon)
 /* wepimg    */ ATTRIB(Shotgun, model2, string, "weaponshotgun");
 /* refname   */ ATTRIB(Shotgun, netname, string, "shotgun");
 /* wepname   */ ATTRIB(Shotgun, m_name, string, _("Shotgun"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, alt_animtime, float, SEC) \
+               P(class, prefix, alt_refire, float, SEC) \
+               P(class, prefix, ammo, float, PRI) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, bullets, float, PRI) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, melee_delay, float, SEC) \
+               P(class, prefix, melee_multihit, float, SEC) \
+               P(class, prefix, melee_nonplayerdamage, float, SEC) \
+               P(class, prefix, melee_no_doubleslap, float, SEC) \
+               P(class, prefix, melee_range, float, SEC) \
+               P(class, prefix, melee_swing_side, float, SEC) \
+               P(class, prefix, melee_swing_up, float, SEC) \
+               P(class, prefix, melee_time, float, SEC) \
+               P(class, prefix, melee_traces, float, SEC) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, solidpenetration, float, PRI) \
+               P(class, prefix, spread, float, PRI) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, weaponreplace, string,NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Shotgun, shotgun)
+#undef X
+
 ENDCLASS(Shotgun)
-REGISTER_WEAPON(SHOTGUN, NEW(Shotgun));
-
-#define SHOTGUN_SETTINGS(w_cvar,w_prop) SHOTGUN_SETTINGS_LIST(w_cvar, w_prop, SHOTGUN, shotgun)
-#define SHOTGUN_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, PRI,  ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, PRI,  bullets) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, PRI,  solidpenetration) \
-       w_cvar(id, sn, PRI,  spread) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_cvar(id, sn, SEC,  melee_time) \
-       w_cvar(id, sn, SEC,  melee_no_doubleslap) \
-       w_cvar(id, sn, SEC,  melee_traces) \
-       w_cvar(id, sn, SEC,  melee_swing_up) \
-       w_cvar(id, sn, SEC,  melee_swing_side) \
-       w_cvar(id, sn, SEC,  melee_nonplayerdamage) \
-       w_cvar(id, sn, SEC,  melee_multihit) \
-       w_cvar(id, sn, SEC,  melee_delay) \
-       w_cvar(id, sn, SEC,  melee_range) \
-       w_cvar(id, sn, SEC,  alt_animtime) \
-       w_cvar(id, sn, SEC,  alt_refire) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(SHOTGUN, shotgun, NEW(Shotgun));
+
 
-#ifdef SVQC
-SHOTGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
@@ -278,10 +280,6 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity
                                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
                        }
                }
-               METHOD(Shotgun, wr_init, void(entity thiswep))
-               {
-                       SHOTGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Shotgun, wr_setup, void(entity thiswep))
                {
                        self.ammo_field = ammo_none;
@@ -309,10 +307,6 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity
                                default: return false; // secondary unavailable
                        }
                }
-               METHOD(Shotgun, wr_config, void(entity thiswep))
-               {
-                       SHOTGUN_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Shotgun, wr_reload, void(entity thiswep))
                {
                        W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
index 308d43fc122f5d9e7ddc82a12f69f31b06ae7057..ef2e5e2612dafd69847c56bf8b1574035b37eed3 100644 (file)
@@ -15,34 +15,34 @@ CLASS(Tuba, Weapon)
 /* refname   */ ATTRIB(Tuba, netname, string, "tuba");
 /* xgettext:no-c-format */
 /* wepname   */ ATTRIB(Tuba, m_name, string, _("@!#%'n Tuba"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, animtime, float, NONE) \
+               P(class, prefix, attenuation, float, NONE) \
+               P(class, prefix, damage, float, NONE) \
+               P(class, prefix, edgedamage, float, NONE) \
+               P(class, prefix, fadetime, float, NONE) \
+               P(class, prefix, force, float, NONE) \
+               P(class, prefix, pitchstep, float, NONE) \
+               P(class, prefix, radius, float, NONE) \
+               P(class, prefix, refire, float, NONE) \
+               P(class, prefix, switchdelay_drop, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+               P(class, prefix, volume, float, NONE) \
+               P(class, prefix, weaponreplace, string, NONE) \
+               P(class, prefix, weaponstartoverride, float, NONE) \
+               P(class, prefix, weaponstart, float, NONE) \
+               P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Tuba, tuba)
+#undef X
+
 ENDCLASS(Tuba)
-REGISTER_WEAPON(TUBA, NEW(Tuba));
-
-#define TUBA_SETTINGS(w_cvar,w_prop) TUBA_SETTINGS_LIST(w_cvar, w_prop, TUBA, tuba)
-#define TUBA_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, animtime) \
-       w_cvar(id, sn, NONE, attenuation) \
-       w_cvar(id, sn, NONE, damage) \
-       w_cvar(id, sn, NONE, edgedamage) \
-       w_cvar(id, sn, NONE, fadetime) \
-       w_cvar(id, sn, NONE, force) \
-       w_cvar(id, sn, NONE, pitchstep) \
-       w_cvar(id, sn, NONE, radius) \
-       w_cvar(id, sn, NONE, refire) \
-       w_cvar(id, sn, NONE, volume) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(TUBA, tuba, NEW(Tuba));
+
 
 #ifdef SVQC
-TUBA_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-float W_Tuba_MarkClientOnlyFieldsAsUsed() {
-       // These variables are only used by client/tuba.qc. TODO: move client/tuba.qc code here.
-       return WEP_CVAR(tuba, fadetime) + WEP_CVAR(tuba, pitchstep) + WEP_CVAR(tuba, volume);
-}
 
 .entity tuba_note;
 .float tuba_smoketime;
@@ -403,10 +403,6 @@ void W_Tuba_NoteOn(float hittype)
                                }
                        }
                }
-               METHOD(Tuba, wr_init, void(entity thiswep))
-               {
-                       TUBA_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Tuba, wr_setup, void(entity thiswep))
                {
                        self.ammo_field = ammo_none;
@@ -447,10 +443,6 @@ void W_Tuba_NoteOn(float hittype)
                {
                        return true; // tuba has infinite ammo
                }
-               METHOD(Tuba, wr_config, void(entity thiswep))
-               {
-                       TUBA_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Tuba, wr_suicidemessage, int(entity thiswep))
                {
                        if(w_deathtype & HITTYPE_BOUNCE)
index 7ab692f24dcd8779ca711bdb88f23367aab168da..d5445000c2e4ae3ec70608d053eeb80deeb01005 100644 (file)
@@ -14,38 +14,42 @@ CLASS(Vaporizer, Weapon)
 /* wepimg    */ ATTRIB(Vaporizer, model2, string, "weaponminstanex");
 /* refname   */ ATTRIB(Vaporizer, netname, string, "vaporizer");
 /* wepname   */ ATTRIB(Vaporizer, m_name, string, _("Vaporizer"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, PRI) \
+       P(class, prefix, animtime, float, PRI) \
+       P(class, prefix, damage, float, PRI) \
+       P(class, prefix, refire, float, PRI) \
+       P(class, prefix, ammo, float, SEC) \
+       P(class, prefix, animtime, float, SEC) \
+       P(class, prefix, damage, float, SEC) \
+       P(class, prefix, delay, float, SEC) \
+       P(class, prefix, edgedamage, float, SEC) \
+       P(class, prefix, force, float, SEC) \
+       P(class, prefix, lifetime, float, SEC) \
+       P(class, prefix, radius, float, SEC) \
+       P(class, prefix, refire, float, SEC) \
+       P(class, prefix, shotangle, float, SEC) \
+       P(class, prefix, speed, float, SEC) \
+       P(class, prefix, spread, float, SEC) \
+       P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Vaporizer, vaporizer)
+#undef X
+
 ENDCLASS(Vaporizer)
-REGISTER_WEAPON(VAPORIZER, NEW(Vaporizer));
-
-#define VAPORIZER_SETTINGS(w_cvar,w_prop) VAPORIZER_SETTINGS_LIST(w_cvar, w_prop, VAPORIZER, vaporizer)
-#define VAPORIZER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, PRI, ammo) \
-       w_cvar(id, sn, PRI, animtime) \
-       w_cvar(id, sn, PRI, damage) \
-       w_cvar(id, sn, PRI, refire) \
-       w_cvar(id, sn, SEC, ammo) \
-       w_cvar(id, sn, SEC, animtime) \
-       w_cvar(id, sn, SEC, damage) \
-       w_cvar(id, sn, SEC, delay) \
-       w_cvar(id, sn, SEC, edgedamage) \
-       w_cvar(id, sn, SEC, force) \
-       w_cvar(id, sn, SEC, lifetime) \
-       w_cvar(id, sn, SEC, radius) \
-       w_cvar(id, sn, SEC, refire) \
-       w_cvar(id, sn, SEC, shotangle) \
-       w_cvar(id, sn, SEC, speed) \
-       w_cvar(id, sn, SEC, spread) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(VAPORIZER, vaporizer, NEW(Vaporizer));
+
 
 #ifdef SVQC
-VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .float vaporizer_lasthit;
 .float jump_interval;
 .float jump_interval2;
@@ -416,11 +420,6 @@ void W_RocketMinsta_Attack3 ()
                        else
                                actor.held_down = false;
                }
-               METHOD(Vaporizer, wr_init, void(entity thiswep))
-               {
-                       //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
-                       VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Vaporizer, wr_setup, void(entity thiswep))
                {
                        self.ammo_field = WEP_AMMO(VAPORIZER);
@@ -441,10 +440,6 @@ void W_RocketMinsta_Attack3 ()
                        ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
                        return ammo_amount;
                }
-               METHOD(Vaporizer, wr_config, void(entity thiswep))
-               {
-                       VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
                {
                        self.vaporizer_lasthit = 0;
index ded0eede4617043675147fb80c52c1aca7ea1a3b..56f7a12aa378352817a6a81efcdbbd7b4617e776 100644 (file)
@@ -14,47 +14,51 @@ CLASS(Vortex, Weapon)
 /* wepimg    */ ATTRIB(Vortex, model2, string, "weaponnex");
 /* refname   */ ATTRIB(Vortex, netname, string, "vortex");
 /* wepname   */ ATTRIB(Vortex, m_name, string, _("Vortex"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, ammo, float, BOTH) \
+               P(class, prefix, animtime, float, BOTH) \
+               P(class, prefix, chargepool, float, SEC) \
+               P(class, prefix, chargepool_pause_regen, float, SEC) \
+               P(class, prefix, chargepool_regen, float, SEC) \
+               P(class, prefix, charge, float, NONE) \
+               P(class, prefix, charge_animlimit, float, NONE) \
+               P(class, prefix, charge_limit, float, NONE) \
+               P(class, prefix, charge_maxspeed, float, NONE) \
+               P(class, prefix, charge_mindmg, float, NONE) \
+               P(class, prefix, charge_minspeed, float, NONE) \
+               P(class, prefix, charge_rate, float, NONE) \
+               P(class, prefix, charge_rot_pause, float, NONE) \
+               P(class, prefix, charge_rot_rate, float, NONE) \
+               P(class, prefix, charge_shot_multiplier, float, NONE) \
+               P(class, prefix, charge_start, float, NONE) \
+               P(class, prefix, charge_velocity_rate, float, NONE) \
+               P(class, prefix, damagefalloff_forcehalflife, float, BOTH) \
+               P(class, prefix, damagefalloff_halflife, float, BOTH) \
+               P(class, prefix, damagefalloff_maxdist, float, BOTH) \
+               P(class, prefix, damagefalloff_mindist, float, BOTH) \
+               P(class, prefix, damage, float, BOTH) \
+               P(class, prefix, force, float, BOTH) \
+               P(class, prefix, refire, float, BOTH) \
+               P(class, prefix, secondary, float, NONE) \
+               P(class, prefix, reload_ammo, float, NONE) \
+        P(class, prefix, reload_time, float, NONE) \
+        P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Vortex, vortex)
+#undef X
+
 ENDCLASS(Vortex)
-REGISTER_WEAPON(VORTEX, NEW(Vortex));
-
-#define VORTEX_SETTINGS(w_cvar,w_prop) VORTEX_SETTINGS_LIST(w_cvar, w_prop, VORTEX, vortex)
-#define VORTEX_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, BOTH, ammo) \
-       w_cvar(id, sn, BOTH, animtime) \
-       w_cvar(id, sn, BOTH, damage) \
-       w_cvar(id, sn, BOTH, force) \
-       w_cvar(id, sn, BOTH, damagefalloff_mindist) \
-       w_cvar(id, sn, BOTH, damagefalloff_maxdist) \
-       w_cvar(id, sn, BOTH, damagefalloff_halflife) \
-       w_cvar(id, sn, BOTH, damagefalloff_forcehalflife) \
-       w_cvar(id, sn, BOTH, refire) \
-       w_cvar(id, sn, NONE, charge) \
-       w_cvar(id, sn, NONE, charge_mindmg) \
-       w_cvar(id, sn, NONE, charge_shot_multiplier) \
-       w_cvar(id, sn, NONE, charge_animlimit) \
-       w_cvar(id, sn, NONE, charge_limit) \
-       w_cvar(id, sn, NONE, charge_rate) \
-       w_cvar(id, sn, NONE, charge_rot_rate) \
-       w_cvar(id, sn, NONE, charge_rot_pause) \
-       w_cvar(id, sn, NONE, charge_start) \
-       w_cvar(id, sn, NONE, charge_minspeed) \
-       w_cvar(id, sn, NONE, charge_maxspeed) \
-       w_cvar(id, sn, NONE, charge_velocity_rate) \
-       w_cvar(id, sn, NONE, secondary) \
-       w_cvar(id, sn, SEC,  chargepool) \
-       w_cvar(id, sn, SEC,  chargepool_regen) \
-       w_cvar(id, sn, SEC,  chargepool_pause_regen) \
-       w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
-       w_prop(id, sn, float,  reloading_time, reload_time) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(VORTEX, vortex, NEW(Vortex));
+
 
 #ifdef SVQC
-VORTEX_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 
 .float vortex_lasthit;
 #endif
@@ -316,10 +320,6 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                                }
                        }
                }
-               METHOD(Vortex, wr_init, void(entity thiswep))
-               {
-                       VORTEX_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-               }
                METHOD(Vortex, wr_setup, void(entity thiswep))
                {
                        self.vortex_lasthit = 0;
@@ -344,10 +344,6 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                                return false; // zoom is not a fire mode
                        }
                }
-               METHOD(Vortex, wr_config, void(entity thiswep))
-               {
-                       VORTEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-               }
                METHOD(Vortex, wr_resetplayer, void(entity thiswep))
                {
                        if (WEP_CVAR(vortex, charge)) {
@@ -373,7 +369,6 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
 
 #endif
 #ifdef CSQC
-float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO
 
                METHOD(Vortex, wr_impacteffect, void(entity thiswep))
                {
index a246359b48bd24ab2184d0722339e6fdbc39693b..95b3a878a763343b5defeafb1df7470261f23975 100644 (file)
@@ -161,6 +161,16 @@ STATIC_INIT(RegisterTempEntities_renumber)
        #define APPROXPASTTIME_MAX (16384 * APPROXPASTTIME_ACCURACY_REQUIREMENT)
        #define APPROXPASTTIME_RANGE (64 * APPROXPASTTIME_ACCURACY_REQUIREMENT)
 
+       #if defined(CSQC)
+               #define Read_float() ReadFloat()
+               #define Read_int() ReadInt24_t()
+               #define Read_string() ReadString()
+       #elif defined(SVQC)
+               #define Write_float(to, f) WriteFloat(to, f)
+               #define Write_int(to, f) WriteInt24_t(to, f)
+               #define Write_string(to, f) WriteString(to, f)
+       #endif
+
        #ifdef CSQC
        #define ReadRegistry(r) r##_from(ReadByte())
 
index 51c16d8c50d3d770eb92ea6588ef2397ecd9d058..6e393ede7bb0d0fc8c68e6f67e81490f6285d8b5 100644 (file)
@@ -165,8 +165,8 @@ STATIC_INIT(RegisterClasses)
        prototype METHOD_REFERENCE(cname, name)
 
 #define METHOD(cname, name, prototype) \
-       class(cname).prototype name; \
        STATIC_METHOD(cname, name, prototype); \
+       class(cname) .prototype name; \
        INIT_STATIC(cname) \
        { \
                this.name = METHOD_REFERENCE(cname, name); \