From d15ec1654e98d814947bdb77e3d57073c7abb075 Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 13 Aug 2024 01:20:20 +0200 Subject: [PATCH] Remove optional blaster secondary attack (copy of primary attack with slightly different settings) Weapons using blaster as secondary attack now load settings from blaster primary --- bal-wep-mario.cfg | 13 --- bal-wep-nexuiz25.cfg | 13 --- bal-wep-samual.cfg | 13 --- bal-wep-xdf.cfg | 13 --- bal-wep-xonotic.cfg | 13 --- .../mutators/mutator/instagib/sv_instagib.qc | 23 ++-- .../common/mutators/mutator/overkill/okhmg.qc | 14 +-- .../mutators/mutator/overkill/okmachinegun.qc | 10 +- .../common/mutators/mutator/overkill/oknex.qc | 32 +++--- .../common/mutators/mutator/overkill/oknex.qh | 16 +-- .../common/mutators/mutator/overkill/okrpc.qc | 14 +-- .../mutators/mutator/overkill/okshotgun.qc | 10 +- qcsrc/common/weapons/weapon/blaster.qc | 103 +++++++----------- qcsrc/common/weapons/weapon/blaster.qh | 35 +++--- qcsrc/common/weapons/weapon/vaporizer.qc | 24 ++-- 15 files changed, 125 insertions(+), 221 deletions(-) diff --git a/bal-wep-mario.cfg b/bal-wep-mario.cfg index ee46e5972..c6b10f072 100644 --- a/bal-wep-mario.cfg +++ b/bal-wep-mario.cfg @@ -11,19 +11,6 @@ set g_balance_blaster_primary_refire 0.7 set g_balance_blaster_primary_shotangle 0 set g_balance_blaster_primary_speed 6000 set g_balance_blaster_primary_spread 0 -set g_balance_blaster_secondary 0 -set g_balance_blaster_secondary_animtime 0.2 -set g_balance_blaster_secondary_damage 25 -set g_balance_blaster_secondary_delay 0 -set g_balance_blaster_secondary_edgedamage 12.5 -set g_balance_blaster_secondary_force 360 -set g_balance_blaster_secondary_force_zscale 1 -set g_balance_blaster_secondary_lifetime 5 -set g_balance_blaster_secondary_radius 70 -set g_balance_blaster_secondary_refire 0.7 -set g_balance_blaster_secondary_shotangle 0 -set g_balance_blaster_secondary_speed 6000 -set g_balance_blaster_secondary_spread 0 set g_balance_blaster_switchdelay_drop 0.2 set g_balance_blaster_switchdelay_raise 0.2 set g_balance_blaster_weaponreplace "" diff --git a/bal-wep-nexuiz25.cfg b/bal-wep-nexuiz25.cfg index a480463cf..ec98688d8 100644 --- a/bal-wep-nexuiz25.cfg +++ b/bal-wep-nexuiz25.cfg @@ -11,19 +11,6 @@ set g_balance_blaster_primary_refire 0.7 set g_balance_blaster_primary_shotangle 0 set g_balance_blaster_primary_speed 9000 set g_balance_blaster_primary_spread 0 -set g_balance_blaster_secondary 0 -set g_balance_blaster_secondary_animtime 0.3 -set g_balance_blaster_secondary_damage 35 -set g_balance_blaster_secondary_delay 0 -set g_balance_blaster_secondary_edgedamage 10 -set g_balance_blaster_secondary_force 400 -set g_balance_blaster_secondary_force_zscale 1 -set g_balance_blaster_secondary_lifetime 30 -set g_balance_blaster_secondary_radius 70 -set g_balance_blaster_secondary_refire 0.7 -set g_balance_blaster_secondary_shotangle 0 -set g_balance_blaster_secondary_speed 9000 -set g_balance_blaster_secondary_spread 0 set g_balance_blaster_switchdelay_drop 0.15 set g_balance_blaster_switchdelay_raise 0.15 set g_balance_blaster_weaponreplace "" diff --git a/bal-wep-samual.cfg b/bal-wep-samual.cfg index 7bbd57098..60020faa8 100644 --- a/bal-wep-samual.cfg +++ b/bal-wep-samual.cfg @@ -11,19 +11,6 @@ set g_balance_blaster_primary_refire 0.7 set g_balance_blaster_primary_shotangle 0 set g_balance_blaster_primary_speed 6000 set g_balance_blaster_primary_spread 0 -set g_balance_blaster_secondary 0 -set g_balance_blaster_secondary_animtime 0.2 -set g_balance_blaster_secondary_damage 25 -set g_balance_blaster_secondary_delay 0 -set g_balance_blaster_secondary_edgedamage 12.5 -set g_balance_blaster_secondary_force 300 -set g_balance_blaster_secondary_force_zscale 1 -set g_balance_blaster_secondary_lifetime 5 -set g_balance_blaster_secondary_radius 70 -set g_balance_blaster_secondary_refire 0.7 -set g_balance_blaster_secondary_shotangle 0 -set g_balance_blaster_secondary_speed 6000 -set g_balance_blaster_secondary_spread 0 set g_balance_blaster_switchdelay_drop 0.15 set g_balance_blaster_switchdelay_raise 0.15 set g_balance_blaster_weaponreplace "" diff --git a/bal-wep-xdf.cfg b/bal-wep-xdf.cfg index d25439986..268da517b 100644 --- a/bal-wep-xdf.cfg +++ b/bal-wep-xdf.cfg @@ -11,19 +11,6 @@ set g_balance_blaster_primary_refire 0.7 set g_balance_blaster_primary_shotangle 0 set g_balance_blaster_primary_speed 6000 set g_balance_blaster_primary_spread 0 -set g_balance_blaster_secondary 0 -set g_balance_blaster_secondary_animtime 0.2 -set g_balance_blaster_secondary_damage 25 -set g_balance_blaster_secondary_delay 0 -set g_balance_blaster_secondary_edgedamage 12.5 -set g_balance_blaster_secondary_force 360 -set g_balance_blaster_secondary_force_zscale 1 -set g_balance_blaster_secondary_lifetime 5 -set g_balance_blaster_secondary_radius 70 -set g_balance_blaster_secondary_refire 0.7 -set g_balance_blaster_secondary_shotangle 0 -set g_balance_blaster_secondary_speed 6000 -set g_balance_blaster_secondary_spread 0 set g_balance_blaster_switchdelay_drop 0 set g_balance_blaster_switchdelay_raise 0 set g_balance_blaster_weaponreplace "" diff --git a/bal-wep-xonotic.cfg b/bal-wep-xonotic.cfg index ac14eb5ba..888ae196a 100644 --- a/bal-wep-xonotic.cfg +++ b/bal-wep-xonotic.cfg @@ -11,19 +11,6 @@ set g_balance_blaster_primary_refire 0.7 set g_balance_blaster_primary_shotangle 0 set g_balance_blaster_primary_speed 6000 set g_balance_blaster_primary_spread 0 -set g_balance_blaster_secondary 0 -set g_balance_blaster_secondary_animtime 0.2 -set g_balance_blaster_secondary_damage 25 -set g_balance_blaster_secondary_delay 0 -set g_balance_blaster_secondary_edgedamage 12.5 -set g_balance_blaster_secondary_force 360 -set g_balance_blaster_secondary_force_zscale 1 -set g_balance_blaster_secondary_lifetime 5 -set g_balance_blaster_secondary_radius 70 -set g_balance_blaster_secondary_refire 0.7 -set g_balance_blaster_secondary_shotangle 0 -set g_balance_blaster_secondary_speed 6000 -set g_balance_blaster_secondary_spread 0 set g_balance_blaster_switchdelay_drop 0.2 set g_balance_blaster_switchdelay_raise 0.2 set g_balance_blaster_weaponreplace "" diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index 028dc7e32..e842eb4fe 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@ -212,20 +212,17 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, Damage_Calculate) if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER)) { - if(frag_deathtype & HITTYPE_SECONDARY) + if(!autocvar_g_instagib_blaster_keepdamage || frag_attacker == frag_target) { - if(!autocvar_g_instagib_blaster_keepdamage || frag_attacker == frag_target) - { - frag_damage = 0; - if(!autocvar_g_instagib_mirrordamage) - frag_mirrordamage = 0; // never do mirror damage on enemies - } - - if(frag_target != frag_attacker) - { - if(!autocvar_g_instagib_blaster_keepforce) - frag_force = '0 0 0'; - } + frag_damage = 0; + if(!autocvar_g_instagib_mirrordamage) + frag_mirrordamage = 0; // never do mirror damage on enemies + } + + if(frag_target != frag_attacker) + { + if(!autocvar_g_instagib_blaster_keepforce) + frag_force = '0 0 0'; } } } diff --git a/qcsrc/common/mutators/mutator/overkill/okhmg.qc b/qcsrc/common/mutators/mutator/overkill/okhmg.qc index d40495ade..feb8a02d4 100644 --- a/qcsrc/common/mutators/mutator/overkill/okhmg.qc +++ b/qcsrc/common/mutators/mutator/overkill/okhmg.qc @@ -63,9 +63,9 @@ METHOD(OverkillHeavyMachineGun, wr_think, void(entity thiswep, entity actor, .en if ((WEP_CVAR_SEC(WEP_OVERKILL_HMG, 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(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); + actor.jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); makevectors(actor.v_angle); - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); + W_Blaster_Attack(actor, weaponentity); if ((actor.(weaponentity).wframe == WFRAME_IDLE) || (actor.(weaponentity).wframe == WFRAME_FIRE2)) { @@ -98,13 +98,13 @@ METHOD(OverkillHeavyMachineGun, wr_think, void(entity thiswep, entity actor, .en } if ((fire & 2) && (WEP_CVAR_SEC(WEP_OVERKILL_HMG, refire_type) == 0)) // Secondary attack { - if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_BLASTER, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_BLASTER, refire))) { return; } makevectors(actor.v_angle); - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready); + W_Blaster_Attack(actor, weaponentity); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready); } } @@ -120,10 +120,10 @@ METHOD(OverkillHeavyMachineGun, wr_checkammo1, bool(entity thiswep, entity actor METHOD(OverkillHeavyMachineGun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_BLASTER, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_BLASTER, ammo); if (autocvar_g_balance_okhmg_reload_ammo) { - ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_HMG.m_id]) >= WEP_CVAR_SEC(WEP_BLASTER, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_HMG.m_id]) >= WEP_CVAR_PRI(WEP_BLASTER, ammo); } return ammo_amount; } diff --git a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc index 341c43125..041ea0b5d 100644 --- a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc +++ b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc @@ -67,9 +67,9 @@ METHOD(OverkillMachineGun, wr_think, void(entity thiswep, entity actor, .entity if ((WEP_CVAR_SEC(WEP_OVERKILL_MACHINEGUN, 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(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); + actor.jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); makevectors(actor.v_angle); - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); + W_Blaster_Attack(actor, weaponentity); if ((actor.(weaponentity).wframe == WFRAME_IDLE) || (actor.(weaponentity).wframe == WFRAME_FIRE2)) { @@ -102,13 +102,13 @@ METHOD(OverkillMachineGun, wr_think, void(entity thiswep, entity actor, .entity } if ((fire & 2) && (WEP_CVAR_SEC(WEP_OVERKILL_MACHINEGUN, refire_type) == 0)) // Secondary attack { - if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_BLASTER, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_PRI(WEP_BLASTER, refire))) { return; } makevectors(actor.v_angle); - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready); + W_Blaster_Attack(actor, weaponentity); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready); } } diff --git a/qcsrc/common/mutators/mutator/overkill/oknex.qc b/qcsrc/common/mutators/mutator/overkill/oknex.qc index cd47fee2d..2b205fea9 100644 --- a/qcsrc/common/mutators/mutator/overkill/oknex.qc +++ b/qcsrc/common/mutators/mutator/overkill/oknex.qc @@ -140,9 +140,9 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone if ((WEP_CVAR_SEC(WEP_OVERKILL_NEX, 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(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); + actor.jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); makevectors(actor.v_angle); - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); + W_Blaster_Attack(actor, weaponentity); if ((actor.(weaponentity).wframe == WFRAME_IDLE) || (actor.(weaponentity).wframe == WFRAME_FIRE2)) { @@ -177,13 +177,13 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone if ((fire & 2) && (WEP_CVAR(WEP_OVERKILL_NEX, secondary) == 2) && (WEP_CVAR_SEC(WEP_OVERKILL_NEX, refire_type) == 0)) { // Secondary attack - if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_BLASTER, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_PRI(WEP_BLASTER, refire))) { return; } makevectors(actor.v_angle); - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready); + W_Blaster_Attack(actor, weaponentity); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready); return; } @@ -199,10 +199,10 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone { if(WEP_CVAR_SEC(WEP_OVERKILL_NEX, chargepool)) { - if(WEP_CVAR_SEC(WEP_BLASTER, ammo)) + if(WEP_CVAR_PRI(WEP_BLASTER, ammo)) { // always deplete if secondary is held - actor.(weaponentity).oknex_chargepool_ammo = max(0, actor.(weaponentity).oknex_chargepool_ammo - WEP_CVAR_SEC(WEP_BLASTER, ammo) * dt); + actor.(weaponentity).oknex_chargepool_ammo = max(0, actor.(weaponentity).oknex_chargepool_ammo - WEP_CVAR_PRI(WEP_BLASTER, ammo) * dt); dt = min(dt, (1 - actor.(weaponentity).oknex_charge) / WEP_CVAR(WEP_OVERKILL_NEX, charge_rate)); actor.oknex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(WEP_OVERKILL_NEX, chargepool_pause_regen); @@ -213,7 +213,7 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone } } - else if(WEP_CVAR_SEC(WEP_BLASTER, ammo)) + else if(WEP_CVAR_PRI(WEP_BLASTER, ammo)) { if(fire & 2) // only eat ammo when the button is pressed { @@ -223,21 +223,21 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone // 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(WEP_OVERKILL_NEX, ammo)) / WEP_CVAR_SEC(WEP_BLASTER, ammo)); + dt = min(dt, (actor.(weaponentity).clip_load - WEP_CVAR_PRI(WEP_OVERKILL_NEX, ammo)) / WEP_CVAR_PRI(WEP_BLASTER, ammo)); dt = max(0, dt); if(dt > 0) { - actor.(weaponentity).clip_load = max(WEP_CVAR_SEC(WEP_BLASTER, ammo), actor.(weaponentity).clip_load - WEP_CVAR_SEC(WEP_BLASTER, ammo) * dt); + actor.(weaponentity).clip_load = max(WEP_CVAR_PRI(WEP_BLASTER, ammo), actor.(weaponentity).clip_load - WEP_CVAR_PRI(WEP_BLASTER, ammo) * dt); } actor.(weaponentity).(weapon_load[WEP_OVERKILL_NEX.m_id]) = actor.(weaponentity).clip_load; } else { - dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(WEP_OVERKILL_NEX, ammo)) / WEP_CVAR_SEC(WEP_BLASTER, ammo)); + dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(WEP_OVERKILL_NEX, ammo)) / WEP_CVAR_PRI(WEP_BLASTER, ammo)); dt = max(0, dt); if(dt > 0) { - actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(WEP_BLASTER, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(WEP_BLASTER, ammo) * dt); + actor.(thiswep.ammo_field) = max(WEP_CVAR_PRI(WEP_BLASTER, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_PRI(WEP_BLASTER, ammo) * dt); } } } @@ -254,10 +254,10 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone } else if(WEP_CVAR(WEP_OVERKILL_NEX, secondary)) { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_BLASTER, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_BLASTER, refire))) { W_OverkillNex_Attack(thiswep, actor, weaponentity, 1); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready); } } } @@ -281,8 +281,8 @@ METHOD(OverkillNex, wr_checkammo2, bool(entity thiswep, entity actor, .entity we if (WEP_CVAR(WEP_OVERKILL_NEX, secondary)) { // don't allow charging if we don't have enough ammo - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_BLASTER, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_BLASTER, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_BLASTER, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_BLASTER, ammo); return ammo_amount; } else diff --git a/qcsrc/common/mutators/mutator/overkill/oknex.qh b/qcsrc/common/mutators/mutator/overkill/oknex.qh index 327be7354..120f6d66d 100644 --- a/qcsrc/common/mutators/mutator/overkill/oknex.qh +++ b/qcsrc/common/mutators/mutator/overkill/oknex.qh @@ -46,16 +46,16 @@ CLASS(OverkillNex, Weapon) P(class, prefix, refire, float, PRI) \ P(class, prefix, secondary, float, NONE) \ P(class, prefix, reload_ammo, float, NONE) \ - P(class, prefix, reload_time, float, NONE) \ - P(class, prefix, switchdelay_raise, float, NONE) \ - P(class, prefix, switchdelay_drop, float, NONE) \ - P(class, prefix, weaponreplace, string, NONE) \ - P(class, prefix, weaponstart, float, NONE) \ - P(class, prefix, weaponstartoverride, float, NONE) \ - P(class, prefix, weaponthrowable, float, NONE) \ + P(class, prefix, reload_time, float, NONE) \ + P(class, prefix, switchdelay_raise, float, NONE) \ + P(class, prefix, switchdelay_drop, float, NONE) \ + P(class, prefix, weaponreplace, string, NONE) \ + P(class, prefix, weaponstart, float, NONE) \ + P(class, prefix, weaponstartoverride, float, NONE) \ + P(class, prefix, weaponthrowable, float, NONE) \ P(class, prefix, refire_type, float, SEC) \ END() - W_PROPS(X, OverkillNex, oknex) + W_PROPS(X, OverkillNex, oknex) #undef X ENDCLASS(OverkillNex) diff --git a/qcsrc/common/mutators/mutator/overkill/okrpc.qc b/qcsrc/common/mutators/mutator/overkill/okrpc.qc index a4bbb3b6d..1f87c9d28 100644 --- a/qcsrc/common/mutators/mutator/overkill/okrpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/okrpc.qc @@ -138,9 +138,9 @@ METHOD(OverkillRocketPropelledChainsaw, wr_think, void(entity thiswep, entity ac if ((WEP_CVAR_SEC(WEP_OVERKILL_RPC, 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(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); + actor.jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); makevectors(actor.v_angle); - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); + W_Blaster_Attack(actor, weaponentity); if ((actor.(weaponentity).wframe == WFRAME_IDLE) || (actor.(weaponentity).wframe == WFRAME_FIRE2)) { @@ -173,13 +173,13 @@ METHOD(OverkillRocketPropelledChainsaw, wr_think, void(entity thiswep, entity ac } if ((fire & 2) && (WEP_CVAR_SEC(WEP_OVERKILL_RPC, refire_type) == 0)) // Secondary attack { - if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_BLASTER, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_BLASTER, refire))) { return; } makevectors(actor.v_angle); - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready); + W_Blaster_Attack(actor, weaponentity); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready); } } @@ -192,8 +192,8 @@ METHOD(OverkillRocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep, enti METHOD(OverkillRocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_BLASTER, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_BLASTER, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_BLASTER, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_BLASTER, ammo); return ammo_amount; } diff --git a/qcsrc/common/mutators/mutator/overkill/okshotgun.qc b/qcsrc/common/mutators/mutator/overkill/okshotgun.qc index 5678bf3ed..886401002 100644 --- a/qcsrc/common/mutators/mutator/overkill/okshotgun.qc +++ b/qcsrc/common/mutators/mutator/overkill/okshotgun.qc @@ -18,9 +18,9 @@ METHOD(OverkillShotgun, wr_think, void(entity thiswep, entity actor, .entity wea if ((WEP_CVAR_SEC(WEP_OVERKILL_SHOTGUN, 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(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); + actor.jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); makevectors(actor.v_angle); - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); + W_Blaster_Attack(actor, weaponentity); if ((actor.(weaponentity).wframe == WFRAME_IDLE) || (actor.(weaponentity).wframe == WFRAME_FIRE2)) { @@ -66,13 +66,13 @@ METHOD(OverkillShotgun, wr_think, void(entity thiswep, entity actor, .entity wea } if ((fire & 2) && (WEP_CVAR_SEC(WEP_OVERKILL_SHOTGUN, refire_type) == 0)) // Secondary attack { - if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_BLASTER, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_BLASTER, refire))) { return; } makevectors(actor.v_angle); - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready); + W_Blaster_Attack(actor, weaponentity); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready); } } diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index 922076f52..3a936a5d8 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -7,21 +7,20 @@ void W_Blaster_Touch(entity this, entity toucher) PROJECTILE_TOUCH(this, toucher); this.event_damage = func_null; - bool isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY); RadiusDamageForSource( this, (this.origin + (this.mins + this.maxs) * 0.5), this.velocity, this.realowner, - WEP_CVAR_BOTH(WEP_BLASTER, isprimary, damage), - WEP_CVAR_BOTH(WEP_BLASTER, isprimary, edgedamage), - WEP_CVAR_BOTH(WEP_BLASTER, isprimary, radius), + WEP_CVAR_PRI(WEP_BLASTER, damage), + WEP_CVAR_PRI(WEP_BLASTER, edgedamage), + WEP_CVAR_PRI(WEP_BLASTER, radius), NULL, NULL, false, - WEP_CVAR_BOTH(WEP_BLASTER, isprimary, force), - WEP_CVAR_BOTH(WEP_BLASTER, isprimary, force_zscale), + WEP_CVAR_PRI(WEP_BLASTER, force), + WEP_CVAR_PRI(WEP_BLASTER, force_zscale), this.projectiledeathtype, this.weaponentity_fld, toucher @@ -34,17 +33,16 @@ void W_Blaster_Think(entity this) { set_movetype(this, MOVETYPE_FLY); setthink(this, SUB_Remove); - bool isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY); - this.nextthink = time + WEP_CVAR_BOTH(WEP_BLASTER, isprimary, lifetime); + this.nextthink = time + WEP_CVAR_PRI(WEP_BLASTER, lifetime); CSQCProjectile(this, true, PROJECTILE_BLASTER, true); } -void W_Blaster_Attack(entity actor, .entity weaponentity, int atk_deathtype) +void W_Blaster_Attack(entity actor, .entity weaponentity) { - bool isprimary = !(atk_deathtype & HITTYPE_SECONDARY); - float atk_shotangle_rad = WEP_CVAR_BOTH(WEP_BLASTER, isprimary, shotangle) * DEG2RAD; - float atk_damage = WEP_CVAR_BOTH(WEP_BLASTER, isprimary, damage); - vector s_forward = v_forward * cos(atk_shotangle_rad) + v_up * sin(atk_shotangle_rad); + float atk_shotangle = WEP_CVAR_PRI(WEP_BLASTER, shotangle) * DEG2RAD; + float atk_damage = WEP_CVAR_PRI(WEP_BLASTER, damage); + vector s_forward = v_forward * cos(atk_shotangle) + v_up * sin(atk_shotangle); + int atk_deathtype = WEP_BLASTER.m_id; W_SetupShot_Dir(actor, weaponentity, s_forward, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, atk_damage, atk_deathtype); W_MuzzleFlash(WEP_BLASTER, actor, weaponentity, w_shotorg, w_shotdir); @@ -58,8 +56,8 @@ void W_Blaster_Attack(entity actor, .entity weaponentity, int atk_deathtype) setorigin(missile, w_shotorg); setsize(missile, '0 0 0', '0 0 0'); - float atk_speed = WEP_CVAR_BOTH(WEP_BLASTER, isprimary, speed); - float atk_spread = WEP_CVAR_BOTH(WEP_BLASTER, isprimary, spread); + float atk_speed = WEP_CVAR_PRI(WEP_BLASTER, speed); + float atk_spread = WEP_CVAR_PRI(WEP_BLASTER, spread); W_SetupProjVelocity_Explicit(missile, w_shotdir, v_up, atk_speed, 0, 0, atk_spread, false); missile.angles = vectoangles(missile.velocity); @@ -75,7 +73,7 @@ void W_Blaster_Attack(entity actor, .entity weaponentity, int atk_deathtype) missile.projectiledeathtype = atk_deathtype; missile.weaponentity_fld = weaponentity; setthink(missile, W_Blaster_Think); - missile.nextthink = time + WEP_CVAR_BOTH(WEP_BLASTER, isprimary, delay); + missile.nextthink = time + WEP_CVAR_PRI(WEP_BLASTER, delay); MUTATOR_CALLHOOK(EditProjectile, actor, missile); @@ -87,70 +85,45 @@ void W_Blaster_Attack(entity actor, .entity weaponentity, int atk_deathtype) METHOD(Blaster, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { - if(WEP_CVAR(WEP_BLASTER, secondary)) - { - if((random() * (WEP_CVAR_PRI(WEP_BLASTER, damage) + WEP_CVAR_SEC(WEP_BLASTER, damage))) > WEP_CVAR_PRI(WEP_BLASTER, damage)) - { PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_SEC(WEP_BLASTER, speed), 0, WEP_CVAR_SEC(WEP_BLASTER, lifetime), false, true); } - else - { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_BLASTER, speed), 0, WEP_CVAR_PRI(WEP_BLASTER, lifetime), false, true); } - } - else - { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_BLASTER, speed), 0, WEP_CVAR_PRI(WEP_BLASTER, lifetime), false, true); } + PHYS_INPUT_BUTTON_ATCK(actor) = + bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_BLASTER, speed), 0, WEP_CVAR_PRI(WEP_BLASTER, lifetime), false, true); } METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire)) { - if(fire & 1) - { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_BLASTER, refire))) - { - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready); - } - } - else if(fire & 2) - { - switch(WEP_CVAR(WEP_BLASTER, secondary)) - { - case 0: // switch to last used weapon - { - if(actor.(weaponentity).m_switchweapon == WEP_BLASTER) // don't do this if already switching - W_LastWeapon(actor, weaponentity); - break; - } - - case 1: // normal projectile secondary - { - if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_BLASTER, refire))) - { - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready); - } - - break; - } - } - } + if(fire & 1) + { + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_BLASTER, refire))) + { + W_Blaster_Attack(actor, weaponentity); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready); + } + } + else if(fire & 2) + { + if(actor.(weaponentity).m_switchweapon == WEP_BLASTER) // don't do this if already switching + W_LastWeapon(actor, weaponentity); + } } METHOD(Blaster, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - return true; // infinite ammo + return true; // infinite ammo } METHOD(Blaster, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - return true; // blaster has infinite ammo + return true; // blaster has infinite ammo } METHOD(Blaster, wr_suicidemessage, Notification(entity thiswep)) { - return WEAPON_BLASTER_SUICIDE; + return WEAPON_BLASTER_SUICIDE; } METHOD(Blaster, wr_killmessage, Notification(entity thiswep)) { - return WEAPON_BLASTER_MURDER; + return WEAPON_BLASTER_MURDER; } METHOD(OffhandBlaster, offhand_think, void(OffhandBlaster this, entity actor, bool key_pressed)) @@ -159,10 +132,10 @@ METHOD(OffhandBlaster, offhand_think, void(OffhandBlaster this, entity actor, bo { return; } - actor.jump_interval = time + WEP_CVAR_SEC(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); + actor.jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); .entity weaponentity = weaponentities[1]; makevectors(actor.v_angle); - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); + W_Blaster_Attack(actor, weaponentity); } #endif @@ -170,9 +143,9 @@ METHOD(OffhandBlaster, offhand_think, void(OffhandBlaster this, entity actor, bo METHOD(Blaster, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2 = w_org + w_backoff * 2; - pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1); - if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); } + vector org2 = w_org + w_backoff * 2; + pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1); + if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); } } #endif diff --git a/qcsrc/common/weapons/weapon/blaster.qh b/qcsrc/common/weapons/weapon/blaster.qh index 23e147478..27709310e 100644 --- a/qcsrc/common/weapons/weapon/blaster.qh +++ b/qcsrc/common/weapons/weapon/blaster.qh @@ -22,25 +22,24 @@ CLASS(Blaster, Weapon) #define X(BEGIN, P, END, class, prefix) \ BEGIN(class) \ - P(class, prefix, animtime, float, BOTH) \ - P(class, prefix, damage, float, BOTH) \ - P(class, prefix, delay, float, BOTH) \ - P(class, prefix, edgedamage, float, BOTH) \ - P(class, prefix, force, float, BOTH) \ - P(class, prefix, force_zscale, float, BOTH) \ - P(class, prefix, lifetime, float, BOTH) \ - P(class, prefix, radius, float, BOTH) \ - P(class, prefix, refire, float, BOTH) \ - P(class, prefix, secondary, float, NONE) \ - P(class, prefix, shotangle, float, BOTH) \ - P(class, prefix, speed, float, BOTH) \ - P(class, prefix, spread, float, BOTH) \ - P(class, prefix, switchdelay_drop, float, NONE) \ + P(class, prefix, animtime, float, PRI) \ + P(class, prefix, damage, float, PRI) \ + P(class, prefix, delay, float, PRI) \ + P(class, prefix, edgedamage, float, PRI) \ + P(class, prefix, force, float, PRI) \ + P(class, prefix, force_zscale, float, PRI) \ + P(class, prefix, lifetime, float, PRI) \ + P(class, prefix, radius, float, PRI) \ + P(class, prefix, refire, float, PRI) \ + P(class, prefix, shotangle, float, PRI) \ + P(class, prefix, speed, float, PRI) \ + P(class, prefix, spread, float, PRI) \ + P(class, prefix, switchdelay_drop, float, NONE) \ P(class, prefix, switchdelay_raise, float, NONE) \ - P(class, prefix, weaponreplace, string, NONE) \ - P(class, prefix, weaponstartoverride, float, NONE) \ - P(class, prefix, weaponstart, float, NONE) \ - P(class, prefix, weaponthrowable, float, NONE) \ + P(class, prefix, weaponreplace, string, NONE) \ + P(class, prefix, weaponstartoverride, float, NONE) \ + P(class, prefix, weaponstart, float, NONE) \ + P(class, prefix, weaponthrowable, float, NONE) \ END() W_PROPS(X, Blaster, blaster) #undef X diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 633ed64e0..8a82bba56 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -249,13 +249,13 @@ METHOD(Vaporizer, wr_aim, void(entity thiswep, entity actor, .entity weaponentit if((actor.items & IT_UNLIMITED_AMMO) || GetResource(actor, thiswep.ammo_type) > 0) PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 1, false, true); else - PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_SEC(WEP_BLASTER, speed), 0, WEP_CVAR_SEC(WEP_BLASTER, lifetime), false, true); // WEAPONTODO: replace with proper vaporizer cvars + PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_BLASTER, speed), 0, WEP_CVAR_PRI(WEP_BLASTER, lifetime), false, true); } METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(WEP_VAPORIZER, ammo)); // if the laser uses load, we also consider its ammo for reloading - if(WEP_CVAR(WEP_VAPORIZER, reload_ammo) && WEP_CVAR_SEC(WEP_BLASTER, ammo) && actor.(weaponentity).clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(WEP_BLASTER, ammo))) { // forced reload + if(WEP_CVAR(WEP_VAPORIZER, reload_ammo) && WEP_CVAR_PRI(WEP_BLASTER, ammo) && actor.(weaponentity).clip_load < min(vaporizer_ammo, WEP_CVAR_PRI(WEP_BLASTER, ammo))) { // forced reload thiswep.wr_reload(thiswep, actor, weaponentity); actor.(weaponentity).hagar_load = false; // rocket minsta exclusive var return; @@ -298,17 +298,17 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent else if (actor.(weaponentity).jump_interval <= time) { // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib) - actor.(weaponentity).jump_interval = time + WEP_CVAR_SEC(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); + actor.(weaponentity).jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); // decrease ammo for the laser? - if(WEP_CVAR_SEC(WEP_BLASTER, ammo)) - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_BLASTER, ammo), weaponentity); + if(WEP_CVAR_PRI(WEP_BLASTER, ammo)) + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(WEP_BLASTER, ammo), weaponentity); makevectors(actor.v_angle); - W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); + W_Blaster_Attack(actor, weaponentity); // now do normal refire - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready); } } else @@ -327,10 +327,10 @@ METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep, entity actor, .entity weap } METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - if(!WEP_CVAR_SEC(WEP_BLASTER, ammo)) + if(!WEP_CVAR_PRI(WEP_BLASTER, ammo)) return true; - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_BLASTER, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_BLASTER, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_BLASTER, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_BLASTER, ammo); return ammo_amount; } METHOD(Vaporizer, wr_resetplayer, void(entity thiswep, entity actor)) @@ -341,8 +341,8 @@ METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponen { float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(WEP_VAPORIZER, ammo)); float used_ammo; - if(WEP_CVAR_SEC(WEP_BLASTER, ammo)) - used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(WEP_BLASTER, ammo)); + if(WEP_CVAR_PRI(WEP_BLASTER, ammo)) + used_ammo = min(vaporizer_ammo, WEP_CVAR_PRI(WEP_BLASTER, ammo)); else used_ammo = vaporizer_ammo; -- 2.39.2