From bf8dc43ce3c330b60ac3a2cffcdc0fc34cd34f53 Mon Sep 17 00:00:00 2001 From: Lyberta Date: Wed, 5 Apr 2017 05:24:05 +0300 Subject: [PATCH] Overkill weapons: better secondary refire. --- bal-wep-overkill-nerfed.cfg | 3 + bal-wep-overkill.cfg | 3 + bal-wep-xonotic.cfg | 3 + .../mutators/mutator/overkill/okmachinegun.qc | 54 +++- .../mutators/mutator/overkill/okmachinegun.qh | 1 + .../mutators/mutator/overkill/okshotgun.qc | 55 ++-- .../mutators/mutator/overkill/okshotgun.qh | 1 + .../mutators/mutator/overkill/okvortex.qc | 238 ++++++++++-------- .../mutators/mutator/overkill/okvortex.qh | 1 + 9 files changed, 225 insertions(+), 134 deletions(-) diff --git a/bal-wep-overkill-nerfed.cfg b/bal-wep-overkill-nerfed.cfg index 9fa1526b8..49d994852 100644 --- a/bal-wep-overkill-nerfed.cfg +++ b/bal-wep-overkill-nerfed.cfg @@ -22,6 +22,7 @@ set g_balance_okshotgun_secondary_force 300 set g_balance_okshotgun_secondary_lifetime 5 set g_balance_okshotgun_secondary_radius 60 set g_balance_okshotgun_secondary_refire 0.7 +set g_balance_okshotgun_secondary_refire_type 0 set g_balance_okshotgun_secondary_shotangle 0 set g_balance_okshotgun_secondary_speed 6000 set g_balance_okshotgun_secondary_spread 0 @@ -57,6 +58,7 @@ set g_balance_okmachinegun_secondary_force 300 set g_balance_okmachinegun_secondary_lifetime 5 set g_balance_okmachinegun_secondary_radius 60 set g_balance_okmachinegun_secondary_refire 0.7 +set g_balance_okmachinegun_secondary_refire_type 0 set g_balance_okmachinegun_secondary_shotangle 0 set g_balance_okmachinegun_secondary_speed 6000 set g_balance_okmachinegun_secondary_spread 0 @@ -113,6 +115,7 @@ set g_balance_okvortex_secondary_damagefalloff_maxdist 0 set g_balance_okvortex_secondary_damagefalloff_mindist 0 set g_balance_okvortex_secondary_force 0 set g_balance_okvortex_secondary_refire 0 +set g_balance_okvortex_secondary_refire_type 0 set g_balance_okvortex_secondary_delay 0 set g_balance_okvortex_secondary_edgedamage 10 set g_balance_okvortex_secondary_lifetime 5 diff --git a/bal-wep-overkill.cfg b/bal-wep-overkill.cfg index 5949be955..86f986eb2 100644 --- a/bal-wep-overkill.cfg +++ b/bal-wep-overkill.cfg @@ -839,6 +839,7 @@ set g_balance_okshotgun_secondary_force 300 set g_balance_okshotgun_secondary_lifetime 5 set g_balance_okshotgun_secondary_radius 70 set g_balance_okshotgun_secondary_refire 0.7 +set g_balance_okshotgun_secondary_refire_type 1 set g_balance_okshotgun_secondary_shotangle 0 set g_balance_okshotgun_secondary_speed 6000 set g_balance_okshotgun_secondary_spread 0 @@ -874,6 +875,7 @@ set g_balance_okmachinegun_secondary_force 300 set g_balance_okmachinegun_secondary_lifetime 5 set g_balance_okmachinegun_secondary_radius 70 set g_balance_okmachinegun_secondary_refire 0.7 +set g_balance_okmachinegun_secondary_refire_type 1 set g_balance_okmachinegun_secondary_shotangle 0 set g_balance_okmachinegun_secondary_speed 6000 set g_balance_okmachinegun_secondary_spread 0 @@ -930,6 +932,7 @@ set g_balance_okvortex_secondary_damagefalloff_maxdist 0 set g_balance_okvortex_secondary_damagefalloff_mindist 0 set g_balance_okvortex_secondary_force 300 set g_balance_okvortex_secondary_refire 0.7 +set g_balance_okvortex_secondary_refire_type 1 set g_balance_okvortex_secondary_delay 0 set g_balance_okvortex_secondary_edgedamage 12.5 set g_balance_okvortex_secondary_lifetime 5 diff --git a/bal-wep-xonotic.cfg b/bal-wep-xonotic.cfg index e530dc4b0..0a538347e 100644 --- a/bal-wep-xonotic.cfg +++ b/bal-wep-xonotic.cfg @@ -839,6 +839,7 @@ set g_balance_okshotgun_secondary_force 300 set g_balance_okshotgun_secondary_lifetime 5 set g_balance_okshotgun_secondary_radius 70 set g_balance_okshotgun_secondary_refire 0.7 +set g_balance_okshotgun_secondary_refire_type 1 set g_balance_okshotgun_secondary_shotangle 0 set g_balance_okshotgun_secondary_speed 6000 set g_balance_okshotgun_secondary_spread 0 @@ -874,6 +875,7 @@ set g_balance_okmachinegun_secondary_force 300 set g_balance_okmachinegun_secondary_lifetime 5 set g_balance_okmachinegun_secondary_radius 70 set g_balance_okmachinegun_secondary_refire 0.7 +set g_balance_okmachinegun_secondary_refire_type 1 set g_balance_okmachinegun_secondary_shotangle 0 set g_balance_okmachinegun_secondary_speed 6000 set g_balance_okmachinegun_secondary_spread 0 @@ -930,6 +932,7 @@ set g_balance_okvortex_secondary_damagefalloff_maxdist 0 set g_balance_okvortex_secondary_damagefalloff_mindist 0 set g_balance_okvortex_secondary_force 300 set g_balance_okvortex_secondary_refire 0.7 +set g_balance_okvortex_secondary_refire_type 1 set g_balance_okvortex_secondary_delay 0 set g_balance_okvortex_secondary_edgedamage 12.5 set g_balance_okvortex_secondary_lifetime 5 diff --git a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc index b08f506a1..38eea0025 100644 --- a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc +++ b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc @@ -131,22 +131,51 @@ METHOD(OverkillMachineGun, wr_aim, void(entity thiswep, entity actor, .entity we METHOD(OverkillMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { + if ((WEP_CVAR_SEC(okmachinegun, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval)) + { + // Secondary uses it's own refire timer if refire_type is 1. + actor.jump_interval = time + WEP_CVAR_SEC(okmachinegun, refire) * W_WeaponRateFactor(actor); + // Ugly hack to reuse the fire mode of the blaster. + makevectors(actor.v_angle); + Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack + actor.(weaponentity).m_weapon = WEP_BLASTER; + W_Blaster_Attack( + actor, + weaponentity, + WEP_BLASTER.m_id | HITTYPE_SECONDARY, + WEP_CVAR_SEC(okmachinegun, shotangle), + WEP_CVAR_SEC(okmachinegun, damage), + WEP_CVAR_SEC(okmachinegun, edgedamage), + WEP_CVAR_SEC(okmachinegun, radius), + WEP_CVAR_SEC(okmachinegun, force), + WEP_CVAR_SEC(okmachinegun, speed), + WEP_CVAR_SEC(okmachinegun, spread), + WEP_CVAR_SEC(okmachinegun, delay), + WEP_CVAR_SEC(okmachinegun, lifetime) + ); + actor.(weaponentity).m_weapon = oldwep; + } if (WEP_CVAR(okmachinegun, reload_ammo) && actor.(weaponentity).clip_load < min(max(WEP_CVAR(okmachinegun, sustained_ammo), WEP_CVAR(okmachinegun, first_ammo)), WEP_CVAR(okmachinegun, burst_ammo))) - { // forced reload + { + // Forced reload thiswep.wr_reload(thiswep, actor, weaponentity); + return; } - else if (WEP_CVAR(okmachinegun, mode) == 1) + if (WEP_CVAR(okmachinegun, mode) == 1) { if(fire & 1) // Primary attack - if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0)) { + if (!weapon_prepareattack(thiswep, actor, weaponentity, false, 0)) + { + return; + } actor.(weaponentity).misc_bulletcounter = 0; W_OverkillMachineGun_Attack_Auto(thiswep, actor, weaponentity, fire); + return; } - - if (fire & 2) // Secondary attack + if ((fire & 2) && (WEP_CVAR_SEC(okmachinegun, refire_type) == 0)) // Secondary attack { - if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okmachinegun, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(okmachinegun, refire))) { return; } @@ -174,17 +203,20 @@ METHOD(OverkillMachineGun, wr_think, void(entity thiswep, entity actor, .entity } else { - if(fire & 1) // Primary attack - if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0)) + if (fire & 1) // Primary attack { + if (!weapon_prepareattack(thiswep, actor, weaponentity, false, 0)) + { + return; + } actor.(weaponentity).misc_bulletcounter = 1; W_OverkillMachineGun_Attack(WEP_OVERKILL_MACHINEGUN, WEP_OVERKILL_MACHINEGUN.m_id, actor, weaponentity); // sets attack_finished weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(okmachinegun, sustained_refire), W_OverkillMachineGun_Attack_Frame); + return; } - - if (fire & 2) // Secondary attack + if ((fire & 2) && (WEP_CVAR_SEC(okmachinegun, refire_type) == 0)) // Secondary attack { - if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okmachinegun, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(okmachinegun, refire))) { return; } diff --git a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh index b2fabdeed..177d18411 100644 --- a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh +++ b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh @@ -57,6 +57,7 @@ CLASS(OverkillMachineGun, Weapon) P(class, prefix, lifetime, float, SEC) \ P(class, prefix, radius, float, SEC) \ P(class, prefix, refire, float, SEC) \ + P(class, prefix, refire_type, float, SEC) \ P(class, prefix, shotangle, float, SEC) \ P(class, prefix, speed, float, SEC) \ P(class, prefix, spread, float, SEC) \ diff --git a/qcsrc/common/mutators/mutator/overkill/okshotgun.qc b/qcsrc/common/mutators/mutator/overkill/okshotgun.qc index 1e34e41a5..6cfd6fbb3 100644 --- a/qcsrc/common/mutators/mutator/overkill/okshotgun.qc +++ b/qcsrc/common/mutators/mutator/overkill/okshotgun.qc @@ -3,8 +3,6 @@ #ifdef SVQC spawnfunc(weapon_okshotgun) { weapon_defaultspawnfunc(this, WEP_OVERKILL_SHOTGUN); } -.float okshotgun_primarytime; - METHOD(OverkillShotgun, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { if (vdist(actor.origin - actor.enemy.origin, >, WEP_CVAR_PRI(okshotgun, bot_range))) @@ -19,30 +17,53 @@ METHOD(OverkillShotgun, wr_aim, void(entity thiswep, entity actor, .entity weapo METHOD(OverkillShotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if (WEP_CVAR(okshotgun, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(okshotgun, ammo)) // forced reload + if ((WEP_CVAR_SEC(okshotgun, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval)) { + // Secondary uses it's own refire timer if refire_type is 1. + actor.jump_interval = time + WEP_CVAR_SEC(okshotgun, refire) * W_WeaponRateFactor(actor); + // Ugly hack to reuse the fire mode of the blaster. + makevectors(actor.v_angle); + Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack + actor.(weaponentity).m_weapon = WEP_BLASTER; + W_Blaster_Attack( + actor, + weaponentity, + WEP_BLASTER.m_id | HITTYPE_SECONDARY, + WEP_CVAR_SEC(okshotgun, shotangle), + WEP_CVAR_SEC(okshotgun, damage), + WEP_CVAR_SEC(okshotgun, edgedamage), + WEP_CVAR_SEC(okshotgun, radius), + WEP_CVAR_SEC(okshotgun, force), + WEP_CVAR_SEC(okshotgun, speed), + WEP_CVAR_SEC(okshotgun, spread), + WEP_CVAR_SEC(okshotgun, delay), + WEP_CVAR_SEC(okshotgun, lifetime) + ); + actor.(weaponentity).m_weapon = oldwep; + } + if (WEP_CVAR(okshotgun, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(okshotgun, ammo)) + { + // Forced reload thiswep.wr_reload(thiswep, actor, weaponentity); return; } if (fire & 1) // Primary attack { - if (time >= actor.(weaponentity).okshotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary + if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(okshotgun, animtime))) { - if (weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(okshotgun, animtime))) - { - W_Shotgun_Attack(thiswep, actor, weaponentity, true, - WEP_CVAR_PRI(okshotgun, ammo), - WEP_CVAR_PRI(okshotgun, damage), - WEP_CVAR_PRI(okshotgun, bullets), - WEP_CVAR_PRI(okshotgun, spread), - WEP_CVAR_PRI(okshotgun, solidpenetration), - WEP_CVAR_PRI(okshotgun, force)); - actor.(weaponentity).okshotgun_primarytime = time + WEP_CVAR_PRI(okshotgun, refire) * W_WeaponRateFactor(actor); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okshotgun, animtime), w_ready); - } + return; } + W_Shotgun_Attack(thiswep, actor, weaponentity, true, + WEP_CVAR_PRI(okshotgun, ammo), + WEP_CVAR_PRI(okshotgun, damage), + WEP_CVAR_PRI(okshotgun, bullets), + WEP_CVAR_PRI(okshotgun, spread), + WEP_CVAR_PRI(okshotgun, solidpenetration), + WEP_CVAR_PRI(okshotgun, force)); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okshotgun, animtime), w_ready); + return; } - else if (fire & 2) // Secondary attack + if ((fire & 2) && (WEP_CVAR_SEC(okshotgun, refire_type) == 0)) // Secondary attack { if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okshotgun, refire))) { diff --git a/qcsrc/common/mutators/mutator/overkill/okshotgun.qh b/qcsrc/common/mutators/mutator/overkill/okshotgun.qh index 65d869912..80b85039a 100644 --- a/qcsrc/common/mutators/mutator/overkill/okshotgun.qh +++ b/qcsrc/common/mutators/mutator/overkill/okshotgun.qh @@ -36,6 +36,7 @@ CLASS(OverkillShotgun, Weapon) P(class, prefix, lifetime, float, SEC) \ P(class, prefix, radius, float, SEC) \ P(class, prefix, refire, float, SEC) \ + P(class, prefix, refire_type, float, SEC) \ P(class, prefix, shotangle, float, SEC) \ P(class, prefix, speed, float, SEC) \ P(class, prefix, spread, float, SEC) \ diff --git a/qcsrc/common/mutators/mutator/overkill/okvortex.qc b/qcsrc/common/mutators/mutator/overkill/okvortex.qc index 98900f7aa..8101f5661 100644 --- a/qcsrc/common/mutators/mutator/overkill/okvortex.qc +++ b/qcsrc/common/mutators/mutator/overkill/okvortex.qc @@ -146,123 +146,149 @@ METHOD(OverkillVortex, wr_think, void(entity thiswep, entity actor, .entity weap if(weaponslot(weaponentity) == 0) actor.okvortex_chargepool_ammo = actor.(weaponentity).okvortex_chargepool_ammo; + if ((WEP_CVAR_SEC(okvortex, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval)) + { + // Secondary uses it's own refire timer if refire_type is 1. + actor.jump_interval = time + WEP_CVAR_SEC(okvortex, refire) * W_WeaponRateFactor(actor); + // Ugly hack to reuse the fire mode of the blaster. + makevectors(actor.v_angle); + Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack + actor.(weaponentity).m_weapon = WEP_BLASTER; + W_Blaster_Attack( + actor, + weaponentity, + WEP_BLASTER.m_id | HITTYPE_SECONDARY, + WEP_CVAR_SEC(okvortex, shotangle), + WEP_CVAR_SEC(okvortex, damage), + WEP_CVAR_SEC(okvortex, edgedamage), + WEP_CVAR_SEC(okvortex, radius), + WEP_CVAR_SEC(okvortex, force), + WEP_CVAR_SEC(okvortex, speed), + WEP_CVAR_SEC(okvortex, spread), + WEP_CVAR_SEC(okvortex, delay), + WEP_CVAR_SEC(okvortex, lifetime) + ); + actor.(weaponentity).m_weapon = oldwep; + } + if (autocvar_g_balance_okvortex_reload_ammo && actor.(weaponentity).clip_load < WEP_CVAR_PRI(okvortex, ammo)) { - // forced reload + // Rorced reload thiswep.wr_reload(thiswep, actor, weaponentity); + return; } - else + if (fire & 1) // Primary attack { - if (fire & 1) - { - if (weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(okvortex, refire))) - { - W_OverkillVortex_Attack(thiswep, actor, weaponentity, 0); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okvortex, animtime), w_ready); - } - } - else if ((fire & 2) && (WEP_CVAR(okvortex, secondary) == 2)) + if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(okvortex, refire))) { - if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okshotgun, refire))) - { - return; - } - // ugly instagib hack to reuse the fire mode of the laser - makevectors(actor.v_angle); - Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack - actor.(weaponentity).m_weapon = WEP_BLASTER; - W_Blaster_Attack( - actor, - weaponentity, - WEP_BLASTER.m_id | HITTYPE_SECONDARY, - WEP_CVAR_SEC(okshotgun, shotangle), - WEP_CVAR_SEC(okshotgun, damage), - WEP_CVAR_SEC(okshotgun, edgedamage), - WEP_CVAR_SEC(okshotgun, radius), - WEP_CVAR_SEC(okshotgun, force), - WEP_CVAR_SEC(okshotgun, speed), - WEP_CVAR_SEC(okshotgun, spread), - WEP_CVAR_SEC(okshotgun, delay), - WEP_CVAR_SEC(okshotgun, lifetime) - ); - actor.(weaponentity).m_weapon = oldwep; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okshotgun, animtime), w_ready); return; } - if((WEP_CVAR(okvortex, charge) && !WEP_CVAR(okvortex, secondary)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2)) + W_OverkillVortex_Attack(thiswep, actor, weaponentity, 0); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okvortex, animtime), w_ready); + return; + } + if ((fire & 2) && (WEP_CVAR(okvortex, secondary) == 2) && (WEP_CVAR_SEC(okvortex, refire_type) == 0)) + { + // Secondary attack + if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(okshotgun, refire))) { - if(WEP_CVAR(okvortex, charge)) - { - actor.(weaponentity).okvortex_charge_rottime = time + WEP_CVAR(okvortex, charge_rot_pause); - float dt = frametime / W_TICSPERFRAME; - - if(actor.(weaponentity).okvortex_charge < 1) - { - if(WEP_CVAR_SEC(okvortex, chargepool)) - { - if(WEP_CVAR_SEC(okvortex, ammo)) - { - // always deplete if secondary is held - actor.okvortex_chargepool_ammo = max(0, actor.okvortex_chargepool_ammo - WEP_CVAR_SEC(okvortex, ammo) * dt); - - dt = min(dt, (1 - actor.(weaponentity).okvortex_charge) / WEP_CVAR(okvortex, charge_rate)); - actor.okvortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(okvortex, chargepool_pause_regen); - dt = min(dt, actor.okvortex_chargepool_ammo); - dt = max(0, dt); - - actor.(weaponentity).okvortex_charge += dt * WEP_CVAR(okvortex, charge_rate); - } - } - - else if(WEP_CVAR_SEC(okvortex, ammo)) - { - if(fire & 2) // only eat ammo when the button is pressed - { - dt = min(dt, (1 - actor.(weaponentity).okvortex_charge) / WEP_CVAR(okvortex, charge_rate)); - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) - { - // if this weapon is reloadable, decrease its load. Else decrease the player's ammo - if(autocvar_g_balance_vortex_reload_ammo) - { - dt = min(dt, (actor.(weaponentity).clip_load - WEP_CVAR_PRI(okvortex, ammo)) / WEP_CVAR_SEC(okvortex, ammo)); - dt = max(0, dt); - if(dt > 0) - { - actor.(weaponentity).clip_load = max(WEP_CVAR_SEC(okvortex, ammo), actor.(weaponentity).clip_load - WEP_CVAR_SEC(okvortex, ammo) * dt); - } - actor.(weaponentity).(weapon_load[WEP_OVERKILL_VORTEX.m_id]) = actor.(weaponentity).clip_load; - } - else - { - dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(okvortex, ammo)) / WEP_CVAR_SEC(okvortex, ammo)); - dt = max(0, dt); - if(dt > 0) - { - actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(okvortex, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(okvortex, ammo) * dt); - } - } - } - actor.(weaponentity).okvortex_charge += dt * WEP_CVAR(okvortex, charge_rate); - } - } - - else - { - dt = min(dt, (1 - actor.(weaponentity).okvortex_charge) / WEP_CVAR(okvortex, charge_rate)); - actor.(weaponentity).okvortex_charge += dt * WEP_CVAR(okvortex, charge_rate); - } - } - } - else if(WEP_CVAR(okvortex, secondary)) - { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okvortex, refire))) - { - W_OverkillVortex_Attack(thiswep, actor, weaponentity, 1); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(okvortex, animtime), w_ready); - } - } + return; } + // ugly instagib hack to reuse the fire mode of the laser + makevectors(actor.v_angle); + Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack + actor.(weaponentity).m_weapon = WEP_BLASTER; + W_Blaster_Attack( + actor, + weaponentity, + WEP_BLASTER.m_id | HITTYPE_SECONDARY, + WEP_CVAR_SEC(okvortex, shotangle), + WEP_CVAR_SEC(okvortex, damage), + WEP_CVAR_SEC(okvortex, edgedamage), + WEP_CVAR_SEC(okvortex, radius), + WEP_CVAR_SEC(okvortex, force), + WEP_CVAR_SEC(okvortex, speed), + WEP_CVAR_SEC(okvortex, spread), + WEP_CVAR_SEC(okvortex, delay), + WEP_CVAR_SEC(okvortex, lifetime) + ); + actor.(weaponentity).m_weapon = oldwep; + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okvortex, animtime), w_ready); + return; } + //if ((WEP_CVAR(okvortex, charge) && (WEP_CVAR(okvortex, secondary) == 1)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2)) + //{ + // if(WEP_CVAR(okvortex, charge)) + // { + // actor.(weaponentity).okvortex_charge_rottime = time + WEP_CVAR(okvortex, charge_rot_pause); + // float dt = frametime / W_TICSPERFRAME; + // + // if(actor.(weaponentity).okvortex_charge < 1) + // { + // if(WEP_CVAR_SEC(okvortex, chargepool)) + // { + // if(WEP_CVAR_SEC(okvortex, ammo)) + // { + // // always deplete if secondary is held + // actor.okvortex_chargepool_ammo = max(0, actor.okvortex_chargepool_ammo - WEP_CVAR_SEC(okvortex, ammo) * dt); + + // dt = min(dt, (1 - actor.(weaponentity).okvortex_charge) / WEP_CVAR(okvortex, charge_rate)); + // actor.okvortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(okvortex, chargepool_pause_regen); + // dt = min(dt, actor.okvortex_chargepool_ammo); + // dt = max(0, dt); + + // actor.(weaponentity).okvortex_charge += dt * WEP_CVAR(okvortex, charge_rate); + // } + // } + + // else if(WEP_CVAR_SEC(okvortex, ammo)) + // { + // if(fire & 2) // only eat ammo when the button is pressed + // { + // dt = min(dt, (1 - actor.(weaponentity).okvortex_charge) / WEP_CVAR(okvortex, charge_rate)); + // if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + // { + // // if this weapon is reloadable, decrease its load. Else decrease the player's ammo + // if(autocvar_g_balance_vortex_reload_ammo) + // { + // dt = min(dt, (actor.(weaponentity).clip_load - WEP_CVAR_PRI(okvortex, ammo)) / WEP_CVAR_SEC(okvortex, ammo)); + // dt = max(0, dt); + // if(dt > 0) + // { + // actor.(weaponentity).clip_load = max(WEP_CVAR_SEC(okvortex, ammo), actor.(weaponentity).clip_load - WEP_CVAR_SEC(okvortex, ammo) * dt); + // } + // actor.(weaponentity).(weapon_load[WEP_OVERKILL_VORTEX.m_id]) = actor.(weaponentity).clip_load; + // } + // else + // { + // dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(okvortex, ammo)) / WEP_CVAR_SEC(okvortex, ammo)); + // dt = max(0, dt); + // if(dt > 0) + // { + // actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(okvortex, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(okvortex, ammo) * dt); + // } + // } + // } + // actor.(weaponentity).okvortex_charge += dt * WEP_CVAR(okvortex, charge_rate); + // } + // } + + // else + // { + // dt = min(dt, (1 - actor.(weaponentity).okvortex_charge) / WEP_CVAR(okvortex, charge_rate)); + // actor.(weaponentity).okvortex_charge += dt * WEP_CVAR(okvortex, charge_rate); + // } + // } + // } + // else if(WEP_CVAR(okvortex, secondary)) + // { + // if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okvortex, refire))) + // { + // W_OverkillVortex_Attack(thiswep, actor, weaponentity, 1); + // weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(okvortex, animtime), w_ready); + // } + // } + //} } METHOD(OverkillVortex, wr_setup, void(entity thiswep, entity actor, .entity weaponentity)) diff --git a/qcsrc/common/mutators/mutator/overkill/okvortex.qh b/qcsrc/common/mutators/mutator/overkill/okvortex.qh index 478c7591f..a0a2bbd0a 100644 --- a/qcsrc/common/mutators/mutator/overkill/okvortex.qh +++ b/qcsrc/common/mutators/mutator/overkill/okvortex.qh @@ -61,6 +61,7 @@ CLASS(OverkillVortex, Weapon) P(class, prefix, lifetime, float, SEC) \ P(class, prefix, radius, float, SEC) \ P(class, prefix, refire, float, SEC) \ + P(class, prefix, refire_type, float, SEC) \ P(class, prefix, shotangle, float, SEC) \ P(class, prefix, speed, float, SEC) \ P(class, prefix, spread, float, SEC) \ -- 2.39.2