From: TimePath Date: Tue, 29 Sep 2015 10:56:13 +0000 (+1000) Subject: Monsters: make mage more player friendly X-Git-Tag: xonotic-v0.8.2~1874^2~39 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=45419c41b4da92340152d6fffe1fa429769b6d6a;p=xonotic%2Fxonotic-data.pk3dir.git Monsters: make mage more player friendly --- diff --git a/qcsrc/common/monsters/monster.qh b/qcsrc/common/monsters/monster.qh index f21019db2..0fd247694 100644 --- a/qcsrc/common/monsters/monster.qh +++ b/qcsrc/common/monsters/monster.qh @@ -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; diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 0030a4fa8..4de03d738 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -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; } } diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index c287bda23..2c6c74b0e 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -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) { diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index fa35cced6..5de8fccd8 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -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) { diff --git a/qcsrc/common/monsters/monster/wyvern.qc b/qcsrc/common/monsters/monster/wyvern.qc index 19f8a53be..dcf1afa7c 100644 --- a/qcsrc/common/monsters/monster/wyvern.qc +++ b/qcsrc/common/monsters/monster/wyvern.qc @@ -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) { diff --git a/qcsrc/common/monsters/monster/zombie.qc b/qcsrc/common/monsters/monster/zombie.qc index cca02dd9e..0e06e4ae8 100644 --- a/qcsrc/common/monsters/monster/zombie.qc +++ b/qcsrc/common/monsters/monster/zombie.qc @@ -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) { diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 9b06f509e..e3e1de4b4 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -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) diff --git a/qcsrc/common/turrets/turret/plasma_dual.qc b/qcsrc/common/turrets/turret/plasma_dual.qc index 3041410ec..49f0b24b2 100644 --- a/qcsrc/common/turrets/turret/plasma_dual.qc +++ b/qcsrc/common/turrets/turret/plasma_dual.qc @@ -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; diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index c797e7538..f158d9226 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index df5e88f69..a5e2f681c 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -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; diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index 706c07a04..df54c6b92 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -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, diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index b4955ef60..5018f0876 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index cfa94a2db..162eac9a6 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 420305d05..8221c22ed 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index df1c3c669..6eb4a976e 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index 54e2496cf..ee3f948cb 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index b8cf3485e..cb696361c 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/hmg.qc b/qcsrc/common/weapons/weapon/hmg.qc index 5e48c2840..881f51380 100644 --- a/qcsrc/common/weapons/weapon/hmg.qc +++ b/qcsrc/common/weapons/weapon/hmg.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index 68907915b..fc52287dd 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 7eb09b22b..afef94488 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -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 diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index fb2cdc850..3d29f9624 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 893b0ae17..2c92ae21c 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index 97a0203f4..26edade48 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index dc11b0158..4cf8265fa 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -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); } diff --git a/qcsrc/common/weapons/weapon/rpc.qc b/qcsrc/common/weapons/weapon/rpc.qc index d8e35351b..bc86bdada 100644 --- a/qcsrc/common/weapons/weapon/rpc.qc +++ b/qcsrc/common/weapons/weapon/rpc.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 811231cca..36c7d5716 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index 79262411e..bbe579bd5 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 42c12fd7e..e577aa125 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index bf2372c7d..21fa7a6f5 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 957e721f1..11c26bbcf 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index 2d09c17e8..2c0d871b1 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -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); diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index bdcb9ee8f..b50ba97cd 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -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);