]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Weapons: use bitflags for fire modes
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 28 Oct 2015 04:12:26 +0000 (15:12 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 28 Oct 2015 04:12:26 +0000 (15:12 +1100)
46 files changed:
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/turrets/turret.qh
qcsrc/common/turrets/turret/ewheel_weapon.qc
qcsrc/common/turrets/turret/flac_weapon.qc
qcsrc/common/turrets/turret/hellion_weapon.qc
qcsrc/common/turrets/turret/hk_weapon.qc
qcsrc/common/turrets/turret/machinegun_weapon.qc
qcsrc/common/turrets/turret/mlrs_weapon.qc
qcsrc/common/turrets/turret/phaser_weapon.qc
qcsrc/common/turrets/turret/plasma_weapon.qc
qcsrc/common/turrets/turret/tesla_weapon.qc
qcsrc/common/turrets/turret/walker_weapon.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/racer_weapon.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qc
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/hmg.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/rpc.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/server/defs.qh
qcsrc/server/mutators/mutator/mutator_overkill.qc
qcsrc/server/weapons/weaponsystem.qc
qcsrc/server/weapons/weaponsystem.qh

index 4349a1e5e24d9df7167d69919a4b896a4726c9d7..490951459875e501f27db9215d9303ed51e6084c 100644 (file)
@@ -854,9 +854,9 @@ float ball_customize()
        return true;
 }
 
-       METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, bool fire1, bool fire2))
+       METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, int fire))
        {
-               if(fire1)
+               if(fire & 1)
                        if(weapon_prepareattack(thiswep, actor, false, autocvar_g_balance_nexball_primary_refire))
                                if(autocvar_g_nexball_basketball_meter)
                                {
@@ -870,14 +870,14 @@ float ball_customize()
                                        W_Nexball_Attack(-1);
                                        weapon_thinkf(actor, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
                                }
-               if(fire2)
+               if(fire & 2)
                        if(weapon_prepareattack(thiswep, actor, true, autocvar_g_balance_nexball_secondary_refire))
                        {
                                W_Nexball_Attack2();
                                weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
                        }
 
-               if(!fire1 && self.metertime && self.ballcarried)
+               if(!(fire & 1) && self.metertime && self.ballcarried)
                {
                        W_Nexball_Attack(time - self.metertime);
                        // DropBall or stealing will set metertime back to 0
index 7388ee66f5bce70ddc448466967f302ce79b488c..611e3b884799ebb65175057c8bbf22e34abd0ec9 100644 (file)
@@ -41,8 +41,8 @@ REGISTER_WEAPON(MAGE_SPIKE, NEW(MageSpike));
 
 void M_Mage_Attack_Spike(vector dir);
 void M_Mage_Attack_Push();
-METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, bool fire1, bool fire2)) {
-    if (fire1)
+METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, int fire)) {
+    if (fire & 1)
     if (!IS_PLAYER(actor) || weapon_prepareattack(thiswep, actor, false, 0.2)) {
         if (!actor.target_range) actor.target_range = autocvar_g_monsters_target_range;
         actor.enemy = Monster_FindTarget(actor);
@@ -51,7 +51,7 @@ METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, bool fire1, bo
         M_Mage_Attack_Spike(w_shotdir);
         weapon_thinkf(actor, WFRAME_FIRE1, 0, w_ready);
     }
-    if (fire2)
+    if (fire & 2)
     if (!IS_PLAYER(actor) || weapon_prepareattack(thiswep, actor, true, 0.5)) {
         M_Mage_Attack_Push();
         weapon_thinkf(actor, WFRAME_FIRE2, 0, w_ready);
@@ -363,7 +363,7 @@ float M_Mage_Attack(float attack_type, entity targ)
                        if(random() <= 0.7)
                        {
                                Weapon wep = WEP_MAGE_SPIKE;
-                               wep.wr_think(wep, self, false, true);
+                               wep.wr_think(wep, self, 2);
                                return true;
                        }
 
@@ -385,7 +385,7 @@ float M_Mage_Attack(float attack_type, entity targ)
                                        self.attack_finished_single = time + (autocvar_g_monster_mage_attack_spike_delay);
                                        self.anim_finished = time + 1;
                                        Weapon wep = WEP_MAGE_SPIKE;
-                                       wep.wr_think(wep, self, true, false);
+                                       wep.wr_think(wep, self, 1);
                                        return true;
                                }
                        }
index 208ae107993480edc0c4c2d3c90d2e4d13323955..52bda4ec95e53e3dddb6c878182148fd96fd49c8 100644 (file)
@@ -50,9 +50,9 @@ float autocvar_g_monster_spider_attack_bite_delay;
 
 void M_Spider_Attack_Web();
 
-METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, bool fire1, bool fire2)) {
+METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
-    if (fire1)
+    if (fire & 1)
     if ((!isPlayer && time >= actor.spider_web_delay) || weapon_prepareattack(thiswep, actor, false, autocvar_g_monster_spider_attack_web_delay)) {
                if (!isPlayer) {
                        actor.spider_web_delay = time + 3;
@@ -67,7 +67,7 @@ METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, bool fir
         weapon_thinkf(actor, WFRAME_FIRE1, 0, w_ready);
         return;
     }
-    if (fire2)
+    if (fire & 2)
     if (!isPlayer || weapon_prepareattack(thiswep, actor, true, 0.5)) {
        if (isPlayer) {
                actor.enemy = Monster_FindTarget(actor);
@@ -160,12 +160,12 @@ bool M_Spider_Attack(int attack_type, entity targ)
                Weapon wep = WEP_SPIDER_ATTACK;
                case MONSTER_ATTACK_MELEE:
                {
-                       wep.wr_think(wep, self, false, true);
+                       wep.wr_think(wep, self, 2);
                        return true;
                }
                case MONSTER_ATTACK_RANGED:
                {
-                       wep.wr_think(wep, self, true, false);
+                       wep.wr_think(wep, self, 1);
                        return true;
                }
        }
index ac9f32205dae432e9104065d29957df55dd7debd..b3bb5bfe8eb030ed1dbf1d61333f0ad0c00614e0 100644 (file)
@@ -48,8 +48,8 @@ float autocvar_g_monster_wyvern_attack_fireball_speed;
 void M_Wyvern_Attack_Fireball_Explode();
 void M_Wyvern_Attack_Fireball_Touch();
 
-METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, bool fire1, bool fire2)) {
-    if (fire1)
+METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, int fire)) {
+    if (fire & 1)
     if (time > actor.attack_finished_single || weapon_prepareattack(thiswep, actor, false, 1.2)) {
         if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
                if (IS_MONSTER(actor)) {
@@ -128,7 +128,7 @@ float M_Wyvern_Attack(float attack_type, entity targ)
                {
                        w_shotdir = normalize((self.enemy.origin + '0 0 10') - self.origin);
                        Weapon wep = WEP_WYVERN_ATTACK;
-                       wep.wr_think(wep, self, true, false);
+                       wep.wr_think(wep, self, 1);
                        return true;
                }
        }
index 8862f47d7763ce8640192bee5048fadd9fb048d7..32f92a6750b90ccdf44097d9b47a661f1ec18009 100644 (file)
@@ -46,7 +46,7 @@ CLASS(Turret, Object)
     /** (SERVER) called when turret attacks */
     METHOD(Turret, tr_attack, void(Turret this)) {
         Weapon w = this.m_weapon;
-        w.wr_think(w, self, true, false);
+        w.wr_think(w, self, 1);
     }
     /** (ALL) */
     METHOD(Turret, tr_config, void(Turret this)) {
index 34e5a598689d7fd9e8d0e00163b48d2ffc397c22..904260300c6b651678be33e3ce1a97b3d7b3dae0 100644 (file)
@@ -16,9 +16,9 @@ REGISTER_WEAPON(EWHEEL, NEW(EWheelAttack));
 #ifdef SVQC
 
 void turret_initparams(entity);
-METHOD(EWheelAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+METHOD(EWheelAttack, wr_think, void(entity thiswep, entity actor, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
-    if (fire1)
+    if (fire & 1)
     if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
index 834f255dae95375d5cd7232f5dc43598d26be223..afba577f1f218e5bdc95caefe8214b9c5d25d3f3 100644 (file)
@@ -16,9 +16,9 @@ REGISTER_WEAPON(FLAC, NEW(FlacAttack));
 #ifdef SVQC
 
 void turret_flac_projectile_think_explode();
-METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
-    if (fire1)
+    if (fire & 1)
     if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
index 2d754e877d0396951cc5173c125bcefe269c3c96..94e6d5f411041c4cd3a5d5c2c3f922e3fb0da5a2 100644 (file)
@@ -19,9 +19,9 @@ float autocvar_g_turrets_unit_hellion_shot_speed_gain;
 float autocvar_g_turrets_unit_hellion_shot_speed_max;
 
 void turret_hellion_missile_think();
-METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
-    if (fire1)
+    if (fire & 1)
     if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
index 98bff57575a181011906ceeedfb8c31742bfc3bb..c7c781872c3296c85448930823d6b9eecb64e30d 100644 (file)
@@ -23,10 +23,10 @@ float autocvar_g_turrets_unit_hk_shot_speed_max;
 float autocvar_g_turrets_unit_hk_shot_speed_turnrate;
 
 void turret_hk_missile_think();
-METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, int fire))
 {
        bool isPlayer = IS_PLAYER(actor);
-       if (fire1)
+       if (fire & 1)
        if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) {
                if (isPlayer) {
             turret_initparams(actor);
index a20bdb22cf051cb3446bf6728a7514e17a940fd1..9dfff9e439cb8a511d3adaa0b0ceb395bb4fb016 100644 (file)
@@ -17,10 +17,10 @@ REGISTER_WEAPON(TUR_MACHINEGUN, NEW(MachineGunTurretAttack));
 
 void W_MachineGun_MuzzleFlash();
 
-METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, int fire))
 {
     bool isPlayer = IS_PLAYER(actor);
-    if (fire1)
+    if (fire & 1)
     if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR(machinegun, sustained_refire))) {
         if (isPlayer) {
             turret_initparams(actor);
index 05933591364da90799e92292d5e8471bd241e8b5..45a12543814fac5dad9ea877f192c9c8ae56cd55 100644 (file)
@@ -15,10 +15,10 @@ REGISTER_WEAPON(TUR_MLRS, NEW(MLRSTurretAttack));
 
 #ifdef SVQC
 
-METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, entity actor, int fire))
 {
     bool isPlayer = IS_PLAYER(actor);
-    if (fire1)
+    if (fire & 1)
     if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR(machinegun, sustained_refire))) {
         if (isPlayer) {
             turret_initparams(actor);
index c4529ae267b872c47da45fda096208d4331a8d21..d493486f70be556995e9e0c7ace0bcf745e1424f 100644 (file)
@@ -18,10 +18,10 @@ void beam_think();
 
 .int fireflag;
 
-METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, int fire))
 {
     bool isPlayer = IS_PLAYER(actor);
-    if (fire1)
+    if (fire & 1)
     if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
index 2141fe64f287daed129b5de618f1b6fdf5e56a66..3a032f2a7b5938363bfc2a38eca9bf72a395f502 100644 (file)
@@ -15,9 +15,9 @@ REGISTER_WEAPON(PLASMA, NEW(PlasmaAttack));
 
 #ifdef SVQC
 
-METHOD(PlasmaAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+METHOD(PlasmaAttack, wr_think, void(entity thiswep, entity actor, int fire)) {
        bool isPlayer = IS_PLAYER(actor);
-       if (fire1)
+       if (fire & 1)
        if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) {
                if (isPlayer) {
             turret_initparams(actor);
index 4391472f739b06e7c97c6b3e7f9cb781e2cfa96a..de3a6d3a87477be8ad3f3524da1cb3eb86b94e2c 100644 (file)
@@ -16,9 +16,9 @@ REGISTER_WEAPON(TESLA, NEW(TeslaCoilTurretAttack));
 #ifdef SVQC
 
 entity toast(entity from, float range, float damage);
-METHOD(TeslaCoilTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+METHOD(TeslaCoilTurretAttack, wr_think, void(entity thiswep, entity actor, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
-    if (fire1)
+    if (fire & 1)
     if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
index 4da45df7fd203ecf894c5b8d990cb086b36a1ae9..b4c8a5d9f905d43ef58072a8009b95617328e13c 100644 (file)
@@ -15,9 +15,9 @@ REGISTER_WEAPON(WALKER, NEW(WalkerTurretAttack));
 
 #ifdef SVQC
 
-METHOD(WalkerTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+METHOD(WalkerTurretAttack, wr_think, void(entity thiswep, entity actor, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
-    if (fire1)
+    if (fire & 1)
     if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
index 8c45b4aa9dc5802c500d8cad3fab15428b79d9f0..1c3d33129882d21ce08f9a05fe4c321b83962804 100644 (file)
@@ -321,7 +321,7 @@ float racer_frame()
                // Fix z-aim (for chase mode)
                crosshair_trace(player);
                w_shotdir.z = normalize(trace_endpos - org).z * 0.5;
-               wep1.wr_think(wep1, self, true, false);
+               wep1.wr_think(wep1, self, 1);
        }
 
        if(autocvar_g_vehicle_racer_rocket_locktarget)
index 6a2339f1e3a4878bee67a59657113595064faae7..d58705b59984755bd036f7cba9829a5f62865cee 100644 (file)
@@ -42,12 +42,12 @@ float autocvar_g_vehicle_racer_rocket_climbspeed;
 float autocvar_g_vehicle_racer_rocket_locked_maxangle;
 
 void racer_fire_rocket(vector org, vector dir, entity trg);
-METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, int fire))
 {
     bool isPlayer = IS_PLAYER(actor);
     entity player = isPlayer ? actor : actor.owner;
     entity veh = player.vehicle;
-    if (fire1)
+    if (fire & 1)
     if (weapon_prepareattack(thiswep, player, false, autocvar_g_vehicle_racer_cannon_refire)) {
         if (veh) {
             veh.vehicle_energy -= autocvar_g_vehicle_racer_cannon_cost;
@@ -63,7 +63,7 @@ METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, bool fire1, boo
         bolt.velocity = normalize(dir) * autocvar_g_vehicle_racer_cannon_speed;
         weapon_thinkf(player, WFRAME_FIRE1, 0, w_ready);
     }
-    if (fire2)
+    if (fire & 2)
     if (!isPlayer || weapon_prepareattack(thiswep, actor, false, 0.2)) {
         if (isPlayer) W_SetupShot_Dir(actor, v_forward, false, 0, SND(Null), CH_WEAPON_B, 0);
         racer_fire_rocket(w_shotorg, w_shotdir, NULL);
index 58a189a85074bf53fb6cce14fe5b0868271eaa6d..422dd8a6413ecf1469b1cb03b246898fe43966ab 100644 (file)
@@ -392,7 +392,7 @@ float raptor_frame()
        if(player.BUTTON_ATCK)
        if (wep1.wr_checkammo1(wep1))
        {
-               wep1.wr_think(wep1, self, true, false);
+               wep1.wr_think(wep1, self, 1);
        }
 
        if(self.vehicle_flags  & VHF_SHIELDREGEN)
@@ -411,7 +411,7 @@ float raptor_frame()
                if(time > raptor.lip + autocvar_g_vehicle_raptor_bombs_refire)
                if(player.BUTTON_ATCK2)
                {
-                       wep2a.wr_think(wep2a, self, false, true);
+                       wep2a.wr_think(wep2a, self, 2);
                        raptor.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
                        raptor.lip   = time;
                }
@@ -422,7 +422,7 @@ float raptor_frame()
                if(time > raptor.lip + autocvar_g_vehicle_raptor_flare_refire)
                if(player.BUTTON_ATCK2)
                {
-                       wep2b.wr_think(wep2b, self, false, true);
+                       wep2b.wr_think(wep2b, self, 2);
                        raptor.delay = time + autocvar_g_vehicle_raptor_flare_refire;
                        raptor.lip   = time;
                }
index 69d981beb3e35c0229ebfcfafe54c4043061bef0..32752c9ce8d7fb6004127b3f429f72a8ef5ebe55 100644 (file)
@@ -51,13 +51,13 @@ float autocvar_g_vehicle_raptor_bomblet_radius;
 float autocvar_g_vehicle_raptor_bomblet_force;
 float autocvar_g_vehicle_raptor_bomblet_explode_delay;
 
-METHOD(RaptorCannon, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+METHOD(RaptorCannon, wr_think, void(entity thiswep, entity actor, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
     entity player = isPlayer ? actor : actor.owner;
     entity veh = player.vehicle;
     // 1 [wait] 1 [wait] 2 [wait] 2 [wait] [wait]
     float t = autocvar_g_vehicle_raptor_cannon_refire * (1 + veh.misc_bulletcounter == 4);
-    if (fire1)
+    if (fire & 1)
     if (weapon_prepareattack(thiswep, player, false, t)) {
         if (isPlayer) W_SetupShot_Dir(player, v_forward, false, 0, SND(Null), CH_WEAPON_B, 0);
         vector org = w_shotorg;
@@ -88,11 +88,11 @@ METHOD(RaptorCannon, wr_checkammo1, bool(RacerAttack thiswep)) {
 float autocvar_g_vehicle_raptor_bombs_refire;
 
 void raptor_bombdrop();
-METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
     entity player = isPlayer ? actor : actor.owner;
     entity veh = player.vehicle;
-    if (fire2)
+    if (fire & 2)
     if (!isPlayer || weapon_prepareattack(thiswep, player, true, autocvar_g_vehicle_raptor_bombs_refire)) {
         if (veh) setself(veh);
         raptor_bombdrop();
@@ -109,11 +109,11 @@ void raptor_flare_think();
 void raptor_flare_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
 void raptor_flare_touch();
 
-METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
+METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
     entity player = isPlayer ? actor : actor.owner;
     entity veh = player.vehicle;
-    if (fire2)
+    if (fire & 2)
     if (!isPlayer || weapon_prepareattack(thiswep, player, true, autocvar_g_vehicle_raptor_flare_refire)) {
         for(int i = 0; i < 3; ++i) {
             entity _flare = spawn();
index a4eb7b71d02ba8f4b139b6c5e23f8edd2f14ffc1..61629595da3c0f4f4f8addae3c6702d5670cf750 100644 (file)
@@ -47,7 +47,7 @@ CLASS(Weapon, Object)
     /** (SERVER) setup weapon data */
     METHOD(Weapon, wr_setup, void(Weapon this)) {}
     /** (SERVER) logic to run every frame */
-    METHOD(Weapon, wr_think, void(Weapon this, entity actor, bool fire1, bool fire2)) {}
+    METHOD(Weapon, wr_think, void(Weapon this, entity actor, int fire)) {}
     /** (SERVER) checks ammo for weapon primary */
     METHOD(Weapon, wr_checkammo1, bool(Weapon this)) {return false;}
     /** (SERVER) checks ammo for weapon second */
index b05132cb1648bfb76efdf2f94a7fdbd1ad0d6bf3..08be8f7d218bb8947807266ffd815c624d63f127 100644 (file)
@@ -656,13 +656,13 @@ void Arc_Smoke()
                                );
                        }
                }
-               METHOD(Arc, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Arc, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        Arc_Player_SetHeat(actor);
                        Arc_Smoke();
 
                        if (time >= actor.arc_overheat)
-                       if (fire1 || fire2 || actor.arc_beam.beam_bursting)
+                       if ((fire & 1) || (fire & 2) || actor.arc_beam.beam_bursting)
                        {
 
                                if(actor.arc_BUTTON_ATCK_prev)
@@ -677,9 +677,9 @@ void Arc_Smoke()
 
                                if((!actor.arc_beam) || wasfreed(actor.arc_beam))
                                {
-                                       if(weapon_prepareattack(thiswep, actor, fire2, 0))
+                                       if(weapon_prepareattack(thiswep, actor, boolean(fire & 2), 0))
                                        {
-                                               W_Arc_Beam(fire2);
+                                               W_Arc_Beam(boolean(fire & 2));
 
                                                if(!actor.arc_BUTTON_ATCK_prev)
                                                {
@@ -701,7 +701,7 @@ void Arc_Smoke()
                        actor.arc_BUTTON_ATCK_prev = false;
 
                        #if 0
-                       if(fire2)
+                       if(fire & 2)
                        if(weapon_prepareattack(thiswep, actor, true, autocvar_g_balance_arc_secondary_refire))
                        {
                                W_Arc_Attack2();
index d7792fac4aef157ea91a93f6a8b72a54c0facb8b..69b97bf6643aeea9f5b195771d4a0bb763dd0a81 100644 (file)
@@ -161,9 +161,9 @@ void W_Blaster_Attack(
                                { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
                }
 
-               METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, int fire))
                {
-                       if(fire1)
+                       if(fire & 1)
                        {
                                if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(blaster, refire)))
                                {
@@ -183,7 +183,7 @@ void W_Blaster_Attack(
                                        weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
                                }
                        }
-                       else if(fire2)
+                       else if(fire & 2)
                        {
                                switch(WEP_CVAR(blaster, secondary))
                                {
index 75d8146de4eb67b1d4fcf18b3241dc7632eaea41..8875dac4e6e5005610993e6111f612cae8392958 100644 (file)
@@ -574,14 +574,14 @@ void W_Crylink_Attack2(Weapon thiswep)
                        else
                                self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
                }
-               METHOD(Crylink, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Crylink, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(autocvar_g_balance_crylink_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload
                                Weapon w = get_weaponinfo(actor.weapon);
                                w.wr_reload(w);
                        }
 
-                       if(fire1)
+                       if(fire & 1)
                        {
                                if(actor.crylink_waitrelease != 1)
                                if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(crylink, refire)))
@@ -591,7 +591,7 @@ void W_Crylink_Attack2(Weapon thiswep)
                                }
                        }
 
-                       if(fire2 && autocvar_g_balance_crylink_secondary)
+                       if((fire & 2) && autocvar_g_balance_crylink_secondary)
                        {
                                if(actor.crylink_waitrelease != 2)
                                if(weapon_prepareattack(thiswep, actor, true, WEP_CVAR_SEC(crylink, refire)))
@@ -601,7 +601,7 @@ void W_Crylink_Attack2(Weapon thiswep)
                                }
                        }
 
-                       if((actor.crylink_waitrelease == 1 && !fire1) || (actor.crylink_waitrelease == 2 && !fire2))
+                       if((actor.crylink_waitrelease == 1 && !(fire & 1)) || (actor.crylink_waitrelease == 2 && !(fire & 2)))
                        {
                                if(!actor.crylink_lastgroup || time > actor.crylink_lastgroup.teleport_time)
                                {
index b9cc0358bbd28c83601549e37f3af0456e73a9c6..fc6b8af19ec45912c74708eccd76df73d1a28aef 100644 (file)
@@ -520,13 +520,13 @@ void W_Devastator_Attack(Weapon thiswep)
                        }
                }
                #endif
-               METHOD(Devastator, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Devastator, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(WEP_CVAR(devastator, reload_ammo) && actor.clip_load < WEP_CVAR(devastator, ammo)) { // forced reload
                                Weapon w = get_weaponinfo(actor.weapon);
                                w.wr_reload(w);
                        } else {
-                               if(fire1)
+                               if(fire & 1)
                                {
                                        if(actor.rl_release || WEP_CVAR(devastator, guidestop))
                                        if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR(devastator, refire)))
@@ -539,7 +539,7 @@ void W_Devastator_Attack(Weapon thiswep)
                                else
                                        actor.rl_release = 1;
 
-                               if(fire2)
+                               if(fire & 2)
                                if(actor.switchweapon == WEP_DEVASTATOR.m_id)
                                {
                                        entity rock;
index 7321d38f2aed1fcd60b90b1552783013e8e59a27..a85f43ea351e1b25adc1aec7409307470377b463 100644 (file)
@@ -406,7 +406,7 @@ void W_Electro_Attack_Orb(Weapon thiswep)
        MUTATOR_CALLHOOK(EditProjectile, self, proj);
 }
 
-void W_Electro_CheckAttack(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_Electro_CheckAttack(Weapon thiswep, entity actor, int fire)
 {SELFPARAM();
        if(self.electro_count > 1)
        if(self.BUTTON_ATCK2)
@@ -418,7 +418,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, bool fire1, bool fire2)
                return;
        }
        // WEAPONTODO: when the player releases the button, cut down the length of refire2?
-       w_ready(thiswep, actor, fire1, fire2);
+       w_ready(thiswep, actor, fire);
 }
 
 .float bot_secondary_electromooth;
@@ -451,7 +451,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, bool fire1, bool fire2)
                                }
                        }
                }
-               METHOD(Electro, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Electro, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO
                        {
@@ -469,7 +469,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, bool fire1, bool fire2)
                                }
                        }
 
-                       if(fire1)
+                       if(fire & 1)
                        {
                                if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire)))
                                {
@@ -477,7 +477,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, bool fire1, bool fire2)
                                                weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
                                }
                        }
-                       else if(fire2)
+                       else if(fire & 2)
                        {
                                if(time >= actor.electro_secondarytime)
                                if(weapon_prepareattack(thiswep, actor, true, WEP_CVAR_SEC(electro, refire)))
index b0761b2c2ad1006623ab473ca9b7cbe912476c99..f56d06857f2b1795991beb156afb2d122dc69fcd 100644 (file)
@@ -226,31 +226,31 @@ void W_Fireball_AttackEffect(float i, vector f_diff)
        Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 }
 
-void W_Fireball_Attack1_Frame4(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_Fireball_Attack1_Frame4(Weapon thiswep, entity actor, int fire)
 {
        W_Fireball_Attack1();
        weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), w_ready);
 }
 
-void W_Fireball_Attack1_Frame3(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_Fireball_Attack1_Frame3(Weapon thiswep, entity actor, int fire)
 {
        W_Fireball_AttackEffect(0, '+1.25 +3.75 0');
        weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame4);
 }
 
-void W_Fireball_Attack1_Frame2(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_Fireball_Attack1_Frame2(Weapon thiswep, entity actor, int fire)
 {
        W_Fireball_AttackEffect(0, '-1.25 +3.75 0');
        weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame3);
 }
 
-void W_Fireball_Attack1_Frame1(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_Fireball_Attack1_Frame1(Weapon thiswep, entity actor, int fire)
 {
        W_Fireball_AttackEffect(1, '+1.25 -3.75 0');
        weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame2);
 }
 
-void W_Fireball_Attack1_Frame0(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_Fireball_Attack1_Frame0(Weapon thiswep, entity actor, int fire)
 {SELFPARAM();
        W_Fireball_AttackEffect(0, '-1.25 -3.75 0');
        sound(self, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM);
@@ -371,18 +371,18 @@ void W_Fireball_Attack2(void)
                                }
                        }
                }
-               METHOD(Fireball, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Fireball, wr_think, void(entity thiswep, entity actor, int fire))
                {
-                       if(fire1)
+                       if(fire & 1)
                        {
                                if(time >= actor.fireball_primarytime)
                                if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(fireball, refire)))
                                {
-                                       W_Fireball_Attack1_Frame0(thiswep, actor, fire1, fire2);
+                                       W_Fireball_Attack1_Frame0(thiswep, actor, fire);
                                        actor.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor();
                                }
                        }
-                       else if(fire2)
+                       else if(fire & 2)
                        {
                                if(weapon_prepareattack(thiswep, actor, true, WEP_CVAR_SEC(fireball, refire)))
                                {
index 37f6875b5595118009cace956d568318439194b8..c88c91e7c9a922ea4d8a80cdec0a5298bf588886 100644 (file)
@@ -407,7 +407,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep)
                        else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
                                self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
                }
-               METHOD(Hagar, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Hagar, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        float loadable_secondary;
                        loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
@@ -417,7 +417,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep)
                        if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
                                Weapon w = get_weaponinfo(actor.weapon);
                                w.wr_reload(w);
-                       } else if(fire1 && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
+                       } else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
                        {
                                if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(hagar, refire)))
                                {
@@ -425,7 +425,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep)
                                        weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
                                }
                        }
-                       else if(fire2 && !loadable_secondary && WEP_CVAR(hagar, secondary))
+                       else if((fire & 2) && !loadable_secondary && WEP_CVAR(hagar, secondary))
                        {
                                if(weapon_prepareattack(thiswep, actor, true, WEP_CVAR_SEC(hagar, refire)))
                                {
index 616939d1e80abd1a83c259d626f91d699ff931ed..d738c81d314b12a06262cc9291eed869c0906269 100644 (file)
@@ -161,11 +161,11 @@ void W_HLAC_Attack2(void)
 }
 
 // weapon frames
-void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, int fire)
 {
        if(actor.weapon != actor.switchweapon) // abort immediately if switching
        {
-               w_ready(thiswep, actor, fire1, fire2);
+               w_ready(thiswep, actor, fire);
                return;
        }
 
@@ -176,7 +176,7 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, bool fire1, bool fire2)
                if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-                       w_ready(thiswep, actor, fire1, fire2);
+                       w_ready(thiswep, actor, fire);
                        return;
                }
 
@@ -211,12 +211,12 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
                {
                        self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
                }
-               METHOD(HLAC, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(HLAC, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(autocvar_g_balance_hlac_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload
                                Weapon w = get_weaponinfo(actor.weapon);
                                w.wr_reload(w);
-                       } else if(fire1)
+                       } else if(fire & 1)
                        {
                                if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(hlac, refire)))
                                {
@@ -226,7 +226,7 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
                                }
                        }
 
-                       else if(fire2 && WEP_CVAR(hlac, secondary))
+                       else if((fire & 2) && WEP_CVAR(hlac, secondary))
                        {
                                if(weapon_prepareattack(thiswep, actor, true, WEP_CVAR_SEC(hlac, refire)))
                                {
index 6707a7c32e960cc0eac5c9a01c68eb8bc42f0dd7..fc9811713fcaaf5e3347792a02e271b41a719c28 100644 (file)
@@ -45,11 +45,11 @@ HMG_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 
 spawnfunc(weapon_hmg) { weapon_defaultspawnfunc(WEP_HMG.m_id); }
 
-void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, int fire)
 {
        if (!actor.BUTTON_ATCK)
        {
-               w_ready(thiswep, actor, fire1, fire2);
+               w_ready(thiswep, actor, fire);
                return;
        }
 
@@ -58,7 +58,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, bool fire1, boo
        if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-               w_ready(thiswep, actor, fire1, fire2);
+               w_ready(thiswep, actor, fire);
                return;
        }
 
@@ -96,18 +96,18 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, bool fire1, boo
                        else
                                self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
                }
-               METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(WEP_CVAR(hmg, reload_ammo) && actor.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
                                Weapon w = get_weaponinfo(actor.weapon);
                                w.wr_reload(w);
                        } else
                        {
-                               if (fire1)
+                               if (fire & 1)
                                if (weapon_prepareattack(thiswep, actor, false, 0))
                                {
                                        actor.misc_bulletcounter = 0;
-                                       W_HeavyMachineGun_Attack_Auto(thiswep, actor, fire1, fire2);
+                                       W_HeavyMachineGun_Attack_Auto(thiswep, actor, fire);
                                }
                        }
                }
index c158d1c3289be58c1881360c35fa8512717dbde8..56c2800798109d9bd7fdecfd67aeb628c27ae70d 100644 (file)
@@ -22,7 +22,7 @@ CLASS(OffhandHook, OffhandWeapon)
     METHOD(OffhandHook, offhand_think, void(OffhandHook this, entity actor, bool key_pressed))
     {
        Weapon wep = WEP_HOOK;
-       wep.wr_think(wep, actor, key_pressed, false);
+       wep.wr_think(wep, actor, key_pressed ? 1 : 0);
     }
 ENDCLASS(OffhandHook)
 OffhandHook OFFHAND_HOOK; STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(OffhandHook); }
@@ -174,9 +174,9 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
        MUTATOR_CALLHOOK(EditProjectile, actor, gren);
 }
 
-               METHOD(Hook, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Hook, wr_think, void(entity thiswep, entity actor, int fire))
                {
-                       if (fire1) {
+                       if (fire & 1) {
                                if(!actor.hook)
                                if(!(actor.hook_state & HOOK_WAITING_FOR_RELEASE))
                                if(time > actor.hook_refire)
@@ -192,7 +192,7 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
                                actor.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
                        }
 
-                       if(fire2)
+                       if(fire & 2)
                        {
                                if(weapon_prepareattack(thiswep, actor, true, WEP_CVAR_SEC(hook, refire)))
                                {
index 90a4471f17bbf6110bca905b19da7b0883821c20..8241d1ecafc6227469f756fe4614a38079d76a52 100644 (file)
@@ -137,11 +137,11 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype)
 }
 
 // weapon frames
-void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, int fire)
 {
        if(actor.weapon != actor.switchweapon) // abort immediately if switching
        {
-               w_ready(thiswep, actor, fire1, fire2);
+               w_ready(thiswep, actor, fire);
                return;
        }
        if(actor.BUTTON_ATCK)
@@ -151,7 +151,7 @@ void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, bool fire1, bool fi
                if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-                       w_ready(thiswep, actor, fire1, fire2);
+                       w_ready(thiswep, actor, fire);
                        return;
                }
                actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
@@ -163,13 +163,13 @@ void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, bool fire1, bool fi
 }
 
 
-void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, int fire)
 {
        float machinegun_spread;
 
-       if(!fire1)
+       if(!(fire & 1))
        {
-               w_ready(thiswep, actor, fire1, fire2);
+               w_ready(thiswep, actor, fire);
                return;
        }
 
@@ -178,7 +178,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, bool fire1, bool fir
        if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-               w_ready(thiswep, actor, fire1, fire2);
+               w_ready(thiswep, actor, fire);
                return;
        }
 
@@ -208,7 +208,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, bool fire1, bool fir
        weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Auto);
 }
 
-void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, int fire)
 {
        W_SetupShot(actor, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
        if(!autocvar_g_norecoil)
@@ -247,7 +247,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, bool fire1, bool fi
                        else
                                self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
                }
-               METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(WEP_CVAR(machinegun, reload_ammo) && actor.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(actor.weapon);
@@ -255,14 +255,14 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, bool fire1, bool fi
                        } else
                        if(WEP_CVAR(machinegun, mode) == 1)
                        {
-                               if(fire1)
+                               if(fire & 1)
                                if(weapon_prepareattack(thiswep, actor, false, 0))
                                {
                                        actor.misc_bulletcounter = 0;
-                                       W_MachineGun_Attack_Auto(thiswep, actor, fire1, fire2);
+                                       W_MachineGun_Attack_Auto(thiswep, actor, fire);
                                }
 
-                               if(fire2)
+                               if(fire & 2)
                                if(weapon_prepareattack(thiswep, actor, true, 0))
                                {
                                        Weapon w = get_weaponinfo(actor.weapon);
@@ -270,20 +270,20 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, bool fire1, bool fi
                                        if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
                                        {
                                                W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-                                               w_ready(thiswep, actor, fire1, fire2);
+                                               w_ready(thiswep, actor, fire);
                                                return;
                                        }
 
                                        W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, burst_ammo));
 
                                        actor.misc_bulletcounter = WEP_CVAR(machinegun, burst) * -1;
-                                       W_MachineGun_Attack_Burst(thiswep, actor, fire1, fire2);
+                                       W_MachineGun_Attack_Burst(thiswep, actor, fire);
                                }
                        }
                        else
                        {
 
-                               if(fire1)
+                               if(fire & 1)
                                if(weapon_prepareattack(thiswep, actor, false, 0))
                                {
                                        actor.misc_bulletcounter = 1;
@@ -291,7 +291,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, bool fire1, bool fi
                                        weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
                                }
 
-                               if(fire2 && WEP_CVAR(machinegun, first))
+                               if((fire & 2) && WEP_CVAR(machinegun, first))
                                if(weapon_prepareattack(thiswep, actor, true, 0))
                                {
                                        actor.misc_bulletcounter = 1;
index 548ede96606e08d786ca252624c4d0353e89e737..b2f9d161db8f2597b5ae5fb56ab929c13345342a 100644 (file)
@@ -499,7 +499,7 @@ float W_MineLayer_PlacedMines(float detonate)
                                if(self.BUTTON_ATCK2 == true) self.BUTTON_ATCK = false;
                        }
                }
-               METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(autocvar_g_balance_minelayer_reload_ammo && actor.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
                        {
@@ -509,7 +509,7 @@ float W_MineLayer_PlacedMines(float detonate)
                                        w.wr_reload(w);
                                }
                        }
-                       else if(fire1)
+                       else if(fire & 1)
                        {
                                if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR(minelayer, refire)))
                                {
@@ -518,7 +518,7 @@ float W_MineLayer_PlacedMines(float detonate)
                                }
                        }
 
-                       if(fire2)
+                       if(fire & 2)
                        {
                                if(W_MineLayer_PlacedMines(true))
                                        sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
index c1995745816ba1d7059743728ab81244d8f06309..d788e7b8855c58e1237e3b4f701461150ce1aede 100644 (file)
@@ -334,12 +334,12 @@ void W_Mortar_Attack2(Weapon thiswep)
                        wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime))));
                        wepinfo_ter_dps = 0;
                        */
-               METHOD(Mortar, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Mortar, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(autocvar_g_balance_mortar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) { // forced reload
                                Weapon w = get_weaponinfo(actor.weapon);
                                w.wr_reload(w);
-                       } else if(fire1)
+                       } else if(fire & 1)
                        {
                                if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(mortar, refire)))
                                {
@@ -347,7 +347,7 @@ void W_Mortar_Attack2(Weapon thiswep)
                                        weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready);
                                }
                        }
-                       else if(fire2)
+                       else if(fire & 2)
                        {
                                if(WEP_CVAR_SEC(mortar, remote_detonateprimary))
                                {
index 790ab53caff9d5fddabf450efb60d017d2bc9d43..b02edd055045f87d7dfa2b35c4ad526aba32c2f0 100644 (file)
@@ -306,11 +306,11 @@ void W_Porto_Attack(float type)
                {
                        PORTO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
                }
-               METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(WEP_CVAR(porto, secondary))
                        {
-                               if(fire1)
+                               if(fire & 1)
                                if(!actor.porto_current)
                                if(!actor.porto_forbidden)
                                if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(porto, refire)))
@@ -319,7 +319,7 @@ void W_Porto_Attack(float type)
                                        weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
                                }
 
-                               if(fire2)
+                               if(fire & 2)
                                if(!actor.porto_current)
                                if(!actor.porto_forbidden)
                                if(weapon_prepareattack(thiswep, actor, true, WEP_CVAR_SEC(porto, refire)))
@@ -332,7 +332,7 @@ void W_Porto_Attack(float type)
                        {
                                if(actor.porto_v_angle_held)
                                {
-                                       if(!fire2)
+                                       if(!(fire & 2))
                                        {
                                                actor.porto_v_angle_held = 0;
 
@@ -341,7 +341,7 @@ void W_Porto_Attack(float type)
                                }
                                else
                                {
-                                       if(fire2)
+                                       if(fire & 2)
                                        {
                                                actor.porto_v_angle = actor.v_angle;
                                                actor.porto_v_angle_held = 1;
@@ -352,7 +352,7 @@ void W_Porto_Attack(float type)
                                if(actor.porto_v_angle_held)
                                        makevectors(actor.porto_v_angle); // override the previously set angles
 
-                               if(fire1)
+                               if(fire & 1)
                                if(!actor.porto_current)
                                if(!actor.porto_forbidden)
                                if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(porto, refire)))
index 49b3931566fd829e61e31a77253d5f5a8bfa2f25..9ac992669b2d8f94184726e0c19d5a77b0ffe7f2 100644 (file)
@@ -90,7 +90,7 @@ void W_Rifle_Attack2(void)
 .float rifle_bullethail_frame;
 .float rifle_bullethail_animtime;
 .float rifle_bullethail_refire;
-void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, int fire)
 {
        float r, sw, af;
 
@@ -160,7 +160,7 @@ void W_Rifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animt
                                }
                        }
                }
-               METHOD(Rifle, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Rifle, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(autocvar_g_balance_rifle_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) { // forced reload
                                Weapon w = get_weaponinfo(actor.weapon);
@@ -168,7 +168,7 @@ void W_Rifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animt
                        } else
                        {
                                actor.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.rifle_accumulator, time);
-                               if(fire1)
+                               if(fire & 1)
                                if(weapon_prepareattack_check(thiswep, actor, false, WEP_CVAR_PRI(rifle, refire)))
                                if(time >= actor.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
                                {
@@ -176,7 +176,7 @@ void W_Rifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animt
                                        W_Rifle_BulletHail(WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
                                        actor.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
                                }
-                               if(fire2)
+                               if(fire & 2)
                                {
                                        if(WEP_CVAR(rifle, secondary))
                                        {
index 71ddaa6b58acd7f77bde45fbca2cb917c70123bf..5d9052363844305fedfddfa3d92b002c0ff338d4 100644 (file)
@@ -153,14 +153,14 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
                {
                        self.BUTTON_ATCK = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
                }
-               METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(WEP_CVAR(rpc, reload_ammo) && actor.clip_load < WEP_CVAR(rpc, ammo)) {
                                Weapon w = get_weaponinfo(actor.weapon);
                                w.wr_reload(w);
                        } else
                        {
-                               if (fire1)
+                               if (fire & 1)
                                {
                                        if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR(rpc, refire)))
                                        {
@@ -169,7 +169,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
                                        }
                                }
 
-                               if (fire2)
+                               if (fire & 2)
                                {
                                        // to-do
                                }
index 645bd9eb9b4475ec31156c64cf358614ec59cf13..78a65129f938bdbf23ed777442aedece57b4415b 100644 (file)
@@ -608,12 +608,12 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
                        else
                                self.BUTTON_ATCK = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
                }
-               METHOD(Seeker, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Seeker, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(autocvar_g_balance_seeker_reload_ammo && actor.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) { // forced reload
                                Weapon w = get_weaponinfo(actor.weapon);
                                w.wr_reload(w);
-                       } else if(fire1)
+                       } else if(fire & 1)
                        {
                                if(WEP_CVAR(seeker, type) == 1)
                                {
@@ -633,7 +633,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
                                }
                        }
 
-                       else if(fire2)
+                       else if(fire & 2)
                        {
                                if(WEP_CVAR(seeker, type) == 1)
                                {
index cc4daf0486732f99be82c67237c5eb1aba086496..47f6e36b146c312e1ab9ba5b10035765d37e5d9c 100644 (file)
@@ -229,7 +229,7 @@ void W_Shockwave_Melee_Think(void)
        }
 }
 
-void W_Shockwave_Melee(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_Shockwave_Melee(Weapon thiswep, entity actor, int fire)
 {
        sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTN_NORM);
        weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
@@ -675,9 +675,9 @@ void W_Shockwave_Attack(void)
                        else
                                { self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false); }
                }
-               METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, int fire))
                {
-                       if(fire1)
+                       if(fire & 1)
                        {
                                if(time >= actor.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
                                {
@@ -689,7 +689,7 @@ void W_Shockwave_Attack(void)
                                        }
                                }
                        }
-                       else if(fire2)
+                       else if(fire & 2)
                        {
                                //if(actor.clip_load >= 0) // we are not currently reloading
                                if(!actor.crouch) // no crouchmelee please
index a5cb397737267127c620db7a4e7269fb31a7f7d1..cd1e2ea781820e21907a15704b59263f4941b043 100644 (file)
@@ -181,7 +181,7 @@ void W_Shotgun_Melee_Think(void)
        }
 }
 
-void W_Shotgun_Attack2(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_Shotgun_Attack2(Weapon thiswep, entity actor, int fire)
 {
        sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTEN_NORM);
        weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(shotgun, animtime), w_ready);
@@ -195,14 +195,14 @@ void W_Shotgun_Attack2(Weapon thiswep, entity actor, bool fire1, bool fire2)
 }
 
 // alternate secondary weapon frames
-void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, int fire)
 {
        Weapon w = get_weaponinfo(actor.weapon);
        if (!w.wr_checkammo2(w))
        if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-               w_ready(thiswep, actor, fire1, fire2);
+               w_ready(thiswep, actor, fire);
                return;
        }
 
@@ -210,14 +210,14 @@ void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, bool fire1, bool fir
        W_Shotgun_Attack(WEP_SHOTGUN, true); // actually is secondary, but we trick the last shot into playing full reload sound
        weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready);
 }
-void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, int fire)
 {
        Weapon w = get_weaponinfo(actor.weapon);
        if (!w.wr_checkammo2(w))
        if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-               w_ready(thiswep, actor, fire1, fire2);
+               w_ready(thiswep, actor, fire);
                return;
        }
 
@@ -234,7 +234,7 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, bool fire1, bool fir
                        else
                                self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false);
                }
-               METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(WEP_CVAR(shotgun, reload_ammo) && actor.clip_load < WEP_CVAR_PRI(shotgun, ammo)) // forced reload
                        {
@@ -246,7 +246,7 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, bool fire1, bool fir
                        }
                        else
                        {
-                               if(fire1)
+                               if(fire & 1)
                                {
                                        if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
                                        {
@@ -258,7 +258,7 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, bool fire1, bool fir
                                                }
                                        }
                                }
-                               else if(fire2 && WEP_CVAR(shotgun, secondary) == 2)
+                               else if((fire & 2) && WEP_CVAR(shotgun, secondary) == 2)
                                {
                                        if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
                                        {
@@ -274,7 +274,7 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, bool fire1, bool fir
                        if(actor.clip_load >= 0) // we are not currently reloading
                        if(!actor.crouch) // no crouchmelee please
                        if(WEP_CVAR(shotgun, secondary) == 1)
-                       if((fire1 && actor.WEP_AMMO(SHOTGUN) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || fire2)
+                       if(((fire & 1) && actor.WEP_AMMO(SHOTGUN) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
                        if(weapon_prepareattack(thiswep, actor, true, WEP_CVAR_SEC(shotgun, refire)))
                        {
                                // attempt forcing playback of the anim by switching to another anim (that we never play) here...
index 66ea8f7b5165151bdb4040bb01883068dd452bf1..46c4095112046f0dedd1edd140d6214bcae8245c 100644 (file)
@@ -379,16 +379,16 @@ void W_Tuba_NoteOn(float hittype)
                                        self.BUTTON_ATCK2 = 1;
                        }
                }
-               METHOD(Tuba, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Tuba, wr_think, void(entity thiswep, entity actor, int fire))
                {
-                       if(fire1)
+                       if(fire & 1)
                        if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR(tuba, refire)))
                        {
                                W_Tuba_NoteOn(0);
                                //weapon_thinkf(actor, WFRAME_FIRE1, autocvar_g_balance_tuba_animtime, w_ready);
                                weapon_thinkf(actor, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
                        }
-                       if(fire2)
+                       if(fire & 2)
                        if(weapon_prepareattack(thiswep, actor, true, WEP_CVAR(tuba, refire)))
                        {
                                W_Tuba_NoteOn(HITTYPE_SECONDARY);
@@ -397,7 +397,7 @@ void W_Tuba_NoteOn(float hittype)
                        }
                        if(actor.tuba_note)
                        {
-                               if(!fire1 && !fire2)
+                               if(!(fire & 1) && !(fire & 2))
                                {
                                        WITH(entity, self, actor.tuba_note, W_Tuba_NoteOff());
                                }
index f7aceee20f3f531f0519610d3a1de5e511ad2b17..bbdeb69ac22c1577b2684d447cafb4adedfb73e2 100644 (file)
@@ -244,7 +244,7 @@ void W_RocketMinsta_Attack3 (void)
                        else
                                self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
                }
-               METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
                        // if the laser uses load, we also consider its ammo for reloading
@@ -255,7 +255,7 @@ void W_RocketMinsta_Attack3 (void)
                                Weapon w = get_weaponinfo(actor.weapon);
                                w.wr_reload(w);
                        }
-                       if(fire1 && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
+                       if((fire & 1) && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
                        {
                                if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(vaporizer, refire)))
                                {
@@ -263,7 +263,7 @@ void W_RocketMinsta_Attack3 (void)
                                        weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
                                }
                        }
-                       if(fire2 || (fire1 && !actor.ammo_cells && autocvar_g_rm))
+                       if((fire & 2) || ((fire & 1) && !actor.ammo_cells && autocvar_g_rm))
                        {
                                if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
                                {
index 5aca18183e9edfb949e697bf327ffaf537714dfa..f8e33f6369a7d90d75159c33af84e5f6baa09034 100644 (file)
@@ -143,7 +143,7 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                                        self.BUTTON_ATCK2 = true;
                        }
                }
-               METHOD(Vortex, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Vortex, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(WEP_CVAR(vortex, charge) && actor.vortex_charge < WEP_CVAR(vortex, charge_limit))
                                actor.vortex_charge = min(1, actor.vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME);
@@ -161,7 +161,7 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                                w.wr_reload(w);
                        } else
                        {
-                               if(fire1)
+                               if(fire & 1)
                                {
                                        if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(vortex, refire)))
                                        {
@@ -169,7 +169,7 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                                                weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
                                        }
                                }
-                               if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (actor.BUTTON_ZOOM | actor.BUTTON_ZOOMSCRIPT) : fire2)
+                               if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (actor.BUTTON_ZOOM | actor.BUTTON_ZOOMSCRIPT) : (fire & 2))
                                {
                                        if(WEP_CVAR(vortex, charge))
                                        {
@@ -196,7 +196,7 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
 
                                                        else if(WEP_CVAR_SEC(vortex, ammo))
                                                        {
-                                                               if(fire2) // only eat ammo when the button is pressed
+                                                               if(fire & 2) // only eat ammo when the button is pressed
                                                                {
                                                                        dt = min(dt, (1 - actor.vortex_charge) / WEP_CVAR(vortex, charge_rate));
                                                                        if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
index 4f790014934e7f6186e2810b43171b929623b69e..a15309274215c8993dfce707de6f6b0c7ba1542b 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "../common/weapons/all.qh"
 
-#define INDEPENDENT_ATTACK_FINISHED
+#define INDEPENDENT_ATTACK_FINISHED 1
 
 #define BUTTON_ATCK       button0
 #define BUTTON_JUMP       button2
@@ -163,11 +163,11 @@ const float MAX_DAMAGEEXTRARADIUS = 16;
 // WEAPONTODO
 .float autoswitch;
 float client_hasweapon(entity cl, float wpn, float andammo, float complain);
-void w_clear(Weapon thiswep, entity actor, bool fire1, bool fire2);
-void w_ready(Weapon thiswep, entity actor, bool fire1, bool fire2);
+void w_clear(Weapon thiswep, entity actor, int fire);
+void w_ready(Weapon thiswep, entity actor, int fire);
 // VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies)
 .float weapon_nextthink;
-.void(Weapon thiswep, entity actor, bool fire1, bool fire2) weapon_think;
+.void(Weapon thiswep, entity actor, int fire) weapon_think;
 
 
 // weapon states (self.weaponentity.state)
index ea5adbf5a6819751922a124e2162b40e822ca6ae..c86626395be136ef88dd582458ffff83d0dad7e6 100644 (file)
@@ -208,7 +208,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
                }
                Weapon wpn = get_weaponinfo(self.weapon);
                if(self.weaponentity.state != WS_CLEAR)
-                       w_ready(wpn, self, self.BUTTON_ATCK, self.BUTTON_ATCK2);
+                       w_ready(wpn, self, (self.BUTTON_ATCK ? 1 : 0) | (self.BUTTON_ATCK2 ? 2 : 0));
 
                self.weapon_blocked = true;
        }
index a52f95a714502e3288451049664882ba832914de..a29f1b5ec43039c14024c0508c0137e5d1949d4c 100644 (file)
@@ -92,14 +92,13 @@ float W_WeaponSpeedFactor()
 }
 
 
-void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, bool fire1, bool fire2) func);
+void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, int fire) func);
 
-float CL_Weaponentity_CustomizeEntityForClient()
+bool CL_Weaponentity_CustomizeEntityForClient()
 {
        SELFPARAM();
-       self.viewmodelforclient = self.owner;
-       if (IS_SPEC(other))
-               if (other.enemy == self.owner) self.viewmodelforclient = other;
+       this.viewmodelforclient = this.owner;
+       if (IS_SPEC(other) && other.enemy == this.owner) this.viewmodelforclient = other;
        return true;
 }
 
@@ -146,85 +145,83 @@ float CL_Weaponentity_CustomizeEntityForClient()
  */
 
 // writes:
-//   self.origin, self.angles
-//   self.weaponentity
-//   self.movedir, self.view_ofs
+//   this.origin, this.angles
+//   this.weaponentity
+//   this.movedir, this.view_ofs
 //   attachment stuff
 //   anim stuff
 // to free:
 //   call again with ""
 //   remove the ent
-void CL_WeaponEntity_SetModel(string name)
+void CL_WeaponEntity_SetModel(entity this, string name)
 {
-       SELFPARAM();
-       float v_shot_idx;
        if (name != "")
        {
                // if there is a child entity, hide it until we're sure we use it
-               if (self.weaponentity) self.weaponentity.model = "";
-               _setmodel(self, W_Model(strcat("v_", name, ".md3")));
-               v_shot_idx = gettagindex(self, "shot");  // used later
-               if (!v_shot_idx) v_shot_idx = gettagindex(self, "tag_shot");
+               if (this.weaponentity) this.weaponentity.model = "";
+               _setmodel(this, W_Model(strcat("v_", name, ".md3")));
+               int v_shot_idx = gettagindex(this, "shot");  // used later
+               if (!v_shot_idx) v_shot_idx = gettagindex(this, "tag_shot");
 
-               _setmodel(self, W_Model(strcat("h_", name, ".iqm")));
+               _setmodel(this, W_Model(strcat("h_", name, ".iqm")));
                // preset some defaults that work great for renamed zym files (which don't need an animinfo)
-               self.anim_fire1  = animfixfps(self, '0 1 0.01', '0 0 0');
-               self.anim_fire2  = animfixfps(self, '1 1 0.01', '0 0 0');
-               self.anim_idle   = animfixfps(self, '2 1 0.01', '0 0 0');
-               self.anim_reload = animfixfps(self, '3 1 0.01', '0 0 0');
+               this.anim_fire1  = animfixfps(this, '0 1 0.01', '0 0 0');
+               this.anim_fire2  = animfixfps(this, '1 1 0.01', '0 0 0');
+               this.anim_idle   = animfixfps(this, '2 1 0.01', '0 0 0');
+               this.anim_reload = animfixfps(this, '3 1 0.01', '0 0 0');
 
                // if we have a "weapon" tag, let's attach the v_ model to it ("invisible hand" style model)
                // if we don't, this is a "real" animated model
-               if (gettagindex(self, "weapon"))
+               if (gettagindex(this, "weapon"))
                {
-                       if (!self.weaponentity) self.weaponentity = spawn();
-                       _setmodel(self.weaponentity, W_Model(strcat("v_", name, ".md3")));
-                       setattachment(self.weaponentity, self, "weapon");
+                       if (!this.weaponentity) this.weaponentity = spawn();
+                       _setmodel(this.weaponentity, W_Model(strcat("v_", name, ".md3")));
+                       setattachment(this.weaponentity, this, "weapon");
                }
-               else if (gettagindex(self, "tag_weapon"))
+               else if (gettagindex(this, "tag_weapon"))
                {
-                       if (!self.weaponentity) self.weaponentity = spawn();
-                       _setmodel(self.weaponentity, W_Model(strcat("v_", name, ".md3")));
-                       setattachment(self.weaponentity, self, "tag_weapon");
+                       if (!this.weaponentity) this.weaponentity = spawn();
+                       _setmodel(this.weaponentity, W_Model(strcat("v_", name, ".md3")));
+                       setattachment(this.weaponentity, this, "tag_weapon");
                }
                else
                {
-                       if (self.weaponentity) remove(self.weaponentity);
-                       self.weaponentity = world;
+                       if (this.weaponentity) remove(this.weaponentity);
+                       this.weaponentity = world;
                }
 
-               setorigin(self, '0 0 0');
-               self.angles = '0 0 0';
-               self.frame = 0;
-               self.viewmodelforclient = world;
+               setorigin(this, '0 0 0');
+               this.angles = '0 0 0';
+               this.frame = 0;
+               this.viewmodelforclient = world;
 
                float idx;
 
                if (v_shot_idx)  // v_ model attached to invisible h_ model
                {
-                       self.movedir = gettaginfo(self.weaponentity, v_shot_idx);
+                       this.movedir = gettaginfo(this.weaponentity, v_shot_idx);
                }
                else
                {
-                       idx = gettagindex(self, "shot");
-                       if (!idx) idx = gettagindex(self, "tag_shot");
+                       idx = gettagindex(this, "shot");
+                       if (!idx) idx = gettagindex(this, "tag_shot");
                        if (idx)
                        {
-                               self.movedir = gettaginfo(self, idx);
+                               this.movedir = gettaginfo(this, idx);
                        }
                        else
                        {
-                               LOG_INFO("WARNING: weapon model ", self.model,
+                               LOG_INFO("WARNING: weapon model ", this.model,
                                        " does not support the 'shot' tag, will display shots TOTALLY wrong\n");
-                               self.movedir = '0 0 0';
+                               this.movedir = '0 0 0';
                        }
                }
 
-               if (self.weaponentity)  // v_ model attached to invisible h_ model
+               if (this.weaponentity)  // v_ model attached to invisible h_ model
                {
-                       idx = gettagindex(self.weaponentity, "shell");
-                       if (!idx) idx = gettagindex(self.weaponentity, "tag_shell");
-                       if (idx) self.spawnorigin = gettaginfo(self.weaponentity, idx);
+                       idx = gettagindex(this.weaponentity, "shell");
+                       if (!idx) idx = gettagindex(this.weaponentity, "tag_shell");
+                       if (idx) this.spawnorigin = gettaginfo(this.weaponentity, idx);
                }
                else
                {
@@ -232,215 +229,211 @@ void CL_WeaponEntity_SetModel(string name)
                }
                if (!idx)
                {
-                       idx = gettagindex(self, "shell");
-                       if (!idx) idx = gettagindex(self, "tag_shell");
+                       idx = gettagindex(this, "shell");
+                       if (!idx) idx = gettagindex(this, "tag_shell");
                        if (idx)
                        {
-                               self.spawnorigin = gettaginfo(self, idx);
+                               this.spawnorigin = gettaginfo(this, idx);
                        }
                        else
                        {
-                               LOG_INFO("WARNING: weapon model ", self.model,
+                               LOG_INFO("WARNING: weapon model ", this.model,
                                        " does not support the 'shell' tag, will display casings wrong\n");
-                               self.spawnorigin = self.movedir;
+                               this.spawnorigin = this.movedir;
                        }
                }
 
                if (v_shot_idx)
                {
-                       self.oldorigin = '0 0 0';  // use regular attachment
+                       this.oldorigin = '0 0 0';  // use regular attachment
                }
                else
                {
-                       if (self.weaponentity)
+                       if (this.weaponentity)
                        {
-                               idx = gettagindex(self, "weapon");
-                               if (!idx) idx = gettagindex(self, "tag_weapon");
+                               idx = gettagindex(this, "weapon");
+                               if (!idx) idx = gettagindex(this, "tag_weapon");
                        }
                        else
                        {
-                               idx = gettagindex(self, "handle");
-                               if (!idx) idx = gettagindex(self, "tag_handle");
+                               idx = gettagindex(this, "handle");
+                               if (!idx) idx = gettagindex(this, "tag_handle");
                        }
                        if (idx)
                        {
-                               self.oldorigin = self.movedir - gettaginfo(self, idx);
+                               this.oldorigin = this.movedir - gettaginfo(this, idx);
                        }
                        else
                        {
-                               LOG_INFO("WARNING: weapon model ", self.model,
+                               LOG_INFO("WARNING: weapon model ", this.model,
                                        " does not support the 'handle' tag and neither does the v_ model support the 'shot' tag, will display muzzle flashes TOTALLY wrong\n");
-                               self.oldorigin = '0 0 0';  // there is no way to recover from this
+                               this.oldorigin = '0 0 0';  // there is no way to recover from this
                        }
                }
 
-               self.viewmodelforclient = self.owner;
+               this.viewmodelforclient = this.owner;
        }
        else
        {
-               self.model = "";
-               if (self.weaponentity) remove(self.weaponentity);
-               self.weaponentity = world;
-               self.movedir = '0 0 0';
-               self.spawnorigin = '0 0 0';
-               self.oldorigin = '0 0 0';
-               self.anim_fire1  = '0 1 0.01';
-               self.anim_fire2  = '0 1 0.01';
-               self.anim_idle   = '0 1 0.01';
-               self.anim_reload = '0 1 0.01';
+               this.model = "";
+               if (this.weaponentity) remove(this.weaponentity);
+               this.weaponentity = world;
+               this.movedir = '0 0 0';
+               this.spawnorigin = '0 0 0';
+               this.oldorigin = '0 0 0';
+               this.anim_fire1  = '0 1 0.01';
+               this.anim_fire2  = '0 1 0.01';
+               this.anim_idle   = '0 1 0.01';
+               this.anim_reload = '0 1 0.01';
        }
 
-       self.view_ofs = '0 0 0';
+       this.view_ofs = '0 0 0';
 
-       if (self.movedir.x >= 0)
+       if (this.movedir.x >= 0)
        {
-               vector v0;
-               v0 = self.movedir;
-               self.movedir = shotorg_adjust(v0, false, false, self.owner.cvar_cl_gunalign);
-               self.view_ofs = shotorg_adjust(v0, false, true, self.owner.cvar_cl_gunalign) - v0;
+               vector v0 = this.movedir;
+               this.movedir = shotorg_adjust(v0, false, false, this.owner.cvar_cl_gunalign);
+               this.view_ofs = shotorg_adjust(v0, false, true, this.owner.cvar_cl_gunalign) - v0;
        }
-       self.owner.stat_shotorg = compressShotOrigin(self.movedir);
-       self.movedir = decompressShotOrigin(self.owner.stat_shotorg); // make them match perfectly
+       this.owner.stat_shotorg = compressShotOrigin(this.movedir);
+       this.movedir = decompressShotOrigin(this.owner.stat_shotorg); // make them match perfectly
 
-       self.spawnorigin += self.view_ofs;                            // offset the casings origin by the same amount
+       this.spawnorigin += this.view_ofs;                            // offset the casings origin by the same amount
 
        // check if an instant weapon switch occurred
-       setorigin(self, self.view_ofs);
+       setorigin(this, this.view_ofs);
        // reset animstate now
-       self.wframe = WFRAME_IDLE;
-       setanim(self, self.anim_idle, true, false, true);
+       this.wframe = WFRAME_IDLE;
+       setanim(this, this.anim_idle, true, false, true);
 }
 
 vector CL_Weapon_GetShotOrg(float wpn)
 {
-       SELFPARAM();
        entity wi = get_weaponinfo(wpn);
-       setself(spawn());
-       CL_WeaponEntity_SetModel(wi.mdl);
-       vector ret = self.movedir;
-       CL_WeaponEntity_SetModel("");
-       remove(self);
-       setself(this);
+       entity e = spawn();
+       CL_WeaponEntity_SetModel(e, wi.mdl);
+       vector ret = e.movedir;
+       CL_WeaponEntity_SetModel(e, "");
+       remove(e);
        return ret;
 }
 
 void CL_Weaponentity_Think()
 {
        SELFPARAM();
-       int tb;
-       self.nextthink = time;
-       if (intermission_running) self.frame = self.anim_idle.x;
-       if (self.owner.weaponentity != self)
+       this.nextthink = time;
+       if (intermission_running) this.frame = this.anim_idle.x;
+       if (this.owner.weaponentity != this)
        {
-               if (self.weaponentity) remove(self.weaponentity);
-               remove(self);
+               if (this.weaponentity) remove(this.weaponentity);
+               remove(this);
                return;
        }
-       if (self.owner.deadflag != DEAD_NO)
+       if (this.owner.deadflag != DEAD_NO)
        {
-               self.model = "";
-               if (self.weaponentity) self.weaponentity.model = "";
+               this.model = "";
+               if (this.weaponentity) this.weaponentity.model = "";
                return;
        }
-       if (self.weaponname != self.owner.weaponname || self.dmg != self.owner.modelindex
-           || self.deadflag != self.owner.deadflag)
+       if (this.weaponname != this.owner.weaponname || this.dmg != this.owner.modelindex
+           || this.deadflag != this.owner.deadflag)
        {
-               self.weaponname = self.owner.weaponname;
-               self.dmg = self.owner.modelindex;
-               self.deadflag = self.owner.deadflag;
+               this.weaponname = this.owner.weaponname;
+               this.dmg = this.owner.modelindex;
+               this.deadflag = this.owner.deadflag;
 
-               CL_WeaponEntity_SetModel(self.owner.weaponname);
+               CL_WeaponEntity_SetModel(this, this.owner.weaponname);
        }
 
-       tb = (self.effects & (EF_TELEPORT_BIT | EF_RESTARTANIM_BIT));
-       self.effects = self.owner.effects & EFMASK_CHEAP;
-       self.effects &= ~EF_LOWPRECISION;
-       self.effects &= ~EF_FULLBRIGHT;  // can mask team color, so get rid of it
-       self.effects &= ~EF_TELEPORT_BIT;
-       self.effects &= ~EF_RESTARTANIM_BIT;
-       self.effects |= tb;
-
-       if (self.owner.alpha == default_player_alpha) self.alpha = default_weapon_alpha;
-       else if (self.owner.alpha != 0) self.alpha = self.owner.alpha;
-       else self.alpha = 1;
-
-       self.glowmod = self.owner.weaponentity_glowmod;
-       self.colormap = self.owner.colormap;
-       if (self.weaponentity)
+       int tb = (this.effects & (EF_TELEPORT_BIT | EF_RESTARTANIM_BIT));
+       this.effects = this.owner.effects & EFMASK_CHEAP;
+       this.effects &= ~EF_LOWPRECISION;
+       this.effects &= ~EF_FULLBRIGHT;  // can mask team color, so get rid of it
+       this.effects &= ~EF_TELEPORT_BIT;
+       this.effects &= ~EF_RESTARTANIM_BIT;
+       this.effects |= tb;
+
+       if (this.owner.alpha == default_player_alpha) this.alpha = default_weapon_alpha;
+       else if (this.owner.alpha != 0) this.alpha = this.owner.alpha;
+       else this.alpha = 1;
+
+       this.glowmod = this.owner.weaponentity_glowmod;
+       this.colormap = this.owner.colormap;
+       if (this.weaponentity)
        {
-               self.weaponentity.effects = self.effects;
-               self.weaponentity.alpha = self.alpha;
-               self.weaponentity.colormap = self.colormap;
-               self.weaponentity.glowmod = self.glowmod;
+               this.weaponentity.effects = this.effects;
+               this.weaponentity.alpha = this.alpha;
+               this.weaponentity.colormap = this.colormap;
+               this.weaponentity.glowmod = this.glowmod;
        }
 
-       self.angles = '0 0 0';
+       this.angles = '0 0 0';
 
-       float f = (self.owner.weapon_nextthink - time);
-       if (self.state == WS_RAISE && !intermission_running)
+       float f = (this.owner.weapon_nextthink - time);
+       if (this.state == WS_RAISE && !intermission_running)
        {
-               entity newwep = get_weaponinfo(self.owner.switchweapon);
+               entity newwep = get_weaponinfo(this.owner.switchweapon);
                f = f * g_weaponratefactor / max(f, newwep.switchdelay_raise);
-               self.angles_x = -90 * f * f;
+               this.angles_x = -90 * f * f;
        }
-       else if (self.state == WS_DROP && !intermission_running)
+       else if (this.state == WS_DROP && !intermission_running)
        {
-               entity oldwep = get_weaponinfo(self.owner.weapon);
+               entity oldwep = get_weaponinfo(this.owner.weapon);
                f = 1 - f * g_weaponratefactor / max(f, oldwep.switchdelay_drop);
-               self.angles_x = -90 * f * f;
+               this.angles_x = -90 * f * f;
        }
-       else if (self.state == WS_CLEAR)
+       else if (this.state == WS_CLEAR)
        {
                f = 1;
-               self.angles_x = -90 * f * f;
+               this.angles_x = -90 * f * f;
        }
 }
 
 void CL_ExteriorWeaponentity_Think()
 {
        SELFPARAM();
-       float tag_found;
-       self.nextthink = time;
-       if (self.owner.exteriorweaponentity != self)
+       this.nextthink = time;
+       if (this.owner.exteriorweaponentity != this)
        {
-               remove(self);
+               remove(this);
                return;
        }
-       if (self.owner.deadflag != DEAD_NO)
+       if (this.owner.deadflag != DEAD_NO)
        {
-               self.model = "";
+               this.model = "";
                return;
        }
-       if (self.weaponname != self.owner.weaponname || self.dmg != self.owner.modelindex
-           || self.deadflag != self.owner.deadflag)
+       if (this.weaponname != this.owner.weaponname || this.dmg != this.owner.modelindex
+           || this.deadflag != this.owner.deadflag)
        {
-               self.weaponname = self.owner.weaponname;
-               self.dmg = self.owner.modelindex;
-               self.deadflag = self.owner.deadflag;
-               if (self.owner.weaponname != "") _setmodel(self, W_Model(strcat("v_", self.owner.weaponname, ".md3")));
-               else self.model = "";
-
-               if ((tag_found = gettagindex(self.owner, "tag_weapon")))
+               this.weaponname = this.owner.weaponname;
+               this.dmg = this.owner.modelindex;
+               this.deadflag = this.owner.deadflag;
+               if (this.owner.weaponname != "") _setmodel(this, W_Model(strcat("v_", this.owner.weaponname, ".md3")));
+               else this.model = "";
+
+               int tag_found;
+               if ((tag_found = gettagindex(this.owner, "tag_weapon")))
                {
-                       self.tag_index = tag_found;
-                       self.tag_entity = self.owner;
+                       this.tag_index = tag_found;
+                       this.tag_entity = this.owner;
                }
                else
                {
-                       setattachment(self, self.owner, "bip01 r hand");
+                       setattachment(this, this.owner, "bip01 r hand");
                }
        }
-       self.effects = self.owner.effects;
-       self.effects |= EF_LOWPRECISION;
-       self.effects = self.effects & EFMASK_CHEAP;  // eat performance
-       if (self.owner.alpha == default_player_alpha) self.alpha = default_weapon_alpha;
-       else if (self.owner.alpha != 0) self.alpha = self.owner.alpha;
-       else self.alpha = 1;
+       this.effects = this.owner.effects;
+       this.effects |= EF_LOWPRECISION;
+       this.effects = this.effects & EFMASK_CHEAP;  // eat performance
+       if (this.owner.alpha == default_player_alpha) this.alpha = default_weapon_alpha;
+       else if (this.owner.alpha != 0) this.alpha = this.owner.alpha;
+       else this.alpha = 1;
 
-       self.glowmod = self.owner.weaponentity_glowmod;
-       self.colormap = self.owner.colormap;
+       this.glowmod = this.owner.weaponentity_glowmod;
+       this.colormap = this.owner.colormap;
 
-       CSQCMODEL_AUTOUPDATE(self);
+       CSQCMODEL_AUTOUPDATE(this);
 }
 
 // spawning weaponentity for client
@@ -473,7 +466,7 @@ void CL_SpawnWeaponentity(entity e)
 }
 
 // Weapon subs
-void w_clear(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void w_clear(Weapon thiswep, entity actor, int fire)
 {
        if (actor.weapon != -1)
        {
@@ -487,7 +480,7 @@ void w_clear(Weapon thiswep, entity actor, bool fire1, bool fire2)
        }
 }
 
-void w_ready(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void w_ready(Weapon thiswep, entity actor, int fire)
 {
        if (actor.weaponentity) actor.weaponentity.state = WS_READY;
        weapon_thinkf(actor, WFRAME_IDLE, 1000000, w_ready);
@@ -495,7 +488,7 @@ void w_ready(Weapon thiswep, entity actor, bool fire1, bool fire2)
 
 .float prevdryfire;
 .float prevwarntime;
-bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, float secondary)
+bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, bool secondary)
 {
        if ((actor.items & IT_UNLIMITED_WEAPON_AMMO)) return true;
        bool ammo = false;
@@ -503,16 +496,14 @@ bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, float secondar
        else WITH(entity, self, actor, ammo = thiswep.wr_checkammo1(thiswep));
        if (ammo) return true;
        // always keep the Mine Layer if we placed mines, so that we can detonate them
-       entity mine;
-       if (actor.weapon == WEP_MINE_LAYER.m_id)
-               for (mine = world; (mine = find(mine, classname, "mine")); )
+       if (thiswep == WEP_MINE_LAYER)
+               for (entity mine; (mine = find(mine, classname, "mine")); )
                        if (mine.owner == actor) return false;
 
-       if (actor.weapon == WEP_SHOTGUN.m_id)
-               if (!secondary && WEP_CVAR(shotgun, secondary) == 1) return false;
-       // no clicking, just allow
+       if (thiswep == WEP_SHOTGUN)
+               if (!secondary && WEP_CVAR(shotgun, secondary) == 1) return false;             // no clicking, just allow
 
-       if (actor.weapon == actor.switchweapon && time - actor.prevdryfire > 1)  // only play once BEFORE starting to switch weapons
+       if (thiswep == get_weaponinfo(actor.switchweapon) && time - actor.prevdryfire > 1) // only play once BEFORE starting to switch weapons
        {
                sound(actor, CH_WEAPON_A, SND_DRYFIRE, VOL_BASE, ATTEN_NORM);
                actor.prevdryfire = time;
@@ -520,8 +511,8 @@ bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, float secondar
 
        // check if the other firing mode has enough ammo
        bool ammo_other = false;
-       if (secondary) WITH(entity, self, actor, ammo = thiswep.wr_checkammo1(thiswep));
-       else WITH(entity, self, actor, ammo = thiswep.wr_checkammo2(thiswep));
+       if (secondary) WITH(entity, self, actor, ammo_other = thiswep.wr_checkammo1(thiswep));
+       else WITH(entity, self, actor, ammo_other = thiswep.wr_checkammo2(thiswep));
        if (ammo_other)
        {
                if (time - actor.prevwarntime > 1)
@@ -531,7 +522,7 @@ bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, float secondar
                                actor,
                                MSG_MULTI,
                                ITEM_WEAPON_PRIMORSEC,
-                               actor.weapon,
+                               thiswep,
                                secondary,
                                (1 - secondary)
                                         );
@@ -545,6 +536,7 @@ bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, float secondar
 
        return false;
 }
+
 .float race_penalty;
 bool weapon_prepareattack_check(Weapon thiswep, entity actor, bool secondary, float attacktime)
 {
@@ -569,6 +561,7 @@ bool weapon_prepareattack_check(Weapon thiswep, entity actor, bool secondary, fl
        }
        return true;
 }
+
 void weapon_prepareattack_do(entity actor, bool secondary, float attacktime)
 {
        actor.weaponentity.state = WS_INUSE;
@@ -588,6 +581,7 @@ void weapon_prepareattack_do(entity actor, bool secondary, float attacktime)
        actor.bulletcounter += 1;
        // dprint("attack finished ", ftos(ATTACK_FINISHED(actor)), "\n");
 }
+
 bool weapon_prepareattack(Weapon thiswep, entity actor, bool secondary, float attacktime)
 {
        if (weapon_prepareattack_check(thiswep, actor, secondary, attacktime))
@@ -598,12 +592,9 @@ bool weapon_prepareattack(Weapon thiswep, entity actor, bool secondary, float at
        return false;
 }
 
-void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, bool fire1, bool fire2) func)
+void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, int fire) func)
 {
-       vector a;
-       vector of, or, ou;
-       float restartanim;
-
+       bool restartanim;
        if (fr == WFRAME_DONTCHANGE)
        {
                fr = actor.weaponentity.wframe;
@@ -618,14 +609,14 @@ void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity
                restartanim = true;
        }
 
-       of = v_forward;
-       or = v_right;
-       ou = v_up;
+       vector of = v_forward;
+       vector or = v_right;
+       vector ou = v_up;
 
        if (actor.weaponentity)
        {
                actor.weaponentity.wframe = fr;
-               a = '0 0 0';
+               vector a = '0 0 0';
                if (fr == WFRAME_IDLE) a = actor.weaponentity.anim_idle;
                else if (fr == WFRAME_FIRE1) a = actor.weaponentity.anim_fire1;
                else if (fr == WFRAME_FIRE2) a = actor.weaponentity.anim_fire2;
@@ -673,22 +664,20 @@ void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity
        }
 }
 
-float forbidWeaponUse(entity player)
+bool forbidWeaponUse(entity player)
 {
-       if (time < game_starttime && !autocvar_sv_ready_restart_after_countdown) return 1;
-       if (round_handler_IsActive() && !round_handler_IsRoundStarted()) return 1;
-       if (player.player_blocked) return 1;
-       if (player.frozen) return 1;
-       if (player.weapon_blocked) return 1;
-       return 0;
+       if (time < game_starttime && !autocvar_sv_ready_restart_after_countdown) return true;
+       if (round_handler_IsActive() && !round_handler_IsRoundStarted()) return true;
+       if (player.player_blocked) return true;
+       if (player.frozen) return true;
+       if (player.weapon_blocked) return true;
+       return false;
 }
 
 .bool hook_switchweapon;
 
 void W_WeaponFrame(entity actor)
 {
-       vector fo, ri, up;
-
        if (frametime) actor.weapon_frametime = frametime;
 
        if (!actor.weaponentity || actor.health < 1) return;  // Dead player can't use weapons and injure impulse commands
@@ -698,7 +687,7 @@ void W_WeaponFrame(entity actor)
                if (actor.weaponentity.state != WS_CLEAR)
                {
                        Weapon wpn = get_weaponinfo(actor.weapon);
-                       w_ready(wpn, actor, actor.BUTTON_ATCK, actor.BUTTON_ATCK2);
+                       w_ready(wpn, actor, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
                        return;
                }
        }
@@ -714,9 +703,9 @@ void W_WeaponFrame(entity actor)
        }
 
        makevectors(actor.v_angle);
-       fo = v_forward;  // save them in case the weapon think functions change it
-       ri = v_right;
-       up = v_up;
+       vector fo = v_forward;  // save them in case the weapon think functions change it
+       vector ri = v_right;
+       vector up = v_up;
 
        // Change weapon
        if (actor.weapon != actor.switchweapon)
@@ -761,16 +750,18 @@ void W_WeaponFrame(entity actor)
                        entity oldwep = get_weaponinfo(actor.weapon);
 
                        // set up weapon switch think in the future, and start drop anim
-#ifndef INDEPENDENT_ATTACK_FINISHED
-                               if (ATTACK_FINISHED(actor) <= time + actor.weapon_frametime * 0.5)
-                               {
-#endif
-                       sound(actor, CH_WEAPON_SINGLE, SND_WEAPON_SWITCH, VOL_BASE, ATTN_NORM);
-                       actor.weaponentity.state = WS_DROP;
-                       weapon_thinkf(actor, WFRAME_DONTCHANGE, oldwep.switchdelay_drop, w_clear);
-#ifndef INDEPENDENT_ATTACK_FINISHED
-               }
+                       if (
+#if INDEPENDENT_ATTACK_FINISHED
+                                   true
+#else
+                                   ATTACK_FINISHED(actor) <= time + actor.weapon_frametime * 0.5
 #endif
+                          )
+                       {
+                               sound(actor, CH_WEAPON_SINGLE, SND_WEAPON_SWITCH, VOL_BASE, ATTN_NORM);
+                               actor.weaponentity.state = WS_DROP;
+                               weapon_thinkf(actor, WFRAME_DONTCHANGE, oldwep.switchdelay_drop, w_clear);
+                       }
                }
        }
 
@@ -778,17 +769,15 @@ void W_WeaponFrame(entity actor)
        // if (actor.button0)
        //      print(ftos(frametime), " ", ftos(time), " >= ", ftos(ATTACK_FINISHED(actor)), " >= ", ftos(actor.weapon_nextthink), "\n");
 
-       float w;
-       w = actor.weapon;
+       int w = actor.weapon;
 
        // call the think code which may fire the weapon
        // and do so multiple times to resolve framerate dependency issues if the
        // server framerate is very low and the weapon fire rate very high
-       float c;
-       c = 0;
+       int c = 0;
        while (c < W_TICSPERFRAME)
        {
-               c = c + 1;
+               c += 1;
                if (w && !(actor.weapons & WepSet_FromWeapon(w)))
                {
                        if (actor.weapon == actor.switchweapon) W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
@@ -814,7 +803,7 @@ void W_WeaponFrame(entity actor)
                                actor.hook_switchweapon = key_pressed;
                                Weapon h = WEP_HOOK;
                                block_weapon = (actor.weapon == h.m_id && (actor.BUTTON_ATCK || key_pressed));
-                               h.wr_think(h, actor, block_weapon, false);
+                               h.wr_think(h, actor, block_weapon ? 1 : 0);
                        }
                }
 
@@ -823,7 +812,7 @@ void W_WeaponFrame(entity actor)
                        if (w)
                        {
                                Weapon e = get_weaponinfo(actor.weapon);
-                               e.wr_think(e, actor, actor.BUTTON_ATCK, actor.BUTTON_ATCK2);
+                               e.wr_think(e, actor, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
                        }
                        else
                        {
@@ -840,7 +829,7 @@ void W_WeaponFrame(entity actor)
                                v_right = ri;
                                v_up = up;
                                Weapon wpn = get_weaponinfo(actor.weapon);
-                               actor.weapon_think(wpn, actor, actor.BUTTON_ATCK, actor.BUTTON_ATCK2);
+                               actor.weapon_think(wpn, actor, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
                        }
                        else
                        {
@@ -852,7 +841,6 @@ void W_WeaponFrame(entity actor)
 
 void W_AttachToShotorg(entity actor, entity flash, vector offset)
 {
-       entity xflash;
        flash.owner = actor;
        flash.angles_z = random() * 360;
 
@@ -860,7 +848,7 @@ void W_AttachToShotorg(entity actor, entity flash, vector offset)
        else setattachment(flash, actor.weaponentity, "tag_shot");
        setorigin(flash, offset);
 
-       xflash = spawn();
+       entity xflash = spawn();
        copyentity(flash, xflash);
 
        flash.viewmodelforclient = actor;
@@ -921,7 +909,7 @@ void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use)
 .float reload_complain;
 .string reload_sound;
 
-void W_ReloadedAndReady(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_ReloadedAndReady(Weapon thiswep, entity actor, int fire)
 {
        // finish the reloading process, and do the ammo transfer
 
@@ -948,14 +936,13 @@ void W_ReloadedAndReady(Weapon thiswep, entity actor, bool fire1, bool fire2)
        // ATTACK_FINISHED(actor) -= actor.reload_time - 1;
 
        Weapon wpn = get_weaponinfo(actor.weapon);
-       w_ready(wpn, actor, actor.BUTTON_ATCK, actor.BUTTON_ATCK2);
+       w_ready(wpn, actor, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
 }
 
 void W_Reload(entity actor, float sent_ammo_min, string sent_sound)
 {
        // set global values to work with
-       entity e;
-       e = get_weaponinfo(actor.weapon);
+       entity e = get_weaponinfo(actor.weapon);
 
        if (cvar("g_overkill"))
                if (actor.ok_use_ammocharge) return;
@@ -1032,10 +1019,7 @@ void W_Reload(entity actor, float sent_ammo_min, string sent_sound)
 
 void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item)
 {
-       SELFPARAM();
-       setself(player);
-       weapon_dropevent_item = weapon_item;
        Weapon w = get_weaponinfo(weapon_type);
-       w.event(w);
-       setself(this);
+       weapon_dropevent_item = weapon_item;
+       WITH(entity, self, player, w.event(w));
 }
index 86d31119568c33f7518bfbb7cc01c176f1acc8a5..ee84a7c611471cc7019f4d5eb94c4ae385495ecd 100644 (file)
@@ -44,6 +44,6 @@ bool weapon_prepareattack_check(Weapon thiswep, entity actor, float secondary, f
 
 void weapon_prepareattack_do(entity actor, float secondary, float attacktime);
 
-void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, bool fire1, bool fire2) func);
+void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, int fire) func);
 
 #endif