]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 f21019db24c5b3bfdb58e8e3aa6d8ab996a6cb36..0fd2476948641c0e8b95b7f3ade124f4fa8e845f 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 0030a4fa81b0f0b1330bd8ee14bcbf90a4638d12..4de03d7380018b83891f269a8b947ba0484690ed 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 c287bda23cf93ca7fc9c74635f4ee2ae36b55c81..2c6c74b0e2619cb6e5fd09dfe7f2768476a3dda3 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 fa35cced689b6ef5b879d5a2a12a1dff94f007bd..5de8fccd870ab8b58d9ee5d95bf49f7db9c7458f 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 19f8a53be887f2e410e4f50a7cf58c8e49da7c70..dcf1afa7cd2987b62c2232f7f5cff30e4f9cd65e 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 cca02dd9e2e2b567b3a852b61ccedc06c5c6ec61..0e06e4ae8ee1ca6ceb3fae5d1f1276a0704a22d1 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 9b06f509ed709cb7af821f5b99a6b54a9a493a64..e3e1de4b433d1254389a081c55a556e6e630a8a8 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 3041410eccafc114cfad91da544695e404dbb358..49f0b24b293bbe11b92b3941bef4945ef518b3c6 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 c797e75389266f757da994256110fdf23e6c4e5c..f158d9226643d348b43fe2f55952f5f165fba9c9 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 df5e88f69dd0084317cddee729863a9b45eb52b7..a5e2f681c00a88fa3588f259d5f210491493ef14 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 706c07a0477c09f1857cad1b312d1ca9a4de998c..df54c6b921360c7ad2bcd5045c11cd67bbf8004a 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 b4955ef608316755b3a465a649524acd5db26d6c..5018f0876bdc5a0a25bf6df74498491f29e71bed 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 cfa94a2dbefa9e82a7f8e4fe75aea53f6cb6eddb..162eac9a60104358562cc77d89c1a5cf2790fad4 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 420305d051cd882576474196162aa46263e01d85..8221c22ed1948137794f354da4d1456da8501f50 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 df1c3c669d1b6f296e8ef49e96ff309c74b374e7..6eb4a976e8933a55bd82d410db10113a2990bf58 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 54e2496cfb9601e024f63a77ddfb20c6e5cddb7a..ee3f948cb585f189af6fa088f1cf370f96d11673 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 b8cf3485e30418165cfc027cbfae13cffe9fef95..cb696361c6831970f96c9c34a5d7f80eecc6847f 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 5e48c2840999f6f814349ab64d7678bd523bc584..881f513807d8f00bc46520094ec91a5cfd6f003c 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 68907915b90fe6e6e4f22ccec25a4c439c97c78e..fc52287ddd4fc75b266231b6b58ea82f294fe497 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 7eb09b22bab792a1a3abf41ed93354e643fdca4e..afef944889325c183f02c31fc1c55899ecbcfdb8 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 fb2cdc850d6a1eba56014c6fed488b40cd371159..3d29f9624cb4b0700090efe44669f4419d7f13f8 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 893b0ae174dc5d18efff87eea1a5ef7e13296fde..2c92ae21c8b06ed02176f631de8cb4df796606ae 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 97a0203f4629e2dbda0c80ee88653201d64db0e4..26edade48cf7c8831f294779a502b2e5e7667c05 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 dc11b0158acc7c07df1b4e56bf37800d98e473e2..4cf8265fa969b94987db1005ffd477d273ffa5a1 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 d8e35351bea2921153d21fbdd8c9fb6629eb1fdf..bc86bdadab50e4d9dc0db60d7a16953fa310f214 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 811231cca4a3b759658eb268c0ca3100ce3ead75..36c7d571641ded893b5b06d934aa51628befee44 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 79262411e5918d946c1c961601097c9370f02d88..bbe579bd55414a3dcb944cedddc7d6aace0c40f8 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 42c12fd7e3f2bcd5cc3b3562df170fa005cd7b44..e577aa1258724ead82187d1455a6027420a7a1f1 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 bf2372c7d5c4d069c824a41b0f4f8ca6c21f5c2b..21fa7a6f5cf49a6b1f95323d5a6c6f6dac347897 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 957e721f194789faecf4200cee2947cf96f57c89..11c26bbcf85859517c99a34a97bfc40fb0edd58b 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 2d09c17e8d262ae372cd09b05a1939667fdd3059..2c0d871b1de607cf48a8e422a4e99ebd452e6b02 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 bdcb9ee8f70532a2450ef4f09a26f3428ed405f4..b50ba97cdaa44ce9e50361a5de1359cb3597549d 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);