]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Overkill weapons: better secondary refire.
authorLyberta <lyberta@lyberta.net>
Wed, 5 Apr 2017 02:24:05 +0000 (05:24 +0300)
committerLyberta <lyberta@lyberta.net>
Wed, 5 Apr 2017 02:24:05 +0000 (05:24 +0300)
bal-wep-overkill-nerfed.cfg
bal-wep-overkill.cfg
bal-wep-xonotic.cfg
qcsrc/common/mutators/mutator/overkill/okmachinegun.qc
qcsrc/common/mutators/mutator/overkill/okmachinegun.qh
qcsrc/common/mutators/mutator/overkill/okshotgun.qc
qcsrc/common/mutators/mutator/overkill/okshotgun.qh
qcsrc/common/mutators/mutator/overkill/okvortex.qc
qcsrc/common/mutators/mutator/overkill/okvortex.qh

index 9fa1526b8fa8b051d2870bcc239380ddec6c768e..49d994852e247ac4053f0a9f2d0d384977dbf231 100644 (file)
@@ -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
index 5949be955693adb5f0984e299c6b648e3af42b30..86f986eb22ccfdcbc2bf432ddb9813626a87ccb9 100644 (file)
@@ -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
index e530dc4b016ec296b36c9675aeded7243500bdf7..0a538347ea3eed05862370b83148741635871504 100644 (file)
@@ -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
index b08f506a1513ea69e2b4d523e3973fc1534bcaea..38eea00254295f451a4bf68eb7138d086f842c2f 100644 (file)
@@ -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;
                        }
index b2fabdeeda545accf09eb6fd6b76185b5affcdf4..177d1841187eb581ccc00dc9ff6091e1868a2249 100644 (file)
@@ -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) \
index 1e34e41a58f301f5bbdf59cc9992e374fa36ef1d..6cfd6fbb36cb4bd641caf8909c17ca98528a56cd 100644 (file)
@@ -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)))
                {
index 65d869912ca0e0c3b869310a784c3b1be7521184..80b85039a54b80293bdcc8ef8a5a30c12a1ac0f1 100644 (file)
@@ -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) \
index 98900f7aa67715d2e151171d3ab28319adb7c0ae..8101f56616f38111a2f3209f2251d83c3edd53c0 100644 (file)
@@ -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))
index 478c7591f0e8809885d73b150fc3214389caf226..a0a2bbd0a3fcf69f13c5389109cd6b9ad77ab743 100644 (file)
@@ -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) \