Monsters: make mage more player friendly
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 29 Sep 2015 10:56:13 +0000 (20:56 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 29 Sep 2015 10:56:13 +0000 (20:56 +1000)
32 files changed:
qcsrc/common/monsters/monster.qh
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/monster/zombie.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/turrets/turret/plasma_dual.qc
qcsrc/common/vehicles/vehicle/racer.qc
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/mutators/gamemode_nexball.qc

index f21019d..0fd2476 100644 (file)
@@ -13,7 +13,7 @@ const int MON_FLAG_CRUSH = 2048; // monster can be stomped in special modes
 const int MON_FLAG_RIDE = 4096; // monster can be ridden in special modes
 
 // entity properties of monsterinfo:
-.bool(int) monster_attackfunc;
+.bool(int, entity targ) monster_attackfunc;
 
 // animations
 .vector anim_blockend;
index 0030a4f..4de03d7 100644 (file)
@@ -39,19 +39,39 @@ REGISTER_WEAPON(MAGE_SPIKE, NEW(MageSpike));
 #ifdef SVQC
 
 void M_Mage_Attack_Spike(vector dir);
-METHOD(MageSpike, wr_think, bool(entity thiswep, bool fire1, bool fire2)) {
-       SELFPARAM();
-       if (fire1)
-       if (weapon_prepareattack(0, WEP_CVAR_PRI(electro, refire))) {
-               if (!self.target_range) self.target_range = autocvar_g_monsters_target_range;
-               self.enemy = Monster_FindTarget(self);
-               W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
-               M_Mage_Attack_Spike(w_shotdir);
-               weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
-       }
-       return true;
+void M_Mage_Attack_Push();
+METHOD(MageSpike, wr_think, bool(MageSpike thiswep, bool fire1, bool fire2)) {
+    SELFPARAM();
+    if (fire1)
+    if (!IS_PLAYER(self) || weapon_prepareattack(false, 0.2)) {
+        if (!self.target_range) self.target_range = autocvar_g_monsters_target_range;
+        self.enemy = Monster_FindTarget(self);
+        W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+       if (!IS_PLAYER(self)) w_shotdir = normalize((self.enemy.origin + '0 0 10') - self.origin);
+        M_Mage_Attack_Spike(w_shotdir);
+        weapon_thinkf(WFRAME_FIRE1, 0, w_ready);
+    }
+    if (fire2)
+    if (!IS_PLAYER(self) || weapon_prepareattack(true, 0.5)) {
+        M_Mage_Attack_Push();
+        weapon_thinkf(WFRAME_FIRE2, 0, w_ready);
+    }
+    return true;
 }
 
+void M_Mage_Attack_Teleport();
+
+CLASS(OffhandMageTeleport, OffhandWeapon)
+    .bool OffhandMageTeleport_key_pressed;
+    METHOD(OffhandMageTeleport, offhand_think, void(OffhandMageTeleport this, entity player, bool key_pressed))
+    {
+        if (key_pressed && !player.OffhandMageTeleport_key_pressed)
+            WITH(entity, self, player, M_Mage_Attack_Teleport());
+        player.OffhandMageTeleport_key_pressed = key_pressed;
+    }
+ENDCLASS(OffhandMageTeleport)
+OffhandMageTeleport OFFHAND_MAGE_TELEPORT; STATIC_INIT(OFFHAND_MAGE_TELEPORT) { OFFHAND_MAGE_TELEPORT = NEW(OffhandMageTeleport); }
+
 float autocvar_g_monster_mage_health;
 float autocvar_g_monster_mage_damageforcescale = 0.5;
 float autocvar_g_monster_mage_attack_spike_damage;
@@ -199,13 +219,6 @@ void M_Mage_Attack_Spike_Think()
        UpdateCSQCProjectile(self);
 }
 
-void M_Mage_Attack_Spike(vector dir);
-void M_Mage_Attack_Spike_Aim()
-{
-       SELFPARAM();
-       return M_Mage_Attack_Spike(normalize((self.enemy.origin + '0 0 10') - self.origin));
-}
-
 void M_Mage_Attack_Spike(vector dir)
 {
        SELFPARAM();
@@ -300,17 +313,25 @@ void M_Mage_Attack_Push()
 
 void M_Mage_Attack_Teleport()
 {SELFPARAM();
-       if(vlen(self.enemy.origin - self.origin) >= 500)
-               return;
+       entity targ = self.enemy;
+       if (!targ) return;
+       if (vlen(targ.origin - self.origin) > 1500) return;
 
-       makevectors(self.enemy.angles);
-       tracebox(self.enemy.origin + ((v_forward * -1) * 200), self.mins, self.maxs, self.origin, MOVE_NOMONSTERS, self);
+       makevectors(targ.angles);
+       tracebox(targ.origin + ((v_forward * -1) * 200), self.mins, self.maxs, self.origin, MOVE_NOMONSTERS, self);
 
        if(trace_fraction < 1)
                return;
 
        Send_Effect(EFFECT_SPAWN_NEUTRAL, self.origin, '0 0 0', 1);
-       setorigin(self, self.enemy.origin + ((v_forward * -1) * 200));
+       setorigin(self, targ.origin + ((v_forward * -1) * 200));
+
+       vector a = vectoangles(targ.origin - self.origin);
+       a.x = -a.x;
+       self.angles_x = a.x;
+       self.angles_y = a.y;
+       self.fixangle = true;
+       self.velocity *= 0.5;
 
        self.attack_finished_single = time + 0.2;
 }
@@ -332,7 +353,7 @@ void M_Mage_Defend_Shield()
        self.anim_finished = time + 1;
 }
 
-float M_Mage_Attack(float attack_type)
+float M_Mage_Attack(float attack_type, entity targ)
 {SELFPARAM();
        switch(attack_type)
        {
@@ -340,7 +361,8 @@ float M_Mage_Attack(float attack_type)
                {
                        if(random() <= 0.7)
                        {
-                               M_Mage_Attack_Push();
+                               Weapon wep = WEP_MAGE_SPIKE;
+                               wep.wr_think(wep, false, true);
                                return true;
                        }
 
@@ -352,7 +374,8 @@ float M_Mage_Attack(float attack_type)
                        {
                                if(random() <= 0.4)
                                {
-                                       M_Mage_Attack_Teleport();
+                                       OffhandWeapon off = OFFHAND_MAGE_TELEPORT;
+                                       off.offhand_think(off, self, true);
                                        return true;
                                }
                                else
@@ -360,7 +383,8 @@ float M_Mage_Attack(float attack_type)
                                        setanim(self, self.anim_shoot, true, true, true);
                                        self.attack_finished_single = time + (autocvar_g_monster_mage_attack_spike_delay);
                                        self.anim_finished = time + 1;
-                                       Monster_Delay(1, 0, 0.2, M_Mage_Attack_Spike_Aim);
+                                       Weapon wep = WEP_MAGE_SPIKE;
+                                       wep.wr_think(wep, true, false);
                                        return true;
                                }
                        }
index c287bda..2c6c74b 100644 (file)
@@ -179,7 +179,7 @@ void M_Shambler_Attack_Lightning()
        CSQCProjectile(gren, true, PROJECTILE_SHAMBLER_LIGHTNING, true);
 }
 
-float M_Shambler_Attack(float attack_type)
+float M_Shambler_Attack(float attack_type, entity targ)
 {SELFPARAM();
        switch(attack_type)
        {
index fa35cce..5de8fcc 100644 (file)
@@ -108,7 +108,7 @@ void M_Spider_Attack_Web()
        CSQCProjectile(proj, true, PROJECTILE_ELECTRO, true);
 }
 
-bool M_Spider_Attack(int attack_type)
+bool M_Spider_Attack(int attack_type, entity targ)
 {SELFPARAM();
        switch(attack_type)
        {
index 19f8a53..dcf1afa 100644 (file)
@@ -93,7 +93,7 @@ void M_Wyvern_Attack_Fireball()
        CSQCProjectile(missile, true, PROJECTILE_FIREMINE, true);
 }
 
-float M_Wyvern_Attack(float attack_type)
+float M_Wyvern_Attack(float attack_type, entity targ)
 {SELFPARAM();
        switch(attack_type)
        {
index cca02dd..0e06e4a 100644 (file)
@@ -118,7 +118,7 @@ float M_Zombie_Defend_Block()
        return true;
 }
 
-float M_Zombie_Attack(float attack_type)
+float M_Zombie_Attack(float attack_type, entity targ)
 {SELFPARAM();
        switch(attack_type)
        {
index 9b06f50..e3e1de4 100644 (file)
@@ -434,7 +434,7 @@ void Monster_Attack_Check(entity e, entity targ)
 
        if(targ_vlen <= e.attack_range)
        {
-               float attack_success = e.monster_attackfunc(MONSTER_ATTACK_MELEE);
+               float attack_success = e.monster_attackfunc(MONSTER_ATTACK_MELEE, targ);
                if(attack_success == 1)
                        Monster_Sound(monstersound_melee, 0, false, CH_VOICE);
                else if(attack_success > 0)
@@ -443,7 +443,7 @@ void Monster_Attack_Check(entity e, entity targ)
 
        if(targ_vlen > e.attack_range)
        {
-               float attack_success = e.monster_attackfunc(MONSTER_ATTACK_RANGED);
+               float attack_success = e.monster_attackfunc(MONSTER_ATTACK_RANGED, targ);
                if(attack_success == 1)
                        Monster_Sound(monstersound_melee, 0, false, CH_VOICE);
                else if(attack_success > 0)
index 3041410..49f0b24 100644 (file)
@@ -33,7 +33,7 @@ REGISTER_WEAPON(PLASMA_DUAL, NEW(PlasmaDualAttack));
 METHOD(PlasmaDualAttack, wr_think, bool(entity thiswep, bool fire1, bool fire2)) {
        SELFPARAM();
        if (fire1)
-       if (weapon_prepareattack(0, WEP_CVAR_PRI(electro, refire))) {
+       if (weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
                W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
                self.tur_shotdir_updated = w_shotdir;
                self.tur_shotorg = w_shotorg;
index c797e75..f158d92 100644 (file)
@@ -40,7 +40,7 @@ void racer_fire_cannon(string tagname);
 METHOD(RacerAttack, wr_think, bool(entity thiswep, bool fire1, bool fire2)) {
        SELFPARAM();
        if (fire1)
-       if (weapon_prepareattack(0, 0)) {
+       if (weapon_prepareattack(false, 0)) {
                W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("lasergun_fire"), CH_WEAPON_B, 0);
                racer_fire_cannon("tag_fire1");
                weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), w_ready);
index df5e88f..a5e2f68 100644 (file)
@@ -678,9 +678,9 @@ void Arc_Smoke()
 
                                if((!self.arc_beam) || wasfreed(self.arc_beam))
                                {
-                                       if(weapon_prepareattack(!!fire2, 0))
+                                       if(weapon_prepareattack(fire2, 0))
                                        {
-                                               W_Arc_Beam(!!fire2);
+                                               W_Arc_Beam(fire2);
 
                                                if(!self.arc_BUTTON_ATCK_prev)
                                                {
@@ -703,7 +703,7 @@ void Arc_Smoke()
 
                        #if 0
                        if(fire2)
-                       if(weapon_prepareattack(1, autocvar_g_balance_arc_secondary_refire))
+                       if(weapon_prepareattack(true, autocvar_g_balance_arc_secondary_refire))
                        {
                                W_Arc_Attack2();
                                self.arc_count = autocvar_g_balance_arc_secondary_count;
index 706c07a..df54c6b 100644 (file)
@@ -166,7 +166,7 @@ void W_Blaster_Attack(
                {
                        if(fire1)
                        {
-                               if(weapon_prepareattack(0, WEP_CVAR_PRI(blaster, refire)))
+                               if(weapon_prepareattack(false, WEP_CVAR_PRI(blaster, refire)))
                                {
                                        W_Blaster_Attack(
                                                WEP_BLASTER.m_id,
@@ -196,7 +196,7 @@ void W_Blaster_Attack(
 
                                        case 1: // normal projectile secondary
                                        {
-                                               if(weapon_prepareattack(1, WEP_CVAR_SEC(blaster, refire)))
+                                               if(weapon_prepareattack(true, WEP_CVAR_SEC(blaster, refire)))
                                                {
                                                        W_Blaster_Attack(
                                                                WEP_BLASTER.m_id | HITTYPE_SECONDARY,
index b4955ef..5018f08 100644 (file)
@@ -585,7 +585,7 @@ void W_Crylink_Attack2(Weapon thiswep)
                        if(fire1)
                        {
                                if(self.crylink_waitrelease != 1)
-                               if(weapon_prepareattack(0, WEP_CVAR_PRI(crylink, refire)))
+                               if(weapon_prepareattack(false, WEP_CVAR_PRI(crylink, refire)))
                                {
                                        W_Crylink_Attack(thiswep);
                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
@@ -595,7 +595,7 @@ void W_Crylink_Attack2(Weapon thiswep)
                        if(fire2 && autocvar_g_balance_crylink_secondary)
                        {
                                if(self.crylink_waitrelease != 2)
-                               if(weapon_prepareattack(1, WEP_CVAR_SEC(crylink, refire)))
+                               if(weapon_prepareattack(true, WEP_CVAR_SEC(crylink, refire)))
                                {
                                        W_Crylink_Attack2(thiswep);
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
index cfa94a2..162eac9 100644 (file)
@@ -531,7 +531,7 @@ void W_Devastator_Attack(Weapon thiswep)
                                if(fire1)
                                {
                                        if(self.rl_release || WEP_CVAR(devastator, guidestop))
-                                       if(weapon_prepareattack(0, WEP_CVAR(devastator, refire)))
+                                       if(weapon_prepareattack(false, WEP_CVAR(devastator, refire)))
                                        {
                                                W_Devastator_Attack(thiswep);
                                                weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
index 420305d..8221c22 100644 (file)
@@ -410,7 +410,7 @@ void W_Electro_CheckAttack(Weapon thiswep, bool fire1, bool fire2)
 {SELFPARAM();
        if(self.electro_count > 1)
        if(self.BUTTON_ATCK2)
-       if(weapon_prepareattack(1, -1))
+       if(weapon_prepareattack(true, -1))
        {
                W_Electro_Attack_Orb(WEP_ELECTRO);
                self.electro_count -= 1;
@@ -474,7 +474,7 @@ void W_Electro_CheckAttack(Weapon thiswep, bool fire1, bool fire2)
 
                        if(fire1)
                        {
-                               if(weapon_prepareattack(0, WEP_CVAR_PRI(electro, refire)))
+                               if(weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire)))
                                {
                                                W_Electro_Attack_Bolt(thiswep);
                                                weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
@@ -483,7 +483,7 @@ void W_Electro_CheckAttack(Weapon thiswep, bool fire1, bool fire2)
                        else if(fire2)
                        {
                                if(time >= self.electro_secondarytime)
-                               if(weapon_prepareattack(1, WEP_CVAR_SEC(electro, refire)))
+                               if(weapon_prepareattack(true, WEP_CVAR_SEC(electro, refire)))
                                {
                                        W_Electro_Attack_Orb(thiswep);
                                        self.electro_count = WEP_CVAR_SEC(electro, count);
index df1c3c6..6eb4a97 100644 (file)
@@ -378,7 +378,7 @@ void W_Fireball_Attack2(void)
                        if(fire1)
                        {
                                if(time >= self.fireball_primarytime)
-                               if(weapon_prepareattack(0, WEP_CVAR_PRI(fireball, refire)))
+                               if(weapon_prepareattack(false, WEP_CVAR_PRI(fireball, refire)))
                                {
                                        W_Fireball_Attack1_Frame0(thiswep, fire1, fire2);
                                        self.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor();
@@ -386,7 +386,7 @@ void W_Fireball_Attack2(void)
                        }
                        else if(fire2)
                        {
-                               if(weapon_prepareattack(1, WEP_CVAR_SEC(fireball, refire)))
+                               if(weapon_prepareattack(true, WEP_CVAR_SEC(fireball, refire)))
                                {
                                        W_Fireball_Attack2();
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready);
index 54e2496..ee3f948 100644 (file)
@@ -223,7 +223,7 @@ void W_Hagar_Attack2_Load_Release(void)
        if(!self.hagar_load)
                return;
 
-       weapon_prepareattack_do(1, WEP_CVAR_SEC(hagar, refire));
+       weapon_prepareattack_do(true, WEP_CVAR_SEC(hagar, refire));
 
        W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
        Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
@@ -419,7 +419,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep)
                                _WEP_ACTION(self.weapon, WR_RELOAD);
                        else if(fire1 && !self.hagar_load && !self.hagar_loadblock) // not while secondary is loaded or awaiting reset
                        {
-                               if(weapon_prepareattack(0, WEP_CVAR_PRI(hagar, refire)))
+                               if(weapon_prepareattack(false, WEP_CVAR_PRI(hagar, refire)))
                                {
                                        W_Hagar_Attack(thiswep);
                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
@@ -427,7 +427,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep)
                        }
                        else if(fire2 && !loadable_secondary && WEP_CVAR(hagar, secondary))
                        {
-                               if(weapon_prepareattack(1, WEP_CVAR_SEC(hagar, refire)))
+                               if(weapon_prepareattack(true, WEP_CVAR_SEC(hagar, refire)))
                                {
                                        W_Hagar_Attack2(thiswep);
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
index b8cf348..cb69636 100644 (file)
@@ -217,7 +217,7 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
                                _WEP_ACTION(self.weapon, WR_RELOAD);
                        else if(fire1)
                        {
-                               if(weapon_prepareattack(0, WEP_CVAR_PRI(hlac, refire)))
+                               if(weapon_prepareattack(false, WEP_CVAR_PRI(hlac, refire)))
                                {
                                        self.misc_bulletcounter = 0;
                                        W_HLAC_Attack(thiswep);
@@ -227,7 +227,7 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
 
                        else if(fire2 && WEP_CVAR(hlac, secondary))
                        {
-                               if(weapon_prepareattack(1, WEP_CVAR_SEC(hlac, refire)))
+                               if(weapon_prepareattack(true, WEP_CVAR_SEC(hlac, refire)))
                                {
                                        W_HLAC_Attack2_Frame(thiswep);
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
index 5e48c28..881f513 100644 (file)
@@ -104,7 +104,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, bool fire1, bool fire2)
                        else
                        {
                                if (fire1)
-                               if (weapon_prepareattack(0, 0))
+                               if (weapon_prepareattack(false, 0))
                                {
                                        self.misc_bulletcounter = 0;
                                        W_HeavyMachineGun_Attack_Auto(thiswep, fire1, fire2);
index 6890791..fc52287 100644 (file)
@@ -189,7 +189,7 @@ void W_Hook_Attack2(Weapon thiswep)
                                if(!(self.hook_state & HOOK_WAITING_FOR_RELEASE))
                                if(!(self.hook_state & HOOK_FIRING))
                                if(time > self.hook_refire)
-                               if(weapon_prepareattack(0, -1))
+                               if(weapon_prepareattack(false, -1))
                                {
                                        W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(hook, ammo));
                                        self.hook_state |= HOOK_FIRING;
@@ -199,7 +199,7 @@ void W_Hook_Attack2(Weapon thiswep)
 
                        if(fire2)
                        {
-                               if(weapon_prepareattack(1, WEP_CVAR_SEC(hook, refire)))
+                               if(weapon_prepareattack(true, WEP_CVAR_SEC(hook, refire)))
                                {
                                        W_Hook_Attack2(thiswep);
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
index 7eb09b2..afef944 100644 (file)
@@ -255,14 +255,14 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, bool fire1, bool fire2)
                        if(WEP_CVAR(machinegun, mode) == 1)
                        {
                                if(fire1)
-                               if(weapon_prepareattack(0, 0))
+                               if(weapon_prepareattack(false, 0))
                                {
                                        self.misc_bulletcounter = 0;
                                        W_MachineGun_Attack_Auto(thiswep, fire1, fire2);
                                }
 
                                if(fire2)
-                               if(weapon_prepareattack(1, 0))
+                               if(weapon_prepareattack(true, 0))
                                {
                                        if(!_WEP_ACTION(self.weapon, WR_CHECKAMMO2))
                                        if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
@@ -282,7 +282,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, bool fire1, bool fire2)
                        {
 
                                if(fire1)
-                               if(weapon_prepareattack(0, 0))
+                               if(weapon_prepareattack(false, 0))
                                {
                                        self.misc_bulletcounter = 1;
                                        W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id); // sets attack_finished
@@ -290,7 +290,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, bool fire1, bool fire2)
                                }
 
                                if(fire2 && WEP_CVAR(machinegun, first))
-                               if(weapon_prepareattack(1, 0))
+                               if(weapon_prepareattack(true, 0))
                                {
                                        self.misc_bulletcounter = 1;
                                        W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY); // sets attack_finished
index fb2cdc8..3d29f96 100644 (file)
@@ -509,7 +509,7 @@ float W_MineLayer_PlacedMines(float detonate)
                        }
                        else if(fire1)
                        {
-                               if(weapon_prepareattack(0, WEP_CVAR(minelayer, refire)))
+                               if(weapon_prepareattack(false, WEP_CVAR(minelayer, refire)))
                                {
                                        W_MineLayer_Attack(thiswep);
                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
index 893b0ae..2c92ae2 100644 (file)
@@ -342,7 +342,7 @@ void W_Mortar_Attack2(Weapon thiswep)
                                _WEP_ACTION(self.weapon, WR_RELOAD);
                        else if(fire1)
                        {
-                               if(weapon_prepareattack(0, WEP_CVAR_PRI(mortar, refire)))
+                               if(weapon_prepareattack(false, WEP_CVAR_PRI(mortar, refire)))
                                {
                                        W_Mortar_Attack(thiswep);
                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready);
@@ -365,7 +365,7 @@ void W_Mortar_Attack2(Weapon thiswep)
                                        if(nadefound)
                                                sound(self, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
                                }
-                               else if(weapon_prepareattack(1, WEP_CVAR_SEC(mortar, refire)))
+                               else if(weapon_prepareattack(true, WEP_CVAR_SEC(mortar, refire)))
                                {
                                        W_Mortar_Attack2(thiswep);
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready);
index 97a0203..26edade 100644 (file)
@@ -309,7 +309,7 @@ void W_Porto_Attack(float type)
                                if(fire1)
                                if(!self.porto_current)
                                if(!self.porto_forbidden)
-                               if(weapon_prepareattack(0, WEP_CVAR_PRI(porto, refire)))
+                               if(weapon_prepareattack(false, WEP_CVAR_PRI(porto, refire)))
                                {
                                        W_Porto_Attack(0);
                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
@@ -318,7 +318,7 @@ void W_Porto_Attack(float type)
                                if(fire2)
                                if(!self.porto_current)
                                if(!self.porto_forbidden)
-                               if(weapon_prepareattack(1, WEP_CVAR_SEC(porto, refire)))
+                               if(weapon_prepareattack(true, WEP_CVAR_SEC(porto, refire)))
                                {
                                        W_Porto_Attack(1);
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(porto, animtime), w_ready);
@@ -351,7 +351,7 @@ void W_Porto_Attack(float type)
                                if(fire1)
                                if(!self.porto_current)
                                if(!self.porto_forbidden)
-                               if(weapon_prepareattack(0, WEP_CVAR_PRI(porto, refire)))
+                               if(weapon_prepareattack(false, WEP_CVAR_PRI(porto, refire)))
                                {
                                        W_Porto_Attack(-1);
                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
index dc11b01..4cf8265 100644 (file)
@@ -170,10 +170,10 @@ void W_Rifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animt
                        {
                                self.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), self.rifle_accumulator, time);
                                if(fire1)
-                               if(weapon_prepareattack_check(0, WEP_CVAR_PRI(rifle, refire)))
+                               if(weapon_prepareattack_check(false, WEP_CVAR_PRI(rifle, refire)))
                                if(time >= self.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
                                {
-                                       weapon_prepareattack_do(0, WEP_CVAR_PRI(rifle, refire));
+                                       weapon_prepareattack_do(false, WEP_CVAR_PRI(rifle, refire));
                                        W_Rifle_BulletHail(WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
                                        self.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
                                }
@@ -185,10 +185,10 @@ void W_Rifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animt
                                                        _WEP_ACTION(self.weapon, WR_RELOAD);
                                                else
                                                {
-                                                       if(weapon_prepareattack_check(1, WEP_CVAR_SEC(rifle, refire)))
+                                                       if(weapon_prepareattack_check(true, WEP_CVAR_SEC(rifle, refire)))
                                                        if(time >= self.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
                                                        {
-                                                               weapon_prepareattack_do(1, WEP_CVAR_SEC(rifle, refire));
+                                                               weapon_prepareattack_do(true, WEP_CVAR_SEC(rifle, refire));
                                                                W_Rifle_BulletHail(WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
                                                                self.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
                                                        }
index d8e3535..bc86bda 100644 (file)
@@ -162,7 +162,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
                        {
                                if (fire1)
                                {
-                                       if(weapon_prepareattack(0, WEP_CVAR(rpc, refire)))
+                                       if(weapon_prepareattack(false, WEP_CVAR(rpc, refire)))
                                        {
                                                W_RocketPropelledChainsaw_Attack(thiswep);
                                                weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(rpc, animtime), w_ready);
index 811231c..36c7d57 100644 (file)
@@ -618,7 +618,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
                        {
                                if(WEP_CVAR(seeker, type) == 1)
                                {
-                                       if(weapon_prepareattack(0, WEP_CVAR(seeker, missile_refire)))
+                                       if(weapon_prepareattack(false, WEP_CVAR(seeker, missile_refire)))
                                        {
                                                W_Seeker_Attack();
                                                weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(seeker, missile_animtime), w_ready);
@@ -626,7 +626,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
                                }
                                else
                                {
-                                       if(weapon_prepareattack(0, WEP_CVAR(seeker, tag_refire)))
+                                       if(weapon_prepareattack(false, WEP_CVAR(seeker, tag_refire)))
                                        {
                                                W_Seeker_Fire_Tag(thiswep);
                                                weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
@@ -638,7 +638,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
                        {
                                if(WEP_CVAR(seeker, type) == 1)
                                {
-                                       if(weapon_prepareattack(0, WEP_CVAR(seeker, tag_refire)))
+                                       if(weapon_prepareattack(false, WEP_CVAR(seeker, tag_refire)))
                                        {
                                                W_Seeker_Fire_Tag(thiswep);
                                                weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
@@ -646,7 +646,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
                                }
                                else
                                {
-                                       if(weapon_prepareattack(0, WEP_CVAR(seeker, flac_refire)))
+                                       if(weapon_prepareattack(false, WEP_CVAR(seeker, flac_refire)))
                                        {
                                                W_Seeker_Fire_Flac(thiswep);
                                                weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready);
index 7926241..bbe579b 100644 (file)
@@ -683,7 +683,7 @@ void W_Shockwave_Attack(void)
                        {
                                if(time >= self.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
                                {
-                                       if(weapon_prepareattack(0, WEP_CVAR(shockwave, blast_animtime)))
+                                       if(weapon_prepareattack(false, WEP_CVAR(shockwave, blast_animtime)))
                                        {
                                                W_Shockwave_Attack();
                                                self.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
@@ -695,7 +695,7 @@ void W_Shockwave_Attack(void)
                        {
                                //if(self.clip_load >= 0) // we are not currently reloading
                                if(!self.crouch) // no crouchmelee please
-                               if(weapon_prepareattack(1, WEP_CVAR(shockwave, melee_refire)))
+                               if(weapon_prepareattack(true, WEP_CVAR(shockwave, melee_refire)))
                                {
                                        // attempt forcing playback of the anim by switching to another anim (that we never play) here...
                                        weapon_thinkf(WFRAME_FIRE1, 0, W_Shockwave_Melee);
index 42c12fd..e577aa1 100644 (file)
@@ -248,7 +248,7 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, bool fire1, bool fire2)
                                {
                                        if(time >= self.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
                                        {
-                                               if(weapon_prepareattack(0, WEP_CVAR_PRI(shotgun, animtime)))
+                                               if(weapon_prepareattack(false, WEP_CVAR_PRI(shotgun, animtime)))
                                                {
                                                        W_Shotgun_Attack(thiswep, true);
                                                        self.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
@@ -260,7 +260,7 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, bool fire1, bool fire2)
                                {
                                        if(time >= self.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
                                        {
-                                               if(weapon_prepareattack(0, WEP_CVAR_SEC(shotgun, alt_animtime)))
+                                               if(weapon_prepareattack(false, WEP_CVAR_SEC(shotgun, alt_animtime)))
                                                {
                                                        W_Shotgun_Attack(thiswep, false);
                                                        self.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
@@ -273,7 +273,7 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, bool fire1, bool fire2)
                        if(!self.crouch) // no crouchmelee please
                        if(WEP_CVAR(shotgun, secondary) == 1)
                        if((fire1 && self.WEP_AMMO(SHOTGUN) <= 0 && !(self.items & IT_UNLIMITED_WEAPON_AMMO)) || fire2)
-                       if(weapon_prepareattack(1, WEP_CVAR_SEC(shotgun, refire)))
+                       if(weapon_prepareattack(true, WEP_CVAR_SEC(shotgun, refire)))
                        {
                                // attempt forcing playback of the anim by switching to another anim (that we never play) here...
                                weapon_thinkf(WFRAME_FIRE1, 0, W_Shotgun_Attack2);
index bf2372c..21fa7a6 100644 (file)
@@ -384,14 +384,14 @@ void W_Tuba_NoteOn(float hittype)
                METHOD(Tuba, wr_think, bool(entity thiswep, bool fire1, bool fire2))
                {
                        if(fire1)
-                       if(weapon_prepareattack(0, WEP_CVAR(tuba, refire)))
+                       if(weapon_prepareattack(false, WEP_CVAR(tuba, refire)))
                        {
                                W_Tuba_NoteOn(0);
                                //weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_tuba_animtime, w_ready);
                                weapon_thinkf(WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
                        }
                        if(fire2)
-                       if(weapon_prepareattack(1, WEP_CVAR(tuba, refire)))
+                       if(weapon_prepareattack(true, WEP_CVAR(tuba, refire)))
                        {
                                W_Tuba_NoteOn(HITTYPE_SECONDARY);
                                //weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_tuba_animtime, w_ready);
index 957e721..11c26bb 100644 (file)
@@ -256,7 +256,7 @@ void W_RocketMinsta_Attack3 (void)
                                _WEP_ACTION(self.weapon, WR_RELOAD);
                        if(fire1 && (self.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(self))
                        {
-                               if(weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
+                               if(weapon_prepareattack(false, WEP_CVAR_PRI(vaporizer, refire)))
                                {
                                        W_Vaporizer_Attack(thiswep);
                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
index 2d09c17..2c0d871 100644 (file)
@@ -163,7 +163,7 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                        {
                                if(fire1)
                                {
-                                       if(weapon_prepareattack(0, WEP_CVAR_PRI(vortex, refire)))
+                                       if(weapon_prepareattack(false, WEP_CVAR_PRI(vortex, refire)))
                                        {
                                                W_Vortex_Attack(thiswep, 0);
                                                weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
@@ -235,7 +235,7 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                                        }
                                        else if(WEP_CVAR(vortex, secondary))
                                        {
-                                               if(weapon_prepareattack(0, WEP_CVAR_SEC(vortex, refire)))
+                                               if(weapon_prepareattack(false, WEP_CVAR_SEC(vortex, refire)))
                                                {
                                                        W_Vortex_Attack(thiswep, 1);
                                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
index bdcb9ee..b50ba97 100644 (file)
@@ -844,7 +844,7 @@ float ball_customize()
        METHOD(BallStealer, wr_think, bool(BallStealer thiswep, bool fire1, bool fire2))
        {
                if(fire1)
-                       if(weapon_prepareattack(0, autocvar_g_balance_nexball_primary_refire))
+                       if(weapon_prepareattack(false, autocvar_g_balance_nexball_primary_refire))
                                if(autocvar_g_nexball_basketball_meter)
                                {
                                        if(self.ballcarried && !self.metertime)
@@ -858,7 +858,7 @@ float ball_customize()
                                        weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
                                }
                if(fire2)
-                       if(weapon_prepareattack(1, autocvar_g_balance_nexball_secondary_refire))
+                       if(weapon_prepareattack(true, autocvar_g_balance_nexball_secondary_refire))
                        {
                                W_Nexball_Attack2();
                                weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);