]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Weapons: remove WEP_ACTION
authorTimePath <andrew.hardaker1995@gmail.com>
Thu, 1 Oct 2015 10:08:53 +0000 (20:08 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Thu, 1 Oct 2015 10:08:53 +0000 (20:08 +1000)
38 files changed:
qcsrc/client/damage.qc
qcsrc/client/view.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/config.qc
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hmg.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/rpc.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_impulse.qc
qcsrc/server/cl_player.qc
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/g_hook.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/mutators/gamemode_nexball.qc
qcsrc/server/mutators/mutator_nix.qc
qcsrc/server/t_items.qc
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/weaponsystem.qc
qcsrc/server/weapons/weaponsystem.qh

index de3145baca1dc45e7cb4f4bee818463bd6c32ca5..7ef7f996bd1e22f93a7c0d07b1650952bbf05974 100644 (file)
@@ -355,6 +355,8 @@ void Ent_DamageInfo(float isNew)
                        w_backoff = -1 * normalize(force);
                setorigin(self, w_org + w_backoff * 2); // for sound() calls
 
                        w_backoff = -1 * normalize(force);
                setorigin(self, w_org + w_backoff * 2); // for sound() calls
 
-               if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) { _WEP_ACTION(hitwep, WR_IMPACTEFFECT); }
+               if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) {
+                       Weapon w = get_weaponinfo(hitwep); w.wr_impacteffect(w);
+               }
        }
 }
        }
 }
index dfb1ef5afec13c3e18f3a4928f484f8b118cb16c..60fb4b0c58fc960b6886140238859fca6bda076d 100644 (file)
@@ -1532,6 +1532,7 @@ void CSQC_UpdateView(float w, float h)
 
        if(autocvar_cl_reticle)
        {
 
        if(autocvar_cl_reticle)
        {
+               Weapon wep = get_weaponinfo(activeweapon);
                // Draw the aiming reticle for weapons that use it
                // reticle_type is changed to the item we are zooming / aiming with, to decide which reticle to use
                // It must be a persisted float for fading out to work properly (you let go of the zoom button for
                // Draw the aiming reticle for weapons that use it
                // reticle_type is changed to the item we are zooming / aiming with, to decide which reticle to use
                // It must be a persisted float for fading out to work properly (you let go of the zoom button for
@@ -1541,7 +1542,7 @@ void CSQC_UpdateView(float w, float h)
                        // no zoom reticle while dead
                        reticle_type = 0;
                }
                        // no zoom reticle while dead
                        reticle_type = 0;
                }
-               else if(_WEP_ACTION(activeweapon, WR_ZOOMRETICLE) && autocvar_cl_reticle_weapon)
+               else if(wep.wr_zoomreticle(wep) && autocvar_cl_reticle_weapon)
                {
                        if(reticle_image != "") { reticle_type = 2; }
                        else { reticle_type = 0; }
                {
                        if(reticle_image != "") { reticle_type = 2; }
                        else { reticle_type = 0; }
index 7b9b6e5f260ba3612bf16d398e5e8fc67c2c20b7..2ee94b020597d8b56c267ede040c65f4bdc0e4b0 100644 (file)
@@ -52,9 +52,7 @@ entity get_weaponinfo(int id)
        return dummy_weapon_info;
 }
 
        return dummy_weapon_info;
 }
 
-#define REGISTER_WEAPON(...) EVAL(OVERLOAD(REGISTER_WEAPON, __VA_ARGS__))
-
-#define REGISTER_WEAPON_2(id, inst) \
+#define REGISTER_WEAPON(id, inst) \
        WepSet WEPSET_##id; \
        REGISTER(RegisterWeapons, WEP, weapon_info, WEP_COUNT, id, m_id, inst) { \
                this.m_id++; \
        WepSet WEPSET_##id; \
        REGISTER(RegisterWeapons, WEP, weapon_info, WEP_COUNT, id, m_id, inst) { \
                this.m_id++; \
@@ -65,18 +63,6 @@ entity get_weaponinfo(int id)
        } \
        REGISTER_INIT(WEP, id)
 
        } \
        REGISTER_INIT(WEP, id)
 
-#define _REGISTER_WEAPON(id, function, ammotype, impulse, flags, rating, color, modelname, mdl, crosshair, wepimg, refname, wepname) \
-       REGISTER_WEAPON_2(id, NEW(Weapon, function, ammotype, impulse, flags, rating, color, modelname, mdl, crosshair, wepimg, refname, wepname))
-
-#ifndef MENUQC
-       #define REGISTER_WEAPON_13(id, function, ammotype, impulse, flags, rating, color, modelname, mdl, crosshair, wepimg, refname, wepname) \
-       bool function(entity this, int); \
-       _REGISTER_WEAPON(id, function, ammotype, impulse, flags, rating, color, modelname, mdl, crosshair, wepimg, refname, wepname)
-#else
-       #define REGISTER_WEAPON_13(id, function, ammotype, impulse, flags, rating, color, modelname, mdl, crosshair, wepimg, refname, wepname) \
-               _REGISTER_WEAPON(id, w_new,   ammotype, impulse, flags, rating, color, modelname, NULL, crosshair, wepimg, refname, wepname)
-#endif
-
 // create cvars for weapon settings
 #define WEP_ADD_CVAR_NONE(wepname,name) [[last]] float autocvar_g_balance_##wepname##_##name;
 
 // create cvars for weapon settings
 #define WEP_ADD_CVAR_NONE(wepname,name) [[last]] float autocvar_g_balance_##wepname##_##name;
 
index 8db08079769a930a8a24bcb1afd20b5b10a6a09f..d932224e3a8bae0e990604ec19ed47410e05b517 100644 (file)
@@ -35,7 +35,8 @@ void Dump_Weapon_Settings(void)
                        { wep_config_queue[x] = string_null; }
 
                // step 2: build new queue
                        { wep_config_queue[x] = string_null; }
 
                // step 2: build new queue
-               _WEP_ACTION(i, WR_CONFIG);
+               Weapon w = get_weaponinfo(i);
+               w.wr_config(w);
 
                // step 3: sort queue
                heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, world);
 
                // step 3: sort queue
                heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, world);
index 75e00aa39716419201ef986ea313f54384c8c8aa..71c42065c9dd145e0cb300aa918f526fcd717192 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef WEAPON_H
 #define WEAPON_H
 
 #ifndef WEAPON_H
 #define WEAPON_H
 
-bool w_new(entity this, int req);
-
 .int ammo_shells;
 .int ammo_nails;
 .int ammo_rockets;
 .int ammo_shells;
 .int ammo_nails;
 .int ammo_rockets;
@@ -11,42 +9,6 @@ bool w_new(entity this, int req);
 .int ammo_fuel;
 .int ammo_none;
 
 .int ammo_fuel;
 .int ammo_none;
 
-// weapon requests
-const int WR_SETUP          =  1; // (SERVER) setup weapon data
-.bool(entity this) wr_setup;
-/** (SERVER) logic to run every frame */
-.bool(entity this, bool fire1, bool fire2) wr_think;
-const int WR_CHECKAMMO1     =  3; // (SERVER) checks ammo for weapon primary
-.bool(entity this) wr_checkammo1;
-const int WR_CHECKAMMO2     =  4; // (SERVER) checks ammo for weapon second
-.bool(entity this) wr_checkammo2;
-const int WR_AIM            =  5; // (SERVER) runs bot aiming code for this weapon
-.bool(entity this) wr_aim;
-const int WR_INIT           =  6; // (BOTH)   precaches models/sounds used by this weapon, also sets up weapon properties
-.bool(entity this) wr_init;
-const int WR_SUICIDEMESSAGE =  7; // (SERVER) notification number for suicide message (may inspect w_deathtype for details)
-.bool(entity this) wr_suicidemessage;
-const int WR_KILLMESSAGE    =  8; // (SERVER) notification number for kill message (may inspect w_deathtype for details)
-.bool(entity this) wr_killmessage;
-const int WR_RELOAD         =  9; // (SERVER) handles reloading for weapon
-.bool(entity this) wr_reload;
-const int WR_RESETPLAYER    = 10; // (SERVER) clears fields that the weapon may use
-.bool(entity this) wr_resetplayer;
-const int WR_IMPACTEFFECT   = 11; // (CLIENT) impact effect for weapon explosion
-.bool(entity this) wr_impacteffect;
-const int WR_PLAYERDEATH    = 12; // (SERVER) called whenever a player dies
-.bool(entity this) wr_playerdeath;
-const int WR_GONETHINK      = 13; // (SERVER) logic to run when weapon is lost
-.bool(entity this) wr_gonethink;
-const int WR_CONFIG         = 14; // (ALL)    dump weapon cvars to config in data directory (see: sv_cmd dumpweapons)
-.bool(entity this) wr_config;
-const int WR_ZOOMRETICLE    = 15; // (CLIENT) weapon specific zoom reticle
-.bool(entity this) wr_zoomreticle;
-const int WR_DROP           = 16; // (SERVER) the weapon is dropped
-.bool(entity this) wr_drop;
-const int WR_PICKUP         = 17; // (SERVER) a weapon is picked up
-.bool(entity this) wr_pickup;
-
 /** fields which are explicitly/manually set are marked with "M", fields set automatically are marked with "A" */
 CLASS(Weapon, Object)
        ATTRIB(Weapon, m_id, int, 0)
 /** fields which are explicitly/manually set are marked with "M", fields set automatically are marked with "A" */
 CLASS(Weapon, Object)
        ATTRIB(Weapon, m_id, int, 0)
@@ -57,8 +19,6 @@ CLASS(Weapon, Object)
     ATTRIB(Weapon, weapon, int, 0);
     /** A: WEPSET_id : WEPSET_... */
     ATTRIB(Weapon, weapons, WepSet, '0 0 0');
     ATTRIB(Weapon, weapon, int, 0);
     /** A: WEPSET_id : WEPSET_... */
     ATTRIB(Weapon, weapons, WepSet, '0 0 0');
-    /** M: function  : w_... */
-    METHOD(Weapon, weapon_func, bool(entity this, int req)) { return w_new(this, req); }
     /** M: ammotype  : main ammo field */
     ATTRIB(Weapon, ammo_field, .int, ammo_none);
     /** M: impulse   : weapon impulse */
     /** M: ammotype  : main ammo field */
     ATTRIB(Weapon, ammo_field, .int, ammo_none);
     /** M: impulse   : weapon impulse */
@@ -86,47 +46,52 @@ CLASS(Weapon, Object)
     /** M: wepname   : human readable name */
     ATTRIB(Weapon, message, string, "AOL CD Thrower");
 
     /** M: wepname   : human readable name */
     ATTRIB(Weapon, message, string, "AOL CD Thrower");
 
+    /** (SERVER) setup weapon data */
+    METHOD(Weapon, wr_setup, bool(Weapon this)) {return false;}
+    /** (SERVER) logic to run every frame */
+    METHOD(Weapon, wr_think, bool(Weapon this, bool fire1, bool fire2)) {return false;}
+    /** (SERVER) checks ammo for weapon primary */
+    METHOD(Weapon, wr_checkammo1, bool(Weapon this)) {return false;}
+    /** (SERVER) checks ammo for weapon second */
+    METHOD(Weapon, wr_checkammo2, bool(Weapon this)) {return false;}
+    /** (SERVER) runs bot aiming code for this weapon */
+    METHOD(Weapon, wr_aim, bool(Weapon this)) {return false;}
+    /** (BOTH)   precaches models/sounds used by this weapon, also sets up weapon properties */
+    METHOD(Weapon, wr_init, bool(Weapon this)) {return false;}
+    /** (SERVER) notification number for suicide message (may inspect w_deathtype for details) */
+    METHOD(Weapon, wr_suicidemessage, bool(Weapon this)) {return false;}
+    /** (SERVER) notification number for kill message (may inspect w_deathtype for details) */
+    METHOD(Weapon, wr_killmessage, bool(Weapon this)) {return false;}
+    /** (SERVER) handles reloading for weapon */
+    METHOD(Weapon, wr_reload, bool(Weapon this)) {return false;}
+    /** (SERVER) clears fields that the weapon may use */
+    METHOD(Weapon, wr_resetplayer, bool(Weapon this)) {return false;}
+    /** (CLIENT) impact effect for weapon explosion */
+    METHOD(Weapon, wr_impacteffect, bool(Weapon this)) {return false;}
+    /** (SERVER) called whenever a player dies */
+    METHOD(Weapon, wr_playerdeath, bool(Weapon this)) {return false;}
+    /** (SERVER) logic to run when weapon is lost */
+    METHOD(Weapon, wr_gonethink, bool(Weapon this)) {return false;}
+    /** (ALL)    dump weapon cvars to config in data directory (see: sv_cmd dumpweapons) */
+    METHOD(Weapon, wr_config, bool(Weapon this)) {return false;}
+    /** (CLIENT) weapon specific zoom reticle */
+    METHOD(Weapon, wr_zoomreticle, bool(Weapon this)) {return false;}
+    /** (SERVER) the weapon is dropped */
+    METHOD(Weapon, wr_drop, bool(Weapon this)) {return false;}
+    /** (SERVER) a weapon is picked up */
+    METHOD(Weapon, wr_pickup, bool(Weapon this)) {return false;}
+
        METHOD(Weapon, display, void(entity this, void(string name, string icon) returns)) {
                returns(this.message, this.model2 ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.model2) : string_null);
        }
 
        METHOD(Weapon, display, void(entity this, void(string name, string icon) returns)) {
                returns(this.message, this.model2 ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.model2) : string_null);
        }
 
-       CONSTRUCTOR(Weapon,
-               bool(entity this, int req) function,
-               .int ammotype,
-               int i,
-               int weapontype,
-               float pickupbasevalue,
-               vector clr,
-               string modelname,
-               entity m,
-               string crosshair,
-               string wepimg,
-               string refname,
-               string wepname
-       ) {
-               CONSTRUCT(Weapon);
-               this.weapon_func = function;
-               this.ammo_field = ammotype;
-               this.impulse = i;
-               this.spawnflags = weapontype;
-               this.bot_pickupbasevalue = pickupbasevalue;
-               this.wpcolor = clr;
-               this.mdl = modelname;
-               this.m_model = m;
-               this.w_crosshair = strzone(car(crosshair));
-               string s = cdr(crosshair);
-               this.w_crosshair_size = ((s != "") ? stof(s) : 1); // so that we can scale the crosshair from code (for compat)
-               this.model2 = strzone(wepimg);
-               this.netname = refname;
-               this.message = wepname;
-       }
        void register_weapon(entity this, int id, WepSet bit)
        {
                this.weapon = id;
                this.weapons = bit;
                this.wpmodel = strzone(strcat("wpn-", ftos(id)));
                #ifdef CSQC
        void register_weapon(entity this, int id, WepSet bit)
        {
                this.weapon = id;
                this.weapons = bit;
                this.wpmodel = strzone(strcat("wpn-", ftos(id)));
                #ifdef CSQC
-               this.weapon_func(this, WR_INIT);
+               this.wr_init(this);
                #endif
        }
 ENDCLASS(Weapon)
                #endif
        }
 ENDCLASS(Weapon)
@@ -158,26 +123,6 @@ const int WEP_FLAG_RELOADABLE     =  0x80; // can has reload
 const int WEP_FLAG_SUPERWEAPON    = 0x100; // powerup timer
 const int WEP_FLAG_MUTATORBLOCKED = 0x200; // hides from impulse 99 etc. (mutators are allowed to clear this flag)
 
 const int WEP_FLAG_SUPERWEAPON    = 0x100; // powerup timer
 const int WEP_FLAG_MUTATORBLOCKED = 0x200; // hides from impulse 99 etc. (mutators are allowed to clear this flag)
 
-bool w_new(entity this, int req) {
-    if (req == WR_SETUP) return this.wr_setup ? this.wr_setup(this) : false;
-    if (req == WR_CHECKAMMO1) return this.wr_checkammo1 ? this.wr_checkammo1(this) : false;
-    if (req == WR_CHECKAMMO2) return this.wr_checkammo2 ? this.wr_checkammo2(this) : false;
-    if (req == WR_AIM) return this.wr_aim ? this.wr_aim(this) : false;
-    if (req == WR_INIT) return this.wr_init ? this.wr_init(this) : false;
-    if (req == WR_SUICIDEMESSAGE) return this.wr_suicidemessage ? this.wr_suicidemessage(this) : false;
-    if (req == WR_KILLMESSAGE) return this.wr_killmessage ? this.wr_killmessage(this) : false;
-    if (req == WR_RELOAD) return this.wr_reload ? this.wr_reload(this) : false;
-    if (req == WR_RESETPLAYER) return this.wr_resetplayer ? this.wr_resetplayer(this) : false;
-    if (req == WR_IMPACTEFFECT) return this.wr_impacteffect ? this.wr_impacteffect(this) : false;
-    if (req == WR_PLAYERDEATH) return this.wr_playerdeath ? this.wr_playerdeath(this) : false;
-    if (req == WR_GONETHINK) return this.wr_gonethink ? this.wr_gonethink(this) : false;
-    if (req == WR_CONFIG) return this.wr_config ? this.wr_config(this) : false;
-    if (req == WR_ZOOMRETICLE) return this.wr_zoomreticle ? this.wr_zoomreticle(this) : false;
-    if (req == WR_DROP) return this.wr_drop ? this.wr_drop(this) : false;
-    if (req == WR_PICKUP) return this.wr_pickup ? this.wr_pickup(this) : false;
-    return false;
-}
-
 // variables:
 string weaponorder_byid;
 
 // variables:
 string weaponorder_byid;
 
@@ -203,8 +148,6 @@ string W_Model(string w_mdl);
 
 
 // other useful macros
 
 
 // other useful macros
-#define WEP_ACTION(wpn,wrequest) wpn.weapon_func(wpn, wrequest)
-#define _WEP_ACTION(wpn,wrequest) WEP_ACTION(get_weaponinfo(wpn), wrequest)
 #define WEP_AMMO(wpn) (WEP_##wpn.ammo_field) // only used inside weapon files/with direct name, don't duplicate prefix
 #define WEP_NAME(wpn) ((get_weaponinfo(wpn)).message)
 
 #define WEP_AMMO(wpn) (WEP_##wpn.ammo_field) // only used inside weapon files/with direct name, don't duplicate prefix
 #define WEP_NAME(wpn) ((get_weaponinfo(wpn)).message)
 
index a5e2f681c00a88fa3588f259d5f210491493ef14..4714c03f102fb449f1596d6a2174c5d9c21b3517 100644 (file)
@@ -275,7 +275,8 @@ void W_Arc_Beam_Think(void)
 
                if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
                setself(self.owner);
 
                if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
                setself(self.owner);
-               if(!WEP_ACTION(WEP_ARC, WR_CHECKAMMO1) && !WEP_ACTION(WEP_ARC, WR_CHECKAMMO2))
+               Weapon w = WEP_ARC;
+               if(!w.wr_checkammo1(w) && !w.wr_checkammo2(w))
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        // note: this doesn't force the switch
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        // note: this doesn't force the switch
index 5018f0876bdc5a0a25bf6df74498491f29e71bed..efa5387646bbf73721a4fd9442f1bcc0d18d3780 100644 (file)
@@ -579,8 +579,10 @@ void W_Crylink_Attack2(Weapon thiswep)
                METHOD(Crylink, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
                        SELFPARAM();
                METHOD(Crylink, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
                        SELFPARAM();
-                       if(autocvar_g_balance_crylink_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
+                       if(autocvar_g_balance_crylink_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       }
 
                        if(fire1)
                        {
 
                        if(fire1)
                        {
index 162eac9a60104358562cc77d89c1a5cf2790fad4..2204548b232537019e49160cf48ff18b0fda0430 100644 (file)
@@ -524,9 +524,10 @@ void W_Devastator_Attack(Weapon thiswep)
                #endif
                METHOD(Devastator, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
                #endif
                METHOD(Devastator, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
-                       if(WEP_CVAR(devastator, reload_ammo) && self.clip_load < WEP_CVAR(devastator, ammo)) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
-                       else
+                       if(WEP_CVAR(devastator, reload_ammo) && self.clip_load < WEP_CVAR(devastator, ammo)) { // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       } else
                        {
                                if(fire1)
                                {
                        {
                                if(fire1)
                                {
index 8221c22ed1948137794f354da4d1456da8501f50..b23072c34aeb599f8db9604d22b3fc0b3bc7d8f8 100644 (file)
@@ -465,7 +465,8 @@ void W_Electro_CheckAttack(Weapon thiswep, bool fire1, bool fire2)
 
                                if(!ammo_amount)
                                {
 
                                if(!ammo_amount)
                                {
-                                       _WEP_ACTION(self.weapon, WR_RELOAD);
+                                       Weapon w = get_weaponinfo(self.weapon);
+                                       w.wr_reload(w);
                                        return false;
                                }
 
                                        return false;
                                }
 
index ee3f948cb585f189af6fa088f1cf370f96d11673..00d8226052ed282b8e7add42947f6c8a87bf3118 100644 (file)
@@ -389,7 +389,8 @@ void W_Hagar_Attack2_Load(Weapon thiswep)
                self.hagar_warning = false;
 
                // we aren't checking ammo during an attack, so we must do it here
                self.hagar_warning = false;
 
                // we aren't checking ammo during an attack, so we must do it here
-               if(!(_WEP_ACTION(self.weapon, WR_CHECKAMMO1) + _WEP_ACTION(self.weapon, WR_CHECKAMMO2)))
+               Weapon w = get_weaponinfo(self.weapon);
+               if(!(w.wr_checkammo1(w) + w.wr_checkammo2(w)))
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        // note: this doesn't force the switch
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        // note: this doesn't force the switch
@@ -415,9 +416,10 @@ void W_Hagar_Attack2_Load(Weapon thiswep)
 
                        if(loadable_secondary)
                                W_Hagar_Attack2_Load(thiswep); // must always run each frame
 
                        if(loadable_secondary)
                                W_Hagar_Attack2_Load(thiswep); // must always run each frame
-                       if(autocvar_g_balance_hagar_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
-                       else if(fire1 && !self.hagar_load && !self.hagar_loadblock) // not while secondary is loaded or awaiting reset
+                       if(autocvar_g_balance_hagar_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       } else if(fire1 && !self.hagar_load && !self.hagar_loadblock) // not while secondary is loaded or awaiting reset
                        {
                                if(weapon_prepareattack(false, WEP_CVAR_PRI(hagar, refire)))
                                {
                        {
                                if(weapon_prepareattack(false, WEP_CVAR_PRI(hagar, refire)))
                                {
index cb696361c6831970f96c9c34a5d7f80eecc6847f..c7cab6d98fa2cde9616e9bc0e29f86d8c6a06dc7 100644 (file)
@@ -171,7 +171,8 @@ void W_HLAC_Attack_Frame(Weapon thiswep, bool fire1, bool fire2)
 
        if(self.BUTTON_ATCK)
        {
 
        if(self.BUTTON_ATCK)
        {
-               if(!_WEP_ACTION(self.weapon, WR_CHECKAMMO1))
+               Weapon w = get_weaponinfo(self.weapon);
+               if(!w.wr_checkammo1(w))
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        W_SwitchWeapon_Force(self, w_getbestweapon(self));
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        W_SwitchWeapon_Force(self, w_getbestweapon(self));
@@ -213,9 +214,10 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
                }
                METHOD(HLAC, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
                }
                METHOD(HLAC, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
-                       if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
-                       else if(fire1)
+                       if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       } else if(fire1)
                        {
                                if(weapon_prepareattack(false, WEP_CVAR_PRI(hlac, refire)))
                                {
                        {
                                if(weapon_prepareattack(false, WEP_CVAR_PRI(hlac, refire)))
                                {
index 881f513807d8f00bc46520094ec91a5cfd6f003c..aae7d7792ace988a7f49b2110c393a1e932c48f9 100644 (file)
@@ -53,7 +53,8 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, bool fire1, bool fire2)
                return;
        }
 
                return;
        }
 
-       if(!_WEP_ACTION(self.weapon, WR_CHECKAMMO1))
+       Weapon w = get_weaponinfo(self.weapon);
+       if(!w.wr_checkammo1(w))
        if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(self, w_getbestweapon(self));
        if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(self, w_getbestweapon(self));
@@ -99,9 +100,10 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, bool fire1, bool fire2)
                }
                METHOD(HeavyMachineGun, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
                }
                METHOD(HeavyMachineGun, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
-                       if(WEP_CVAR(hmg, reload_ammo) && self.clip_load < WEP_CVAR(hmg, ammo)) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
-                       else
+                       if(WEP_CVAR(hmg, reload_ammo) && self.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       } else
                        {
                                if (fire1)
                                if (weapon_prepareattack(false, 0))
                        {
                                if (fire1)
                                if (weapon_prepareattack(false, 0))
index afef944889325c183f02c31fc1c55899ecbcfdb8..cc2d893c9bf7480305c433aec1b41d570dabc748 100644 (file)
@@ -146,7 +146,8 @@ void W_MachineGun_Attack_Frame(Weapon thiswep, bool fire1, bool fire2)
        }
        if(self.BUTTON_ATCK)
        {
        }
        if(self.BUTTON_ATCK)
        {
-               if(!_WEP_ACTION(self.weapon, WR_CHECKAMMO2))
+               Weapon w = get_weaponinfo(self.weapon);
+               if(!w.wr_checkammo2(w))
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        W_SwitchWeapon_Force(self, w_getbestweapon(self));
                if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        W_SwitchWeapon_Force(self, w_getbestweapon(self));
@@ -172,7 +173,8 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, bool fire1, bool fire2)
                return;
        }
 
                return;
        }
 
-       if(!_WEP_ACTION(self.weapon, WR_CHECKAMMO1))
+       Weapon w = get_weaponinfo(self.weapon);
+       if(!w.wr_checkammo1(w))
        if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(self, w_getbestweapon(self));
        if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(self, w_getbestweapon(self));
@@ -249,9 +251,10 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, bool fire1, bool fire2)
                }
                METHOD(MachineGun, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
                }
                METHOD(MachineGun, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
-                       if(WEP_CVAR(machinegun, reload_ammo) && self.clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo))) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
-                       else
+                       if(WEP_CVAR(machinegun, reload_ammo) && self.clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo))) { // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       } else
                        if(WEP_CVAR(machinegun, mode) == 1)
                        {
                                if(fire1)
                        if(WEP_CVAR(machinegun, mode) == 1)
                        {
                                if(fire1)
@@ -264,7 +267,8 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, bool fire1, bool fire2)
                                if(fire2)
                                if(weapon_prepareattack(true, 0))
                                {
                                if(fire2)
                                if(weapon_prepareattack(true, 0))
                                {
-                                       if(!_WEP_ACTION(self.weapon, WR_CHECKAMMO2))
+                                       Weapon w = get_weaponinfo(self.weapon);
+                                       if(!w.wr_checkammo2(w))
                                        if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                                        {
                                                W_SwitchWeapon_Force(self, w_getbestweapon(self));
                                        if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                                        {
                                                W_SwitchWeapon_Force(self, w_getbestweapon(self));
index 3d29f9624cb4b0700090efe44669f4419d7f13f8..0ecc4b73f45697c2143e694da12f71e6ea2a5734 100644 (file)
@@ -125,7 +125,8 @@ void W_MineLayer_Explode(void)
        if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
        {
                setself(self.realowner);
        if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
        {
                setself(self.realowner);
-               if(!WEP_ACTION(WEP_MINE_LAYER, WR_CHECKAMMO1))
+               Weapon w = WEP_MINE_LAYER;
+               if(!w.wr_checkammo1(w))
                {
                        self.cnt = WEP_MINE_LAYER.m_id;
                        ATTACK_FINISHED(self) = time;
                {
                        self.cnt = WEP_MINE_LAYER.m_id;
                        ATTACK_FINISHED(self) = time;
@@ -150,7 +151,8 @@ void W_MineLayer_DoRemoteExplode(void)
        if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
        {
                setself(self.realowner);
        if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
        {
                setself(self.realowner);
-               if(!WEP_ACTION(WEP_MINE_LAYER, WR_CHECKAMMO1))
+               Weapon w = WEP_MINE_LAYER;
+               if(!w.wr_checkammo1(w))
                {
                        self.cnt = WEP_MINE_LAYER.m_id;
                        ATTACK_FINISHED(self) = time;
                {
                        self.cnt = WEP_MINE_LAYER.m_id;
                        ATTACK_FINISHED(self) = time;
@@ -504,8 +506,10 @@ float W_MineLayer_PlacedMines(float detonate)
                        if(autocvar_g_balance_minelayer_reload_ammo && self.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
                        {
                                // not if we're holding the minelayer without enough ammo, but can detonate existing mines
                        if(autocvar_g_balance_minelayer_reload_ammo && self.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
                        {
                                // not if we're holding the minelayer without enough ammo, but can detonate existing mines
-                               if(!(W_MineLayer_PlacedMines(false) && self.WEP_AMMO(MINE_LAYER) < WEP_CVAR(minelayer, ammo)))
-                                       _WEP_ACTION(self.weapon, WR_RELOAD);
+                               if(!(W_MineLayer_PlacedMines(false) && self.WEP_AMMO(MINE_LAYER) < WEP_CVAR(minelayer, ammo))) {
+                                       Weapon w = get_weaponinfo(self.weapon);
+                                       w.wr_reload(w);
+                               }
                        }
                        else if(fire1)
                        {
                        }
                        else if(fire1)
                        {
index 2c92ae21c8b06ed02176f631de8cb4df796606ae..91533f790dd03259bc35dd9bb786d3a15c93e8e0 100644 (file)
@@ -338,9 +338,10 @@ void W_Mortar_Attack2(Weapon thiswep)
                        */
                METHOD(Mortar, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
                        */
                METHOD(Mortar, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
-                       if(autocvar_g_balance_mortar_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
-                       else if(fire1)
+                       if(autocvar_g_balance_mortar_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) { // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       } else if(fire1)
                        {
                                if(weapon_prepareattack(false, WEP_CVAR_PRI(mortar, refire)))
                                {
                        {
                                if(weapon_prepareattack(false, WEP_CVAR_PRI(mortar, refire)))
                                {
index 4cf8265fa969b94987db1005ffd477d273ffa5a1..5a438e0b8da1e933f3d47f11482a7bc0a70c82ee 100644 (file)
@@ -164,9 +164,10 @@ void W_Rifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animt
                }
                METHOD(Rifle, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
                }
                METHOD(Rifle, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
-                       if(autocvar_g_balance_rifle_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
-                       else
+                       if(autocvar_g_balance_rifle_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) { // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       } else
                        {
                                self.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), self.rifle_accumulator, time);
                                if(fire1)
                        {
                                self.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), self.rifle_accumulator, time);
                                if(fire1)
@@ -181,9 +182,10 @@ void W_Rifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animt
                                {
                                        if(WEP_CVAR(rifle, secondary))
                                        {
                                {
                                        if(WEP_CVAR(rifle, secondary))
                                        {
-                                               if(WEP_CVAR_SEC(rifle, reload))
-                                                       _WEP_ACTION(self.weapon, WR_RELOAD);
-                                               else
+                                               if(WEP_CVAR_SEC(rifle, reload)) {
+                                                       Weapon w = get_weaponinfo(self.weapon);
+                                                       w.wr_reload(w);
+                                               } else
                                                {
                                                        if(weapon_prepareattack_check(true, WEP_CVAR_SEC(rifle, refire)))
                                                        if(time >= self.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
                                                {
                                                        if(weapon_prepareattack_check(true, WEP_CVAR_SEC(rifle, refire)))
                                                        if(time >= self.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
index bc86bdadab50e4d9dc0db60d7a16953fa310f214..d18b268878d5516f7c18ef82402d34827e28c233 100644 (file)
@@ -156,9 +156,10 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
                }
                METHOD(RocketPropelledChainsaw, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
                }
                METHOD(RocketPropelledChainsaw, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
-                       if(WEP_CVAR(rpc, reload_ammo) && self.clip_load < WEP_CVAR(rpc, ammo))
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
-                       else
+                       if(WEP_CVAR(rpc, reload_ammo) && self.clip_load < WEP_CVAR(rpc, ammo)) {
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       } else
                        {
                                if (fire1)
                                {
                        {
                                if (fire1)
                                {
index 36c7d571641ded893b5b06d934aa51628befee44..e551485dc0c77a3908a5b8f38fc9e7289c04aca7 100644 (file)
@@ -611,10 +611,10 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
                }
                METHOD(Seeker, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
                }
                METHOD(Seeker, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
-                       if(autocvar_g_balance_seeker_reload_ammo && self.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
-
-                       else if(fire1)
+                       if(autocvar_g_balance_seeker_reload_ammo && self.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       else if(fire1)
                        {
                                if(WEP_CVAR(seeker, type) == 1)
                                {
                        {
                                if(WEP_CVAR(seeker, type) == 1)
                                {
index e577aa1258724ead82187d1455a6027420a7a1f1..c634fe6637c490e6a41e8f80af30b0b17ec86de4 100644 (file)
@@ -197,7 +197,8 @@ void W_Shotgun_Attack2(Weapon thiswep, bool fire1, bool fire2)
 // alternate secondary weapon frames
 void W_Shotgun_Attack3_Frame2(Weapon thiswep, bool fire1, bool fire2)
 {SELFPARAM();
 // alternate secondary weapon frames
 void W_Shotgun_Attack3_Frame2(Weapon thiswep, bool fire1, bool fire2)
 {SELFPARAM();
-       if (!_WEP_ACTION(self.weapon, WR_CHECKAMMO2))
+       Weapon w = get_weaponinfo(self.weapon);
+       if (!w.wr_checkammo2(w))
        if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(self, w_getbestweapon(self));
        if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(self, w_getbestweapon(self));
@@ -211,7 +212,8 @@ void W_Shotgun_Attack3_Frame2(Weapon thiswep, bool fire1, bool fire2)
 }
 void W_Shotgun_Attack3_Frame1(Weapon thiswep, bool fire1, bool fire2)
 {SELFPARAM();
 }
 void W_Shotgun_Attack3_Frame1(Weapon thiswep, bool fire1, bool fire2)
 {SELFPARAM();
-       if (!_WEP_ACTION(self.weapon, WR_CHECKAMMO2))
+       Weapon w = get_weaponinfo(self.weapon);
+       if (!w.wr_checkammo2(w))
        if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(self, w_getbestweapon(self));
        if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(self, w_getbestweapon(self));
@@ -239,8 +241,10 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, bool fire1, bool fire2)
                        if(WEP_CVAR(shotgun, reload_ammo) && self.clip_load < WEP_CVAR_PRI(shotgun, ammo)) // forced reload
                        {
                                // don't force reload an empty shotgun if its melee attack is active
                        if(WEP_CVAR(shotgun, reload_ammo) && self.clip_load < WEP_CVAR_PRI(shotgun, ammo)) // forced reload
                        {
                                // don't force reload an empty shotgun if its melee attack is active
-                               if(WEP_CVAR(shotgun, secondary) < 2)
-                                       _WEP_ACTION(self.weapon, WR_RELOAD);
+                               if(WEP_CVAR(shotgun, secondary) < 2) {
+                                       Weapon w = get_weaponinfo(self.weapon);
+                                       w.wr_reload(w);
+                               }
                        }
                        else
                        {
                        }
                        else
                        {
index 11c26bbcf85859517c99a34a97bfc40fb0edd58b..aeb9125108a9b4a74c8e9f5db13258c9b0a9b6d2 100644 (file)
@@ -250,10 +250,13 @@ void W_RocketMinsta_Attack3 (void)
                {
                        float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
                        // if the laser uses load, we also consider its ammo for reloading
                {
                        float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
                        // if the laser uses load, we also consider its ammo for reloading
-                       if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
-                       else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
+                       if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       } else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) { // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       }
                        if(fire1 && (self.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(self))
                        {
                                if(weapon_prepareattack(false, WEP_CVAR_PRI(vaporizer, refire)))
                        if(fire1 && (self.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(self))
                        {
                                if(weapon_prepareattack(false, WEP_CVAR_PRI(vaporizer, refire)))
index 2c0d871b1de607cf48a8e422a4e99ebd452e6b02..0ed6aa85cb0fb9fa4dfa33b2350ef4942de08f8a 100644 (file)
@@ -157,9 +157,10 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                                        self.pauseregen_finished = max(self.pauseregen_finished, time + WEP_CVAR_SEC(vortex, chargepool_pause_regen));
                                }
 
                                        self.pauseregen_finished = max(self.pauseregen_finished, time + WEP_CVAR_SEC(vortex, chargepool_pause_regen));
                                }
 
-                       if(autocvar_g_balance_vortex_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
-                       else
+                       if(autocvar_g_balance_vortex_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       } else
                        {
                                if(fire1)
                                {
                        {
                                if(fire1)
                                {
index 4f7f7fb8ecad12b386a23eab720679fd4226d69d..06f2801d5bd701be05aa779f28353e4bc0c10fbe 100644 (file)
@@ -102,7 +102,8 @@ void havocbot_ai()
 
                if(self.weapons)
                {
 
                if(self.weapons)
                {
-                       _WEP_ACTION(self.weapon, WR_AIM);
+                       Weapon w = get_weaponinfo(self.weapon);
+                       w.wr_aim(w);
                        if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
                        {
                                self.BUTTON_ATCK = false;
                        if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
                        {
                                self.BUTTON_ATCK = false;
@@ -962,8 +963,9 @@ float havocbot_chooseweapon_checkreload(int new_weapon)
                float i, other_weapon_available = false;
                for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                {
                float i, other_weapon_available = false;
                for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                {
+                       Weapon w = get_weaponinfo(i);
                        // if we are out of ammo for all other weapons, it's an emergency to switch to anything else
                        // if we are out of ammo for all other weapons, it's an emergency to switch to anything else
-                       if (_WEP_ACTION(i, WR_CHECKAMMO1) + _WEP_ACTION(i, WR_CHECKAMMO2))
+                       if (w.wr_checkammo1(w) + w.wr_checkammo2(w))
                                other_weapon_available = true;
                }
                if(other_weapon_available)
                                other_weapon_available = true;
                }
                if(other_weapon_available)
index 4afd34e7ccef7cbde855f98d014be20db686cdad..bccbf6e13c2e0805c47b99f9d7b42c9cefd47675 100644 (file)
@@ -619,7 +619,8 @@ void PutClientInServer()
                // reset fields the weapons may use
                for (int j = WEP_FIRST; j <= WEP_LAST; ++j)
                {
                // reset fields the weapons may use
                for (int j = WEP_FIRST; j <= WEP_LAST; ++j)
                {
-                       _WEP_ACTION(j, WR_RESETPLAYER);
+                       Weapon w = get_weaponinfo(j);
+                       w.wr_resetplayer(w);
 
                        // all weapons must be fully loaded when we spawn
                        entity e = get_weaponinfo(j);
 
                        // all weapons must be fully loaded when we spawn
                        entity e = get_weaponinfo(j);
index 823f2a6652005ca493c695d265d45a1db7bea7c9..37fc84bdcdf22da6fb824950d810d6abab971c62 100644 (file)
@@ -134,7 +134,10 @@ void ImpulseCommands (void)
                                        W_PreviousWeapon(1);
                                        break;
                                case 20:
                                        W_PreviousWeapon(1);
                                        break;
                                case 20:
-                                       if(!forbidWeaponUse(self)) { _WEP_ACTION(self.weapon, WR_RELOAD); }
+                                       if(!forbidWeaponUse(self)) {
+                                               Weapon w = get_weaponinfo(self.weapon);
+                                               w.wr_reload(w);
+                                       }
                                        break;
                        }
                }
                                        break;
                        }
                }
index db6893d36e20a07938a279d60ac285f05594dd92..e94ba628323711d0b469eaa0af9ba060788ebdfd 100644 (file)
@@ -548,7 +548,8 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, self, deathtype);
                excess = frag_damage;
 
                MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, self, deathtype);
                excess = frag_damage;
 
-               _WEP_ACTION(self.weapon, WR_PLAYERDEATH);
+               Weapon wep = get_weaponinfo(self.weapon);
+               wep.wr_playerdeath(wep);
 
                RemoveGrapplingHook(self);
 
 
                RemoveGrapplingHook(self);
 
@@ -630,7 +631,8 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                // reset fields the weapons may use just in case
                for (j = WEP_FIRST; j <= WEP_LAST; ++j)
                {
                // reset fields the weapons may use just in case
                for (j = WEP_FIRST; j <= WEP_LAST; ++j)
                {
-                       _WEP_ACTION(j, WR_RESETPLAYER);
+                       Weapon w = get_weaponinfo(j);
+                       w.wr_resetplayer(w);
                        ATTACK_FINISHED_FOR(self, j) = 0;
                }
        }
                        ATTACK_FINISHED_FOR(self, j) = 0;
                }
        }
index f6f3d1b7a0cab833b6b5322ee8c85a8b24da7387..251da0d6274262b7c6ec3a3c1e88134806ab3267 100644 (file)
@@ -164,7 +164,6 @@ const float MAX_DAMAGEEXTRARADIUS = 16;
 
 // WEAPONTODO
 .float autoswitch;
 
 // WEAPONTODO
 .float autoswitch;
-//float _WEP_ACTION(float wpn, float wrequest);
 float client_hasweapon(entity cl, float wpn, float andammo, float complain);
 void w_clear(Weapon thiswep, bool fire1, bool fire2);
 void w_ready(Weapon thiswep, bool fire1, bool fire2);
 float client_hasweapon(entity cl, float wpn, float andammo, float complain);
 void w_clear(Weapon thiswep, bool fire1, bool fire2);
 void w_ready(Weapon thiswep, bool fire1, bool fire2);
index 76e69865a7edf593bf67fb92ca81ddd5ad2fd5ee..866586e7d93c97859836227e27bb1a70316c0c81 100644 (file)
@@ -265,7 +265,8 @@ float Obituary_WeaponDeath(
        if(death_weapon)
        {
                w_deathtype = deathtype;
        if(death_weapon)
        {
                w_deathtype = deathtype;
-               int death_message = _WEP_ACTION(death_weapon, ((murder) ? WR_KILLMESSAGE : WR_SUICIDEMESSAGE));
+               Weapon w = get_weaponinfo(death_weapon);
+               int death_message = ((murder) ? w.wr_killmessage : w.wr_suicidemessage)(w);
                w_deathtype = false;
 
                if (death_message)
                w_deathtype = false;
 
                if (death_message)
index bda9c058078408f572a29922b664fe4392e65e00..95b8c7ba3e245af29096f3eedbdd40dc99e3d916 100644 (file)
@@ -521,7 +521,8 @@ void GrappleHookInit()
        }
        else
        {
        }
        else
        {
-               WEP_ACTION(WEP_HOOK, WR_INIT);
+               Weapon w = WEP_HOOK;
+               w.wr_init(w);
                hook_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 1);
                hook_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 2);
                hook_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 3);
                hook_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 1);
                hook_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 2);
                hook_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 3);
index 210d8eb66722459a5d718cb5b213c14fbd043a75..d18960ec9f30adcaf64b9606e3fb390426e3b09f 100644 (file)
@@ -719,8 +719,10 @@ void readplayerstartcvars()
        for (i = WEP_FIRST; i <= WEP_LAST; ++i)
        {
                e = get_weaponinfo(i);
        for (i = WEP_FIRST; i <= WEP_LAST; ++i)
        {
                e = get_weaponinfo(i);
-               if(precache_weapons & WepSet_FromWeapon(i))
-                       _WEP_ACTION(i, WR_INIT);
+               if(precache_weapons & WepSet_FromWeapon(i)) {
+                       Weapon w = get_weaponinfo(i);
+                       w.wr_init(w);
+               }
        }
 
        start_ammo_shells = max(0, start_ammo_shells);
        }
 
        start_ammo_shells = max(0, start_ammo_shells);
index 0c5a2644a15d9df30ef640a20d5de7710ede1fa3..f338eb3f16f43637071905346927f61f1eb701b5 100644 (file)
@@ -419,8 +419,10 @@ void readlevelcvars(void)
        if (!warmup_stage)
                game_starttime = time + cvar("g_start_delay");
 
        if (!warmup_stage)
                game_starttime = time + cvar("g_start_delay");
 
-       for(int i = WEP_FIRST; i <= WEP_LAST; ++i)
-               _WEP_ACTION(i, WR_INIT);
+       for(int i = WEP_FIRST; i <= WEP_LAST; ++i) {
+               Weapon w = get_weaponinfo(i);
+               w.wr_init(w);
+       }
 
        readplayerstartcvars();
 }
 
        readplayerstartcvars();
 }
index b50ba97cdaa44ce9e50361a5de1359cb3597549d..590968290b2189bcea2c0bafaa0a257c525e605d 100644 (file)
@@ -170,7 +170,8 @@ void GiveBall(entity plyr, entity ball)
        plyr.weaponentity.switchweapon = plyr.weapon;
        plyr.weapons = WEPSET_NEXBALL;
        setself(plyr);
        plyr.weaponentity.switchweapon = plyr.weapon;
        plyr.weapons = WEPSET_NEXBALL;
        setself(plyr);
-       WEP_ACTION(WEP_NEXBALL, WR_RESETPLAYER);
+       Weapon w = WEP_NEXBALL;
+       w.wr_resetplayer(w);
        plyr.switchweapon = WEP_NEXBALL.m_id;
        W_SwitchWeapon(WEP_NEXBALL.m_id);
        setself(this);
        plyr.switchweapon = WEP_NEXBALL.m_id;
        W_SwitchWeapon(WEP_NEXBALL.m_id);
        setself(this);
@@ -951,7 +952,8 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink)
                        if(self.weaponentity.weapons)
                        {
                                self.weapons = self.weaponentity.weapons;
                        if(self.weaponentity.weapons)
                        {
                                self.weapons = self.weaponentity.weapons;
-                               WEP_ACTION(WEP_NEXBALL, WR_RESETPLAYER);
+                               Weapon w = WEP_NEXBALL;
+                               w.wr_resetplayer(w);
                                self.switchweapon = self.weaponentity.switchweapon;
                                W_SwitchWeapon(self.switchweapon);
 
                                self.switchweapon = self.weaponentity.switchweapon;
                                W_SwitchWeapon(self.switchweapon);
 
index 93864b18445790047df2585b0d2bac3cf7f55418..24c35d9e48a3b09ee7aef1a324e910f379fcbf7f 100644 (file)
@@ -60,7 +60,8 @@ void NIX_GiveCurrentWeapon()
                        nix_nextchange = time; // start the first round now!
                else
                        nix_nextchange = time + autocvar_g_balance_nix_roundtime;
                        nix_nextchange = time; // start the first round now!
                else
                        nix_nextchange = time + autocvar_g_balance_nix_roundtime;
-               //_WEP_ACTION(nix_weapon, WR_INIT); // forget it, too slow
+               // Weapon w = get_weaponinfo(nix_weapon);
+               // w.wr_init(w); // forget it, too slow
        }
 
        // get weapon info
        }
 
        // get weapon info
@@ -101,7 +102,8 @@ void NIX_GiveCurrentWeapon()
                else
                        Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon);
 
                else
                        Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon);
 
-               _WEP_ACTION(nix_weapon, WR_RESETPLAYER);
+               Weapon w = get_weaponinfo(nix_weapon);
+               w.wr_resetplayer(w);
 
                // all weapons must be fully loaded when we spawn
                if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
 
                // all weapons must be fully loaded when we spawn
                if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
@@ -155,8 +157,10 @@ void NIX_precache()
 {
        float i;
        for (i = WEP_FIRST; i <= WEP_LAST; ++i)
 {
        float i;
        for (i = WEP_FIRST; i <= WEP_LAST; ++i)
-               if (NIX_CanChooseWeapon(i))
-                       _WEP_ACTION(i, WR_INIT);
+               if (NIX_CanChooseWeapon(i)) {
+                       Weapon w = get_weaponinfo(i);
+                       w.wr_init(w);
+               }
 }
 
 MUTATOR_HOOKFUNCTION(nix_ForbidThrowCurrentWeapon)
 }
 
 MUTATOR_HOOKFUNCTION(nix_ForbidThrowCurrentWeapon)
index c921502cf390f442b5cdf618c34585e1389afa64..be4991c2a8e05b07bef76aa0ecc0294f1a82cad8 100644 (file)
@@ -654,7 +654,7 @@ float Item_GiveTo(entity item, entity player)
                        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                        if(it & WepSet_FromWeapon(i))
                        {
                        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                        if(it & WepSet_FromWeapon(i))
                        {
-                               W_DropEvent(WR_PICKUP, player, i, item);
+                               W_DropEvent(wr_pickup, player, i, item);
                                W_GiveWeapon(player, i);
                        }
                }
                                W_GiveWeapon(player, i);
                        }
                }
@@ -1444,8 +1444,10 @@ void spawnfunc_target_items (void)
                                        if(s == e.netname)
                                        {
                                                self.weapons |= WepSet_FromWeapon(j);
                                        if(s == e.netname)
                                        {
                                                self.weapons |= WepSet_FromWeapon(j);
-                                               if(self.spawnflags == 0 || self.spawnflags == 2)
-                                                       _WEP_ACTION(e.weapon, WR_INIT);
+                                               if(self.spawnflags == 0 || self.spawnflags == 2) {
+                                                       Weapon w = get_weaponinfo(e.weapon);
+                                                       w.wr_init(w);
+                                               }
                                                break;
                                        }
                                }
                                                break;
                                        }
                                }
@@ -1515,7 +1517,8 @@ void spawnfunc_target_items (void)
                        e = get_weaponinfo(j);
                        if(argv(i) == e.netname)
                        {
                        e = get_weaponinfo(j);
                        if(argv(i) == e.netname)
                        {
-                               _WEP_ACTION(e.weapon, WR_INIT);
+                               Weapon w = get_weaponinfo(e.weapon);
+                               w.wr_init(w);
                                break;
                        }
                }
                                break;
                        }
                }
@@ -1828,8 +1831,10 @@ float GiveItems(entity e, float beginarg, float endarg)
                {
                        POSTGIVE_WEAPON(e, j, SND(WEAPONPICKUP), string_null);
                        if (!(save_weapons & WepSet_FromWeapon(j)))
                {
                        POSTGIVE_WEAPON(e, j, SND(WEAPONPICKUP), string_null);
                        if (!(save_weapons & WepSet_FromWeapon(j)))
-                               if(e.weapons & WepSet_FromWeapon(j))
-                                       _WEP_ACTION(wi.weapon, WR_INIT);
+                               if(e.weapons & WepSet_FromWeapon(j)) {
+                                       Weapon w = get_weaponinfo(wi.weapon);
+                                       w.wr_init(w);
+                               }
                }
        }
        POSTGIVE_VALUE(e, strength_finished, 1, SND(POWERUP), SND(POWEROFF));
                }
        }
        POSTGIVE_VALUE(e, strength_finished, 1, SND(POWERUP), SND(POWEROFF));
index afc445cb26d6fb5c8348a15e2c6c5abc04ecd887..ce2a671c4584f9290ea9a67d93b985c102f11179 100644 (file)
@@ -49,8 +49,8 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
                        else
                        {
                                setself(cl);
                        else
                        {
                                setself(cl);
-                               f = _WEP_ACTION(wpn, WR_CHECKAMMO1);
-                               f = f + _WEP_ACTION(wpn, WR_CHECKAMMO2);
+                               Weapon w = get_weaponinfo(wpn);
+                               f = w.wr_checkammo1(w) + w.wr_checkammo2(w);
 
                                // always allow selecting the Mine Layer if we placed mines, so that we can detonate them
                                entity mine;
 
                                // always allow selecting the Mine Layer if we placed mines, so that we can detonate them
                                entity mine;
@@ -262,7 +262,10 @@ void W_SwitchWeapon(float imp)
                else
                        self.selectweapon = imp; // update selectweapon ANYWAY
        }
                else
                        self.selectweapon = imp; // update selectweapon ANYWAY
        }
-       else if(!forbidWeaponUse(self)) { _WEP_ACTION(self.weapon, WR_RELOAD); }
+       else if(!forbidWeaponUse(self)) {
+               Weapon w = get_weaponinfo(self.weapon);
+               w.wr_reload(w);
+       }
 }
 
 void W_CycleWeapon(string weaponorder, float dir)
 }
 
 void W_CycleWeapon(string weaponorder, float dir)
index 7079ee0c020334cd40a0449a0ccec2650fd6b138..b011bb1fffd3e9c1fd5d3318d0765edd1bc26da7 100644 (file)
@@ -180,7 +180,9 @@ void weapon_defaultspawnfunc(float wpn)
        StartItem(strzone(e.m_model.model_str()), string_null, self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue);
        self.item_pickupsound_ent = SND_WEAPONPICKUP;
        #if 0 // WEAPONTODO
        StartItem(strzone(e.m_model.model_str()), string_null, self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue);
        self.item_pickupsound_ent = SND_WEAPONPICKUP;
        #if 0 // WEAPONTODO
-       if (self.modelindex) // don't precache if self was removed
-               _WEP_ACTION(e.weapon, WR_INIT);
+       if (self.modelindex) { // don't precache if self was removed
+               Weapon w = get_weaponinfo(e.weapon);
+               w.wr_init(w);
+       }
        #endif
 }
        #endif
 }
index 2fb19609eaf71685cc33a15d7d9ca700fb870cc2..a649cf75b9858ee2d84ce74ce6e1b857e021a522 100644 (file)
@@ -44,7 +44,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
        wep.flags |= FL_TOSSED;
        wep.colormap = own.colormap;
 
        wep.flags |= FL_TOSSED;
        wep.colormap = own.colormap;
 
-       W_DropEvent(WR_DROP,own,wpn,wep);
+       W_DropEvent(wr_drop,own,wpn,wep);
 
        if(WepSet_FromWeapon(wpn) & WEPSET_SUPERWEAPONS)
        {
 
        if(WepSet_FromWeapon(wpn) & WEPSET_SUPERWEAPONS)
        {
index a6961aec87196383bb63f383e850fc873c7f92fb..951128f2d7dc1aed836d45c1706dd859fa5adfaf 100644 (file)
@@ -459,8 +459,9 @@ void w_ready(Weapon thiswep, bool fire1, bool fire2)
 .float prevwarntime;
 float weapon_prepareattack_checkammo(float secondary)
 {SELFPARAM();
 .float prevwarntime;
 float weapon_prepareattack_checkammo(float secondary)
 {SELFPARAM();
+       Weapon w = get_weaponinfo(self.weapon);
        if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
        if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
-       if (!_WEP_ACTION(self.weapon, WR_CHECKAMMO1 + secondary))
+       if (!w.(secondary ? wr_checkammo2 : wr_checkammo1)(w))
        {
                // always keep the Mine Layer if we placed mines, so that we can detonate them
                entity mine;
        {
                // always keep the Mine Layer if we placed mines, so that we can detonate them
                entity mine;
@@ -478,7 +479,7 @@ float weapon_prepareattack_checkammo(float secondary)
                        self.prevdryfire = time;
                }
 
                        self.prevdryfire = time;
                }
 
-               if(_WEP_ACTION(self.weapon, WR_CHECKAMMO2 - secondary)) // check if the other firing mode has enough ammo
+               if(w.(secondary ? wr_checkammo1 : wr_checkammo2)(w)) // check if the other firing mode has enough ammo
                {
                        if(time - self.prevwarntime > 1)
                        {
                {
                        if(time - self.prevwarntime > 1)
                        {
@@ -703,7 +704,8 @@ void W_WeaponFrame()
                        self.weaponname = newwep.mdl;
                        self.bulletcounter = 0;
                        self.ammo_field = newwep.ammo_field;
                        self.weaponname = newwep.mdl;
                        self.bulletcounter = 0;
                        self.ammo_field = newwep.ammo_field;
-                       _WEP_ACTION(self.switchweapon, WR_SETUP);
+                       Weapon w = get_weaponinfo(self.switchweapon);
+                       w.wr_setup(w);
                        self.weaponentity.state = WS_RAISE;
 
                        // set our clip load to the load of the weapon we switched to, if it's reloadable
                        self.weaponentity.state = WS_RAISE;
 
                        // set our clip load to the load of the weapon we switched to, if it's reloadable
@@ -778,7 +780,8 @@ void W_WeaponFrame()
                        entity e = get_weaponinfo(self.weapon);
                        if (e.wr_think) e.wr_think(e, self.BUTTON_ATCK, self.BUTTON_ATCK2);
                } else {
                        entity e = get_weaponinfo(self.weapon);
                        if (e.wr_think) e.wr_think(e, self.BUTTON_ATCK, self.BUTTON_ATCK2);
                } else {
-                       _WEP_ACTION(self.weapon, WR_GONETHINK);
+                       Weapon w = get_weaponinfo(self.weapon);
+                       w.wr_gonethink(w);
                }
 
                if (time + self.weapon_frametime * 0.5 >= self.weapon_nextthink)
                }
 
                if (time + self.weapon_frametime * 0.5 >= self.weapon_nextthink)
@@ -942,7 +945,8 @@ void W_Reload(float sent_ammo_min, string sent_sound)
                        self.reload_complain = time + 1;
                }
                // switch away if the amount of ammo is not enough to keep using this weapon
                        self.reload_complain = time + 1;
                }
                // switch away if the amount of ammo is not enough to keep using this weapon
-               if (!(_WEP_ACTION(self.weapon, WR_CHECKAMMO1) + _WEP_ACTION(self.weapon, WR_CHECKAMMO2)))
+               Weapon w = get_weaponinfo(self.weapon);
+               if (!(w.wr_checkammo1(w) + w.wr_checkammo2(w)))
                {
                        self.clip_load = -1; // reload later
                        W_SwitchToOtherWeapon(self);
                {
                        self.clip_load = -1; // reload later
                        W_SwitchToOtherWeapon(self);
@@ -977,10 +981,11 @@ void W_Reload(float sent_ammo_min, string sent_sound)
        self.clip_load = self.(weapon_load[self.weapon]) = -1;
 }
 
        self.clip_load = self.(weapon_load[self.weapon]) = -1;
 }
 
-void W_DropEvent(float event, entity player, float weapon_type, entity weapon_item)
+void W_DropEvent(.bool(Weapon) event, entity player, float weapon_type, entity weapon_item)
 {SELFPARAM();
        setself(player);
        weapon_dropevent_item = weapon_item;
 {SELFPARAM();
        setself(player);
        weapon_dropevent_item = weapon_item;
-       _WEP_ACTION(weapon_type, event);
+       Weapon w = get_weaponinfo(weapon_type);
+       w.event(w);
        setself(this);
 }
        setself(this);
 }
index 6bb2d656e3f4aa54d854b692c875b669a9d92ec7..196cac85700f5aae3ff4e3e7badb97992e1fd0c6 100644 (file)
@@ -24,7 +24,7 @@ void W_AttachToShotorg(entity flash, vector offset);
 
 void W_DecreaseAmmo(Weapon wep, float ammo_use);
 
 
 void W_DecreaseAmmo(Weapon wep, float ammo_use);
 
-void W_DropEvent(float event, entity player, float weapon_type, entity weapon_item);
+void W_DropEvent(.bool(Weapon) event, entity player, float weapon_type, entity weapon_item);
 
 void W_Reload(float sent_ammo_min, string sent_sound);
 
 
 void W_Reload(float sent_ammo_min, string sent_sound);