From 5aea27ce6752a0b9215e2e3022ced5bc45cdfdd4 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 11 Aug 2024 16:05:35 +0200 Subject: [PATCH] Switch to using the WEP_CVAR* macros I added in the previous commit as they are more versatile --- qcsrc/client/hud/crosshair.qc | 6 +- qcsrc/client/weapons/projectile.qc | 12 +- .../common/mutators/mutator/overkill/okhmg.qc | 34 ++-- .../mutators/mutator/overkill/okmachinegun.qc | 44 ++--- .../common/mutators/mutator/overkill/oknex.qc | 130 ++++++------- .../common/mutators/mutator/overkill/okrpc.qc | 56 +++--- .../mutators/mutator/overkill/okshotgun.qc | 48 ++--- qcsrc/common/turrets/turret/ewheel_weapon.qc | 4 +- qcsrc/common/turrets/turret/flac_weapon.qc | 4 +- qcsrc/common/turrets/turret/hellion_weapon.qc | 4 +- qcsrc/common/turrets/turret/hk_weapon.qc | 4 +- .../turrets/turret/machinegun_weapon.qc | 2 +- qcsrc/common/turrets/turret/mlrs_weapon.qc | 2 +- qcsrc/common/turrets/turret/phaser_weapon.qc | 4 +- qcsrc/common/turrets/turret/plasma_weapon.qc | 4 +- qcsrc/common/turrets/turret/tesla_weapon.qc | 4 +- qcsrc/common/turrets/turret/walker_weapon.qc | 4 +- qcsrc/common/weapons/all.qh | 13 +- qcsrc/common/weapons/weapon/arc.qc | 172 +++++++++--------- qcsrc/common/weapons/weapon/blaster.qc | 44 ++--- qcsrc/common/weapons/weapon/crylink.qc | 126 ++++++------- qcsrc/common/weapons/weapon/devastator.qc | 126 ++++++------- qcsrc/common/weapons/weapon/electro.qc | 146 +++++++-------- qcsrc/common/weapons/weapon/fireball.qc | 72 ++++---- qcsrc/common/weapons/weapon/hagar.qc | 116 ++++++------ qcsrc/common/weapons/weapon/hlac.qc | 66 +++---- qcsrc/common/weapons/weapon/hook.qc | 48 ++--- qcsrc/common/weapons/weapon/machinegun.qc | 122 ++++++------- qcsrc/common/weapons/weapon/minelayer.qc | 68 +++---- qcsrc/common/weapons/weapon/mortar.qc | 106 +++++------ qcsrc/common/weapons/weapon/porto.qc | 26 +-- qcsrc/common/weapons/weapon/rifle.qc | 68 +++---- qcsrc/common/weapons/weapon/seeker.qc | 124 ++++++------- qcsrc/common/weapons/weapon/shockwave.qc | 126 ++++++------- qcsrc/common/weapons/weapon/shotgun.qc | 166 ++++++++--------- qcsrc/common/weapons/weapon/tuba.qc | 18 +- qcsrc/common/weapons/weapon/vaporizer.qc | 40 ++-- qcsrc/common/weapons/weapon/vortex.qc | 128 ++++++------- qcsrc/server/bot/default/havocbot/havocbot.qc | 4 +- qcsrc/server/client.qc | 6 +- qcsrc/server/weapons/tracing.qh | 42 ++--- qcsrc/server/weapons/weaponsystem.qc | 2 +- 42 files changed, 1168 insertions(+), 1173 deletions(-) diff --git a/qcsrc/client/hud/crosshair.qc b/qcsrc/client/hud/crosshair.qc index 6084b319e..feea596f1 100644 --- a/qcsrc/client/hud/crosshair.qc +++ b/qcsrc/client/hud/crosshair.qc @@ -540,16 +540,16 @@ void HUD_Crosshair(entity this) ring_rgb = wcross_color; ring_image = "gfx/crosshair_ring_nexgun"; } - else if (autocvar_crosshair_ring && wepent.activeweapon == WEP_MINE_LAYER && WEP_CVAR(minelayer, limit) && autocvar_crosshair_ring_minelayer) + else if (autocvar_crosshair_ring && wepent.activeweapon == WEP_MINE_LAYER && WEP_CVAR(WEP_MINE_LAYER, limit) && autocvar_crosshair_ring_minelayer) { - ring_value = bound(0, wepent.minelayer_mines / WEP_CVAR(minelayer, limit), 1); + ring_value = bound(0, wepent.minelayer_mines / WEP_CVAR(WEP_MINE_LAYER, limit), 1); ring_alpha = autocvar_crosshair_ring_minelayer_alpha; ring_rgb = wcross_color; ring_image = "gfx/crosshair_ring"; } else if (wepent.activeweapon == WEP_HAGAR && wepent.hagar_load && autocvar_crosshair_ring_hagar) { - ring_value = bound(0, wepent.hagar_load / WEP_CVAR_SEC(hagar, load_max), 1); + ring_value = bound(0, wepent.hagar_load / WEP_CVAR_SEC(WEP_HAGAR, load_max), 1); ring_alpha = autocvar_crosshair_ring_hagar_alpha; ring_rgb = wcross_color; ring_image = "gfx/crosshair_ring"; diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 1df65036e..893d53ae5 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -358,8 +358,8 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) this.maxs = '4 4 4'; set_movetype(this, MOVETYPE_BOUNCE); settouch(this, func_null); - this.bouncefactor = WEP_CVAR_SEC(electro, bouncefactor); - this.bouncestop = WEP_CVAR_SEC(electro, bouncestop); + this.bouncefactor = WEP_CVAR_SEC(WEP_ELECTRO, bouncefactor); + this.bouncestop = WEP_CVAR_SEC(WEP_ELECTRO, bouncestop); break; case PROJECTILE_RPC: case PROJECTILE_ROCKET: @@ -376,8 +376,8 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) this.maxs = '3 3 3'; set_movetype(this, MOVETYPE_BOUNCE); settouch(this, func_null); - this.bouncefactor = WEP_CVAR(mortar, bouncefactor); - this.bouncestop = WEP_CVAR(mortar, bouncestop); + this.bouncefactor = WEP_CVAR(WEP_MORTAR, bouncefactor); + this.bouncestop = WEP_CVAR(WEP_MORTAR, bouncestop); break; case PROJECTILE_GOLEM_LIGHTNING: this.mins = '-8 -8 -8'; @@ -462,8 +462,8 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) this.maxs = '0 0 -4'; this.move_movetype = MOVETYPE_BOUNCE; settouch(this, func_null); - this.bouncefactor = WEP_CVAR_SEC(electro, bouncefactor); - this.bouncestop = WEP_CVAR_SEC(electro, bouncestop); + this.bouncefactor = WEP_CVAR_SEC(WEP_ELECTRO, bouncefactor); + this.bouncestop = WEP_CVAR_SEC(WEP_ELECTRO, bouncestop); break; */ default: diff --git a/qcsrc/common/mutators/mutator/overkill/okhmg.qc b/qcsrc/common/mutators/mutator/overkill/okhmg.qc index 7348f2efe..0f4da664f 100644 --- a/qcsrc/common/mutators/mutator/overkill/okhmg.qc +++ b/qcsrc/common/mutators/mutator/overkill/okhmg.qc @@ -25,9 +25,9 @@ void W_OverkillHeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity return; } - W_DecreaseAmmo(WEP_OVERKILL_HMG, actor, WEP_CVAR_PRI(okhmg, ammo), weaponentity); + W_DecreaseAmmo(WEP_OVERKILL_HMG, actor, WEP_CVAR_PRI(WEP_OVERKILL_HMG, ammo), weaponentity); - W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(okhmg, damage), WEP_OVERKILL_HMG.m_id); + W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(WEP_OVERKILL_HMG, damage), WEP_OVERKILL_HMG.m_id); if(!autocvar_g_norecoil) { @@ -35,8 +35,8 @@ void W_OverkillHeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity actor.punchangle_y = random () - 0.5; } - float okhmg_spread = bound(WEP_CVAR_PRI(okhmg, spread_min), WEP_CVAR_PRI(okhmg, spread_min) + (WEP_CVAR_PRI(okhmg, spread_add) * actor.(weaponentity).misc_bulletcounter), WEP_CVAR_PRI(okhmg, spread_max)); - fireBullet(actor, weaponentity, w_shotorg, w_shotdir, okhmg_spread, WEP_CVAR_PRI(okhmg, solidpenetration), WEP_CVAR_PRI(okhmg, damage), 0, WEP_CVAR_PRI(okhmg, force), WEP_OVERKILL_HMG.m_id, EFFECT_RIFLE); + float okhmg_spread = bound(WEP_CVAR_PRI(WEP_OVERKILL_HMG, spread_min), WEP_CVAR_PRI(WEP_OVERKILL_HMG, spread_min) + (WEP_CVAR_PRI(WEP_OVERKILL_HMG, spread_add) * actor.(weaponentity).misc_bulletcounter), WEP_CVAR_PRI(WEP_OVERKILL_HMG, spread_max)); + fireBullet(actor, weaponentity, w_shotorg, w_shotdir, okhmg_spread, WEP_CVAR_PRI(WEP_OVERKILL_HMG, solidpenetration), WEP_CVAR_PRI(WEP_OVERKILL_HMG, damage), 0, WEP_CVAR_PRI(WEP_OVERKILL_HMG, force), WEP_OVERKILL_HMG.m_id, EFFECT_RIFLE); actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1; @@ -48,8 +48,8 @@ void W_OverkillHeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity SpawnCasing(((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), vectoangles(v_forward), 3, actor, weaponentity); } - ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(okhmg, refire) * W_WeaponRateFactor(actor); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okhmg, refire), W_OverkillHeavyMachineGun_Attack_Auto); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(WEP_OVERKILL_HMG, refire) * W_WeaponRateFactor(actor); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_OVERKILL_HMG, refire), W_OverkillHeavyMachineGun_Attack_Auto); } METHOD(OverkillHeavyMachineGun, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) @@ -60,10 +60,10 @@ METHOD(OverkillHeavyMachineGun, wr_aim, void(entity thiswep, entity actor, .enti METHOD(OverkillHeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if ((WEP_CVAR_SEC(okhmg, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval)) + 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(okhmg, refire) * W_WeaponRateFactor(actor); + actor.jump_interval = time + WEP_CVAR_SEC(WEP_OVERKILL_HMG, refire) * W_WeaponRateFactor(actor); makevectors(actor.v_angle); W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); if ((actor.(weaponentity).wframe == WFRAME_IDLE) || @@ -80,7 +80,7 @@ METHOD(OverkillHeavyMachineGun, wr_think, void(entity thiswep, entity actor, .en animdecide_setaction(actor, ANIMACTION_SHOOT, true); } } - if (WEP_CVAR(okhmg, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(okhmg, ammo)) + if (WEP_CVAR(WEP_OVERKILL_HMG, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(WEP_OVERKILL_HMG, ammo)) { // Forced reload. thiswep.wr_reload(thiswep, actor, weaponentity); @@ -96,41 +96,41 @@ METHOD(OverkillHeavyMachineGun, wr_think, void(entity thiswep, entity actor, .en W_OverkillHeavyMachineGun_Attack_Auto(thiswep, actor, weaponentity, fire); return; } - if ((fire & 2) && (WEP_CVAR_SEC(okhmg, refire_type) == 0)) // Secondary attack + if ((fire & 2) && (WEP_CVAR_SEC(WEP_OVERKILL_HMG, refire_type) == 0)) // Secondary attack { - if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okhmg, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_OVERKILL_HMG, refire))) { return; } makevectors(actor.v_angle); W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okhmg, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_OVERKILL_HMG, animtime), w_ready); } } METHOD(OverkillHeavyMachineGun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okhmg, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_OVERKILL_HMG, ammo); if (autocvar_g_balance_okhmg_reload_ammo) { - ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_HMG.m_id]) >= WEP_CVAR_PRI(okhmg, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_HMG.m_id]) >= WEP_CVAR_PRI(WEP_OVERKILL_HMG, ammo); } return ammo_amount; } METHOD(OverkillHeavyMachineGun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(okhmg, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_OVERKILL_HMG, ammo); if (autocvar_g_balance_okhmg_reload_ammo) { - ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_HMG.m_id]) >= WEP_CVAR_SEC(okhmg, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_HMG.m_id]) >= WEP_CVAR_SEC(WEP_OVERKILL_HMG, ammo); } return ammo_amount; } METHOD(OverkillHeavyMachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, WEP_CVAR_PRI(okhmg, ammo), SND_RELOAD); + W_Reload(actor, weaponentity, WEP_CVAR_PRI(WEP_OVERKILL_HMG, ammo), SND_RELOAD); } METHOD(OverkillHeavyMachineGun, wr_suicidemessage, Notification(entity thiswep)) diff --git a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc index 9eec4f2ff..0bcbc258c 100644 --- a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc +++ b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc @@ -20,26 +20,26 @@ void W_OverkillMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weap return; } - W_DecreaseAmmo(WEP_OVERKILL_MACHINEGUN, actor, WEP_CVAR_PRI(okmachinegun, ammo), weaponentity); + W_DecreaseAmmo(WEP_OVERKILL_MACHINEGUN, actor, WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, ammo), weaponentity); - W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(okmachinegun, damage), WEP_OVERKILL_MACHINEGUN.m_id); + W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, damage), WEP_OVERKILL_MACHINEGUN.m_id); if(!autocvar_g_norecoil) { actor.punchangle_x = random() - 0.5; actor.punchangle_y = random() - 0.5; } - okmachinegun_spread = bound(WEP_CVAR_PRI(okmachinegun, spread_min), WEP_CVAR_PRI(okmachinegun, spread_min) + (WEP_CVAR_PRI(okmachinegun, spread_add) * actor.(weaponentity).misc_bulletcounter), WEP_CVAR_PRI(okmachinegun, spread_max)); + okmachinegun_spread = bound(WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, spread_min), WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, spread_min) + (WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, spread_add) * actor.(weaponentity).misc_bulletcounter), WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, spread_max)); fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, okmachinegun_spread, - WEP_CVAR_PRI(okmachinegun, solidpenetration), - WEP_CVAR_PRI(okmachinegun, damage), - WEP_CVAR(okmachinegun, damagefalloff_halflife), - WEP_CVAR(okmachinegun, damagefalloff_mindist), - WEP_CVAR(okmachinegun, damagefalloff_maxdist), + WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, solidpenetration), + WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, damage), + WEP_CVAR(WEP_OVERKILL_MACHINEGUN, damagefalloff_halflife), + WEP_CVAR(WEP_OVERKILL_MACHINEGUN, damagefalloff_mindist), + WEP_CVAR(WEP_OVERKILL_MACHINEGUN, damagefalloff_maxdist), 0, - WEP_CVAR_PRI(okmachinegun, force), - WEP_CVAR(okmachinegun, damagefalloff_forcehalflife), + WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, force), + WEP_CVAR(WEP_OVERKILL_MACHINEGUN, damagefalloff_forcehalflife), WEP_OVERKILL_MACHINEGUN.m_id, EFFECT_RIFLE, true); actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1; @@ -52,8 +52,8 @@ void W_OverkillMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weap SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), vectoangles(v_forward), 3, actor, weaponentity); } - ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(okmachinegun, refire) * W_WeaponRateFactor(actor); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okmachinegun, refire), W_OverkillMachineGun_Attack_Auto); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, refire) * W_WeaponRateFactor(actor); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, refire), W_OverkillMachineGun_Attack_Auto); } METHOD(OverkillMachineGun, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) @@ -64,10 +64,10 @@ 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)) + 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(okmachinegun, refire) * W_WeaponRateFactor(actor); + actor.jump_interval = time + WEP_CVAR_SEC(WEP_OVERKILL_MACHINEGUN, refire) * W_WeaponRateFactor(actor); makevectors(actor.v_angle); W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); if ((actor.(weaponentity).wframe == WFRAME_IDLE) || @@ -84,7 +84,7 @@ METHOD(OverkillMachineGun, wr_think, void(entity thiswep, entity actor, .entity animdecide_setaction(actor, ANIMACTION_SHOOT, true); } } - if (WEP_CVAR(okmachinegun, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(okmachinegun, ammo)) + if (WEP_CVAR(WEP_OVERKILL_MACHINEGUN, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, ammo)) { // Forced reload thiswep.wr_reload(thiswep, actor, weaponentity); @@ -100,25 +100,25 @@ METHOD(OverkillMachineGun, wr_think, void(entity thiswep, entity actor, .entity W_OverkillMachineGun_Attack_Auto(thiswep, actor, weaponentity, fire); return; } - if ((fire & 2) && (WEP_CVAR_SEC(okmachinegun, refire_type) == 0)) // Secondary attack + if ((fire & 2) && (WEP_CVAR_SEC(WEP_OVERKILL_MACHINEGUN, refire_type) == 0)) // Secondary attack { - if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(okmachinegun, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_OVERKILL_MACHINEGUN, refire))) { return; } makevectors(actor.v_angle); W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okmachinegun, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_OVERKILL_MACHINEGUN, animtime), w_ready); } } METHOD(OverkillMachineGun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { float ammo_amount; - ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okmachinegun, ammo); - if (WEP_CVAR(okmachinegun, reload_ammo)) + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, ammo); + if (WEP_CVAR(WEP_OVERKILL_MACHINEGUN, reload_ammo)) { - ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_MACHINEGUN.m_id]) >= WEP_CVAR_PRI(okmachinegun, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_MACHINEGUN.m_id]) >= WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, ammo); } return ammo_amount; } @@ -130,7 +130,7 @@ METHOD(OverkillMachineGun, wr_checkammo2, bool(entity thiswep, entity actor, .en METHOD(OverkillMachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, WEP_CVAR_PRI(okmachinegun, ammo), SND_RELOAD); + W_Reload(actor, weaponentity, WEP_CVAR_PRI(WEP_OVERKILL_MACHINEGUN, ammo), SND_RELOAD); } METHOD(OverkillMachineGun, wr_suicidemessage, Notification(entity thiswep)) diff --git a/qcsrc/common/mutators/mutator/overkill/oknex.qc b/qcsrc/common/mutators/mutator/overkill/oknex.qc index a6a6d633b..2a256aa2e 100644 --- a/qcsrc/common/mutators/mutator/overkill/oknex.qc +++ b/qcsrc/common/mutators/mutator/overkill/oknex.qc @@ -9,9 +9,9 @@ METHOD(OverkillNex, wr_glow, vector(OverkillNex this, int actor_colors, entity wepent)) { - if (!WEP_CVAR(oknex, charge)) return '0 0 0'; + if (!WEP_CVAR(WEP_OVERKILL_NEX, charge)) return '0 0 0'; float charge = max(0.25, wepent.oknex_charge); - float animlimit = WEP_CVAR(oknex, charge_animlimit); + float animlimit = WEP_CVAR(WEP_OVERKILL_NEX, charge_animlimit); float f = min(1, charge / animlimit); vector mycolors = colormapPaletteColor(actor_colors & 0x0F, true); vector g = f * (mycolors * 0.3); @@ -35,21 +35,21 @@ MUTATOR_HOOKFUNCTION(oknex_charge, GetPressedKeys) entity player = M_ARGV(0, entity); // WEAPONTODO - if(!WEP_CVAR(oknex, charge) || !WEP_CVAR(oknex, charge_velocity_rate)) + if(!WEP_CVAR(WEP_OVERKILL_NEX, charge) || !WEP_CVAR(WEP_OVERKILL_NEX, charge_velocity_rate)) return; for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { .entity weaponentity = weaponentities[slot]; - if (player.(weaponentity).m_weapon == WEP_OVERKILL_NEX && WEP_CVAR(oknex, charge) && WEP_CVAR(oknex, charge_velocity_rate) && vdist(vec2(player.velocity), >, WEP_CVAR(oknex, charge_minspeed))) + if (player.(weaponentity).m_weapon == WEP_OVERKILL_NEX && WEP_CVAR(WEP_OVERKILL_NEX, charge) && WEP_CVAR(WEP_OVERKILL_NEX, charge_velocity_rate) && vdist(vec2(player.velocity), >, WEP_CVAR(WEP_OVERKILL_NEX, charge_minspeed))) { float xyspeed = vlen(vec2(player.velocity)); // add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed - xyspeed = min(xyspeed, WEP_CVAR(oknex, charge_maxspeed)); - float f = (xyspeed - WEP_CVAR(oknex, charge_minspeed)) / (WEP_CVAR(oknex, charge_maxspeed) - WEP_CVAR(oknex, charge_minspeed)); + xyspeed = min(xyspeed, WEP_CVAR(WEP_OVERKILL_NEX, charge_maxspeed)); + float f = (xyspeed - WEP_CVAR(WEP_OVERKILL_NEX, charge_minspeed)) / (WEP_CVAR(WEP_OVERKILL_NEX, charge_maxspeed) - WEP_CVAR(WEP_OVERKILL_NEX, charge_minspeed)); // add the extra charge - player.(weaponentity).oknex_charge = min(1, player.(weaponentity).oknex_charge + WEP_CVAR(oknex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH); + player.(weaponentity).oknex_charge = min(1, player.(weaponentity).oknex_charge + WEP_CVAR(WEP_OVERKILL_NEX, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH); } } } @@ -58,21 +58,21 @@ void W_OverkillNex_Attack(Weapon thiswep, entity actor, .entity weaponentity, fl { float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge; - mydmg = WEP_CVAR_BOTH(oknex, !issecondary, damage); - myforce = WEP_CVAR_BOTH(oknex, !issecondary, force); - mymindist = WEP_CVAR_BOTH(oknex, !issecondary, damagefalloff_mindist); - mymaxdist = WEP_CVAR_BOTH(oknex, !issecondary, damagefalloff_maxdist); - myhalflife = WEP_CVAR_BOTH(oknex, !issecondary, damagefalloff_halflife); - myforcehalflife = WEP_CVAR_BOTH(oknex, !issecondary, damagefalloff_forcehalflife); - myammo = WEP_CVAR_BOTH(oknex, !issecondary, ammo); + mydmg = WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !issecondary, damage); + myforce = WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !issecondary, force); + mymindist = WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !issecondary, damagefalloff_mindist); + mymaxdist = WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !issecondary, damagefalloff_maxdist); + myhalflife = WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !issecondary, damagefalloff_halflife); + myforcehalflife = WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !issecondary, damagefalloff_forcehalflife); + myammo = WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !issecondary, ammo); float flying; flying = IsFlying(actor); // do this BEFORE to make the trace values from FireRailgunBullet last - if (WEP_CVAR(oknex, charge)) + if (WEP_CVAR(WEP_OVERKILL_NEX, charge)) { - charge = WEP_CVAR(oknex, charge_mindmg) / mydmg + (1 - WEP_CVAR(oknex, charge_mindmg) / mydmg) * actor.(weaponentity).oknex_charge; - actor.(weaponentity).oknex_charge *= WEP_CVAR(oknex, charge_shot_multiplier); // do this AFTER setting mydmg/myforce + charge = WEP_CVAR(WEP_OVERKILL_NEX, charge_mindmg) / mydmg + (1 - WEP_CVAR(WEP_OVERKILL_NEX, charge_mindmg) / mydmg) * actor.(weaponentity).oknex_charge; + actor.(weaponentity).oknex_charge *= WEP_CVAR(WEP_OVERKILL_NEX, charge_shot_multiplier); // do this AFTER setting mydmg/myforce // O RLY? -- divVerent // YA RLY -- FruitieX } @@ -84,9 +84,9 @@ void W_OverkillNex_Attack(Weapon thiswep, entity actor, .entity weaponentity, fl myforce *= charge; W_SetupShot(actor, weaponentity, true, 5, SND_NEXFIRE, CH_WEAPON_A, mydmg, thiswep.m_id); - if(charge > WEP_CVAR(oknex, charge_animlimit) && WEP_CVAR(oknex, charge_animlimit)) // if the OverkillNex is overcharged, we play an extra sound + if(charge > WEP_CVAR(WEP_OVERKILL_NEX, charge_animlimit) && WEP_CVAR(WEP_OVERKILL_NEX, charge_animlimit)) // if the OverkillNex is overcharged, we play an extra sound { - sound(actor, CH_WEAPON_B, SND_NEXCHARGE, VOL_BASE * (charge - 0.5 * WEP_CVAR(oknex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(oknex, charge_animlimit)), ATTN_NORM); + sound(actor, CH_WEAPON_B, SND_NEXCHARGE, VOL_BASE * (charge - 0.5 * WEP_CVAR(WEP_OVERKILL_NEX, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(WEP_OVERKILL_NEX, charge_animlimit)), ATTN_NORM); } yoda = 0; @@ -117,30 +117,30 @@ METHOD(OverkillNex, wr_aim, void(entity thiswep, entity actor, .entity weaponent PHYS_INPUT_BUTTON_ATCK(actor) = true; else { - if(WEP_CVAR(oknex, charge)) + if(WEP_CVAR(WEP_OVERKILL_NEX, charge)) PHYS_INPUT_BUTTON_ATCK2(actor) = true; } } METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if (WEP_CVAR(oknex, charge) && actor.(weaponentity).oknex_charge < WEP_CVAR(oknex, charge_limit)) + if (WEP_CVAR(WEP_OVERKILL_NEX, charge) && actor.(weaponentity).oknex_charge < WEP_CVAR(WEP_OVERKILL_NEX, charge_limit)) { - actor.(weaponentity).oknex_charge = min(1, actor.(weaponentity).oknex_charge + WEP_CVAR(oknex, charge_rate) * frametime / W_TICSPERFRAME); + actor.(weaponentity).oknex_charge = min(1, actor.(weaponentity).oknex_charge + WEP_CVAR(WEP_OVERKILL_NEX, charge_rate) * frametime / W_TICSPERFRAME); } - if (WEP_CVAR_SEC(oknex, chargepool)) + if (WEP_CVAR_SEC(WEP_OVERKILL_NEX, chargepool)) if (actor.(weaponentity).oknex_chargepool_ammo < 1) { if (actor.oknex_chargepool_pauseregen_finished < time) - actor.(weaponentity).oknex_chargepool_ammo = min(1, actor.(weaponentity).oknex_chargepool_ammo + WEP_CVAR_SEC(oknex, chargepool_regen) * frametime / W_TICSPERFRAME); - actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(oknex, chargepool_pause_regen)); + actor.(weaponentity).oknex_chargepool_ammo = min(1, actor.(weaponentity).oknex_chargepool_ammo + WEP_CVAR_SEC(WEP_OVERKILL_NEX, chargepool_regen) * frametime / W_TICSPERFRAME); + actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(WEP_OVERKILL_NEX, chargepool_pause_regen)); } - if ((WEP_CVAR_SEC(oknex, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval)) + 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(oknex, refire) * W_WeaponRateFactor(actor); + actor.jump_interval = time + WEP_CVAR_SEC(WEP_OVERKILL_NEX, refire) * W_WeaponRateFactor(actor); makevectors(actor.v_angle); W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); if ((actor.(weaponentity).wframe == WFRAME_IDLE) || @@ -158,7 +158,7 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone } } - if (autocvar_g_balance_oknex_reload_ammo && actor.(weaponentity).clip_load < WEP_CVAR_PRI(oknex, ammo)) + if (autocvar_g_balance_oknex_reload_ammo && actor.(weaponentity).clip_load < WEP_CVAR_PRI(WEP_OVERKILL_NEX, ammo)) { // Rorced reload thiswep.wr_reload(thiswep, actor, weaponentity); @@ -166,98 +166,98 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone } if (fire & 1) // Primary attack { - if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(oknex, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_OVERKILL_NEX, refire))) { return; } W_OverkillNex_Attack(thiswep, actor, weaponentity, 0); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(oknex, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_OVERKILL_NEX, animtime), w_ready); return; } - if ((fire & 2) && (WEP_CVAR(oknex, secondary) == 2) && (WEP_CVAR_SEC(oknex, refire_type) == 0)) + 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(oknex, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_OVERKILL_NEX, refire))) { return; } makevectors(actor.v_angle); W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(oknex, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_OVERKILL_NEX, animtime), w_ready); return; } #if 0 - if ((WEP_CVAR(oknex, charge) && (WEP_CVAR(oknex, secondary) == 1)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2)) + if ((WEP_CVAR(WEP_OVERKILL_NEX, charge) && (WEP_CVAR(WEP_OVERKILL_NEX, secondary) == 1)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2)) { - if(WEP_CVAR(oknex, charge)) + if(WEP_CVAR(WEP_OVERKILL_NEX, charge)) { - actor.(weaponentity).oknex_charge_rottime = time + WEP_CVAR(oknex, charge_rot_pause); + actor.(weaponentity).oknex_charge_rottime = time + WEP_CVAR(WEP_OVERKILL_NEX, charge_rot_pause); float dt = frametime / W_TICSPERFRAME; if(actor.(weaponentity).oknex_charge < 1) { - if(WEP_CVAR_SEC(oknex, chargepool)) + if(WEP_CVAR_SEC(WEP_OVERKILL_NEX, chargepool)) { - if(WEP_CVAR_SEC(oknex, ammo)) + if(WEP_CVAR_SEC(WEP_OVERKILL_NEX, ammo)) { // always deplete if secondary is held - actor.(weaponentity).oknex_chargepool_ammo = max(0, actor.(weaponentity).oknex_chargepool_ammo - WEP_CVAR_SEC(oknex, ammo) * dt); + actor.(weaponentity).oknex_chargepool_ammo = max(0, actor.(weaponentity).oknex_chargepool_ammo - WEP_CVAR_SEC(WEP_OVERKILL_NEX, ammo) * dt); - dt = min(dt, (1 - actor.(weaponentity).oknex_charge) / WEP_CVAR(oknex, charge_rate)); - actor.oknex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(oknex, chargepool_pause_regen); + 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); dt = min(dt, actor.(weaponentity).oknex_chargepool_ammo); dt = max(0, dt); - actor.(weaponentity).oknex_charge += dt * WEP_CVAR(oknex, charge_rate); + actor.(weaponentity).oknex_charge += dt * WEP_CVAR(WEP_OVERKILL_NEX, charge_rate); } } - else if(WEP_CVAR_SEC(oknex, ammo)) + else if(WEP_CVAR_SEC(WEP_OVERKILL_NEX, ammo)) { if(fire & 2) // only eat ammo when the button is pressed { - dt = min(dt, (1 - actor.(weaponentity).oknex_charge) / WEP_CVAR(oknex, charge_rate)); + dt = min(dt, (1 - actor.(weaponentity).oknex_charge) / WEP_CVAR(WEP_OVERKILL_NEX, charge_rate)); if(!(actor.items & IT_UNLIMITED_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(oknex, ammo)) / WEP_CVAR_SEC(oknex, ammo)); + dt = min(dt, (actor.(weaponentity).clip_load - WEP_CVAR_PRI(WEP_OVERKILL_NEX, ammo)) / WEP_CVAR_SEC(WEP_OVERKILL_NEX, ammo)); dt = max(0, dt); if(dt > 0) { - actor.(weaponentity).clip_load = max(WEP_CVAR_SEC(oknex, ammo), actor.(weaponentity).clip_load - WEP_CVAR_SEC(oknex, ammo) * dt); + actor.(weaponentity).clip_load = max(WEP_CVAR_SEC(WEP_OVERKILL_NEX, ammo), actor.(weaponentity).clip_load - WEP_CVAR_SEC(WEP_OVERKILL_NEX, 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(oknex, ammo)) / WEP_CVAR_SEC(oknex, ammo)); + dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(WEP_OVERKILL_NEX, ammo)) / WEP_CVAR_SEC(WEP_OVERKILL_NEX, ammo)); dt = max(0, dt); if(dt > 0) { - actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(oknex, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(oknex, ammo) * dt); + actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(WEP_OVERKILL_NEX, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(WEP_OVERKILL_NEX, ammo) * dt); } } } - actor.(weaponentity).oknex_charge += dt * WEP_CVAR(oknex, charge_rate); + actor.(weaponentity).oknex_charge += dt * WEP_CVAR(WEP_OVERKILL_NEX, charge_rate); } } else { - dt = min(dt, (1 - actor.(weaponentity).oknex_charge) / WEP_CVAR(oknex, charge_rate)); - actor.(weaponentity).oknex_charge += dt * WEP_CVAR(oknex, charge_rate); + dt = min(dt, (1 - actor.(weaponentity).oknex_charge) / WEP_CVAR(WEP_OVERKILL_NEX, charge_rate)); + actor.(weaponentity).oknex_charge += dt * WEP_CVAR(WEP_OVERKILL_NEX, charge_rate); } } } - else if(WEP_CVAR(oknex, secondary)) + else if(WEP_CVAR(WEP_OVERKILL_NEX, secondary)) { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(oknex, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_OVERKILL_NEX, refire))) { W_OverkillNex_Attack(thiswep, actor, weaponentity, 1); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(oknex, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(WEP_OVERKILL_NEX, animtime), w_ready); } } } @@ -271,18 +271,18 @@ METHOD(OverkillNex, wr_setup, void(entity thiswep, entity actor, .entity weapone METHOD(OverkillNex, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(oknex, ammo); - ammo_amount += (autocvar_g_balance_oknex_reload_ammo && actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(oknex, ammo)); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_OVERKILL_NEX, ammo); + ammo_amount += (autocvar_g_balance_oknex_reload_ammo && actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_OVERKILL_NEX, ammo)); return ammo_amount; } METHOD(OverkillNex, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - if (WEP_CVAR(oknex, secondary)) + 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(oknex, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(oknex, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_OVERKILL_NEX, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_OVERKILL_NEX, ammo); return ammo_amount; } else @@ -293,11 +293,11 @@ METHOD(OverkillNex, wr_checkammo2, bool(entity thiswep, entity actor, .entity we METHOD(OverkillNex, wr_resetplayer, void(entity thiswep, entity actor)) { - if (WEP_CVAR(oknex, charge)) { + if (WEP_CVAR(WEP_OVERKILL_NEX, charge)) { for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { .entity weaponentity = weaponentities[slot]; - actor.(weaponentity).oknex_charge = WEP_CVAR(oknex, charge_start); + actor.(weaponentity).oknex_charge = WEP_CVAR(WEP_OVERKILL_NEX, charge_start); } } actor.oknex_lasthit = 0; @@ -305,7 +305,7 @@ METHOD(OverkillNex, wr_resetplayer, void(entity thiswep, entity actor)) METHOD(OverkillNex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, WEP_CVAR_PRI(oknex, ammo), SND_RELOAD); + W_Reload(actor, weaponentity, WEP_CVAR_PRI(WEP_OVERKILL_NEX, ammo), SND_RELOAD); } METHOD(OverkillNex, wr_suicidemessage, Notification(entity thiswep)) @@ -320,7 +320,7 @@ METHOD(OverkillNex, wr_killmessage, Notification(entity thiswep)) METHOD(OverkillNex, wr_zoom, bool(entity thiswep, entity actor)) { - return PHYS_INPUT_BUTTON_ATCK2(actor) && !WEP_CVAR(oknex, secondary); + return PHYS_INPUT_BUTTON_ATCK2(actor) && !WEP_CVAR(WEP_OVERKILL_NEX, secondary); } #endif @@ -345,7 +345,7 @@ METHOD(OverkillNex, wr_init, void(entity thiswep)) METHOD(OverkillNex, wr_zoom, bool(entity thiswep, entity actor)) { - if(button_zoom || zoomscript_caught || (!WEP_CVAR(oknex, secondary) && button_attack2)) + if(button_zoom || zoomscript_caught || (!WEP_CVAR(WEP_OVERKILL_NEX, secondary) && button_attack2)) { return true; } @@ -358,7 +358,7 @@ METHOD(OverkillNex, wr_zoom, bool(entity thiswep, entity actor)) METHOD(OverkillNex, wr_zoomdir, bool(entity thiswep)) { - return button_attack2 && !WEP_CVAR(oknex, secondary); + return button_attack2 && !WEP_CVAR(WEP_OVERKILL_NEX, secondary); } #endif diff --git a/qcsrc/common/mutators/mutator/overkill/okrpc.qc b/qcsrc/common/mutators/mutator/overkill/okrpc.qc index 3437883ad..ec9a30ff1 100644 --- a/qcsrc/common/mutators/mutator/overkill/okrpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/okrpc.qc @@ -9,12 +9,12 @@ void W_OverkillRocketPropelledChainsaw_Explode(entity this, entity directhitenti this.event_damage = func_null; this.takedamage = DAMAGE_NO; - float explosion_damage = RadiusDamage(this, this.realowner, WEP_CVAR_PRI(okrpc, damage), WEP_CVAR_PRI(okrpc, edgedamage), WEP_CVAR_PRI(okrpc, radius), NULL, NULL, WEP_CVAR_PRI(okrpc, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); + float explosion_damage = RadiusDamage(this, this.realowner, WEP_CVAR_PRI(WEP_OVERKILL_RPC, damage), WEP_CVAR_PRI(WEP_OVERKILL_RPC, edgedamage), WEP_CVAR_PRI(WEP_OVERKILL_RPC, radius), NULL, NULL, WEP_CVAR_PRI(WEP_OVERKILL_RPC, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); if (explosion_damage > 0 && this.m_chainsaw_damage > 0) { // if chainsaw hit something, it removed fired damage (so that direct hit is 100%) // now that we also damaged something by explosion we'd go over 100% so let's add the fired damage back - accuracy_add(this.realowner, DEATH_WEAPONOF(this.projectiledeathtype), WEP_CVAR(okrpc, damage), 0); + accuracy_add(this.realowner, DEATH_WEAPONOF(this.projectiledeathtype), WEP_CVAR(WEP_OVERKILL_RPC, damage), 0); } delete(this); @@ -69,16 +69,16 @@ void W_OverkillRocketPropelledChainsaw_Think(entity this) { // The fired damage of the explosion is already counted in the statistics (when launching the chainsaw). // We remove it here so that a direct hit that passes through and doesn't damage anything by the explosion later is still 100%. - float fired_damage = WEP_CVAR_PRI(okrpc, damage2) - WEP_CVAR_PRI(okrpc, damage); - float hit_damage = WEP_CVAR_PRI(okrpc, damage2); + float fired_damage = WEP_CVAR_PRI(WEP_OVERKILL_RPC, damage2) - WEP_CVAR_PRI(WEP_OVERKILL_RPC, damage); + float hit_damage = WEP_CVAR_PRI(WEP_OVERKILL_RPC, damage2); accuracy_add(this.realowner, DEATH_WEAPONOF(this.projectiledeathtype), fired_damage, hit_damage); } - this.m_chainsaw_damage += WEP_CVAR_PRI(okrpc, damage2); + this.m_chainsaw_damage += WEP_CVAR_PRI(WEP_OVERKILL_RPC, damage2); } - Damage(trace_ent, this, this.realowner, WEP_CVAR_PRI(okrpc, damage2), this.projectiledeathtype, this.weaponentity_fld, this.origin, normalize(this.origin - trace_ent.origin) * WEP_CVAR_PRI(okrpc, force)); + Damage(trace_ent, this, this.realowner, WEP_CVAR_PRI(WEP_OVERKILL_RPC, damage2), this.projectiledeathtype, this.weaponentity_fld, this.origin, normalize(this.origin - trace_ent.origin) * WEP_CVAR_PRI(WEP_OVERKILL_RPC, force)); } - this.velocity = mydir * (myspeed + (WEP_CVAR_PRI(okrpc, speedaccel) * sys_frametime)); + this.velocity = mydir * (myspeed + (WEP_CVAR_PRI(WEP_OVERKILL_RPC, speedaccel) * sys_frametime)); UpdateCSQCProjectile(this); this.nextthink = time; @@ -88,18 +88,18 @@ void W_OverkillRocketPropelledChainsaw_Attack(Weapon thiswep, entity actor, .ent { entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(actor); - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(okrpc, ammo), weaponentity); - W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(okrpc, damage), thiswep.m_id); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(WEP_OVERKILL_RPC, ammo), weaponentity); + W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(WEP_OVERKILL_RPC, damage), thiswep.m_id); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); PROJECTILE_MAKETRIGGER(missile); missile.owner = missile.realowner = actor; missile.bot_dodge = true; - missile.bot_dodgerating = WEP_CVAR_PRI(okrpc, damage) * 2; + missile.bot_dodgerating = WEP_CVAR_PRI(WEP_OVERKILL_RPC, damage) * 2; missile.takedamage = DAMAGE_YES; - missile.damageforcescale = WEP_CVAR_PRI(okrpc, damageforcescale); - SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_PRI(okrpc, health)); + missile.damageforcescale = WEP_CVAR_PRI(WEP_OVERKILL_RPC, damageforcescale); + SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_PRI(WEP_OVERKILL_RPC, health)); missile.event_damage = W_OverkillRocketPropelledChainsaw_Damage; missile.damagedbycontents = true; IL_PUSH(g_damagedbycontents, missile); @@ -110,12 +110,12 @@ void W_OverkillRocketPropelledChainsaw_Attack(Weapon thiswep, entity actor, .ent setsize (missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot setorigin(missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point - W_SetupProjVelocity_Basic(missile, WEP_CVAR_PRI(okrpc, speed), 0); + W_SetupProjVelocity_Basic(missile, WEP_CVAR_PRI(WEP_OVERKILL_RPC, speed), 0); settouch(missile, W_OverkillRocketPropelledChainsaw_Touch); setthink(missile, W_OverkillRocketPropelledChainsaw_Think); - missile.cnt = time + WEP_CVAR_PRI(okrpc, lifetime); + missile.cnt = time + WEP_CVAR_PRI(WEP_OVERKILL_RPC, lifetime); missile.nextthink = time; missile.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, missile); @@ -130,15 +130,15 @@ void W_OverkillRocketPropelledChainsaw_Attack(Weapon thiswep, entity actor, .ent METHOD(OverkillRocketPropelledChainsaw, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { - PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(okrpc, speed), 0, WEP_CVAR_PRI(okrpc, lifetime), false, true); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_OVERKILL_RPC, speed), 0, WEP_CVAR_PRI(WEP_OVERKILL_RPC, lifetime), false, true); } METHOD(OverkillRocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if ((WEP_CVAR_SEC(okrpc, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval)) + 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(okrpc, refire) * W_WeaponRateFactor(actor); + actor.jump_interval = time + WEP_CVAR_SEC(WEP_OVERKILL_RPC, refire) * W_WeaponRateFactor(actor); makevectors(actor.v_angle); W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); if ((actor.(weaponentity).wframe == WFRAME_IDLE) || @@ -155,7 +155,7 @@ METHOD(OverkillRocketPropelledChainsaw, wr_think, void(entity thiswep, entity ac animdecide_setaction(actor, ANIMACTION_SHOOT, true); } } - if (WEP_CVAR(okrpc, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(okrpc, ammo)) + if (WEP_CVAR(WEP_OVERKILL_RPC, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(WEP_OVERKILL_RPC, ammo)) { // Forced reload thiswep.wr_reload(thiswep, actor, weaponentity); @@ -163,43 +163,43 @@ METHOD(OverkillRocketPropelledChainsaw, wr_think, void(entity thiswep, entity ac } if (fire & 1) // Primary attack { - if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(okrpc, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_OVERKILL_RPC, refire))) { return; } W_OverkillRocketPropelledChainsaw_Attack(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okrpc, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_OVERKILL_RPC, animtime), w_ready); return; } - if ((fire & 2) && (WEP_CVAR_SEC(okrpc, refire_type) == 0)) // Secondary attack + if ((fire & 2) && (WEP_CVAR_SEC(WEP_OVERKILL_RPC, refire_type) == 0)) // Secondary attack { - if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okrpc, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_OVERKILL_RPC, refire))) { return; } makevectors(actor.v_angle); W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okrpc, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_OVERKILL_RPC, animtime), w_ready); } } METHOD(OverkillRocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okrpc, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(okrpc, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_OVERKILL_RPC, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_OVERKILL_RPC, ammo); return ammo_amount; } METHOD(OverkillRocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(okrpc, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(okrpc, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_OVERKILL_RPC, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_OVERKILL_RPC, ammo); return ammo_amount; } METHOD(OverkillRocketPropelledChainsaw, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, WEP_CVAR_PRI(okrpc, ammo), SND_RELOAD); + W_Reload(actor, weaponentity, WEP_CVAR_PRI(WEP_OVERKILL_RPC, ammo), SND_RELOAD); } METHOD(OverkillRocketPropelledChainsaw, wr_suicidemessage, Notification(entity thiswep)) diff --git a/qcsrc/common/mutators/mutator/overkill/okshotgun.qc b/qcsrc/common/mutators/mutator/overkill/okshotgun.qc index 3524430b6..139b7b41a 100644 --- a/qcsrc/common/mutators/mutator/overkill/okshotgun.qc +++ b/qcsrc/common/mutators/mutator/overkill/okshotgun.qc @@ -3,7 +3,7 @@ #ifdef SVQC METHOD(OverkillShotgun, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { - if (vdist(actor.origin - actor.enemy.origin, >, WEP_CVAR_PRI(okshotgun, bot_range))) + if (vdist(actor.origin - actor.enemy.origin, >, WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, bot_range))) { PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false, false); } @@ -15,10 +15,10 @@ 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_SEC(okshotgun, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval)) + 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(okshotgun, refire) * W_WeaponRateFactor(actor); + actor.jump_interval = time + WEP_CVAR_SEC(WEP_OVERKILL_SHOTGUN, refire) * W_WeaponRateFactor(actor); makevectors(actor.v_angle); W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); if ((actor.(weaponentity).wframe == WFRAME_IDLE) || @@ -35,7 +35,7 @@ METHOD(OverkillShotgun, wr_think, void(entity thiswep, entity actor, .entity wea animdecide_setaction(actor, ANIMACTION_SHOOT, true); } } - if (WEP_CVAR(okshotgun, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(okshotgun, ammo)) + if (WEP_CVAR(WEP_OVERKILL_SHOTGUN, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, ammo)) { // Forced reload thiswep.wr_reload(thiswep, actor, weaponentity); @@ -43,43 +43,43 @@ METHOD(OverkillShotgun, wr_think, void(entity thiswep, entity actor, .entity wea } if (fire & 1) // Primary attack { - if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(okshotgun, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, refire))) { return; } W_Shotgun_Attack(thiswep, actor, weaponentity, true, - WEP_CVAR_PRI(okshotgun, ammo), - WEP_CVAR_PRI(okshotgun, damage), - WEP_CVAR_PRI(okshotgun, damagefalloff_halflife), - WEP_CVAR_PRI(okshotgun, damagefalloff_mindist), - WEP_CVAR_PRI(okshotgun, damagefalloff_maxdist), - WEP_CVAR_PRI(okshotgun, bullets), - WEP_CVAR_PRI(okshotgun, spread), - WEP_CVAR_PRI(okshotgun, spread_pattern), - WEP_CVAR_PRI(okshotgun, spread_pattern_scale), - WEP_CVAR_PRI(okshotgun, solidpenetration), - WEP_CVAR_PRI(okshotgun, force), - WEP_CVAR_PRI(okshotgun, damagefalloff_forcehalflife), + WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, ammo), + WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, damage), + WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, damagefalloff_halflife), + WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, damagefalloff_mindist), + WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, damagefalloff_maxdist), + WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, bullets), + WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, spread), + WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, spread_pattern), + WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, spread_pattern_scale), + WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, solidpenetration), + WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, force), + WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, damagefalloff_forcehalflife), EFFECT_RIFLE_WEAK); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okshotgun, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, animtime), w_ready); return; } - if ((fire & 2) && (WEP_CVAR_SEC(okshotgun, refire_type) == 0)) // Secondary attack + if ((fire & 2) && (WEP_CVAR_SEC(WEP_OVERKILL_SHOTGUN, refire_type) == 0)) // Secondary attack { - if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okshotgun, refire))) + if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_OVERKILL_SHOTGUN, refire))) { return; } makevectors(actor.v_angle); W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okshotgun, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_OVERKILL_SHOTGUN, animtime), w_ready); } } METHOD(OverkillShotgun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okshotgun, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_SHOTGUN.m_id]) >= WEP_CVAR_PRI(okshotgun, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_SHOTGUN.m_id]) >= WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, ammo); return ammo_amount; } @@ -90,7 +90,7 @@ METHOD(OverkillShotgun, wr_checkammo2, bool(entity thiswep, entity actor, .entit METHOD(OverkillShotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, WEP_CVAR_PRI(okshotgun, ammo), SND_RELOAD); // WEAPONTODO + W_Reload(actor, weaponentity, WEP_CVAR_PRI(WEP_OVERKILL_SHOTGUN, ammo), SND_RELOAD); // WEAPONTODO } METHOD(OverkillShotgun, wr_suicidemessage, Notification(entity thiswep)) diff --git a/qcsrc/common/turrets/turret/ewheel_weapon.qc b/qcsrc/common/turrets/turret/ewheel_weapon.qc index 4a0fe87c4..924e23d0c 100644 --- a/qcsrc/common/turrets/turret/ewheel_weapon.qc +++ b/qcsrc/common/turrets/turret/ewheel_weapon.qc @@ -7,14 +7,14 @@ SOUND(EWheelAttack_FIRE, W_Sound("electro_fire")); METHOD(EWheelAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_EWheelAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_EWHEEL.m_id); actor.tur_shotdir_updated = w_shotdir; actor.tur_shotorg = w_shotorg; actor.tur_head = actor; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); } turret_do_updates(actor); diff --git a/qcsrc/common/turrets/turret/flac_weapon.qc b/qcsrc/common/turrets/turret/flac_weapon.qc index ef7b60c8e..c1940ad7f 100644 --- a/qcsrc/common/turrets/turret/flac_weapon.qc +++ b/qcsrc/common/turrets/turret/flac_weapon.qc @@ -7,7 +7,7 @@ SOUND(FlacAttack_FIRE, W_Sound("electro_fire")); METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_FlacAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_FLAC.m_id); @@ -15,7 +15,7 @@ METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, .entity weaponen actor.tur_shotorg = w_shotorg; actor.tur_head = actor; actor.tur_impacttime = 10; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); } turret_tag_fire_update(actor); diff --git a/qcsrc/common/turrets/turret/hellion_weapon.qc b/qcsrc/common/turrets/turret/hellion_weapon.qc index 1c12a33c6..0fc190a2c 100644 --- a/qcsrc/common/turrets/turret/hellion_weapon.qc +++ b/qcsrc/common/turrets/turret/hellion_weapon.qc @@ -10,7 +10,7 @@ SOUND(HellionAttack_FIRE, W_Sound("electro_fire")); METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_HellionAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_HELLION.m_id); @@ -18,7 +18,7 @@ METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, .entity weapo actor.tur_shotorg = w_shotorg; actor.tur_head = actor; actor.shot_radius = 500; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); } if (!isPlayer) { if (actor.tur_head.frame != 0) diff --git a/qcsrc/common/turrets/turret/hk_weapon.qc b/qcsrc/common/turrets/turret/hk_weapon.qc index 4bb856d95..8a66d098e 100644 --- a/qcsrc/common/turrets/turret/hk_weapon.qc +++ b/qcsrc/common/turrets/turret/hk_weapon.qc @@ -15,14 +15,14 @@ METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, .entity { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_HunterKillerAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_HK.m_id); actor.tur_shotdir_updated = w_shotdir; actor.tur_shotorg = w_shotorg; actor.tur_head = actor; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); } entity missile = turret_projectile(actor, SND_ROCKET_FIRE, 6, 10, DEATH_TURRET_HK.m_id, PROJECTILE_ROCKET, false, false); te_explosion (missile.origin); diff --git a/qcsrc/common/turrets/turret/machinegun_weapon.qc b/qcsrc/common/turrets/turret/machinegun_weapon.qc index 9d4ff2294..0315240fb 100644 --- a/qcsrc/common/turrets/turret/machinegun_weapon.qc +++ b/qcsrc/common/turrets/turret/machinegun_weapon.qc @@ -8,7 +8,7 @@ METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, .ent { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(machinegun, sustained_refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(WEP_MACHINEGUN, sustained_refire))) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_MachineGunTurretAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_MACHINEGUN.m_id); diff --git a/qcsrc/common/turrets/turret/mlrs_weapon.qc b/qcsrc/common/turrets/turret/mlrs_weapon.qc index 75f2e8b4a..526caccdd 100644 --- a/qcsrc/common/turrets/turret/mlrs_weapon.qc +++ b/qcsrc/common/turrets/turret/mlrs_weapon.qc @@ -6,7 +6,7 @@ METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, entity actor, .entity we { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(machinegun, sustained_refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(WEP_MACHINEGUN, sustained_refire))) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_MLRSTurretAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_MLRS.m_id); diff --git a/qcsrc/common/turrets/turret/phaser_weapon.qc b/qcsrc/common/turrets/turret/phaser_weapon.qc index b9547bedd..be08f4b17 100644 --- a/qcsrc/common/turrets/turret/phaser_weapon.qc +++ b/qcsrc/common/turrets/turret/phaser_weapon.qc @@ -9,7 +9,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_PhaserTurretAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_PHASER.m_id); @@ -17,7 +17,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity actor.tur_shotorg = w_shotorg; actor.tur_head = actor; actor.shot_speed = 1; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); } entity beam = new(PhaserTurret_beam); setmodel(beam, MDL_TUR_PHASER_BEAM); diff --git a/qcsrc/common/turrets/turret/plasma_weapon.qc b/qcsrc/common/turrets/turret/plasma_weapon.qc index de53de984..5dd6f1e3b 100644 --- a/qcsrc/common/turrets/turret/plasma_weapon.qc +++ b/qcsrc/common/turrets/turret/plasma_weapon.qc @@ -5,14 +5,14 @@ SOUND(PlasmaAttack_FIRE, W_Sound("electro_fire")); METHOD(PlasmaAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_PlasmaAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_PLASMA.m_id); actor.tur_shotdir_updated = w_shotdir; actor.tur_shotorg = w_shotorg; actor.tur_head = actor; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); } entity missile = turret_projectile(actor, SND_HAGAR_FIRE, 1, 0, DEATH_TURRET_PLASMA.m_id, PROJECTILE_ELECTRO_BEAM, true, true); missile.missile_flags = MIF_SPLASH; diff --git a/qcsrc/common/turrets/turret/tesla_weapon.qc b/qcsrc/common/turrets/turret/tesla_weapon.qc index f6102801d..e877ce247 100644 --- a/qcsrc/common/turrets/turret/tesla_weapon.qc +++ b/qcsrc/common/turrets/turret/tesla_weapon.qc @@ -7,14 +7,14 @@ SOUND(TeslaCoilTurretAttack_FIRE, W_Sound("electro_fire")); METHOD(TeslaCoilTurretAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_TeslaCoilTurretAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_TESLA.m_id); actor.tur_shotdir_updated = w_shotdir; actor.tur_shotorg = w_shotorg; actor.tur_head = actor; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); } float d = actor.shot_dmg; diff --git a/qcsrc/common/turrets/turret/walker_weapon.qc b/qcsrc/common/turrets/turret/walker_weapon.qc index c16d13014..320118c86 100644 --- a/qcsrc/common/turrets/turret/walker_weapon.qc +++ b/qcsrc/common/turrets/turret/walker_weapon.qc @@ -6,14 +6,14 @@ SOUND(WalkerTurretAttack_FIRE, W_Sound("electro_fire")); METHOD(WalkerTurretAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_WalkerTurretAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_WALK_GUN.m_id); actor.tur_shotdir_updated = w_shotdir; actor.tur_shotorg = w_shotorg; actor.tur_head = actor; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); } sound (actor, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM); fireBullet(actor, weaponentity, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, 0, actor.shot_force, DEATH_TURRET_WALK_GUN.m_id, EFFECT_BULLET); diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index 729cd831f..27a506935 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -298,15 +298,10 @@ const .float reloading_time = reload_time; // read cvars from weapon settings // cvars are created as such: g_balance_wepname_name -#define WEP_CVAR(wepname, name) (_wep_##wepname.wepvar_##name) -#define WEP_CVAR_PRI(wepname, name) WEP_CVAR(wepname, primary_##name) -#define WEP_CVAR_SEC(wepname, name) WEP_CVAR(wepname, secondary_##name) -#define WEP_CVAR_BOTH(wepname, isprimary, name) ((isprimary) ? WEP_CVAR_PRI(wepname, name) : WEP_CVAR_SEC(wepname, name)) - -#define WEP_CVAR_E(wep, name) (wep.wepvar_##name) -#define WEP_CVAR_PRI_E(wep, name) WEP_CVAR_E(wep, primary_##name) -#define WEP_CVAR_SEC_E(wep, name) WEP_CVAR_E(wep, secondary_##name) -#define WEP_CVAR_BOTH_E(wep, isprimary, name) ((isprimary) ? WEP_CVAR_PRI_E(wep, name) : WEP_CVAR_SEC_E(wep, name)) +#define WEP_CVAR(wep, name) (wep.wepvar_##name) +#define WEP_CVAR_PRI(wep, name) WEP_CVAR(wep, primary_##name) +#define WEP_CVAR_SEC(wep, name) WEP_CVAR(wep, secondary_##name) +#define WEP_CVAR_BOTH(wep, isprimary, name) ((isprimary) ? WEP_CVAR_PRI(wep, name) : WEP_CVAR_SEC(wep, name)) const int WEP_FIRST = 1; #define WEP_LAST (REGISTRY_COUNT(Weapons) - 1) diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index d12310c18..4139bcc24 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -20,12 +20,12 @@ bool W_Arc_Beam_Send(entity this, entity to, int sf) if(sf & ARC_SF_SETTINGS) // settings information { - WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_degreespersegment)); - WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_distancepersegment)); - WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_maxangle)); - WriteCoord(MSG_ENTITY, WEP_CVAR(arc, beam_range)); - WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_returnspeed)); - WriteByte(MSG_ENTITY, WEP_CVAR(arc, beam_tightness) * 10); + WriteShort(MSG_ENTITY, WEP_CVAR(WEP_ARC, beam_degreespersegment)); + WriteShort(MSG_ENTITY, WEP_CVAR(WEP_ARC, beam_distancepersegment)); + WriteShort(MSG_ENTITY, WEP_CVAR(WEP_ARC, beam_maxangle)); + WriteCoord(MSG_ENTITY, WEP_CVAR(WEP_ARC, beam_range)); + WriteShort(MSG_ENTITY, WEP_CVAR(WEP_ARC, beam_returnspeed)); + WriteByte(MSG_ENTITY, WEP_CVAR(WEP_ARC, beam_tightness) * 10); WriteByte(MSG_ENTITY, drawlocal); WriteByte(MSG_ENTITY, etof(this.owner)); @@ -64,18 +64,18 @@ void Reset_ArcBeam(entity player, vector forward) float Arc_GetHeat_Percent(entity player, .entity weaponentity) { - if ( WEP_CVAR(arc, overheat_max) <= 0 || WEP_CVAR(arc, overheat_max) <= 0 ) + if ( WEP_CVAR(WEP_ARC, overheat_max) <= 0 || WEP_CVAR(WEP_ARC, overheat_max) <= 0 ) { player.arc_overheat = 0; return 0; } if ( player.(weaponentity).arc_beam ) - return player.(weaponentity).arc_beam.beam_heat/WEP_CVAR(arc, overheat_max); + return player.(weaponentity).arc_beam.beam_heat/WEP_CVAR(WEP_ARC, overheat_max); if ( player.arc_overheat > time ) { - return (player.arc_overheat-time) / WEP_CVAR(arc, overheat_max) + return (player.arc_overheat-time) / WEP_CVAR(WEP_ARC, overheat_max) * player.arc_cooldown; } @@ -91,8 +91,8 @@ void W_Arc_Bolt_Explode(entity this, entity directhitentity) { this.event_damage = func_null; RadiusDamage(this, this.realowner, - WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), - NULL, NULL, WEP_CVAR(arc, bolt_force), + WEP_CVAR(WEP_ARC, bolt_damage), WEP_CVAR(WEP_ARC, bolt_edgedamage), WEP_CVAR(WEP_ARC, bolt_radius), + NULL, NULL, WEP_CVAR(WEP_ARC, bolt_force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); @@ -121,7 +121,7 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam void W_Arc_Bolt_Touch(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); - if(this.cnt >= WEP_CVAR(arc, bolt_bounce_count) || !WEP_CVAR(arc, bolt_bounce_count) || toucher.takedamage == DAMAGE_AIM) { + if(this.cnt >= WEP_CVAR(WEP_ARC, bolt_bounce_count) || !WEP_CVAR(WEP_ARC, bolt_bounce_count) || toucher.takedamage == DAMAGE_AIM) { this.use(this, NULL, toucher); } else { this.cnt++; @@ -129,21 +129,21 @@ void W_Arc_Bolt_Touch(entity this, entity toucher) this.angles = vectoangles(this.velocity); this.owner = NULL; this.projectiledeathtype |= HITTYPE_BOUNCE; - if(WEP_CVAR(arc, bolt_bounce_explode)) + if(WEP_CVAR(WEP_ARC, bolt_bounce_explode)) { RadiusDamage(this, this.realowner, - WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), - NULL, NULL, WEP_CVAR(arc, bolt_force), + WEP_CVAR(WEP_ARC, bolt_damage), WEP_CVAR(WEP_ARC, bolt_edgedamage), WEP_CVAR(WEP_ARC, bolt_radius), + NULL, NULL, WEP_CVAR(WEP_ARC, bolt_force), this.projectiledeathtype, this.weaponentity_fld, toucher); } - if(this.cnt == 1 && WEP_CVAR(arc, bolt_bounce_lifetime)) - this.nextthink = time + WEP_CVAR(arc, bolt_bounce_lifetime); + if(this.cnt == 1 && WEP_CVAR(WEP_ARC, bolt_bounce_lifetime)) + this.nextthink = time + WEP_CVAR(WEP_ARC, bolt_bounce_lifetime); } } void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity, int fire) { - W_SetupShot(actor, weaponentity, false, 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, WEP_CVAR(arc, bolt_damage), thiswep.m_id | HITTYPE_SECONDARY); + W_SetupShot(actor, weaponentity, false, 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, WEP_CVAR(WEP_ARC, bolt_damage), thiswep.m_id | HITTYPE_SECONDARY); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); @@ -151,11 +151,11 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity, int f missile.owner = missile.realowner = actor; missile.bot_dodge = true; IL_PUSH(g_bot_dodge, missile); - missile.bot_dodgerating = WEP_CVAR(arc, bolt_damage); + missile.bot_dodgerating = WEP_CVAR(WEP_ARC, bolt_damage); missile.takedamage = DAMAGE_YES; - SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(arc, bolt_health)); - missile.damageforcescale = WEP_CVAR(arc, bolt_damageforcescale); + SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(WEP_ARC, bolt_health)); + missile.damageforcescale = WEP_CVAR(WEP_ARC, bolt_damageforcescale); missile.event_damage = W_Arc_Bolt_Damage; missile.damagedbycontents = true; IL_PUSH(g_damagedbycontents, missile); @@ -164,7 +164,7 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity, int f missile.cnt = 0; missile.use = W_Arc_Bolt_Explode_use; setthink(missile, adaptor_think2use_hittype_splash); - missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime); + missile.nextthink = time + WEP_CVAR(WEP_ARC, bolt_lifetime); PROJECTILE_MAKETRIGGER(missile); missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; missile.weaponentity_fld = weaponentity; @@ -172,7 +172,7 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity, int f setsize(missile, '0 0 0', '0 0 0'); set_movetype(missile, MOVETYPE_BOUNCEMISSILE); - W_SetupProjVelocity_PRE(missile, arc, bolt_); + W_SetupProjVelocity_PRE(missile, WEP_ARC, bolt_); missile.angles = vectoangles(missile.velocity); missile.flags = FL_PROJECTILE; @@ -186,12 +186,12 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity, int f actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1; if(actor.(weaponentity).misc_bulletcounter == 0) { - ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(arc, bolt_refire2) * W_WeaponRateFactor(actor); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(WEP_ARC, bolt_refire2) * W_WeaponRateFactor(actor); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_ARC, bolt_refire), w_ready); } else { - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), W_Arc_Attack_Bolt); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_ARC, bolt_refire), W_Arc_Attack_Bolt); } } @@ -206,7 +206,7 @@ void W_Arc_Beam_Think(entity this) } float burst = 0; - if( (PHYS_INPUT_BUTTON_ATCK2(own) && !WEP_CVAR(arc, bolt)) || this.beam_bursting) + if( (PHYS_INPUT_BUTTON_ATCK2(own) && !WEP_CVAR(WEP_ARC, bolt)) || this.beam_bursting) { if(!this.beam_bursting) this.beam_bursting = true; @@ -220,21 +220,21 @@ void W_Arc_Beam_Think(entity this) || !weapon_prepareattack_check(thiswep, own, weaponentity, this.beam_bursting, -1) || own.(weaponentity).m_switchweapon != WEP_ARC || (!PHYS_INPUT_BUTTON_ATCK(own) && !burst) - || (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max)) ) + || (WEP_CVAR(WEP_ARC, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(WEP_ARC, overheat_max)) ) { - if ( WEP_CVAR(arc, cooldown) > 0 ) + if ( WEP_CVAR(WEP_ARC, cooldown) > 0 ) { float cooldown_speed = 0; - if ( this.beam_heat > WEP_CVAR(arc, overheat_min) && WEP_CVAR(arc, cooldown) > 0 ) + if ( this.beam_heat > WEP_CVAR(WEP_ARC, overheat_min) && WEP_CVAR(WEP_ARC, cooldown) > 0 ) { - cooldown_speed = WEP_CVAR(arc, cooldown); + cooldown_speed = WEP_CVAR(WEP_ARC, cooldown); } else if ( !burst ) { - cooldown_speed = this.beam_heat / WEP_CVAR(arc, beam_refire); + cooldown_speed = this.beam_heat / WEP_CVAR(WEP_ARC, beam_refire); } - bool overheat = (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max)); + bool overheat = (WEP_CVAR(WEP_ARC, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(WEP_ARC, overheat_max)); if (overheat) { Send_Effect(EFFECT_ARC_OVERHEAT, this.beam_start, this.beam_wantdir, 1); @@ -243,7 +243,7 @@ void W_Arc_Beam_Think(entity this) if ( cooldown_speed ) { - if (WEP_CVAR(arc, cooldown_release) || overheat) + if (WEP_CVAR(WEP_ARC, cooldown_release) || overheat) own.arc_overheat = time + this.beam_heat / cooldown_speed; own.arc_cooldown = cooldown_speed; } @@ -267,9 +267,9 @@ void W_Arc_Beam_Think(entity this) { float rootammo; if(burst) - { rootammo = WEP_CVAR(arc, burst_ammo); } + { rootammo = WEP_CVAR(WEP_ARC, burst_ammo); } else - { rootammo = WEP_CVAR(arc, beam_ammo); } + { rootammo = WEP_CVAR(WEP_ARC, beam_ammo); } if(rootammo) { @@ -277,8 +277,8 @@ void W_Arc_Beam_Think(entity this) SetResource(own, thiswep.ammo_type, max(0, GetResource(own, thiswep.ammo_type) - (rootammo * frametime))); } } - float heat_speed = burst ? WEP_CVAR(arc, burst_heat) : WEP_CVAR(arc, beam_heat); - this.beam_heat = min( WEP_CVAR(arc, overheat_max), this.beam_heat + heat_speed*frametime ); + float heat_speed = burst ? WEP_CVAR(WEP_ARC, burst_heat) : WEP_CVAR(WEP_ARC, beam_heat); + this.beam_heat = min( WEP_CVAR(WEP_ARC, overheat_max), this.beam_heat + heat_speed*frametime ); makevectors(own.v_angle); @@ -289,8 +289,8 @@ void W_Arc_Beam_Think(entity this) 0, SND_Null, 0, - WEP_CVAR(arc, beam_damage) * coefficient, - WEP_CVAR(arc, beam_range), + WEP_CVAR(WEP_ARC, beam_damage) * coefficient, + WEP_CVAR(WEP_ARC, beam_range), thiswep.m_id ); @@ -334,9 +334,9 @@ void W_Arc_Beam_Think(entity this) // Perhaps we should do some form of rounding/snapping? float angle = vlen(w_shotdir - this.beam_dir) * RAD2DEG; float max_blendfactor = 1; - if(angle && (angle > WEP_CVAR(arc, beam_maxangle))) - max_blendfactor = WEP_CVAR(arc, beam_maxangle) / angle; - float blendfactor = bound(0, (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)), max_blendfactor); + if(angle && (angle > WEP_CVAR(WEP_ARC, beam_maxangle))) + max_blendfactor = WEP_CVAR(WEP_ARC, beam_maxangle) / angle; + float blendfactor = bound(0, (1 - (WEP_CVAR(WEP_ARC, beam_returnspeed) * frametime)), max_blendfactor); if(vdist(this.beam_dir - w_shotdir, <, 0.01)) this.beam_dir = w_shotdir; else @@ -347,21 +347,21 @@ void W_Arc_Beam_Think(entity this) // calculate how many segments are needed float max_allowed_segments = ARC_MAX_SEGMENTS; - if(WEP_CVAR(arc, beam_distancepersegment)) + if(WEP_CVAR(WEP_ARC, beam_distancepersegment)) { - max_allowed_segments = 1 + (vlen(w_shotdir / WEP_CVAR(arc, beam_distancepersegment))); + max_allowed_segments = 1 + (vlen(w_shotdir / WEP_CVAR(WEP_ARC, beam_distancepersegment))); max_allowed_segments = bound(1, max_allowed_segments, ARC_MAX_SEGMENTS); } - if(WEP_CVAR(arc, beam_degreespersegment)) + if(WEP_CVAR(WEP_ARC, beam_degreespersegment)) { - segments = min(angle, WEP_CVAR(arc, beam_maxangle)) / WEP_CVAR(arc, beam_degreespersegment); + segments = min(angle, WEP_CVAR(WEP_ARC, beam_maxangle)) / WEP_CVAR(WEP_ARC, beam_degreespersegment); segments = bound(1, segments, max_allowed_segments); } } - vector beam_endpos = (w_shotorg + (this.beam_dir * WEP_CVAR(arc, beam_range))); - vector beam_controlpoint = w_shotorg + w_shotdir * (WEP_CVAR(arc, beam_range) * (1 - WEP_CVAR(arc, beam_tightness))); + vector beam_endpos = (w_shotorg + (this.beam_dir * WEP_CVAR(WEP_ARC, beam_range))); + vector beam_controlpoint = w_shotorg + w_shotdir * (WEP_CVAR(WEP_ARC, beam_range) * (1 - WEP_CVAR(WEP_ARC, beam_tightness))); float i; float new_beam_type = 0; @@ -413,14 +413,14 @@ void W_Arc_Beam_Think(entity this) bool is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || IS_MONSTER(trace_ent)); if(SAME_TEAM(own, trace_ent)) { - float roothealth = ((burst) ? WEP_CVAR(arc, burst_healing_hps) : WEP_CVAR(arc, beam_healing_hps)); - float rootarmor = ((burst) ? WEP_CVAR(arc, burst_healing_aps) : WEP_CVAR(arc, beam_healing_aps)); - float hplimit = ((IS_PLAYER(trace_ent)) ? WEP_CVAR(arc, beam_healing_hmax) : RES_LIMIT_NONE); + float roothealth = ((burst) ? WEP_CVAR(WEP_ARC, burst_healing_hps) : WEP_CVAR(WEP_ARC, beam_healing_hps)); + float rootarmor = ((burst) ? WEP_CVAR(WEP_ARC, burst_healing_aps) : WEP_CVAR(WEP_ARC, beam_healing_aps)); + float hplimit = ((IS_PLAYER(trace_ent)) ? WEP_CVAR(WEP_ARC, beam_healing_hmax) : RES_LIMIT_NONE); Heal(trace_ent, own, (roothealth * coefficient), hplimit); if(IS_PLAYER(trace_ent) && rootarmor - && GetResource(trace_ent, RES_ARMOR) <= WEP_CVAR(arc, beam_healing_amax)) + && GetResource(trace_ent, RES_ARMOR) <= WEP_CVAR(WEP_ARC, beam_healing_amax)) { - GiveResourceWithLimit(trace_ent, RES_ARMOR, (rootarmor * coefficient), WEP_CVAR(arc, beam_healing_amax)); + GiveResourceWithLimit(trace_ent, RES_ARMOR, (rootarmor * coefficient), WEP_CVAR(WEP_ARC, beam_healing_amax)); trace_ent.pauserotarmor_finished = max( trace_ent.pauserotarmor_finished, time + autocvar_g_balance_pause_armor_rot @@ -429,7 +429,7 @@ void W_Arc_Beam_Think(entity this) if(roothealth || rootarmor) new_beam_type = ARC_BT_HEAL; } - else if(trace_ent.takedamage && (is_player || WEP_CVAR(arc, beam_nonplayerdamage))) + else if(trace_ent.takedamage && (is_player || WEP_CVAR(WEP_ARC, beam_nonplayerdamage))) { // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?) // NO. trace_endpos should be just fine. If not, @@ -437,9 +437,9 @@ void W_Arc_Beam_Think(entity this) vector hitorigin = trace_endpos; float falloff = ExponentialFalloff( - WEP_CVAR(arc, beam_falloff_mindist), - WEP_CVAR(arc, beam_falloff_maxdist), - WEP_CVAR(arc, beam_falloff_halflifedist), + WEP_CVAR(WEP_ARC, beam_falloff_mindist), + WEP_CVAR(WEP_ARC, beam_falloff_maxdist), + WEP_CVAR(WEP_ARC, beam_falloff_halflifedist), vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, hitorigin) - w_shotorg) ); @@ -447,12 +447,12 @@ void W_Arc_Beam_Think(entity this) if(is_player) { if(burst) - rootdamage = WEP_CVAR(arc, burst_damage); + rootdamage = WEP_CVAR(WEP_ARC, burst_damage); else - rootdamage = WEP_CVAR(arc, beam_damage); + rootdamage = WEP_CVAR(WEP_ARC, beam_damage); } else - rootdamage = WEP_CVAR(arc, beam_nonplayerdamage); + rootdamage = WEP_CVAR(WEP_ARC, beam_nonplayerdamage); if(accuracy_isgooddamage(own, trace_ent)) { @@ -467,7 +467,7 @@ void W_Arc_Beam_Think(entity this) WEP_ARC.m_id, weaponentity, hitorigin, - WEP_CVAR(arc, beam_force) * new_dir * coefficient * falloff + WEP_CVAR(WEP_ARC, beam_force) * new_dir * coefficient * falloff ); new_beam_type = ARC_BT_HIT; @@ -506,7 +506,7 @@ void W_Arc_Beam(float burst, entity actor, .entity weaponentity) set_movetype(beam, MOVETYPE_NONE); beam.bot_dodge = true; IL_PUSH(g_bot_dodge, beam); - beam.bot_dodgerating = WEP_CVAR(arc, beam_damage); + beam.bot_dodgerating = WEP_CVAR(WEP_ARC, beam_damage); beam.beam_bursting = burst; Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send); @@ -523,9 +523,9 @@ void W_Arc_Attack(Weapon thiswep, entity actor, .entity weaponentity, int fire) // attack handled by the beam itself, this is just a loop to keep the attack happening! // NOTE: arc doesn't use a refire - //ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(arc, refire) * W_WeaponRateFactor(actor); + //ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(WEP_ARC, refire) * W_WeaponRateFactor(actor); actor.(weaponentity).wframe = WFRAME_FIRE1; - weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), W_Arc_Attack); + weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(WEP_ARC, beam_animtime), W_Arc_Attack); } void Arc_Smoke(Weapon thiswep, entity actor, .entity weaponentity, int fire) { @@ -552,11 +552,11 @@ void Arc_Smoke(Weapon thiswep, entity actor, .entity weaponentity, int fire) } } } - else if ( actor.(weaponentity).arc_beam && WEP_CVAR(arc, overheat_max) > 0 && - actor.(weaponentity).arc_beam.beam_heat > WEP_CVAR(arc, overheat_min) ) + else if ( actor.(weaponentity).arc_beam && WEP_CVAR(WEP_ARC, overheat_max) > 0 && + actor.(weaponentity).arc_beam.beam_heat > WEP_CVAR(WEP_ARC, overheat_min) ) { - if ( random() < (actor.(weaponentity).arc_beam.beam_heat-WEP_CVAR(arc, overheat_min)) / - ( WEP_CVAR(arc, overheat_max)-WEP_CVAR(arc, overheat_min) ) ) + if ( random() < (actor.(weaponentity).arc_beam.beam_heat-WEP_CVAR(WEP_ARC, overheat_min)) / + ( WEP_CVAR(WEP_ARC, overheat_max)-WEP_CVAR(WEP_ARC, overheat_min) ) ) Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 ); } @@ -571,14 +571,14 @@ void Arc_Smoke(Weapon thiswep, entity actor, .entity weaponentity, int fire) METHOD(Arc, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { - if(WEP_CVAR(arc, beam_botaimspeed)) + if(WEP_CVAR(WEP_ARC, beam_botaimspeed)) { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim( actor, weaponentity, - WEP_CVAR(arc, beam_botaimspeed), + WEP_CVAR(WEP_ARC, beam_botaimspeed), 0, - WEP_CVAR(arc, beam_botaimlifetime), + WEP_CVAR(WEP_ARC, beam_botaimlifetime), false, true ); } @@ -599,7 +599,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i Arc_Player_SetHeat(actor, weaponentity); Arc_Smoke(thiswep, actor, weaponentity, fire); - bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt)); + bool beam_fire2 = ((fire & 2) && !WEP_CVAR(WEP_ARC, bolt)); if (time >= actor.arc_overheat) if ((fire & 1) || beam_fire2 || actor.(weaponentity).arc_beam.beam_bursting) @@ -612,7 +612,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready); else #endif - weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(WEP_ARC, beam_animtime), w_ready); } #endif @@ -625,7 +625,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i if(!actor.(weaponentity).arc_BUTTON_ATCK_prev) { actor.(weaponentity).wframe = WFRAME_FIRE1; - weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), W_Arc_Attack); + weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(WEP_ARC, beam_animtime), W_Arc_Attack); actor.(weaponentity).arc_BUTTON_ATCK_prev = true; } } @@ -647,11 +647,11 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i float ammo_available = GetResource(actor, thiswep.ammo_type); // We don't want to shoot 3 rounds if there's 2 left in the mag, so we'll use a fraction. // Also keep the fraction <= 1 otherwise we'd mag dump in one burst. - float burst_fraction = min(1, ammo_available / WEP_CVAR(arc, bolt_ammo)); - int to_shoot = floor(WEP_CVAR(arc, bolt_count) * burst_fraction); + float burst_fraction = min(1, ammo_available / WEP_CVAR(WEP_ARC, bolt_ammo)); + int to_shoot = floor(WEP_CVAR(WEP_ARC, bolt_count) * burst_fraction); // We also don't want to use 3 rounds if there's only 2 left. - int to_use = min(WEP_CVAR(arc, bolt_ammo), ammo_available); + int to_use = min(WEP_CVAR(WEP_ARC, bolt_ammo), ammo_available); W_DecreaseAmmo(thiswep, actor, to_use, weaponentity); // Bursting counts up to 0 from a negative. @@ -663,8 +663,8 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i if(actor.(weaponentity).arc_BUTTON_ATCK_prev) { sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready); - ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor(actor); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_ARC, beam_animtime), w_ready); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(WEP_ARC, beam_refire) * W_WeaponRateFactor(actor); } actor.(weaponentity).arc_BUTTON_ATCK_prev = false; @@ -699,19 +699,19 @@ METHOD(Arc, wr_init, void(entity thiswep)) } METHOD(Arc, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - return ((!WEP_CVAR(arc, beam_ammo)) || (GetResource(actor, thiswep.ammo_type) > 0)); + return ((!WEP_CVAR(WEP_ARC, beam_ammo)) || (GetResource(actor, thiswep.ammo_type) > 0)); } METHOD(Arc, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - if(WEP_CVAR(arc, bolt)) + if(WEP_CVAR(WEP_ARC, bolt)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(arc, bolt_ammo); - ammo_amount += actor.(weaponentity).(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_ARC, bolt_ammo); + ammo_amount += actor.(weaponentity).(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(WEP_ARC, bolt_ammo); return ammo_amount; } else - return WEP_CVAR(arc, overheat_max) > 0 && - ((!WEP_CVAR(arc, burst_ammo)) || (GetResource(actor, thiswep.ammo_type) > 0)); + return WEP_CVAR(WEP_ARC, overheat_max) > 0 && + ((!WEP_CVAR(WEP_ARC, burst_ammo)) || (GetResource(actor, thiswep.ammo_type) > 0)); } METHOD(Arc, wr_killmessage, Notification(entity thiswep)) { diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index 426a68ec3..a76d9d4bb 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -14,14 +14,14 @@ void W_Blaster_Touch(entity this, entity toucher) (this.origin + (this.mins + this.maxs) * 0.5), this.velocity, this.realowner, - WEP_CVAR_BOTH_E(this.real_weapon, isprimary, damage), - WEP_CVAR_BOTH_E(this.real_weapon, isprimary, edgedamage), - WEP_CVAR_BOTH_E(this.real_weapon, isprimary, radius), + WEP_CVAR_BOTH(this.real_weapon, isprimary, damage), + WEP_CVAR_BOTH(this.real_weapon, isprimary, edgedamage), + WEP_CVAR_BOTH(this.real_weapon, isprimary, radius), NULL, NULL, false, - WEP_CVAR_BOTH_E(this.real_weapon, isprimary, force), - WEP_CVAR_BOTH_E(this.real_weapon, isprimary, force_zscale), + WEP_CVAR_BOTH(this.real_weapon, isprimary, force), + WEP_CVAR_BOTH(this.real_weapon, isprimary, force_zscale), this.projectiledeathtype, this.weaponentity_fld, toucher @@ -35,7 +35,7 @@ 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(blaster, isprimary, lifetime); + this.nextthink = time + WEP_CVAR_BOTH(WEP_BLASTER, isprimary, lifetime); CSQCProjectile(this, true, PROJECTILE_BLASTER, true); } @@ -46,8 +46,8 @@ void W_Blaster_Attack( float atk_deathtype) { bool isprimary = !(atk_deathtype & HITTYPE_SECONDARY); - float atk_shotangle_rad = WEP_CVAR_BOTH(blaster, isprimary, shotangle) * DEG2RAD; - float atk_damage = WEP_CVAR_BOTH(blaster, isprimary, damage); + 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); W_SetupShot_Dir(actor, weaponentity, s_forward, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, atk_damage, atk_deathtype); @@ -63,8 +63,8 @@ void W_Blaster_Attack( setorigin(missile, w_shotorg); setsize(missile, '0 0 0', '0 0 0'); - float atk_speed = WEP_CVAR_BOTH(blaster, isprimary, speed); - float atk_spread = WEP_CVAR_BOTH(blaster, isprimary, spread); + float atk_speed = WEP_CVAR_BOTH(WEP_BLASTER, isprimary, speed); + float atk_spread = WEP_CVAR_BOTH(WEP_BLASTER, isprimary, spread); W_SetupProjVelocity_Explicit(missile, w_shotdir, v_up, atk_speed, 0, 0, atk_spread, false); missile.angles = vectoangles(missile.velocity); @@ -80,7 +80,7 @@ void W_Blaster_Attack( missile.projectiledeathtype = atk_deathtype; missile.weaponentity_fld = weaponentity; setthink(missile, W_Blaster_Think); - missile.nextthink = time + WEP_CVAR_BOTH(blaster, isprimary, delay); + missile.nextthink = time + WEP_CVAR_BOTH(WEP_BLASTER, isprimary, delay); MUTATOR_CALLHOOK(EditProjectile, actor, missile); @@ -92,30 +92,30 @@ void W_Blaster_Attack( METHOD(Blaster, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { - if(WEP_CVAR(blaster, secondary)) + if(WEP_CVAR(WEP_BLASTER, secondary)) { - if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage)) - { PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false, true); } + 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(blaster, speed), 0, WEP_CVAR_PRI(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); } } else - { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(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(blaster, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_BLASTER, refire))) { W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready); } } else if(fire & 2) { - switch(WEP_CVAR(blaster, secondary)) + switch(WEP_CVAR(WEP_BLASTER, secondary)) { case 0: // switch to last used weapon { @@ -126,10 +126,10 @@ METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponenti case 1: // normal projectile secondary { - if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(blaster, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_BLASTER, refire))) { W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready); } break; @@ -164,7 +164,7 @@ METHOD(OffhandBlaster, offhand_think, void(OffhandBlaster this, entity actor, bo { return; } - actor.jump_interval = time + WEP_CVAR_SEC(blaster, refire) * W_WeaponRateFactor(actor); + actor.jump_interval = time + WEP_CVAR_SEC(WEP_BLASTER, refire) * W_WeaponRateFactor(actor); .entity weaponentity = weaponentities[1]; makevectors(actor.v_angle); W_Blaster_Attack(actor, this, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 60ab1336f..494a203f4 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -71,8 +71,8 @@ void W_Crylink_LinkExplode(entity e, entity e2, entity directhitentity) float isprimary = !(e.projectiledeathtype & HITTYPE_SECONDARY); - RadiusDamage(e, e.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * a, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * a, WEP_CVAR_BOTH(crylink, isprimary, radius), - NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * a, e.projectiledeathtype, e.weaponentity_fld, directhitentity); + RadiusDamage(e, e.realowner, WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, damage) * a, WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, edgedamage) * a, WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, radius), + NULL, NULL, WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, force) * a, e.projectiledeathtype, e.weaponentity_fld, directhitentity); W_Crylink_LinkExplode(e.queuenext, e2, directhitentity); @@ -189,18 +189,18 @@ void W_Crylink_LinkJoinEffect_Think(entity this) { float isprimary = !(e.projectiledeathtype & HITTYPE_SECONDARY); - if(WEP_CVAR_BOTH(crylink, isprimary, joinexplode)) + if(WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, joinexplode)) { - n /= WEP_CVAR_BOTH(crylink, isprimary, shots); + n /= WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, shots); RadiusDamage( e, e.realowner, - WEP_CVAR_BOTH(crylink, isprimary, joinexplode_damage) * n, - WEP_CVAR_BOTH(crylink, isprimary, joinexplode_edgedamage) * n, - WEP_CVAR_BOTH(crylink, isprimary, joinexplode_radius) * n, + WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, joinexplode_damage) * n, + WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, joinexplode_edgedamage) * n, + WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, joinexplode_radius) * n, e.realowner, NULL, - WEP_CVAR_BOTH(crylink, isprimary, joinexplode_force) * n, + WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, joinexplode_force) * n, e.projectiledeathtype, e.weaponentity_fld, NULL @@ -249,14 +249,14 @@ void W_Crylink_Touch(entity this, entity toucher) if(finalhit) f = 1; else - f = WEP_CVAR_BOTH(crylink, isprimary, bouncedamagefactor); + f = WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, bouncedamagefactor); if(a) f *= a; - float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), - NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * f, this.projectiledeathtype, this.weaponentity_fld, toucher); + float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, damage) * f, WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, edgedamage) * f, WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, radius), + NULL, NULL, WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, force) * f, this.projectiledeathtype, this.weaponentity_fld, toucher); - if(totaldamage && ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(this, WEP_CVAR_BOTH(crylink, isprimary, radius))))) + if(totaldamage && ((WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(this, WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, radius))))) { .entity weaponentity = this.weaponentity_fld; if(this == this.crylink_owner.(weaponentity).crylink_lastgroup) @@ -294,19 +294,19 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity) vector forward, right, up; float maxdmg; - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(crylink, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(WEP_CRYLINK, ammo), weaponentity); - maxdmg = WEP_CVAR_PRI(crylink, damage) * WEP_CVAR_PRI(crylink, shots); - maxdmg *= 1 + WEP_CVAR_PRI(crylink, bouncedamagefactor) * WEP_CVAR_PRI(crylink, bounces); - if(WEP_CVAR_PRI(crylink, joinexplode)) - maxdmg += WEP_CVAR_PRI(crylink, joinexplode_damage); + maxdmg = WEP_CVAR_PRI(WEP_CRYLINK, damage) * WEP_CVAR_PRI(WEP_CRYLINK, shots); + maxdmg *= 1 + WEP_CVAR_PRI(WEP_CRYLINK, bouncedamagefactor) * WEP_CVAR_PRI(WEP_CRYLINK, bounces); + if(WEP_CVAR_PRI(WEP_CRYLINK, joinexplode)) + maxdmg += WEP_CVAR_PRI(WEP_CRYLINK, joinexplode_damage); W_SetupShot(actor, weaponentity, false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, maxdmg, thiswep.m_id); forward = v_forward; right = v_right; up = v_up; - shots = WEP_CVAR_PRI(crylink, shots); + shots = WEP_CVAR_PRI(WEP_CRYLINK, shots); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); proj = prevproj = firstproj = NULL; for(counter = 0; counter < shots; ++counter) @@ -318,7 +318,7 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity) proj.crylink_owner = actor; proj.weaponentity_fld = weaponentity; proj.bot_dodge = true; - proj.bot_dodgerating = WEP_CVAR_PRI(crylink, damage); + proj.bot_dodgerating = WEP_CVAR_PRI(WEP_CRYLINK, damage); if(shots == 1) { proj.queuenext = proj; proj.queueprev = proj; @@ -348,25 +348,25 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity) setsize(proj, '0 0 0', '0 0 0'); s = W_CalculateSpreadPattern(1, counter, shots); - s = s * WEP_CVAR_PRI(crylink, spread) * autocvar_g_weaponspreadfactor; - W_SetupProjVelocity_Explicit(proj, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_PRI(crylink, speed), 0, 0, 0, false); + s = s * WEP_CVAR_PRI(WEP_CRYLINK, spread) * autocvar_g_weaponspreadfactor; + W_SetupProjVelocity_Explicit(proj, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_PRI(WEP_CRYLINK, speed), 0, 0, 0, false); settouch(proj, W_Crylink_Touch); setthink(proj, W_Crylink_Fadethink); if(counter == 0) { - proj.fade_time = time + WEP_CVAR_PRI(crylink, middle_lifetime); - proj.fade_rate = 1 / WEP_CVAR_PRI(crylink, middle_fadetime); - proj.nextthink = time + WEP_CVAR_PRI(crylink, middle_lifetime) + WEP_CVAR_PRI(crylink, middle_fadetime); + proj.fade_time = time + WEP_CVAR_PRI(WEP_CRYLINK, middle_lifetime); + proj.fade_rate = 1 / WEP_CVAR_PRI(WEP_CRYLINK, middle_fadetime); + proj.nextthink = time + WEP_CVAR_PRI(WEP_CRYLINK, middle_lifetime) + WEP_CVAR_PRI(WEP_CRYLINK, middle_fadetime); } else { - proj.fade_time = time + WEP_CVAR_PRI(crylink, other_lifetime); - proj.fade_rate = 1 / WEP_CVAR_PRI(crylink, other_fadetime); - proj.nextthink = time + WEP_CVAR_PRI(crylink, other_lifetime) + WEP_CVAR_PRI(crylink, other_fadetime); + proj.fade_time = time + WEP_CVAR_PRI(WEP_CRYLINK, other_lifetime); + proj.fade_rate = 1 / WEP_CVAR_PRI(WEP_CRYLINK, other_fadetime); + proj.nextthink = time + WEP_CVAR_PRI(WEP_CRYLINK, other_lifetime) + WEP_CVAR_PRI(WEP_CRYLINK, other_fadetime); } - proj.teleport_time = time + WEP_CVAR_PRI(crylink, joindelay); - proj.cnt = WEP_CVAR_PRI(crylink, bounces); + proj.teleport_time = time + WEP_CVAR_PRI(WEP_CRYLINK, joindelay); + proj.cnt = WEP_CVAR_PRI(WEP_CRYLINK, bounces); //proj.scale = 1 + 1 * proj.cnt; proj.angles = vectoangles(proj.velocity); @@ -382,7 +382,7 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity) MUTATOR_CALLHOOK(EditProjectile, actor, proj); } - if(WEP_CVAR_PRI(crylink, joinspread) != 0 && WEP_CVAR_PRI(crylink, shots) > 1) + if(WEP_CVAR_PRI(WEP_CRYLINK, joinspread) != 0 && WEP_CVAR_PRI(WEP_CRYLINK, shots) > 1) { actor.(weaponentity).crylink_lastgroup = proj; W_Crylink_CheckLinks(proj); @@ -398,19 +398,19 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity) vector forward, right, up; float maxdmg; - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(crylink, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_CRYLINK, ammo), weaponentity); - maxdmg = WEP_CVAR_SEC(crylink, damage) * WEP_CVAR_SEC(crylink, shots); - maxdmg *= 1 + WEP_CVAR_SEC(crylink, bouncedamagefactor) * WEP_CVAR_SEC(crylink, bounces); - if(WEP_CVAR_SEC(crylink, joinexplode)) - maxdmg += WEP_CVAR_SEC(crylink, joinexplode_damage); + maxdmg = WEP_CVAR_SEC(WEP_CRYLINK, damage) * WEP_CVAR_SEC(WEP_CRYLINK, shots); + maxdmg *= 1 + WEP_CVAR_SEC(WEP_CRYLINK, bouncedamagefactor) * WEP_CVAR_SEC(WEP_CRYLINK, bounces); + if(WEP_CVAR_SEC(WEP_CRYLINK, joinexplode)) + maxdmg += WEP_CVAR_SEC(WEP_CRYLINK, joinexplode_damage); W_SetupShot(actor, weaponentity, false, 2, SND_CRYLINK_FIRE2, CH_WEAPON_A, maxdmg, thiswep.m_id | HITTYPE_SECONDARY); forward = v_forward; right = v_right; up = v_up; - shots = WEP_CVAR_SEC(crylink, shots); + shots = WEP_CVAR_SEC(WEP_CRYLINK, shots); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); proj = prevproj = firstproj = NULL; for(counter = 0; counter < shots; ++counter) @@ -422,7 +422,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity) proj.realowner = proj.owner = actor; proj.crylink_owner = actor; proj.bot_dodge = true; - proj.bot_dodgerating = WEP_CVAR_SEC(crylink, damage); + proj.bot_dodgerating = WEP_CVAR_SEC(WEP_CRYLINK, damage); if(shots == 1) { proj.queuenext = proj; proj.queueprev = proj; @@ -451,34 +451,34 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity) setorigin(proj, w_shotorg); setsize(proj, '0 0 0', '0 0 0'); - if(WEP_CVAR_SEC(crylink, spreadtype) == 1) + if(WEP_CVAR_SEC(WEP_CRYLINK, spreadtype) == 1) { s = W_CalculateSpreadPattern(1, counter, shots); - s = s * WEP_CVAR_SEC(crylink, spread) * autocvar_g_weaponspreadfactor; + s = s * WEP_CVAR_SEC(WEP_CRYLINK, spread) * autocvar_g_weaponspreadfactor; s = w_shotdir + right * s.y + up * s.z; } else { - s = (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * WEP_CVAR_SEC(crylink, spread) * autocvar_g_weaponspreadfactor); + s = (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * WEP_CVAR_SEC(WEP_CRYLINK, spread) * autocvar_g_weaponspreadfactor); } - W_SetupProjVelocity_Explicit(proj, s, v_up, WEP_CVAR_SEC(crylink, speed), 0, 0, 0, false); + W_SetupProjVelocity_Explicit(proj, s, v_up, WEP_CVAR_SEC(WEP_CRYLINK, speed), 0, 0, 0, false); settouch(proj, W_Crylink_Touch); setthink(proj, W_Crylink_Fadethink); if(counter == (shots - 1) / 2) { - proj.fade_time = time + WEP_CVAR_SEC(crylink, middle_lifetime); - proj.fade_rate = 1 / WEP_CVAR_SEC(crylink, middle_fadetime); - proj.nextthink = time + WEP_CVAR_SEC(crylink, middle_lifetime) + WEP_CVAR_SEC(crylink, middle_fadetime); + proj.fade_time = time + WEP_CVAR_SEC(WEP_CRYLINK, middle_lifetime); + proj.fade_rate = 1 / WEP_CVAR_SEC(WEP_CRYLINK, middle_fadetime); + proj.nextthink = time + WEP_CVAR_SEC(WEP_CRYLINK, middle_lifetime) + WEP_CVAR_SEC(WEP_CRYLINK, middle_fadetime); } else { - proj.fade_time = time + WEP_CVAR_SEC(crylink, other_lifetime); - proj.fade_rate = 1 / WEP_CVAR_SEC(crylink, other_fadetime); - proj.nextthink = time + WEP_CVAR_SEC(crylink, other_lifetime) + WEP_CVAR_SEC(crylink, other_fadetime); + proj.fade_time = time + WEP_CVAR_SEC(WEP_CRYLINK, other_lifetime); + proj.fade_rate = 1 / WEP_CVAR_SEC(WEP_CRYLINK, other_fadetime); + proj.nextthink = time + WEP_CVAR_SEC(WEP_CRYLINK, other_lifetime) + WEP_CVAR_SEC(WEP_CRYLINK, other_fadetime); } - proj.teleport_time = time + WEP_CVAR_SEC(crylink, joindelay); - proj.cnt = WEP_CVAR_SEC(crylink, bounces); + proj.teleport_time = time + WEP_CVAR_SEC(WEP_CRYLINK, joindelay); + proj.cnt = WEP_CVAR_SEC(WEP_CRYLINK, bounces); //proj.scale = 1 + 1 * proj.cnt; proj.angles = vectoangles(proj.velocity); @@ -494,7 +494,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity) MUTATOR_CALLHOOK(EditProjectile, actor, proj); } - if(WEP_CVAR_SEC(crylink, joinspread) != 0 && WEP_CVAR_SEC(crylink, shots) > 1) + if(WEP_CVAR_SEC(WEP_CRYLINK, joinspread) != 0 && WEP_CVAR_SEC(WEP_CRYLINK, shots) > 1) { actor.(weaponentity).crylink_lastgroup = proj; W_Crylink_CheckLinks(proj); @@ -505,33 +505,33 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity) METHOD(Crylink, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { if(random() < 0.10) - PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false, true); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_CRYLINK, speed), 0, WEP_CVAR_PRI(WEP_CRYLINK, middle_lifetime), false, true); else - PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false, true); + PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_SEC(WEP_CRYLINK, speed), 0, WEP_CVAR_SEC(WEP_CRYLINK, middle_lifetime), false, true); } METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if(autocvar_g_balance_crylink_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload + if(autocvar_g_balance_crylink_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(WEP_CRYLINK, ammo), WEP_CVAR_SEC(WEP_CRYLINK, ammo))) { // forced reload thiswep.wr_reload(thiswep, actor, weaponentity); } else if(fire & 1) { if(actor.(weaponentity).crylink_waitrelease != 1) - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(crylink, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_CRYLINK, refire))) { W_Crylink_Attack(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_CRYLINK, animtime), w_ready); } } else if((fire & 2) && autocvar_g_balance_crylink_secondary) { if(actor.(weaponentity).crylink_waitrelease != 2) - if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(crylink, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_CRYLINK, refire))) { W_Crylink_Attack2(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_CRYLINK, animtime), w_ready); } } @@ -546,7 +546,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit entity linkjoineffect; float isprimary = (actor.(weaponentity).crylink_waitrelease == 1); - pos = W_Crylink_LinkJoin(actor.(weaponentity).crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed)); + pos = W_Crylink_LinkJoin(actor.(weaponentity).crylink_lastgroup, WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, joinspread) * WEP_CVAR_BOTH(WEP_CRYLINK, isprimary, speed)); linkjoineffect = new(linkjoineffect); linkjoineffect.weaponentity_fld = weaponentity; @@ -572,8 +572,8 @@ METHOD(Crylink, wr_checkammo1, bool(entity thiswep, entity actor, .entity weapon if(actor.(weaponentity).crylink_lastgroup && actor.(weaponentity).crylink_waitrelease) return true; - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(crylink, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(crylink, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_CRYLINK, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_CRYLINK, ammo); return ammo_amount; } METHOD(Crylink, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) @@ -582,13 +582,13 @@ METHOD(Crylink, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapon if(actor.(weaponentity).crylink_lastgroup && actor.(weaponentity).crylink_waitrelease) return true; - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(crylink, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(crylink, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_CRYLINK, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_CRYLINK, ammo); return ammo_amount; } METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND_RELOAD); + W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(WEP_CRYLINK, ammo), WEP_CVAR_SEC(WEP_CRYLINK, ammo)), SND_RELOAD); } METHOD(Crylink, wr_suicidemessage, Notification(entity thiswep)) { diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index ef08d30b8..d1f22665d 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -31,12 +31,12 @@ void W_Devastator_Explode(entity this, entity directhitentity) RadiusDamage( this, this.realowner, - WEP_CVAR(devastator, damage), - WEP_CVAR(devastator, edgedamage), - WEP_CVAR(devastator, radius), + WEP_CVAR(WEP_DEVASTATOR, damage), + WEP_CVAR(WEP_DEVASTATOR, edgedamage), + WEP_CVAR(WEP_DEVASTATOR, radius), NULL, NULL, - WEP_CVAR(devastator, force), + WEP_CVAR(WEP_DEVASTATOR, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity @@ -46,7 +46,7 @@ void W_Devastator_Explode(entity this, entity directhitentity) .entity weaponentity = this.weaponentity_fld; if(this.realowner.(weaponentity).m_weapon == thiswep) { - if(GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo)) + if(GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(WEP_DEVASTATOR, ammo)) if(!(this.realowner.items & IT_UNLIMITED_AMMO)) { this.realowner.cnt = thiswep.m_id; @@ -71,15 +71,15 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) bool handled_as_rocketjump = false; entity head = NULL; - bool allow_rocketjump = WEP_CVAR(devastator, remote_jump); + bool allow_rocketjump = WEP_CVAR(WEP_DEVASTATOR, remote_jump); MUTATOR_CALLHOOK(AllowRocketJumping, allow_rocketjump); allow_rocketjump = M_ARGV(0, bool); - if(allow_rocketjump && WEP_CVAR(devastator, remote_jump_radius)) + if(allow_rocketjump && WEP_CVAR(WEP_DEVASTATOR, remote_jump_radius)) { head = WarpZone_FindRadius( this.origin, - WEP_CVAR(devastator, remote_jump_radius), + WEP_CVAR(WEP_DEVASTATOR, remote_jump_radius), false ); @@ -87,20 +87,20 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) { if(head.takedamage && (head == this.realowner)) { - if(vdist(this.origin - head.WarpZone_findradius_nearest, <=, WEP_CVAR(devastator, remote_jump_radius))) + if(vdist(this.origin - head.WarpZone_findradius_nearest, <=, WEP_CVAR(WEP_DEVASTATOR, remote_jump_radius))) { // we handled this as a rocketjump :) handled_as_rocketjump = true; // modify velocity - if(WEP_CVAR(devastator, remote_jump_velocity_z_add)) + if(WEP_CVAR(WEP_DEVASTATOR, remote_jump_velocity_z_add)) { head.velocity_x *= 0.9; head.velocity_y *= 0.9; head.velocity_z = bound( - WEP_CVAR(devastator, remote_jump_velocity_z_min), - head.velocity.z + WEP_CVAR(devastator, remote_jump_velocity_z_add), - WEP_CVAR(devastator, remote_jump_velocity_z_max) + WEP_CVAR(WEP_DEVASTATOR, remote_jump_velocity_z_min), + head.velocity.z + WEP_CVAR(WEP_DEVASTATOR, remote_jump_velocity_z_add), + WEP_CVAR(WEP_DEVASTATOR, remote_jump_velocity_z_max) ); } @@ -108,12 +108,12 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) RadiusDamage( this, head, - WEP_CVAR(devastator, remote_jump_damage), - WEP_CVAR(devastator, remote_jump_damage), - WEP_CVAR(devastator, remote_jump_radius), + WEP_CVAR(WEP_DEVASTATOR, remote_jump_damage), + WEP_CVAR(WEP_DEVASTATOR, remote_jump_damage), + WEP_CVAR(WEP_DEVASTATOR, remote_jump_radius), NULL, head, - (WEP_CVAR(devastator, remote_jump_force) ? WEP_CVAR(devastator, remote_jump_force) : 0), + (WEP_CVAR(WEP_DEVASTATOR, remote_jump_force) ? WEP_CVAR(WEP_DEVASTATOR, remote_jump_force) : 0), this.projectiledeathtype | HITTYPE_BOUNCE, this.weaponentity_fld, NULL @@ -128,12 +128,12 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) RadiusDamage( this, this.realowner, - WEP_CVAR(devastator, remote_damage), - WEP_CVAR(devastator, remote_edgedamage), - WEP_CVAR(devastator, remote_radius), + WEP_CVAR(WEP_DEVASTATOR, remote_damage), + WEP_CVAR(WEP_DEVASTATOR, remote_edgedamage), + WEP_CVAR(WEP_DEVASTATOR, remote_radius), (handled_as_rocketjump ? head : NULL), NULL, - WEP_CVAR(devastator, remote_force), + WEP_CVAR(WEP_DEVASTATOR, remote_force), this.projectiledeathtype | HITTYPE_BOUNCE, this.weaponentity_fld, NULL @@ -142,7 +142,7 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) Weapon thiswep = WEP_DEVASTATOR; if(this.realowner.(weaponentity).m_weapon == thiswep) { - if(GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo)) + if(GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(WEP_DEVASTATOR, ammo)) if(!(this.realowner.items & IT_UNLIMITED_AMMO)) { this.realowner.cnt = thiswep.m_id; @@ -160,7 +160,7 @@ void W_Devastator_RemoteExplode(entity this, .entity weaponentity) { if((this.spawnshieldtime >= 0) ? (time >= this.spawnshieldtime) // timer - : (vdist(NearestPointOnBox(this.realowner, this.origin) - this.origin, >, WEP_CVAR(devastator, remote_radius))) // safety device + : (vdist(NearestPointOnBox(this.realowner, this.origin) - this.origin, >, WEP_CVAR(WEP_DEVASTATOR, remote_radius))) // safety device ) { W_Devastator_DoRemoteExplode(this, weaponentity); @@ -215,9 +215,9 @@ void W_Devastator_Think(entity this) // accelerate makevectors(this.angles.x * '-1 0 0' + this.angles.y * '0 1 0'); - velspeed = WEP_CVAR(devastator, speed) * W_WeaponSpeedFactor(this.realowner) - (this.velocity * v_forward); + velspeed = WEP_CVAR(WEP_DEVASTATOR, speed) * W_WeaponSpeedFactor(this.realowner) - (this.velocity * v_forward); if(velspeed > 0) - this.velocity = this.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor(this.realowner) * frametime, velspeed); + this.velocity = this.velocity + v_forward * min(WEP_CVAR(WEP_DEVASTATOR, speedaccel) * W_WeaponSpeedFactor(this.realowner) * frametime, velspeed); // laser guided, or remote detonation .entity weaponentity = this.weaponentity_fld; @@ -226,11 +226,11 @@ void W_Devastator_Think(entity this) if(this == this.realowner.(weaponentity).lastrocket) if(!this.realowner.(weaponentity).rl_release) if(!PHYS_INPUT_BUTTON_ATCK2(this)) - if(WEP_CVAR(devastator, guiderate)) + if(WEP_CVAR(WEP_DEVASTATOR, guiderate)) if(time > this.pushltime) if(!IS_DEAD(this.realowner)) { - f = WEP_CVAR(devastator, guideratedelay); + f = WEP_CVAR(WEP_DEVASTATOR, guideratedelay); if(f) f = bound(0, (time - this.pushltime) / f, 1); else @@ -251,8 +251,8 @@ void W_Devastator_Think(entity this) // now it gets tricky... we want to move like some curve to approximate the target direction // but we are limiting the rate at which we can turn! - goal = desiredorigin + ((this.origin - desiredorigin) * desireddir + WEP_CVAR(devastator, guidegoal)) * desireddir; - newdir = W_Devastator_SteerTo(olddir, normalize(goal - this.origin), cos(WEP_CVAR(devastator, guiderate) * f * frametime * DEG2RAD)); + goal = desiredorigin + ((this.origin - desiredorigin) * desireddir + WEP_CVAR(WEP_DEVASTATOR, guidegoal)) * desireddir; + newdir = W_Devastator_SteerTo(olddir, normalize(goal - this.origin), cos(WEP_CVAR(WEP_DEVASTATOR, guiderate) * f * frametime * DEG2RAD)); this.velocity = newdir * velspeed; this.angles = vectoangles(this.velocity); @@ -303,27 +303,27 @@ void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float d void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int fire) { - W_DecreaseAmmo(thiswep, actor, WEP_CVAR(devastator, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_DEVASTATOR, ammo), weaponentity); - W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(devastator, damage), thiswep.m_id); + W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(WEP_DEVASTATOR, damage), thiswep.m_id); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); entity missile = WarpZone_RefSys_SpawnSameRefSys(actor); missile.weaponentity_fld = weaponentity; missile.owner = missile.realowner = actor; actor.(weaponentity).lastrocket = missile; - if(WEP_CVAR(devastator, detonatedelay) >= 0) - missile.spawnshieldtime = time + WEP_CVAR(devastator, detonatedelay); + if(WEP_CVAR(WEP_DEVASTATOR, detonatedelay) >= 0) + missile.spawnshieldtime = time + WEP_CVAR(WEP_DEVASTATOR, detonatedelay); else missile.spawnshieldtime = -1; // NOTE: proximity based when rocket jumping - missile.pushltime = time + WEP_CVAR(devastator, guidedelay); + missile.pushltime = time + WEP_CVAR(WEP_DEVASTATOR, guidedelay); missile.classname = "rocket"; missile.bot_dodge = true; - missile.bot_dodgerating = WEP_CVAR(devastator, damage) * 2; // * 2 because it can be detonated inflight which makes it even more dangerous + missile.bot_dodgerating = WEP_CVAR(WEP_DEVASTATOR, damage) * 2; // * 2 because it can be detonated inflight which makes it even more dangerous missile.takedamage = DAMAGE_YES; - missile.damageforcescale = WEP_CVAR(devastator, damageforcescale); - SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(devastator, health)); + missile.damageforcescale = WEP_CVAR(WEP_DEVASTATOR, damageforcescale); + SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(WEP_DEVASTATOR, health)); missile.event_damage = W_Devastator_Damage; missile.damagedbycontents = true; IL_PUSH(g_damagedbycontents, missile); @@ -334,20 +334,20 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int setsize(missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot setorigin(missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point - W_SetupProjVelocity_Basic(missile, WEP_CVAR(devastator, speedstart), 0); + W_SetupProjVelocity_Basic(missile, WEP_CVAR(WEP_DEVASTATOR, speedstart), 0); missile.angles = vectoangles(missile.velocity); settouch(missile, W_Devastator_Touch); setthink(missile, W_Devastator_Think); missile.nextthink = time; - missile.cnt = time + WEP_CVAR(devastator, lifetime); + missile.cnt = time + WEP_CVAR(WEP_DEVASTATOR, lifetime); missile.rl_detonate_later = (fire & 2); // allow instant detonation missile.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, missile); IL_PUSH(g_bot_dodge, missile); missile.missile_flags = MIF_SPLASH; - CSQCProjectile(missile, WEP_CVAR(devastator, guiderate) == 0 && WEP_CVAR(devastator, speedaccel) == 0, PROJECTILE_ROCKET, false); // because of fly sound + CSQCProjectile(missile, WEP_CVAR(WEP_DEVASTATOR, guiderate) == 0 && WEP_CVAR(WEP_DEVASTATOR, speedaccel) == 0, PROJECTILE_ROCKET, false); // because of fly sound // common properties MUTATOR_CALLHOOK(EditProjectile, actor, missile); @@ -360,7 +360,7 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int METHOD(Devastator, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { - if (!WEP_CVAR(devastator, guidestop) && !actor.(weaponentity).rl_release) + if (!WEP_CVAR(WEP_DEVASTATOR, guidestop) && !actor.(weaponentity).rl_release) { int fired_rockets = 0; IL_EACH(g_projectiles, it.realowner == actor && it.classname == "rocket", @@ -373,23 +373,23 @@ METHOD(Devastator, wr_aim, void(entity thiswep, entity actor, .entity weaponenti } // aim and decide to fire if appropriate - float spd = WEP_CVAR(devastator, speed); + float spd = WEP_CVAR(WEP_DEVASTATOR, speed); // simulate rocket guide by calculating rocket trajectory with higher speed // 20 times faster at 90 degrees guide rate - if (WEP_CVAR(devastator, guiderate) > 0) - spd *= sqrt(WEP_CVAR(devastator, guiderate)) * (20 / 9.489); // 9.489 ~= sqrt(90) + if (WEP_CVAR(WEP_DEVASTATOR, guiderate) > 0) + spd *= sqrt(WEP_CVAR(WEP_DEVASTATOR, guiderate)) * (20 / 9.489); // 9.489 ~= sqrt(90) // no need to fire with high accuracy on large distances if rockets can be guided - bool shot_accurate = (WEP_CVAR(devastator, guiderate) < 50); - PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, spd, 0, WEP_CVAR(devastator, lifetime), false, shot_accurate); + bool shot_accurate = (WEP_CVAR(WEP_DEVASTATOR, guiderate) < 50); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, spd, 0, WEP_CVAR(WEP_DEVASTATOR, lifetime), false, shot_accurate); float pred_time = bound(0.02, 0.02 + (8 - skill) * 0.01, 0.1); if(skill >= 2) // skill 0 and 1 bots won't detonate rockets! { // decide whether to detonate rockets float selfdamage = 0, teamdamage = 0, enemydamage = 0; float pred_selfdamage = 0, pred_teamdamage = 0, pred_enemydamage = 0; - float edgedamage = WEP_CVAR(devastator, edgedamage); - float coredamage = WEP_CVAR(devastator, damage); - float edgeradius = WEP_CVAR(devastator, radius); + float edgedamage = WEP_CVAR(WEP_DEVASTATOR, edgedamage); + float coredamage = WEP_CVAR(WEP_DEVASTATOR, damage); + float edgeradius = WEP_CVAR(WEP_DEVASTATOR, radius); IL_EACH(g_projectiles, it.realowner == actor && it.classname == "rocket", { entity rocket = it; @@ -477,16 +477,16 @@ METHOD(Devastator, wr_aim, void(entity thiswep, entity actor, .entity weaponenti METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if(WEP_CVAR(devastator, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR(devastator, ammo)) { // forced reload + if(WEP_CVAR(WEP_DEVASTATOR, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR(WEP_DEVASTATOR, ammo)) { // forced reload thiswep.wr_reload(thiswep, actor, weaponentity); } else { if(fire & 1) { - if(actor.(weaponentity).rl_release || WEP_CVAR(devastator, guidestop)) - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire))) + if(actor.(weaponentity).rl_release || WEP_CVAR(WEP_DEVASTATOR, guidestop)) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(WEP_DEVASTATOR, refire))) { W_Devastator_Attack(thiswep, actor, weaponentity, fire); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_DEVASTATOR, animtime), w_ready); actor.(weaponentity).rl_release = 0; } } @@ -521,12 +521,12 @@ METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor, .entity wea if(ATTACK_FINISHED(actor, weaponentity) <= time || PS(actor).m_weapon != WEP_DEVASTATOR) { ammo_amount = false; - if(WEP_CVAR(devastator, reload_ammo)) + if(WEP_CVAR(WEP_DEVASTATOR, reload_ammo)) { - if(GetResource(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo) && actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo)) + if(GetResource(actor, thiswep.ammo_type) < WEP_CVAR(WEP_DEVASTATOR, ammo) && actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(WEP_DEVASTATOR, ammo)) ammo_amount = true; } - else if(GetResource(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo)) + else if(GetResource(actor, thiswep.ammo_type) < WEP_CVAR(WEP_DEVASTATOR, ammo)) ammo_amount = true; return !ammo_amount; } @@ -534,19 +534,19 @@ METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor, .entity wea #if 0 if(actor.rl_release == 0) { - LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE", actor.rl_release, GetResource(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo)); + LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE", actor.rl_release, GetResource(actor, thiswep.ammo_type), WEP_CVAR(WEP_DEVASTATOR, ammo)); return true; } else { - ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo); - LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s", actor.rl_release, GetResource(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE")); + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_DEVASTATOR, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(WEP_DEVASTATOR, ammo); + LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s", actor.rl_release, GetResource(actor, thiswep.ammo_type), WEP_CVAR(WEP_DEVASTATOR, ammo), (ammo_amount ? "TRUE" : "FALSE")); return ammo_amount; } #else - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(devastator, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_DEVASTATOR, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(WEP_DEVASTATOR, ammo); return ammo_amount; #endif } @@ -565,7 +565,7 @@ METHOD(Devastator, wr_resetplayer, void(entity thiswep, entity actor)) } METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, WEP_CVAR(devastator, ammo), SND_RELOAD); + W_Reload(actor, weaponentity, WEP_CVAR(WEP_DEVASTATOR, ammo), SND_RELOAD); } METHOD(Devastator, wr_suicidemessage, Notification(entity thiswep)) { diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 280267a9a..2a53deb0a 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -5,7 +5,7 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own) { - entity e = WarpZone_FindRadius(org, rad, !WEP_CVAR(electro, combo_comboradius_thruwall)); + entity e = WarpZone_FindRadius(org, rad, !WEP_CVAR(WEP_ELECTRO, combo_comboradius_thruwall)); while(e) { if(e.classname == "electro_orb") @@ -18,10 +18,10 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own) continue; } // do we allow thruwall triggering? - if(WEP_CVAR(electro, combo_comboradius_thruwall)) + if(WEP_CVAR(WEP_ELECTRO, combo_comboradius_thruwall)) { // if distance is greater than thruwall distance, check to make sure it's not through a wall - if(vdist(e.WarpZone_findradius_dist, >, WEP_CVAR(electro, combo_comboradius_thruwall))) + if(vdist(e.WarpZone_findradius_dist, >, WEP_CVAR(WEP_ELECTRO, combo_comboradius_thruwall))) { WarpZone_TraceLine(org, e.origin, MOVE_NOMONSTERS, e); if(trace_fraction != 1) @@ -43,8 +43,8 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own) // delay combo chains, looks cooler float delay = 0; - if (WEP_CVAR(electro, combo_speed)) - delay = vlen(e.WarpZone_findradius_dist) / WEP_CVAR(electro, combo_speed); + if (WEP_CVAR(WEP_ELECTRO, combo_speed)) + delay = vlen(e.WarpZone_findradius_dist) / WEP_CVAR(WEP_ELECTRO, combo_speed); e.nextthink = time + delay; } e = e.chain; @@ -53,7 +53,7 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own) void W_Electro_ExplodeCombo(entity this) { - W_Electro_TriggerCombo(this.origin, WEP_CVAR(electro, combo_comboradius), this.realowner); + W_Electro_TriggerCombo(this.origin, WEP_CVAR(WEP_ELECTRO, combo_comboradius), this.realowner); this.event_damage = func_null; this.velocity = this.movedir; // .velocity must be != '0 0 0' for particle fx and decal to work @@ -61,12 +61,12 @@ void W_Electro_ExplodeCombo(entity this) RadiusDamage( this, this.realowner, - WEP_CVAR(electro, combo_damage), - WEP_CVAR(electro, combo_edgedamage), - WEP_CVAR(electro, combo_radius), + WEP_CVAR(WEP_ELECTRO, combo_damage), + WEP_CVAR(WEP_ELECTRO, combo_edgedamage), + WEP_CVAR(WEP_ELECTRO, combo_radius), NULL, NULL, - WEP_CVAR(electro, combo_force), + WEP_CVAR(WEP_ELECTRO, combo_force), WEP_ELECTRO.m_id | HITTYPE_BOUNCE, // use THIS type for a combo because primary can't bounce this.weaponentity_fld, NULL @@ -93,12 +93,12 @@ void W_Electro_Explode(entity this, entity directhitentity) RadiusDamage( this, this.realowner, - WEP_CVAR_SEC(electro, damage), - WEP_CVAR_SEC(electro, edgedamage), - WEP_CVAR_SEC(electro, radius), + WEP_CVAR_SEC(WEP_ELECTRO, damage), + WEP_CVAR_SEC(WEP_ELECTRO, edgedamage), + WEP_CVAR_SEC(WEP_ELECTRO, radius), NULL, NULL, - WEP_CVAR_SEC(electro, force), + WEP_CVAR_SEC(WEP_ELECTRO, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity @@ -106,16 +106,16 @@ void W_Electro_Explode(entity this, entity directhitentity) } else { - W_Electro_TriggerCombo(this.origin, WEP_CVAR_PRI(electro, comboradius), this.realowner); + W_Electro_TriggerCombo(this.origin, WEP_CVAR_PRI(WEP_ELECTRO, comboradius), this.realowner); RadiusDamage( this, this.realowner, - WEP_CVAR_PRI(electro, damage), - WEP_CVAR_PRI(electro, edgedamage), - WEP_CVAR_PRI(electro, radius), + WEP_CVAR_PRI(WEP_ELECTRO, damage), + WEP_CVAR_PRI(WEP_ELECTRO, edgedamage), + WEP_CVAR_PRI(WEP_ELECTRO, radius), NULL, NULL, - WEP_CVAR_PRI(electro, force), + WEP_CVAR_PRI(WEP_ELECTRO, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity @@ -148,10 +148,10 @@ void W_Electro_Bolt_Think(entity this) return; } - if(WEP_CVAR_PRI(electro, midaircombo_radius)) + if(WEP_CVAR_PRI(WEP_ELECTRO, midaircombo_radius)) { float found = 0; - entity e = WarpZone_FindRadius(this.origin, WEP_CVAR_PRI(electro, midaircombo_radius), true); + entity e = WarpZone_FindRadius(this.origin, WEP_CVAR_PRI(WEP_ELECTRO, midaircombo_radius), true); // loop through nearby orbs and trigger them while(e) @@ -168,15 +168,15 @@ void W_Electro_Bolt_Think(entity this) bool explode; if (this.owner == e.owner) { - explode = WEP_CVAR_PRI(electro, midaircombo_own); + explode = WEP_CVAR_PRI(WEP_ELECTRO, midaircombo_own); } else if (SAME_TEAM(this.owner, e.owner)) { - explode = WEP_CVAR_PRI(electro, midaircombo_teammate); + explode = WEP_CVAR_PRI(WEP_ELECTRO, midaircombo_teammate); } else { - explode = WEP_CVAR_PRI(electro, midaircombo_enemy); + explode = WEP_CVAR_PRI(WEP_ELECTRO, midaircombo_enemy); } if (explode) @@ -192,8 +192,8 @@ void W_Electro_Bolt_Think(entity this) // while keeping the chaining delay. setthink(e, W_Electro_ExplodeCombo); float delay = 0; - if (WEP_CVAR_PRI(electro, midaircombo_speed)) - delay = vlen(e.WarpZone_findradius_dist) / WEP_CVAR_PRI(electro, midaircombo_speed); + if (WEP_CVAR_PRI(WEP_ELECTRO, midaircombo_speed)) + delay = vlen(e.WarpZone_findradius_dist) / WEP_CVAR_PRI(WEP_ELECTRO, midaircombo_speed); e.nextthink = time + delay; ++found; @@ -203,10 +203,10 @@ void W_Electro_Bolt_Think(entity this) } // if we triggered an orb, should we explode? if not, lets try again next time - if(found && WEP_CVAR_PRI(electro, midaircombo_explode)) + if(found && WEP_CVAR_PRI(WEP_ELECTRO, midaircombo_explode)) { this.use(this, NULL, NULL); } else - { this.nextthink = min(time + WEP_CVAR_PRI(electro, midaircombo_interval), this.ltime); } + { this.nextthink = min(time + WEP_CVAR_PRI(WEP_ELECTRO, midaircombo_interval), this.ltime); } } else { this.nextthink = this.ltime; } // this.nextthink = time; @@ -216,7 +216,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) { entity proj; - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(electro, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(WEP_ELECTRO, ammo), weaponentity); W_SetupShot_ProjectileSize( actor, @@ -227,7 +227,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) 2, SND_ELECTRO_FIRE, CH_WEAPON_A, - WEP_CVAR_PRI(electro, damage), + WEP_CVAR_PRI(WEP_ELECTRO, damage), thiswep.m_id ); @@ -236,11 +236,11 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) proj = new(electro_bolt); proj.owner = proj.realowner = actor; proj.bot_dodge = true; - proj.bot_dodgerating = WEP_CVAR_PRI(electro, damage); + proj.bot_dodgerating = WEP_CVAR_PRI(WEP_ELECTRO, damage); proj.use = W_Electro_Explode_use; setthink(proj, W_Electro_Bolt_Think); proj.nextthink = time; - proj.ltime = time + WEP_CVAR_PRI(electro, lifetime); + proj.ltime = time + WEP_CVAR_PRI(WEP_ELECTRO, lifetime); PROJECTILE_MAKETRIGGER(proj); proj.projectiledeathtype = thiswep.m_id; proj.weaponentity_fld = weaponentity; @@ -248,7 +248,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) // if (IS_CSQC) set_movetype(proj, MOVETYPE_FLY); - W_SetupProjVelocity_PRI(proj, electro); + W_SetupProjVelocity_PRI(proj, WEP_ELECTRO); proj.angles = vectoangles(proj.velocity); settouch(proj, W_Electro_TouchExplode); setsize(proj, '0 0 -3', '0 0 -3'); @@ -327,8 +327,8 @@ void W_Electro_Orb_Stick(entity this, entity to) newproj.weaponentity_fld = this.weaponentity_fld; settouch(newproj, func_null); - if(WEP_CVAR_SEC(electro, stick_lifetime) > 0){ - newproj.death_time = time + WEP_CVAR_SEC(electro, stick_lifetime); + if(WEP_CVAR_SEC(WEP_ELECTRO, stick_lifetime) > 0){ + newproj.death_time = time + WEP_CVAR_SEC(WEP_ELECTRO, stick_lifetime); }else{ newproj.death_time = this.death_time; } @@ -362,7 +362,7 @@ void W_Electro_Orb_Stick(entity this, entity to) void W_Electro_Orb_Touch(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); - if(toucher.takedamage == DAMAGE_AIM && WEP_CVAR_SEC(electro, touchexplode)) + if(toucher.takedamage == DAMAGE_AIM && WEP_CVAR_SEC(WEP_ELECTRO, touchexplode)) { W_Electro_Explode(this, toucher); } else if(toucher.owner != this.owner && toucher.classname != this.classname) // don't stick to player's other projectiles! { @@ -370,8 +370,8 @@ void W_Electro_Orb_Touch(entity this, entity toucher) spamsound(this, CH_SHOTS, SND_ELECTRO_BOUNCE, VOL_BASE, ATTEN_NORM); this.projectiledeathtype |= HITTYPE_BOUNCE; - if(WEP_CVAR_SEC(electro, stick)){ - if(WEP_CVAR_SEC(electro, stick_lifetime) == 0){ + if(WEP_CVAR_SEC(WEP_ELECTRO, stick)){ + if(WEP_CVAR_SEC(WEP_ELECTRO, stick_lifetime) == 0){ W_Electro_Explode(this, toucher); } else { W_Electro_Orb_Stick(this, toucher); @@ -404,8 +404,8 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float setthink(this, W_Electro_ExplodeCombo); // delay combo chains, looks cooler // bound the length, inflictor may be in a galaxy far far away (warpzones) - float len = min(WEP_CVAR(electro, combo_radius), vlen(this.origin - inflictor.origin)); - float delay = len / WEP_CVAR(electro, combo_speed); + float len = min(WEP_CVAR(WEP_ELECTRO, combo_radius), vlen(this.origin - inflictor.origin)); + float delay = len / WEP_CVAR(WEP_ELECTRO, combo_speed); this.nextthink = time + delay; } else @@ -418,7 +418,7 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity) { - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(electro, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_ELECTRO, ammo), weaponentity); W_SetupShot_ProjectileSize( actor, @@ -429,7 +429,7 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity) 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, - WEP_CVAR_SEC(electro, damage), + WEP_CVAR_SEC(WEP_ELECTRO, damage), thiswep.m_id | HITTYPE_SECONDARY ); @@ -442,9 +442,9 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity) proj.use = W_Electro_Explode_use; setthink(proj, adaptor_think2use_hittype_splash); proj.bot_dodge = true; - proj.bot_dodgerating = WEP_CVAR_SEC(electro, damage); - proj.nextthink = time + WEP_CVAR_SEC(electro, lifetime); - proj.death_time = time + WEP_CVAR_SEC(electro, lifetime); + proj.bot_dodgerating = WEP_CVAR_SEC(WEP_ELECTRO, damage); + proj.nextthink = time + WEP_CVAR_SEC(WEP_ELECTRO, lifetime); + proj.death_time = time + WEP_CVAR_SEC(WEP_ELECTRO, lifetime); PROJECTILE_MAKETRIGGER(proj); proj.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; proj.weaponentity_fld = weaponentity; @@ -453,30 +453,30 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity) //proj.glow_size = 50; //proj.glow_color = 45; set_movetype(proj, MOVETYPE_BOUNCE); - W_SetupProjVelocity_UP_SEC(proj, electro); + W_SetupProjVelocity_UP_SEC(proj, WEP_ELECTRO); settouch(proj, W_Electro_Orb_Touch); setsize(proj, '-4 -4 -4', '4 4 4'); proj.takedamage = DAMAGE_YES; - proj.damageforcescale = WEP_CVAR_SEC(electro, damageforcescale); - SetResourceExplicit(proj, RES_HEALTH, WEP_CVAR_SEC(electro, health)); + proj.damageforcescale = WEP_CVAR_SEC(WEP_ELECTRO, damageforcescale); + SetResourceExplicit(proj, RES_HEALTH, WEP_CVAR_SEC(WEP_ELECTRO, health)); proj.event_damage = W_Electro_Orb_Damage; proj.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, proj); IL_PUSH(g_bot_dodge, proj); - proj.damagedbycontents = (WEP_CVAR_SEC(electro, damagedbycontents)); + proj.damagedbycontents = (WEP_CVAR_SEC(WEP_ELECTRO, damagedbycontents)); if(proj.damagedbycontents) IL_PUSH(g_damagedbycontents, proj); - proj.bouncefactor = WEP_CVAR_SEC(electro, bouncefactor); - proj.bouncestop = WEP_CVAR_SEC(electro, bouncestop); + proj.bouncefactor = WEP_CVAR_SEC(WEP_ELECTRO, bouncefactor); + proj.bouncestop = WEP_CVAR_SEC(WEP_ELECTRO, bouncestop); proj.missile_flags = MIF_SPLASH | MIF_ARC; - if(WEP_CVAR_SEC(electro, limit) > 0) + if(WEP_CVAR_SEC(WEP_ELECTRO, limit) > 0) { if (!LimitedElectroBallRubbleList) LimitedElectroBallRubbleList = IL_NEW(); ListNewChildRubble(LimitedElectroBallRubbleList, proj); - LimitedChildrenRubble(LimitedElectroBallRubbleList, "electro_orb", WEP_CVAR_SEC(electro, limit), adaptor_think2use_hittype_splash, actor); + LimitedChildrenRubble(LimitedElectroBallRubbleList, "electro_orb", WEP_CVAR_SEC(WEP_ELECTRO, limit), adaptor_think2use_hittype_splash, actor); } CSQCProjectile(proj, true, PROJECTILE_ELECTRO, false); // no culling, it has sound @@ -493,7 +493,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i W_Electro_Attack_Orb(thiswep, actor, weaponentity); actor.(weaponentity).electro_count -= 1; actor.(weaponentity).electro_secondarytime = time; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_ELECTRO, animtime), W_Electro_CheckAttack); return; } w_ready(thiswep, actor, weaponentity, fire); @@ -509,8 +509,8 @@ METHOD(Electro, wr_aim, void(entity thiswep, entity actor, .entity weaponentity) { float shoot; - if(WEP_CVAR_PRI(electro, speed)) - shoot = bot_aim(actor, weaponentity, WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false, true); + if(WEP_CVAR_PRI(WEP_ELECTRO, speed)) + shoot = bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_ELECTRO, speed), 0, WEP_CVAR_PRI(WEP_ELECTRO, lifetime), false, true); else shoot = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false, true); @@ -522,7 +522,7 @@ METHOD(Electro, wr_aim, void(entity thiswep, entity actor, .entity weaponentity) } else { - if(bot_aim(actor, weaponentity, WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true, true)) + if(bot_aim(actor, weaponentity, WEP_CVAR_SEC(WEP_ELECTRO, speed), WEP_CVAR_SEC(WEP_ELECTRO, speed_up), WEP_CVAR_SEC(WEP_ELECTRO, lifetime), true, true)) { PHYS_INPUT_BUTTON_ATCK2(actor) = true; if(random() < 0.03) actor.bot_secondary_electromooth = 0; @@ -534,9 +534,9 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO { float ammo_amount = 0; - if(actor.(weaponentity).clip_load >= WEP_CVAR_PRI(electro, ammo)) + if(actor.(weaponentity).clip_load >= WEP_CVAR_PRI(WEP_ELECTRO, ammo)) ammo_amount = 1; - if(actor.(weaponentity).clip_load >= WEP_CVAR_SEC(electro, ammo)) + if(actor.(weaponentity).clip_load >= WEP_CVAR_SEC(WEP_ELECTRO, ammo)) ammo_amount += 1; if(!ammo_amount) @@ -548,49 +548,49 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit if(fire & 1) { - if(time >= actor.(weaponentity).electro_secondarytime + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor(actor)) - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) + if(time >= actor.(weaponentity).electro_secondarytime + WEP_CVAR_SEC(WEP_ELECTRO, refire2) * W_WeaponRateFactor(actor)) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { W_Electro_Attack_Bolt(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); } } else if(fire & 2) { - if(time >= actor.(weaponentity).electro_secondarytime + WEP_CVAR_SEC(electro, refire) * W_WeaponRateFactor(actor)) + if(time >= actor.(weaponentity).electro_secondarytime + WEP_CVAR_SEC(WEP_ELECTRO, refire) * W_WeaponRateFactor(actor)) if(weapon_prepareattack(thiswep, actor, weaponentity, true, -1)) { W_Electro_Attack_Orb(thiswep, actor, weaponentity); - actor.(weaponentity).electro_count = WEP_CVAR_SEC(electro, count); + actor.(weaponentity).electro_count = WEP_CVAR_SEC(WEP_ELECTRO, count); actor.(weaponentity).electro_secondarytime = time; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_ELECTRO, animtime), W_Electro_CheckAttack); } } } METHOD(Electro, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(electro, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(electro, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_ELECTRO, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_ELECTRO, ammo); return ammo_amount; } METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { float ammo_amount; - if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false. + if(WEP_CVAR(WEP_ELECTRO, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false. { - ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo); + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_ELECTRO, ammo) + WEP_CVAR_PRI(WEP_ELECTRO, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_ELECTRO, ammo) + WEP_CVAR_PRI(WEP_ELECTRO, ammo); } else { - ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(electro, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(electro, ammo); + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_ELECTRO, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_ELECTRO, ammo); } return ammo_amount; } METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD); + W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(WEP_ELECTRO, ammo), WEP_CVAR_SEC(WEP_ELECTRO, ammo)), SND_RELOAD); } METHOD(Electro, wr_suicidemessage, Notification(entity thiswep)) { diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index f7c77c514..323da5c11 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -19,12 +19,12 @@ void W_Fireball_Explode(entity this, entity directhitentity) RadiusDamage( this, this.realowner, - WEP_CVAR_PRI(fireball, damage), - WEP_CVAR_PRI(fireball, edgedamage), - WEP_CVAR_PRI(fireball, radius), + WEP_CVAR_PRI(WEP_FIREBALL, damage), + WEP_CVAR_PRI(WEP_FIREBALL, edgedamage), + WEP_CVAR_PRI(WEP_FIREBALL, radius), NULL, NULL, - WEP_CVAR_PRI(fireball, force), + WEP_CVAR_PRI(WEP_FIREBALL, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity ); @@ -32,11 +32,11 @@ void W_Fireball_Explode(entity this, entity directhitentity) if(GetResource(this.realowner, RES_HEALTH) + GetResource(this.realowner, RES_ARMOR) >= d) if(!this.cnt) { - modeleffect_spawn("models/sphere/sphere.md3", 0, 0, this.origin, '0 0 0', '0 0 0', '0 0 0', 0, WEP_CVAR_PRI(fireball, bfgradius), 0.2, 0.05, 0.25); + modeleffect_spawn("models/sphere/sphere.md3", 0, 0, this.origin, '0 0 0', '0 0 0', '0 0 0', 0, WEP_CVAR_PRI(WEP_FIREBALL, bfgradius), 0.2, 0.05, 0.25); // 2. bfg effect // NOTE: this cannot be made warpzone aware by design. So, better intentionally ignore warpzones here. - for(e = findradius(this.origin, WEP_CVAR_PRI(fireball, bfgradius)); e; e = e.chain) + for(e = findradius(this.origin, WEP_CVAR_PRI(WEP_FIREBALL, bfgradius)); e; e = e.chain) { if(e != this.realowner && e.takedamage == DAMAGE_AIM && !IS_INDEPENDENT_PLAYER(e)) if(!IS_PLAYER(e) || !this.realowner || DIFF_TEAM(e, this)) @@ -52,23 +52,23 @@ void W_Fireball_Explode(entity this, entity directhitentity) if(/* trace_startsolid || */ trace_fraction != 1) continue; dist = vlen(this.origin - e.origin - e.view_ofs); - points = (1 - sqrt(dist / WEP_CVAR_PRI(fireball, bfgradius))); + points = (1 - sqrt(dist / WEP_CVAR_PRI(WEP_FIREBALL, bfgradius))); if(points <= 0) continue; dir = normalize(e.origin + e.view_ofs - this.origin); if(accuracy_isgooddamage(this.realowner, e)) - accuracy_add(this.realowner, WEP_FIREBALL, 0, WEP_CVAR_PRI(fireball, bfgdamage) * points); + accuracy_add(this.realowner, WEP_FIREBALL, 0, WEP_CVAR_PRI(WEP_FIREBALL, bfgdamage) * points); Damage( e, this, this.realowner, - WEP_CVAR_PRI(fireball, bfgdamage) * points, + WEP_CVAR_PRI(WEP_FIREBALL, bfgdamage) * points, this.projectiledeathtype | HITTYPE_BOUNCE | HITTYPE_SPLASH, this.weaponentity_fld, e.origin + e.view_ofs, - WEP_CVAR_PRI(fireball, bfgforce) * dir + WEP_CVAR_PRI(WEP_FIREBALL, bfgforce) * dir ); Send_Effect(EFFECT_FIREBALL_BFGDAMAGE, e.origin, -1 * dir, 1); @@ -144,7 +144,7 @@ void W_Fireball_Think(entity this) return; } - W_Fireball_LaserPlay(this, 0.1, WEP_CVAR_PRI(fireball, laserradius), WEP_CVAR_PRI(fireball, laserdamage), WEP_CVAR_PRI(fireball, laseredgedamage), WEP_CVAR_PRI(fireball, laserburntime)); + W_Fireball_LaserPlay(this, 0.1, WEP_CVAR_PRI(WEP_FIREBALL, laserradius), WEP_CVAR_PRI(WEP_FIREBALL, laserdamage), WEP_CVAR_PRI(WEP_FIREBALL, laseredgedamage), WEP_CVAR_PRI(WEP_FIREBALL, laserburntime)); this.nextthink = time + 0.1; } @@ -167,30 +167,30 @@ void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float dam void W_Fireball_Attack1(entity actor, .entity weaponentity) { - W_SetupShot_ProjectileSize(actor, weaponentity, '-16 -16 -16', '16 16 16', false, 2, SND_FIREBALL_FIRE2, CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage), WEP_FIREBALL.m_id); + W_SetupShot_ProjectileSize(actor, weaponentity, '-16 -16 -16', '16 16 16', false, 2, SND_FIREBALL_FIRE2, CH_WEAPON_A, WEP_CVAR_PRI(WEP_FIREBALL, damage) + WEP_CVAR_PRI(WEP_FIREBALL, bfgdamage), WEP_FIREBALL.m_id); W_MuzzleFlash(WEP_FIREBALL, actor, weaponentity, w_shotorg, w_shotdir); entity proj = new(plasma_prim); proj.owner = proj.realowner = actor; proj.bot_dodge = true; - proj.bot_dodgerating = WEP_CVAR_PRI(fireball, damage); - proj.pushltime = time + WEP_CVAR_PRI(fireball, lifetime); + proj.bot_dodgerating = WEP_CVAR_PRI(WEP_FIREBALL, damage); + proj.pushltime = time + WEP_CVAR_PRI(WEP_FIREBALL, lifetime); proj.use = W_Fireball_Explode_use; setthink(proj, W_Fireball_Think); proj.nextthink = time; - SetResourceExplicit(proj, RES_HEALTH, WEP_CVAR_PRI(fireball, health)); + SetResourceExplicit(proj, RES_HEALTH, WEP_CVAR_PRI(WEP_FIREBALL, health)); proj.team = actor.team; proj.event_damage = W_Fireball_Damage; proj.takedamage = DAMAGE_YES; - proj.damageforcescale = WEP_CVAR_PRI(fireball, damageforcescale); + proj.damageforcescale = WEP_CVAR_PRI(WEP_FIREBALL, damageforcescale); PROJECTILE_MAKETRIGGER(proj); proj.projectiledeathtype = WEP_FIREBALL.m_id; proj.weaponentity_fld = weaponentity; setorigin(proj, w_shotorg); set_movetype(proj, MOVETYPE_FLY); - W_SetupProjVelocity_PRI(proj, fireball); + W_SetupProjVelocity_PRI(proj, WEP_FIREBALL); proj.angles = vectoangles(proj.velocity); settouch(proj, W_Fireball_TouchExplode); setsize(proj, '-16 -16 -16', '16 16 16'); @@ -214,32 +214,32 @@ void W_Fireball_AttackEffect(entity actor, .entity weaponentity, float i, vector void W_Fireball_Attack1_Frame4(Weapon thiswep, entity actor, .entity weaponentity, int fire) { W_Fireball_Attack1(actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), w_ready); } void W_Fireball_Attack1_Frame3(Weapon thiswep, entity actor, .entity weaponentity, int fire) { W_Fireball_AttackEffect(actor, weaponentity, 0, '+1.25 +3.75 0'); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame4); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), W_Fireball_Attack1_Frame4); } void W_Fireball_Attack1_Frame2(Weapon thiswep, entity actor, .entity weaponentity, int fire) { W_Fireball_AttackEffect(actor, weaponentity, 0, '-1.25 +3.75 0'); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame3); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), W_Fireball_Attack1_Frame3); } void W_Fireball_Attack1_Frame1(Weapon thiswep, entity actor, .entity weaponentity, int fire) { W_Fireball_AttackEffect(actor, weaponentity, 1, '+1.25 -3.75 0'); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame2); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), W_Fireball_Attack1_Frame2); } void W_Fireball_Attack1_Frame0(Weapon thiswep, entity actor, .entity weaponentity, int fire) { W_Fireball_AttackEffect(actor, weaponentity, 0, '-1.25 -3.75 0'); sound(actor, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame1); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), W_Fireball_Attack1_Frame1); } void W_Fireball_Firemine_Think(entity this) @@ -253,7 +253,7 @@ void W_Fireball_Firemine_Think(entity this) // make it "hot" once it leaves its owner if(this.owner) { - if(vdist(this.origin - this.owner.origin - this.owner.view_ofs, >, WEP_CVAR_SEC(fireball, laserradius))) + if(vdist(this.origin - this.owner.origin - this.owner.view_ofs, >, WEP_CVAR_SEC(WEP_FIREBALL, laserradius))) { this.cnt += 1; if(this.cnt == 3) @@ -263,7 +263,7 @@ void W_Fireball_Firemine_Think(entity this) this.cnt = 0; } - W_Fireball_LaserPlay(this, 0.1, WEP_CVAR_SEC(fireball, laserradius), WEP_CVAR_SEC(fireball, laserdamage), WEP_CVAR_SEC(fireball, laseredgedamage), WEP_CVAR_SEC(fireball, laserburntime)); + W_Fireball_LaserPlay(this, 0.1, WEP_CVAR_SEC(WEP_FIREBALL, laserradius), WEP_CVAR_SEC(WEP_FIREBALL, laserdamage), WEP_CVAR_SEC(WEP_FIREBALL, laseredgedamage), WEP_CVAR_SEC(WEP_FIREBALL, laserburntime)); this.nextthink = time + 0.1; } @@ -272,7 +272,7 @@ void W_Fireball_Firemine_Touch(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); if(toucher.takedamage == DAMAGE_AIM) - if(Fire_AddDamage(toucher, this.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), this.projectiledeathtype) >= 0) + if(Fire_AddDamage(toucher, this.realowner, WEP_CVAR_SEC(WEP_FIREBALL, damage), WEP_CVAR_SEC(WEP_FIREBALL, damagetime), this.projectiledeathtype) >= 0) { delete(this); return; @@ -303,7 +303,7 @@ void W_Fireball_Attack2(entity actor, .entity weaponentity) f_diff = '+1.25 +3.75 0'; break; } - W_SetupShot_ProjectileSize(actor, weaponentity, '-4 -4 -4', '4 4 4', false, 2, SND_FIREBALL_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(fireball, damage), WEP_FIREBALL.m_id | HITTYPE_SECONDARY); + W_SetupShot_ProjectileSize(actor, weaponentity, '-4 -4 -4', '4 4 4', false, 2, SND_FIREBALL_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(WEP_FIREBALL, damage), WEP_FIREBALL.m_id | HITTYPE_SECONDARY); traceline(w_shotorg, w_shotorg + f_diff_x * v_up + f_diff_y * v_right, MOVE_NORMAL, actor); w_shotorg = trace_endpos; @@ -312,7 +312,7 @@ void W_Fireball_Attack2(entity actor, .entity weaponentity) proj = new(grenade); proj.owner = proj.realowner = actor; proj.bot_dodge = true; - proj.bot_dodgerating = WEP_CVAR_SEC(fireball, damage); + proj.bot_dodgerating = WEP_CVAR_SEC(WEP_FIREBALL, damage); set_movetype(proj, MOVETYPE_BOUNCE); proj.projectiledeathtype = WEP_FIREBALL.m_id | HITTYPE_SECONDARY; settouch(proj, W_Fireball_Firemine_Touch); @@ -321,9 +321,9 @@ void W_Fireball_Attack2(entity actor, .entity weaponentity) setorigin(proj, w_shotorg); setthink(proj, W_Fireball_Firemine_Think); proj.nextthink = time; - proj.damageforcescale = WEP_CVAR_SEC(fireball, damageforcescale); - proj.pushltime = time + WEP_CVAR_SEC(fireball, lifetime); - W_SetupProjVelocity_UP_SEC(proj, fireball); + proj.damageforcescale = WEP_CVAR_SEC(WEP_FIREBALL, damageforcescale); + proj.pushltime = time + WEP_CVAR_SEC(WEP_FIREBALL, lifetime); + W_SetupProjVelocity_UP_SEC(proj, WEP_FIREBALL); proj.angles = vectoangles(proj.velocity); proj.flags = FL_PROJECTILE; @@ -342,7 +342,7 @@ METHOD(Fireball, wr_aim, void(entity thiswep, entity actor, .entity weaponentity PHYS_INPUT_BUTTON_ATCK2(actor) = false; if(actor.bot_primary_fireballmooth == 0) { - if(bot_aim(actor, weaponentity, WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false, false)) + if(bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_FIREBALL, speed), 0, WEP_CVAR_PRI(WEP_FIREBALL, lifetime), false, false)) { PHYS_INPUT_BUTTON_ATCK(actor) = true; if(random() < 0.02) actor.bot_primary_fireballmooth = 1; @@ -350,7 +350,7 @@ METHOD(Fireball, wr_aim, void(entity thiswep, entity actor, .entity weaponentity } else { - if(bot_aim(actor, weaponentity, WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true, false)) + if(bot_aim(actor, weaponentity, WEP_CVAR_SEC(WEP_FIREBALL, speed), WEP_CVAR_SEC(WEP_FIREBALL, speed_up), WEP_CVAR_SEC(WEP_FIREBALL, lifetime), true, false)) { PHYS_INPUT_BUTTON_ATCK2(actor) = true; if(random() < 0.01) actor.bot_primary_fireballmooth = 0; @@ -362,18 +362,18 @@ METHOD(Fireball, wr_think, void(entity thiswep, entity actor, .entity weaponenti if(fire & 1) { if(time >= actor.(weaponentity).fireball_primarytime) - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(fireball, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_FIREBALL, refire))) { W_Fireball_Attack1_Frame0(thiswep, actor, weaponentity, fire); - actor.(weaponentity).fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor(actor); + actor.(weaponentity).fireball_primarytime = time + WEP_CVAR_PRI(WEP_FIREBALL, refire2) * W_WeaponRateFactor(actor); } } else if(fire & 2) { - if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(fireball, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_FIREBALL, refire))) { W_Fireball_Attack2(actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_FIREBALL, animtime), w_ready); } } } diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index d018bb3f6..fb404d998 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -7,7 +7,7 @@ void W_Hagar_Explode(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR_PRI(hagar, damage), WEP_CVAR_PRI(hagar, edgedamage), WEP_CVAR_PRI(hagar, radius), NULL, NULL, WEP_CVAR_PRI(hagar, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR_PRI(WEP_HAGAR, damage), WEP_CVAR_PRI(WEP_HAGAR, edgedamage), WEP_CVAR_PRI(WEP_HAGAR, radius), NULL, NULL, WEP_CVAR_PRI(WEP_HAGAR, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -20,7 +20,7 @@ void W_Hagar_Explode_use(entity this, entity actor, entity trigger) void W_Hagar_Explode2(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR_SEC(hagar, damage), WEP_CVAR_SEC(hagar, edgedamage), WEP_CVAR_SEC(hagar, radius), NULL, NULL, WEP_CVAR_SEC(hagar, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR_SEC(WEP_HAGAR, damage), WEP_CVAR_SEC(WEP_HAGAR, edgedamage), WEP_CVAR_SEC(WEP_HAGAR, radius), NULL, NULL, WEP_CVAR_SEC(WEP_HAGAR, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -40,7 +40,7 @@ void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage && (this.projectiledeathtype & HITTYPE_SECONDARY)); if(is_linkexplode) - is_linkexplode = (is_linkexplode && WEP_CVAR_SEC(hagar, load_linkexplode)); + is_linkexplode = (is_linkexplode && WEP_CVAR_SEC(WEP_HAGAR, load_linkexplode)); else is_linkexplode = -1; // not secondary load, so continue as normal without exception. @@ -79,20 +79,20 @@ void W_Hagar_Attack(Weapon thiswep, entity actor, .entity weaponentity) { entity missile; - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(hagar, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(WEP_HAGAR, ammo), weaponentity); - W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage), thiswep.m_id); + W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(WEP_HAGAR, damage), thiswep.m_id); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); missile = new(missile); missile.owner = missile.realowner = actor; missile.bot_dodge = true; - missile.bot_dodgerating = WEP_CVAR_PRI(hagar, damage); + missile.bot_dodgerating = WEP_CVAR_PRI(WEP_HAGAR, damage); missile.takedamage = DAMAGE_YES; - SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_PRI(hagar, health)); - missile.damageforcescale = WEP_CVAR_PRI(hagar, damageforcescale); + SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_PRI(WEP_HAGAR, health)); + missile.damageforcescale = WEP_CVAR_PRI(WEP_HAGAR, damageforcescale); missile.event_damage = W_Hagar_Damage; missile.damagedbycontents = true; IL_PUSH(g_damagedbycontents, missile); @@ -100,7 +100,7 @@ void W_Hagar_Attack(Weapon thiswep, entity actor, .entity weaponentity) settouch(missile, W_Hagar_Touch); missile.use = W_Hagar_Explode_use; setthink(missile, adaptor_think2use_hittype_splash); - missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime); + missile.nextthink = time + WEP_CVAR_PRI(WEP_HAGAR, lifetime); PROJECTILE_MAKETRIGGER(missile); missile.projectiledeathtype = thiswep.m_id; missile.weaponentity_fld = weaponentity; @@ -108,7 +108,7 @@ void W_Hagar_Attack(Weapon thiswep, entity actor, .entity weaponentity) setsize(missile, '0 0 0', '0 0 0'); set_movetype(missile, MOVETYPE_FLY); - W_SetupProjVelocity_PRI(missile, hagar); + W_SetupProjVelocity_PRI(missile, WEP_HAGAR); missile.angles = vectoangles(missile.velocity); missile.flags = FL_PROJECTILE; @@ -125,20 +125,20 @@ void W_Hagar_Attack2(Weapon thiswep, entity actor, .entity weaponentity) { entity missile; - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_HAGAR, ammo), weaponentity); - W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage), thiswep.m_id | HITTYPE_SECONDARY); + W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(WEP_HAGAR, damage), thiswep.m_id | HITTYPE_SECONDARY); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); missile = new(missile); missile.owner = missile.realowner = actor; missile.bot_dodge = true; - missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage); + missile.bot_dodgerating = WEP_CVAR_SEC(WEP_HAGAR, damage); missile.takedamage = DAMAGE_YES; - SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_SEC(hagar, health)); - missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale); + SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_SEC(WEP_HAGAR, health)); + missile.damageforcescale = WEP_CVAR_SEC(WEP_HAGAR, damageforcescale); missile.event_damage = W_Hagar_Damage; missile.damagedbycontents = true; IL_PUSH(g_damagedbycontents, missile); @@ -147,7 +147,7 @@ void W_Hagar_Attack2(Weapon thiswep, entity actor, .entity weaponentity) missile.cnt = 0; missile.use = W_Hagar_Explode2_use; setthink(missile, adaptor_think2use_hittype_splash); - missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand); + missile.nextthink = time + WEP_CVAR_SEC(WEP_HAGAR, lifetime_min) + random() * WEP_CVAR_SEC(WEP_HAGAR, lifetime_rand); PROJECTILE_MAKETRIGGER(missile); missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; missile.weaponentity_fld = weaponentity; @@ -155,7 +155,7 @@ void W_Hagar_Attack2(Weapon thiswep, entity actor, .entity weaponentity) setsize(missile, '0 0 0', '0 0 0'); set_movetype(missile, MOVETYPE_BOUNCEMISSILE); - W_SetupProjVelocity_SEC(missile, hagar); + W_SetupProjVelocity_SEC(missile, WEP_HAGAR); missile.angles = vectoangles(missile.velocity); missile.flags = FL_PROJECTILE; @@ -181,10 +181,10 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen if(!actor.(weaponentity).hagar_load) return; - weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire)); + weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(WEP_HAGAR, refire)); shots = actor.(weaponentity).hagar_load; - W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage) * shots, thiswep.m_id | HITTYPE_SECONDARY); + W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(WEP_HAGAR, damage) * shots, thiswep.m_id | HITTYPE_SECONDARY); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); forward = v_forward; @@ -197,11 +197,11 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen missile = new(missile); missile.owner = missile.realowner = actor; missile.bot_dodge = true; - missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage); + missile.bot_dodgerating = WEP_CVAR_SEC(WEP_HAGAR, damage); missile.takedamage = DAMAGE_YES; - SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_SEC(hagar, health)); - missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale); + SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_SEC(WEP_HAGAR, health)); + missile.damageforcescale = WEP_CVAR_SEC(WEP_HAGAR, damageforcescale); missile.event_damage = W_Hagar_Damage; missile.damagedbycontents = true; IL_PUSH(g_damagedbycontents, missile); @@ -209,7 +209,7 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen settouch(missile, W_Hagar_Touch); // not bouncy missile.use = W_Hagar_Explode2_use; setthink(missile, adaptor_think2use_hittype_splash); - missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand); + missile.nextthink = time + WEP_CVAR_SEC(WEP_HAGAR, lifetime_min) + random() * WEP_CVAR_SEC(WEP_HAGAR, lifetime_rand); PROJECTILE_MAKETRIGGER(missile); missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; missile.weaponentity_fld = weaponentity; @@ -219,14 +219,14 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen missile.missile_flags = MIF_SPLASH; // per-shot spread calculation: the more shots there are, the less spread is applied (based on the bias cvar) - spread_pershot = ((shots - 1) / (WEP_CVAR_SEC(hagar, load_max) - 1)); - spread_pershot = (1 - (spread_pershot * WEP_CVAR_SEC(hagar, load_spread_bias))); - spread_pershot = (WEP_CVAR_SEC(hagar, spread) * spread_pershot * autocvar_g_weaponspreadfactor); + spread_pershot = ((shots - 1) / (WEP_CVAR_SEC(WEP_HAGAR, load_max) - 1)); + spread_pershot = (1 - (spread_pershot * WEP_CVAR_SEC(WEP_HAGAR, load_spread_bias))); + spread_pershot = (WEP_CVAR_SEC(WEP_HAGAR, spread) * spread_pershot * autocvar_g_weaponspreadfactor); s = W_CalculateSpreadPattern(1, counter, shots); - s = s * WEP_CVAR_SEC(hagar, load_spread) * autocvar_g_weaponspreadfactor; + s = s * WEP_CVAR_SEC(WEP_HAGAR, load_spread) * autocvar_g_weaponspreadfactor; - W_SetupProjVelocity_Explicit(missile, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_SEC(hagar, speed), 0, 0, spread_pershot, false); + W_SetupProjVelocity_Explicit(missile, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_SEC(WEP_HAGAR, speed), 0, 0, spread_pershot, false); missile.angles = vectoangles(missile.velocity); missile.flags = FL_PROJECTILE; @@ -238,8 +238,8 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen MUTATOR_CALLHOOK(EditProjectile, actor, missile); } - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, load_animtime), w_ready); - actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor(actor); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_HAGAR, load_animtime), w_ready); + actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(WEP_HAGAR, refire) * W_WeaponRateFactor(actor); actor.(weaponentity).hagar_load = 0; } @@ -251,33 +251,33 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity) if (weaponUseForbidden(actor)) return; - bool loaded = actor.(weaponentity).hagar_load >= WEP_CVAR_SEC(hagar, load_max); + bool loaded = actor.(weaponentity).hagar_load >= WEP_CVAR_SEC(WEP_HAGAR, load_max); // this is different than WR_CHECKAMMO when it comes to reloading bool enough_ammo; if(actor.items & IT_UNLIMITED_AMMO) enough_ammo = true; else if(autocvar_g_balance_hagar_reload_ammo) - enough_ammo = actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(hagar, ammo); + enough_ammo = actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_HAGAR, ammo); else - enough_ammo = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hagar, ammo); + enough_ammo = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_HAGAR, ammo); bool stopped = loaded || !enough_ammo; if(PHYS_INPUT_BUTTON_ATCK2(actor)) { - if(PHYS_INPUT_BUTTON_ATCK(actor) && WEP_CVAR_SEC(hagar, load_abort)) + if(PHYS_INPUT_BUTTON_ATCK(actor) && WEP_CVAR_SEC(WEP_HAGAR, load_abort)) { if(actor.(weaponentity).hagar_load) { // if we pressed primary fire while loading, unload all rockets and abort actor.(weaponentity).state = WS_READY; - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo) * actor.(weaponentity).hagar_load * -1, weaponentity); // give back ammo + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_HAGAR, ammo) * actor.(weaponentity).hagar_load * -1, weaponentity); // give back ammo actor.(weaponentity).hagar_load = 0; sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM); // pause until we can load rockets again, once we re-press the alt fire button - actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor); + actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(WEP_HAGAR, load_speed) * W_WeaponRateFactor(actor); // require letting go of the alt fire button before we can load again actor.(weaponentity).hagar_loadblock = true; @@ -290,15 +290,15 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity) { if(!actor.(weaponentity).hagar_loadblock && actor.(weaponentity).hagar_loadstep < time) { - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_HAGAR, ammo), weaponentity); actor.(weaponentity).state = WS_INUSE; actor.(weaponentity).hagar_load += 1; sound(actor, CH_WEAPON_B, SND_HAGAR_LOAD, VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most - if(actor.(weaponentity).hagar_load >= WEP_CVAR_SEC(hagar, load_max)) + if(actor.(weaponentity).hagar_load >= WEP_CVAR_SEC(WEP_HAGAR, load_max)) stopped = true; else - actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor); + actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(WEP_HAGAR, load_speed) * W_WeaponRateFactor(actor); } } if(stopped && !actor.(weaponentity).hagar_loadbeep && actor.(weaponentity).hagar_load) // prevents the beep from playing each frame @@ -306,7 +306,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity) // if this is the last rocket we can load, play a beep sound to notify the player sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM); actor.(weaponentity).hagar_loadbeep = true; - actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_hold) * W_WeaponRateFactor(actor); + actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(WEP_HAGAR, load_hold) * W_WeaponRateFactor(actor); } } } @@ -319,7 +319,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity) if(actor.(weaponentity).hagar_load) { // play warning sound if we're about to release - if(stopped && actor.(weaponentity).hagar_loadstep - 0.5 < time && WEP_CVAR_SEC(hagar, load_hold) >= 0) + if(stopped && actor.(weaponentity).hagar_loadstep - 0.5 < time && WEP_CVAR_SEC(WEP_HAGAR, load_hold) >= 0) { if(!actor.(weaponentity).hagar_warning) // prevents the beep from playing each frame { @@ -330,7 +330,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity) } // release if player let go of button or if they've held it in too long - if(!PHYS_INPUT_BUTTON_ATCK2(actor) || (stopped && actor.(weaponentity).hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0)) + if(!PHYS_INPUT_BUTTON_ATCK2(actor) || (stopped && actor.(weaponentity).hagar_loadstep < time && WEP_CVAR_SEC(WEP_HAGAR, load_hold) >= 0)) { actor.(weaponentity).state = WS_READY; W_Hagar_Attack2_Load_Release(thiswep, actor, weaponentity); @@ -370,26 +370,26 @@ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int W_Hagar_Attack(thiswep, actor, weaponentity); - ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor(actor); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(WEP_HAGAR, refire) * W_WeaponRateFactor(actor); actor.(weaponentity).wframe = WFRAME_FIRE1; - weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR_PRI(hagar, refire), W_Hagar_Attack_Auto); + weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR_PRI(WEP_HAGAR, refire), W_Hagar_Attack_Auto); } METHOD(Hagar, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { if(random()>0.15) - PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false, true); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_HAGAR, speed), 0, WEP_CVAR_PRI(WEP_HAGAR, lifetime), false, true); else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming - PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false, true); + PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_HAGAR, speed), 0, WEP_CVAR_PRI(WEP_HAGAR, lifetime), false, true); } METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { float loadable_secondary; - loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary)); + loadable_secondary = (WEP_CVAR_SEC(WEP_HAGAR, load) && WEP_CVAR(WEP_HAGAR, secondary)); if(loadable_secondary) W_Hagar_Attack2_Load(thiswep, actor, weaponentity); // must always run each frame - if(autocvar_g_balance_hagar_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload + if(autocvar_g_balance_hagar_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(WEP_HAGAR, ammo), WEP_CVAR_SEC(WEP_HAGAR, ammo))) { // forced reload thiswep.wr_reload(thiswep, actor, weaponentity); } else if((fire & 1) && !actor.(weaponentity).hagar_load && !actor.(weaponentity).hagar_loadblock) // not while secondary is loaded or awaiting reset @@ -397,12 +397,12 @@ METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0)) W_Hagar_Attack_Auto(thiswep, actor, weaponentity, fire); } - else if((fire & 2) && !loadable_secondary && WEP_CVAR(hagar, secondary)) + else if((fire & 2) && !loadable_secondary && WEP_CVAR(WEP_HAGAR, secondary)) { - if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_HAGAR, refire))) { W_Hagar_Attack2(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_HAGAR, refire), w_ready); } } } @@ -420,20 +420,20 @@ METHOD(Hagar, wr_setup, void(entity thiswep, entity actor, .entity weaponentity) actor.(weaponentity).hagar_loadblock = false; if(actor.(weaponentity).hagar_load) { - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo) * actor.(weaponentity).hagar_load * -1, weaponentity); // give back ammo if necessary + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_HAGAR, ammo) * actor.(weaponentity).hagar_load * -1, weaponentity); // give back ammo if necessary actor.(weaponentity).hagar_load = 0; } } METHOD(Hagar, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(hagar, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(hagar, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_HAGAR, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_HAGAR, ammo); return ammo_amount; } METHOD(Hagar, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hagar, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(hagar, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_HAGAR, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_HAGAR, ammo); return ammo_amount; } METHOD(Hagar, wr_resetplayer, void(entity thiswep, entity actor)) @@ -447,13 +447,13 @@ METHOD(Hagar, wr_resetplayer, void(entity thiswep, entity actor)) METHOD(Hagar, wr_playerdeath, void(entity thiswep, entity actor, .entity weaponentity)) { // if we have any rockets loaded when we die, release them - if(actor.(weaponentity).hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath)) + if(actor.(weaponentity).hagar_load && WEP_CVAR_SEC(WEP_HAGAR, load_releasedeath)) W_Hagar_Attack2_Load_Release(thiswep, actor, weaponentity); } METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { if(!actor.(weaponentity).hagar_load) // require releasing loaded rockets first - W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND_RELOAD); + W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(WEP_HAGAR, ammo), WEP_CVAR_SEC(WEP_HAGAR, ammo)), SND_RELOAD); } METHOD(Hagar, wr_suicidemessage, Notification(entity thiswep)) { diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index 18dde7440..b62d9478e 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -12,8 +12,8 @@ void W_HLAC_Touch(entity this, entity toucher) isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY); - RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(hlac, isprimary, damage), WEP_CVAR_BOTH(hlac, isprimary, edgedamage), WEP_CVAR_BOTH(hlac, isprimary, radius), - NULL, NULL, WEP_CVAR_BOTH(hlac, isprimary, force), this.projectiledeathtype, this.weaponentity_fld, toucher); + RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(WEP_HLAC, isprimary, damage), WEP_CVAR_BOTH(WEP_HLAC, isprimary, edgedamage), WEP_CVAR_BOTH(WEP_HLAC, isprimary, radius), + NULL, NULL, WEP_CVAR_BOTH(WEP_HLAC, isprimary, force), this.projectiledeathtype, this.weaponentity_fld, toucher); delete(this); } @@ -22,14 +22,14 @@ void W_HLAC_Attack(Weapon thiswep, entity actor, .entity weaponentity) { entity missile; - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(hlac, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(WEP_HLAC, ammo), weaponentity); - float spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * actor.(weaponentity).misc_bulletcounter); - spread = min(spread,WEP_CVAR_PRI(hlac, spread_max)); + float spread = WEP_CVAR_PRI(WEP_HLAC, spread_min) + (WEP_CVAR_PRI(WEP_HLAC, spread_add) * actor.(weaponentity).misc_bulletcounter); + spread = min(spread,WEP_CVAR_PRI(WEP_HLAC, spread_max)); if(IS_DUCKED(actor)) - spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod); + spread = spread * WEP_CVAR_PRI(WEP_HLAC, spread_crouchmod); - W_SetupShot(actor, weaponentity, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage), thiswep.m_id); + W_SetupShot(actor, weaponentity, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(WEP_HLAC, damage), thiswep.m_id); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); if(!autocvar_g_norecoil) { @@ -41,7 +41,7 @@ void W_HLAC_Attack(Weapon thiswep, entity actor, .entity weaponentity) missile.owner = missile.realowner = actor; missile.bot_dodge = true; - missile.bot_dodgerating = WEP_CVAR_PRI(hlac, damage); + missile.bot_dodgerating = WEP_CVAR_PRI(WEP_HLAC, damage); set_movetype(missile, MOVETYPE_FLY); PROJECTILE_MAKETRIGGER(missile); @@ -49,13 +49,13 @@ void W_HLAC_Attack(Weapon thiswep, entity actor, .entity weaponentity) setorigin(missile, w_shotorg); setsize(missile, '0 0 0', '0 0 0'); - W_SetupProjVelocity_Basic(missile, WEP_CVAR_PRI(hlac, speed), spread); + W_SetupProjVelocity_Basic(missile, WEP_CVAR_PRI(WEP_HLAC, speed), spread); //missile.angles = vectoangles(missile.velocity); // csqc settouch(missile, W_HLAC_Touch); setthink(missile, SUB_Remove); - missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime); + missile.nextthink = time + WEP_CVAR_PRI(WEP_HLAC, lifetime); missile.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, missile); @@ -71,22 +71,22 @@ void W_HLAC_Attack(Weapon thiswep, entity actor, .entity weaponentity) void W_HLAC_Attack2(Weapon thiswep, entity actor, .entity weaponentity) { entity missile; - float spread = WEP_CVAR_SEC(hlac, spread); + float spread = WEP_CVAR_SEC(WEP_HLAC, spread); if(IS_DUCKED(actor)) - spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod); + spread = spread * WEP_CVAR_SEC(WEP_HLAC, spread_crouchmod); - W_SetupShot(actor, weaponentity, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage) * WEP_CVAR_SEC(hlac, shots), thiswep.m_id | HITTYPE_SECONDARY); + W_SetupShot(actor, weaponentity, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(WEP_HLAC, damage) * WEP_CVAR_SEC(WEP_HLAC, shots), thiswep.m_id | HITTYPE_SECONDARY); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hlac, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_HLAC, ammo), weaponentity); - for(int j = WEP_CVAR_SEC(hlac, shots); j > 0; --j) + for(int j = WEP_CVAR_SEC(WEP_HLAC, shots); j > 0; --j) { missile = new(hlacbolt); missile.owner = missile.realowner = actor; missile.bot_dodge = true; - missile.bot_dodgerating = WEP_CVAR_SEC(hlac, damage); + missile.bot_dodgerating = WEP_CVAR_SEC(WEP_HLAC, damage); set_movetype(missile, MOVETYPE_FLY); PROJECTILE_MAKETRIGGER(missile); @@ -94,13 +94,13 @@ void W_HLAC_Attack2(Weapon thiswep, entity actor, .entity weaponentity) setorigin(missile, w_shotorg); setsize(missile, '0 0 0', '0 0 0'); - W_SetupProjVelocity_Basic(missile, WEP_CVAR_SEC(hlac, speed), spread); + W_SetupProjVelocity_Basic(missile, WEP_CVAR_SEC(WEP_HLAC, speed), spread); //missile.angles = vectoangles(missile.velocity); // csqc settouch(missile, W_HLAC_Touch); setthink(missile, SUB_Remove); - missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime); + missile.nextthink = time + WEP_CVAR_SEC(WEP_HLAC, lifetime); missile.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, missile); @@ -140,59 +140,59 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int return; } - ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor(actor); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(WEP_HLAC, refire) * W_WeaponRateFactor(actor); W_HLAC_Attack(thiswep, actor, weaponentity); actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_HLAC, refire), W_HLAC_Attack_Frame); } else { - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_HLAC, animtime), w_ready); } } METHOD(HLAC, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { - PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false, true); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_HLAC, speed), 0, WEP_CVAR_PRI(WEP_HLAC, lifetime), false, true); } METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if(autocvar_g_balance_hlac_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload + if(autocvar_g_balance_hlac_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(WEP_HLAC, ammo), WEP_CVAR_SEC(WEP_HLAC, ammo))) { // forced reload thiswep.wr_reload(thiswep, actor, weaponentity); } else if(fire & 1) { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_HLAC, refire))) { actor.(weaponentity).misc_bulletcounter = 0; W_HLAC_Attack(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_HLAC, refire), W_HLAC_Attack_Frame); } } - else if((fire & 2) && WEP_CVAR(hlac, secondary)) + else if((fire & 2) && WEP_CVAR(WEP_HLAC, secondary)) { - if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hlac, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_HLAC, refire))) { W_HLAC_Attack2(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_HLAC, animtime), w_ready); } } } METHOD(HLAC, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(hlac, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(hlac, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_HLAC, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_HLAC, ammo); return ammo_amount; } METHOD(HLAC, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hlac, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(hlac, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_HLAC, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_HLAC, ammo); return ammo_amount; } METHOD(HLAC, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND_RELOAD); + W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(WEP_HLAC, ammo), WEP_CVAR_SEC(WEP_HLAC, ammo)), SND_RELOAD); } METHOD(HLAC, wr_suicidemessage, Notification(entity thiswep)) { diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index 94d4ac33e..e383760d3 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -30,12 +30,12 @@ void W_Hook_Explode2(entity this) setthink(this, W_Hook_ExplodeThink); this.nextthink = time; - this.dmg = WEP_CVAR_SEC(hook, damage); - this.dmg_edge = WEP_CVAR_SEC(hook, edgedamage); - this.dmg_radius = WEP_CVAR_SEC(hook, radius); - this.dmg_force = WEP_CVAR_SEC(hook, force); - this.dmg_power = WEP_CVAR_SEC(hook, power); - this.dmg_duration = WEP_CVAR_SEC(hook, duration); + this.dmg = WEP_CVAR_SEC(WEP_HOOK, damage); + this.dmg_edge = WEP_CVAR_SEC(WEP_HOOK, edgedamage); + this.dmg_radius = WEP_CVAR_SEC(WEP_HOOK, radius); + this.dmg_force = WEP_CVAR_SEC(WEP_HOOK, force); + this.dmg_power = WEP_CVAR_SEC(WEP_HOOK, power); + this.dmg_duration = WEP_CVAR_SEC(WEP_HOOK, duration); this.teleport_time = time; this.dmg_last = 1; set_movetype(this, MOVETYPE_NONE); @@ -68,13 +68,13 @@ void W_Hook_Touch2(entity this, entity toucher) void W_Hook_Attack2(Weapon thiswep, entity actor, .entity weaponentity) { - //W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb) - W_SetupShot(actor, weaponentity, false, 4, SND_HOOKBOMB_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hook, damage), WEP_HOOK.m_id | HITTYPE_SECONDARY); + //W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_HOOK, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb) + W_SetupShot(actor, weaponentity, false, 4, SND_HOOKBOMB_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(WEP_HOOK, damage), WEP_HOOK.m_id | HITTYPE_SECONDARY); entity gren = new(hookbomb); gren.owner = gren.realowner = actor; gren.bot_dodge = true; - gren.bot_dodgerating = WEP_CVAR_SEC(hook, damage); + gren.bot_dodgerating = WEP_CVAR_SEC(WEP_HOOK, damage); set_movetype(gren, MOVETYPE_TOSS); PROJECTILE_MAKETRIGGER(gren); gren.projectiledeathtype = WEP_HOOK.m_id | HITTYPE_SECONDARY; @@ -82,24 +82,24 @@ void W_Hook_Attack2(Weapon thiswep, entity actor, .entity weaponentity) setorigin(gren, w_shotorg); setsize(gren, '0 0 0', '0 0 0'); - gren.nextthink = time + WEP_CVAR_SEC(hook, lifetime); + gren.nextthink = time + WEP_CVAR_SEC(WEP_HOOK, lifetime); setthink(gren, adaptor_think2use_hittype_splash); gren.use = W_Hook_Explode2_use; settouch(gren, W_Hook_Touch2); gren.takedamage = DAMAGE_YES; - SetResourceExplicit(gren, RES_HEALTH, WEP_CVAR_SEC(hook, health)); - gren.damageforcescale = WEP_CVAR_SEC(hook, damageforcescale); + SetResourceExplicit(gren, RES_HEALTH, WEP_CVAR_SEC(WEP_HOOK, health)); + gren.damageforcescale = WEP_CVAR_SEC(WEP_HOOK, damageforcescale); gren.event_damage = W_Hook_Damage; gren.damagedbycontents = true; IL_PUSH(g_damagedbycontents, gren); gren.missile_flags = MIF_SPLASH | MIF_ARC; - gren.velocity = '0 0 1' * WEP_CVAR_SEC(hook, speed); + gren.velocity = '0 0 1' * WEP_CVAR_SEC(WEP_HOOK, speed); if (autocvar_g_projectiles_newton_style) gren.velocity = gren.velocity + actor.velocity; - gren.gravity = WEP_CVAR_SEC(hook, gravity); + gren.gravity = WEP_CVAR_SEC(WEP_HOOK, gravity); //W_SetupProjVelocity_Basic(gren); // just falling down! gren.angles = '0 0 0'; @@ -120,10 +120,10 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, if(time > actor.(weaponentity).hook_refire) if(weapon_prepareattack(thiswep, actor, weaponentity, false, -1)) { - W_DecreaseAmmo(thiswep, actor, thiswep.ammo_factor * WEP_CVAR_PRI(hook, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, thiswep.ammo_factor * WEP_CVAR_PRI(WEP_HOOK, ammo), weaponentity); actor.(weaponentity).hook_state |= HOOK_FIRING; actor.(weaponentity).hook_state |= HOOK_WAITING_FOR_RELEASE; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_HOOK, animtime), w_ready); } } else { actor.(weaponentity).hook_state |= HOOK_REMOVING; @@ -132,17 +132,17 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, if(fire & 2) { - if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hook, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_HOOK, refire))) { W_Hook_Attack2(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_HOOK, animtime), w_ready); } } if(actor.(weaponentity).hook) { // if hooked, no bombs, and increase the timer - actor.(weaponentity).hook_refire = max(actor.(weaponentity).hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor(actor)); + actor.(weaponentity).hook_refire = max(actor.(weaponentity).hook_refire, time + WEP_CVAR_PRI(WEP_HOOK, refire) * W_WeaponRateFactor(actor)); // hook also inhibits health regeneration, but only for 1 second if(!(actor.items & IT_UNLIMITED_AMMO)) @@ -151,14 +151,14 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, if(actor.(weaponentity).hook && actor.(weaponentity).hook.state == 1) { - float hooked_time_max = WEP_CVAR_PRI(hook, hooked_time_max); + float hooked_time_max = WEP_CVAR_PRI(WEP_HOOK, hooked_time_max); if(hooked_time_max > 0) { if( time > actor.(weaponentity).hook_time_hooked + hooked_time_max ) actor.(weaponentity).hook_state |= HOOK_REMOVING; } - float hooked_fuel = thiswep.ammo_factor * WEP_CVAR_PRI(hook, hooked_ammo); + float hooked_fuel = thiswep.ammo_factor * WEP_CVAR_PRI(WEP_HOOK, hooked_ammo); if(hooked_fuel > 0) { if( time > actor.(weaponentity).hook_time_fueldecrease ) @@ -185,7 +185,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, else { actor.(weaponentity).hook_time_hooked = time; - actor.(weaponentity).hook_time_fueldecrease = time + WEP_CVAR_PRI(hook, hooked_time_free); + actor.(weaponentity).hook_time_fueldecrease = time + WEP_CVAR_PRI(WEP_HOOK, hooked_time_free); } actor.(weaponentity).hook_state = BITSET(actor.(weaponentity).hook_state, HOOK_PULLING, (!PHYS_INPUT_BUTTON_CROUCH(actor) || !autocvar_g_balance_grapplehook_crouchslide)); @@ -216,12 +216,12 @@ METHOD(Hook, wr_checkammo1, bool(Hook thiswep, entity actor, .entity weaponentit if(actor.(weaponentity).hook) return GetResource(actor, RES_FUEL) > 0; - return GetResource(actor, RES_FUEL) >= WEP_CVAR_PRI(hook, ammo); + return GetResource(actor, RES_FUEL) >= WEP_CVAR_PRI(WEP_HOOK, ammo); } METHOD(Hook, wr_checkammo2, bool(Hook thiswep, entity actor, .entity weaponentity)) { // infinite ammo for now - return true; // actor.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above + return true; // actor.ammo_cells >= WEP_CVAR_SEC(WEP_HOOK, ammo); // WEAPONTODO: see above } METHOD(Hook, wr_resetplayer, void(entity thiswep, entity actor)) { diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index efb4913c0..bb68bdece 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -4,7 +4,7 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity weaponentity) { - W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, ((actor.(weaponentity).misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)), deathtype); + W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, ((actor.(weaponentity).misc_bulletcounter == 1) ? WEP_CVAR(WEP_MACHINEGUN, first_damage) : WEP_CVAR(WEP_MACHINEGUN, sustained_damage)), deathtype); if(!autocvar_g_norecoil) { @@ -13,31 +13,31 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity we } // this attack_finished just enforces a cooldown at the end of a burst - ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(WEP_MACHINEGUN, first_refire) * W_WeaponRateFactor(actor); if(actor.(weaponentity).misc_bulletcounter == 1) fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, - WEP_CVAR(machinegun, first_spread), - WEP_CVAR(machinegun, solidpenetration), - WEP_CVAR(machinegun, first_damage), - WEP_CVAR(machinegun, damagefalloff_halflife), - WEP_CVAR(machinegun, damagefalloff_mindist), - WEP_CVAR(machinegun, damagefalloff_maxdist), + WEP_CVAR(WEP_MACHINEGUN, first_spread), + WEP_CVAR(WEP_MACHINEGUN, solidpenetration), + WEP_CVAR(WEP_MACHINEGUN, first_damage), + WEP_CVAR(WEP_MACHINEGUN, damagefalloff_halflife), + WEP_CVAR(WEP_MACHINEGUN, damagefalloff_mindist), + WEP_CVAR(WEP_MACHINEGUN, damagefalloff_maxdist), 0, - WEP_CVAR(machinegun, first_force), - WEP_CVAR(machinegun, damagefalloff_forcehalflife), + WEP_CVAR(WEP_MACHINEGUN, first_force), + WEP_CVAR(WEP_MACHINEGUN, damagefalloff_forcehalflife), deathtype, EFFECT_BULLET, true); else fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, - WEP_CVAR(machinegun, sustained_spread), - WEP_CVAR(machinegun, solidpenetration), - WEP_CVAR(machinegun, sustained_damage), - WEP_CVAR(machinegun, damagefalloff_halflife), - WEP_CVAR(machinegun, damagefalloff_mindist), - WEP_CVAR(machinegun, damagefalloff_maxdist), + WEP_CVAR(WEP_MACHINEGUN, sustained_spread), + WEP_CVAR(WEP_MACHINEGUN, solidpenetration), + WEP_CVAR(WEP_MACHINEGUN, sustained_damage), + WEP_CVAR(WEP_MACHINEGUN, damagefalloff_halflife), + WEP_CVAR(WEP_MACHINEGUN, damagefalloff_mindist), + WEP_CVAR(WEP_MACHINEGUN, damagefalloff_maxdist), 0, - WEP_CVAR(machinegun, sustained_force), - WEP_CVAR(machinegun, damagefalloff_forcehalflife), + WEP_CVAR(WEP_MACHINEGUN, sustained_force), + WEP_CVAR(WEP_MACHINEGUN, damagefalloff_forcehalflife), deathtype, EFFECT_BULLET, true); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); @@ -50,9 +50,9 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity we } if(actor.(weaponentity).misc_bulletcounter == 1) - W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, first_ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_MACHINEGUN, first_ammo), weaponentity); else - W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, sustained_ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_MACHINEGUN, sustained_ammo), weaponentity); } // weapon frames @@ -74,10 +74,10 @@ void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentit } actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1; W_MachineGun_Attack(thiswep, thiswep.m_id, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_MACHINEGUN, sustained_refire), W_MachineGun_Attack_Frame); } else - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_MACHINEGUN, sustained_refire), w_ready); } @@ -99,19 +99,19 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity return; } - W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, sustained_ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_MACHINEGUN, sustained_ammo), weaponentity); - W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage), thiswep.m_id); + W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(WEP_MACHINEGUN, sustained_damage), thiswep.m_id); if(!autocvar_g_norecoil) { actor.punchangle_x = random() - 0.5; actor.punchangle_y = random() - 0.5; } - machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + (WEP_CVAR(machinegun, spread_add) * actor.(weaponentity).misc_bulletcounter), WEP_CVAR(machinegun, spread_max)); - fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), - WEP_CVAR(machinegun, damagefalloff_halflife), WEP_CVAR(machinegun, damagefalloff_mindist), WEP_CVAR(machinegun, damagefalloff_maxdist), 0, - WEP_CVAR(machinegun, sustained_force), WEP_CVAR(machinegun, damagefalloff_forcehalflife), thiswep.m_id, EFFECT_BULLET, true); + machinegun_spread = bound(WEP_CVAR(WEP_MACHINEGUN, spread_min), WEP_CVAR(WEP_MACHINEGUN, spread_min) + (WEP_CVAR(WEP_MACHINEGUN, spread_add) * actor.(weaponentity).misc_bulletcounter), WEP_CVAR(WEP_MACHINEGUN, spread_max)); + fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(WEP_MACHINEGUN, solidpenetration), WEP_CVAR(WEP_MACHINEGUN, sustained_damage), + WEP_CVAR(WEP_MACHINEGUN, damagefalloff_halflife), WEP_CVAR(WEP_MACHINEGUN, damagefalloff_mindist), WEP_CVAR(WEP_MACHINEGUN, damagefalloff_maxdist), 0, + WEP_CVAR(WEP_MACHINEGUN, sustained_force), WEP_CVAR(WEP_MACHINEGUN, damagefalloff_forcehalflife), thiswep.m_id, EFFECT_BULLET, true); actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1; @@ -123,22 +123,22 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), vectoangles(v_forward), 3, actor, weaponentity); } - ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Auto); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(WEP_MACHINEGUN, first_refire) * W_WeaponRateFactor(actor); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_MACHINEGUN, sustained_refire), W_MachineGun_Attack_Auto); } void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentity, int fire) { - W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage), thiswep.m_id); + W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(WEP_MACHINEGUN, sustained_damage), thiswep.m_id); if(!autocvar_g_norecoil) { actor.punchangle_x = random() - 0.5; actor.punchangle_y = random() - 0.5; } - fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), - WEP_CVAR(machinegun, damagefalloff_halflife), WEP_CVAR(machinegun, damagefalloff_mindist), WEP_CVAR(machinegun, damagefalloff_maxdist), 0, - WEP_CVAR(machinegun, sustained_force), WEP_CVAR(machinegun, damagefalloff_forcehalflife), thiswep.m_id, EFFECT_BULLET, true); + fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(WEP_MACHINEGUN, burst_spread), WEP_CVAR(WEP_MACHINEGUN, solidpenetration), WEP_CVAR(WEP_MACHINEGUN, sustained_damage), + WEP_CVAR(WEP_MACHINEGUN, damagefalloff_halflife), WEP_CVAR(WEP_MACHINEGUN, damagefalloff_mindist), WEP_CVAR(WEP_MACHINEGUN, damagefalloff_maxdist), 0, + WEP_CVAR(WEP_MACHINEGUN, sustained_force), WEP_CVAR(WEP_MACHINEGUN, damagefalloff_forcehalflife), thiswep.m_id, EFFECT_BULLET, true); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); @@ -151,12 +151,12 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1; if(actor.(weaponentity).misc_bulletcounter == 0) { - ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(machinegun, burst_refire2) * W_WeaponRateFactor(actor); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, burst_animtime), w_ready); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(WEP_MACHINEGUN, burst_refire2) * W_WeaponRateFactor(actor); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(WEP_MACHINEGUN, burst_animtime), w_ready); } else { - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, burst_refire), W_MachineGun_Attack_Burst); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(WEP_MACHINEGUN, burst_refire), W_MachineGun_Attack_Burst); } } @@ -171,13 +171,13 @@ METHOD(MachineGun, wr_aim, void(entity thiswep, entity actor, .entity weaponenti METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { // forced reload - wait until the bulletcounter is 0 so a burst loop can finish - if(WEP_CVAR(machinegun, reload_ammo) - && actor.(weaponentity).clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)) + if(WEP_CVAR(WEP_MACHINEGUN, reload_ammo) + && actor.(weaponentity).clip_load < min(max(WEP_CVAR(WEP_MACHINEGUN, sustained_ammo), WEP_CVAR(WEP_MACHINEGUN, first_ammo)), WEP_CVAR(WEP_MACHINEGUN, burst_ammo)) && actor.(weaponentity).misc_bulletcounter >= 0) { thiswep.wr_reload(thiswep, actor, weaponentity); } - else if(WEP_CVAR(machinegun, mode) == 1) + else if(WEP_CVAR(WEP_MACHINEGUN, mode) == 1) { if(fire & 1) if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0)) @@ -199,7 +199,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen } float ammo_available; - if (WEP_CVAR(machinegun, reload_ammo) > 0) + if (WEP_CVAR(WEP_MACHINEGUN, reload_ammo) > 0) { ammo_available = actor.(weaponentity).clip_load; } @@ -210,11 +210,11 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen // We don't want to shoot 3 rounds if there's 2 left in the mag, so we'll use a fraction. // Also keep the fraction <= 1 otherwise we'd mag dump in one burst. - float burst_fraction = min(1, ammo_available / WEP_CVAR(machinegun, burst_ammo)); - int to_shoot = floor(WEP_CVAR(machinegun, burst) * burst_fraction); + float burst_fraction = min(1, ammo_available / WEP_CVAR(WEP_MACHINEGUN, burst_ammo)); + int to_shoot = floor(WEP_CVAR(WEP_MACHINEGUN, burst) * burst_fraction); // We also don't want to use 3 rounds if there's only 2 left. - int to_use = min(WEP_CVAR(machinegun, burst_ammo), ammo_available); + int to_use = min(WEP_CVAR(WEP_MACHINEGUN, burst_ammo), ammo_available); W_DecreaseAmmo(thiswep, actor, to_use, weaponentity); // Bursting counts up to 0 from a negative. @@ -230,50 +230,50 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen { actor.(weaponentity).misc_bulletcounter = 1; W_MachineGun_Attack(thiswep, thiswep.m_id, actor, weaponentity); // sets attack_finished - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_MACHINEGUN, sustained_refire), W_MachineGun_Attack_Frame); } - if((fire & 2) && WEP_CVAR(machinegun, first)) + if((fire & 2) && WEP_CVAR(WEP_MACHINEGUN, first)) if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0)) { actor.(weaponentity).misc_bulletcounter = 1; W_MachineGun_Attack(thiswep, thiswep.m_id | HITTYPE_SECONDARY, actor, weaponentity); // sets attack_finished - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(WEP_MACHINEGUN, first_refire), w_ready); } } } METHOD(MachineGun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { float ammo_amount; - if(WEP_CVAR(machinegun, mode) == 1) - ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(machinegun, sustained_ammo); + if(WEP_CVAR(WEP_MACHINEGUN, mode) == 1) + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_MACHINEGUN, sustained_ammo); else - ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(machinegun, first_ammo); + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_MACHINEGUN, first_ammo); - if(WEP_CVAR(machinegun, reload_ammo)) + if(WEP_CVAR(WEP_MACHINEGUN, reload_ammo)) { - if(WEP_CVAR(machinegun, mode) == 1) - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(machinegun, sustained_ammo); + if(WEP_CVAR(WEP_MACHINEGUN, mode) == 1) + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(WEP_MACHINEGUN, sustained_ammo); else - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(machinegun, first_ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(WEP_MACHINEGUN, first_ammo); } return ammo_amount; } METHOD(MachineGun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { float ammo_amount; - float burst_ammo_per_shot = WEP_CVAR(machinegun, burst_ammo) / WEP_CVAR(machinegun, burst); - if(WEP_CVAR(machinegun, mode) == 1) + float burst_ammo_per_shot = WEP_CVAR(WEP_MACHINEGUN, burst_ammo) / WEP_CVAR(WEP_MACHINEGUN, burst); + if(WEP_CVAR(WEP_MACHINEGUN, mode) == 1) ammo_amount = GetResource(actor, thiswep.ammo_type) >= burst_ammo_per_shot; else - ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(machinegun, first_ammo); + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_MACHINEGUN, first_ammo); - if(WEP_CVAR(machinegun, reload_ammo)) + if(WEP_CVAR(WEP_MACHINEGUN, reload_ammo)) { - if(WEP_CVAR(machinegun, mode) == 1) + if(WEP_CVAR(WEP_MACHINEGUN, mode) == 1) ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= burst_ammo_per_shot; else - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(machinegun, first_ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(WEP_MACHINEGUN, first_ammo); } return ammo_amount; } @@ -281,7 +281,7 @@ METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weapone { if(actor.(weaponentity).misc_bulletcounter < 0) return; - W_Reload(actor, weaponentity, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND_RELOAD); + W_Reload(actor, weaponentity, min(max(WEP_CVAR(WEP_MACHINEGUN, sustained_ammo), WEP_CVAR(WEP_MACHINEGUN, first_ammo)), WEP_CVAR(WEP_MACHINEGUN, burst_ammo)), SND_RELOAD); } METHOD(MachineGun, wr_suicidemessage, Notification(entity thiswep)) { diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 63c7b9e44..0131669bf 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -65,7 +65,7 @@ void W_MineLayer_Explode(entity this, entity directhitentity) this.event_damage = func_null; this.takedamage = DAMAGE_NO; - RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, damage), WEP_CVAR(minelayer, edgedamage), WEP_CVAR(minelayer, radius), NULL, NULL, WEP_CVAR(minelayer, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR(WEP_MINE_LAYER, damage), WEP_CVAR(WEP_MINE_LAYER, edgedamage), WEP_CVAR(WEP_MINE_LAYER, radius), NULL, NULL, WEP_CVAR(WEP_MINE_LAYER, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); .entity weaponentity = this.weaponentity_fld; Weapon thiswep = WEP_MINE_LAYER; @@ -95,8 +95,8 @@ void W_MineLayer_DoRemoteExplode(entity this) if(this.move_movetype == MOVETYPE_NONE || this.move_movetype == MOVETYPE_FOLLOW) this.velocity = this.movedir; // .velocity must be != '0 0 0' for particle fx and decal to work - RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius), - NULL, NULL, WEP_CVAR(minelayer, remote_force), this.projectiledeathtype | HITTYPE_BOUNCE, this.weaponentity_fld, NULL); + RadiusDamage(this, this.realowner, WEP_CVAR(WEP_MINE_LAYER, remote_damage), WEP_CVAR(WEP_MINE_LAYER, remote_edgedamage), WEP_CVAR(WEP_MINE_LAYER, remote_radius), + NULL, NULL, WEP_CVAR(WEP_MINE_LAYER, remote_force), this.projectiledeathtype | HITTYPE_BOUNCE, this.weaponentity_fld, NULL); .entity weaponentity = this.weaponentity_fld; Weapon thiswep = WEP_MINE_LAYER; @@ -118,7 +118,7 @@ void W_MineLayer_RemoteExplode(entity this) if(!IS_DEAD(this.realowner)) if((this.spawnshieldtime >= 0) ? (time >= this.spawnshieldtime) // timer - : (vdist(NearestPointOnBox(this.realowner, this.origin) - this.origin, >, WEP_CVAR(minelayer, remote_radius))) // safety device + : (vdist(NearestPointOnBox(this.realowner, this.origin) - this.origin, >, WEP_CVAR(WEP_MINE_LAYER, remote_radius))) // safety device ) { W_MineLayer_DoRemoteExplode(this); @@ -128,10 +128,10 @@ void W_MineLayer_RemoteExplode(entity this) void W_MineLayer_ProximityExplode(entity this) { // make sure no friend is in the mine's radius. If there is any, explosion is delayed until they're at a safe distance - if(WEP_CVAR(minelayer, protection) && this.mine_explodeanyway == 0) + if(WEP_CVAR(WEP_MINE_LAYER, protection) && this.mine_explodeanyway == 0) { entity head; - head = findradius(this.origin, WEP_CVAR(minelayer, radius)); + head = findradius(this.origin, WEP_CVAR(WEP_MINE_LAYER, radius)); while(head) { if(head == this.realowner || SAME_TEAM(head, this.realowner)) @@ -174,9 +174,9 @@ void W_MineLayer_Think(entity this) // TODO: replace this mine_trigger.wav sound with a real countdown if((time > this.cnt) && (!this.mine_time) && (this.cnt > 0)) { - if(WEP_CVAR(minelayer, lifetime_countdown) > 0) + if(WEP_CVAR(WEP_MINE_LAYER, lifetime_countdown) > 0) spamsound(this, CH_SHOTS, SND_MINE_TRIGGER, VOL_BASE, ATTN_NORM); - this.mine_time = time + WEP_CVAR(minelayer, lifetime_countdown); + this.mine_time = time + WEP_CVAR(WEP_MINE_LAYER, lifetime_countdown); this.mine_explodeanyway = 1; // make the mine super aggressive -- Samual: Rather, make it not care if a team mate is near. } @@ -190,7 +190,7 @@ void W_MineLayer_Think(entity this) } // set the mine for detonation when a foe gets close enough - head = findradius(this.origin, WEP_CVAR(minelayer, proximityradius)); + head = findradius(this.origin, WEP_CVAR(WEP_MINE_LAYER, proximityradius)); while(head) { if(IS_PLAYER(head) && !IS_DEAD(head) && !STAT(FROZEN, head) && !IS_INDEPENDENT_PLAYER(head)) @@ -198,7 +198,7 @@ void W_MineLayer_Think(entity this) if(!this.mine_time) { spamsound(this, CH_SHOTS, SND_MINE_TRIGGER, VOL_BASE, ATTN_NORM); - this.mine_time = time + WEP_CVAR(minelayer, time); + this.mine_time = time + WEP_CVAR(WEP_MINE_LAYER, time); } head = head.chain; } @@ -256,38 +256,38 @@ void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float da void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity) { // scan how many mines we placed, and return if we reached our limit - if(WEP_CVAR(minelayer, limit)) + if(WEP_CVAR(WEP_MINE_LAYER, limit)) { int minecount = W_MineLayer_Count(actor, weaponentity); - if(minecount >= WEP_CVAR(minelayer, limit)) + if(minecount >= WEP_CVAR(WEP_MINE_LAYER, limit)) { // the refire delay keeps this message from being spammed - Send_Notification(NOTIF_ONE, actor, MSG_MULTI, WEAPON_MINELAYER_LIMIT, WEP_CVAR(minelayer, limit)); + Send_Notification(NOTIF_ONE, actor, MSG_MULTI, WEAPON_MINELAYER_LIMIT, WEP_CVAR(WEP_MINE_LAYER, limit)); play2(actor, SND(UNAVAILABLE)); return; } } - W_DecreaseAmmo(thiswep, actor, WEP_CVAR(minelayer, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_MINE_LAYER, ammo), weaponentity); - W_SetupShot_ProjectileSize(actor, weaponentity, '-4 -4 -4', '4 4 4', false, 5, SND_MINE_FIRE, CH_WEAPON_A, WEP_CVAR(minelayer, damage), thiswep.m_id); + W_SetupShot_ProjectileSize(actor, weaponentity, '-4 -4 -4', '4 4 4', false, 5, SND_MINE_FIRE, CH_WEAPON_A, WEP_CVAR(WEP_MINE_LAYER, damage), thiswep.m_id); W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); entity mine = WarpZone_RefSys_SpawnSameRefSys(actor); mine.weaponentity_fld = weaponentity; IL_PUSH(g_mines, mine); mine.owner = mine.realowner = actor; - if(WEP_CVAR(minelayer, detonatedelay) >= 0) - mine.spawnshieldtime = time + WEP_CVAR(minelayer, detonatedelay); + if(WEP_CVAR(WEP_MINE_LAYER, detonatedelay) >= 0) + mine.spawnshieldtime = time + WEP_CVAR(WEP_MINE_LAYER, detonatedelay); else mine.spawnshieldtime = -1; mine.classname = "mine"; mine.bot_dodge = true; - mine.bot_dodgerating = WEP_CVAR(minelayer, damage) * 2; // * 2 because it can detonate inflight which makes it even more dangerous + mine.bot_dodgerating = WEP_CVAR(WEP_MINE_LAYER, damage) * 2; // * 2 because it can detonate inflight which makes it even more dangerous mine.takedamage = DAMAGE_YES; - mine.damageforcescale = WEP_CVAR(minelayer, damageforcescale); - SetResourceExplicit(mine, RES_HEALTH, WEP_CVAR(minelayer, health)); + mine.damageforcescale = WEP_CVAR(WEP_MINE_LAYER, damageforcescale); + SetResourceExplicit(mine, RES_HEALTH, WEP_CVAR(WEP_MINE_LAYER, health)); mine.event_damage = W_MineLayer_Damage; mine.damagedbycontents = true; IL_PUSH(g_damagedbycontents, mine); @@ -299,13 +299,13 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity) setsize(mine, '-4 -4 -4', '4 4 4'); // give it some size so it can be shot setorigin(mine, w_shotorg - v_forward * 4); // move it back so it hits the wall at the right point - W_SetupProjVelocity_Basic(mine, WEP_CVAR(minelayer, speed), 0); + W_SetupProjVelocity_Basic(mine, WEP_CVAR(WEP_MINE_LAYER, speed), 0); mine.angles = vectoangles(mine.velocity); settouch(mine, W_MineLayer_Touch); setthink(mine, W_MineLayer_Think); mine.nextthink = time; - mine.cnt = (WEP_CVAR(minelayer, lifetime) - WEP_CVAR(minelayer, lifetime_countdown)); + mine.cnt = (WEP_CVAR(WEP_MINE_LAYER, lifetime) - WEP_CVAR(WEP_MINE_LAYER, lifetime_countdown)); mine.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, mine); IL_PUSH(g_bot_dodge, mine); @@ -344,18 +344,18 @@ METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor, .entity weaponentit { // aim and decide to fire if appropriate int minecount = W_MineLayer_Count(actor, weaponentity); - if(minecount >= WEP_CVAR(minelayer, limit)) + if(minecount >= WEP_CVAR(WEP_MINE_LAYER, limit)) PHYS_INPUT_BUTTON_ATCK(actor) = false; else - PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false, false); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR(WEP_MINE_LAYER, speed), 0, WEP_CVAR(WEP_MINE_LAYER, lifetime), false, false); if(skill >= 2) // skill 0 and 1 bots won't detonate mines! { // decide whether to detonate mines float edgedamage, coredamage, edgeradius, recipricoledgeradius; float selfdamage, teamdamage, enemydamage; - edgedamage = WEP_CVAR(minelayer, edgedamage); - coredamage = WEP_CVAR(minelayer, damage); - edgeradius = WEP_CVAR(minelayer, radius); + edgedamage = WEP_CVAR(WEP_MINE_LAYER, edgedamage); + coredamage = WEP_CVAR(WEP_MINE_LAYER, damage); + edgeradius = WEP_CVAR(WEP_MINE_LAYER, radius); recipricoledgeradius = 1 / edgeradius; selfdamage = 0; teamdamage = 0; @@ -429,19 +429,19 @@ METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponent { actor.(weaponentity).minelayer_mines = W_MineLayer_Count(actor, weaponentity); - if(autocvar_g_balance_minelayer_reload_ammo && actor.(weaponentity).clip_load < WEP_CVAR(minelayer, ammo)) // forced reload + if(autocvar_g_balance_minelayer_reload_ammo && actor.(weaponentity).clip_load < WEP_CVAR(WEP_MINE_LAYER, ammo)) // forced reload { // not if we're holding the minelayer without enough ammo, but can detonate existing mines - if(!(W_MineLayer_PlacedMines(actor, weaponentity, false) && GetResource(actor, thiswep.ammo_type) < WEP_CVAR(minelayer, ammo))) { + if(!(W_MineLayer_PlacedMines(actor, weaponentity, false) && GetResource(actor, thiswep.ammo_type) < WEP_CVAR(WEP_MINE_LAYER, ammo))) { thiswep.wr_reload(thiswep, actor, weaponentity); } } else if(fire & 1) { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(minelayer, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(WEP_MINE_LAYER, refire))) { W_MineLayer_Attack(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_MINE_LAYER, animtime), w_ready); } } @@ -456,8 +456,8 @@ METHOD(MineLayer, wr_checkammo1, bool(entity thiswep, entity actor, .entity weap // actually do // don't switch while placing a mine //if(ATTACK_FINISHED(actor, weaponentity) <= time || PS(actor).m_weapon != WEP_MINE_LAYER) //{ - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(minelayer, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(minelayer, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_MINE_LAYER, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(WEP_MINE_LAYER, ammo); return ammo_amount; //} //return true; @@ -479,7 +479,7 @@ METHOD(MineLayer, wr_resetplayer, void(entity thiswep, entity actor)) } METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, WEP_CVAR(minelayer, ammo), SND_RELOAD); + W_Reload(actor, weaponentity, WEP_CVAR(WEP_MINE_LAYER, ammo), SND_RELOAD); } METHOD(MineLayer, wr_suicidemessage, Notification(entity thiswep)) { diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 442f88265..986acd03d 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -17,7 +17,7 @@ void W_Mortar_Grenade_Explode(entity this, entity directhitentity) if(this.move_movetype == MOVETYPE_NONE) this.velocity = this.movedir; // .velocity must be != '0 0 0' for particle fx and decal to work - RadiusDamage(this, this.realowner, WEP_CVAR_PRI(mortar, damage), WEP_CVAR_PRI(mortar, edgedamage), WEP_CVAR_PRI(mortar, radius), NULL, NULL, WEP_CVAR_PRI(mortar, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR_PRI(WEP_MORTAR, damage), WEP_CVAR_PRI(WEP_MORTAR, edgedamage), WEP_CVAR_PRI(WEP_MORTAR, radius), NULL, NULL, WEP_CVAR_PRI(WEP_MORTAR, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -42,7 +42,7 @@ void W_Mortar_Grenade_Explode2(entity this, entity directhitentity) if(this.move_movetype == MOVETYPE_NONE) this.velocity = this.movedir; // .velocity must be != '0 0 0' for particle fx and decal to work - RadiusDamage(this, this.realowner, WEP_CVAR_SEC(mortar, damage), WEP_CVAR_SEC(mortar, edgedamage), WEP_CVAR_SEC(mortar, radius), NULL, NULL, WEP_CVAR_SEC(mortar, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR_SEC(WEP_MORTAR, damage), WEP_CVAR_SEC(WEP_MORTAR, edgedamage), WEP_CVAR_SEC(WEP_MORTAR, radius), NULL, NULL, WEP_CVAR_SEC(WEP_MORTAR, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -75,25 +75,25 @@ void W_Mortar_Grenade_Think1(entity this) W_Mortar_Grenade_Explode(this, NULL); return; } - if(this.gl_detonate_later && this.gl_bouncecnt >= WEP_CVAR_PRI(mortar, remote_minbouncecnt)) + if(this.gl_detonate_later && this.gl_bouncecnt >= WEP_CVAR_PRI(WEP_MORTAR, remote_minbouncecnt)) W_Mortar_Grenade_Explode(this, NULL); } void W_Mortar_Grenade_Touch1(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); - if(toucher.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile + if(toucher.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(WEP_MORTAR, type) == 0) // always explode when hitting a player, or if normal mortar projectile { this.use(this, NULL, toucher); } - else if(WEP_CVAR_PRI(mortar, type) == 1) // bounce + else if(WEP_CVAR_PRI(WEP_MORTAR, type) == 1) // bounce { spamsound(this, CH_SHOTS, SND_GRENADE_BOUNCE_RANDOM(), VOL_BASE, ATTN_NORM); Send_Effect(EFFECT_HAGAR_BOUNCE, this.origin, this.velocity, 1); this.projectiledeathtype |= HITTYPE_BOUNCE; this.gl_bouncecnt += 1; } - else if(WEP_CVAR_PRI(mortar, type) == 2 && (!toucher || (toucher.takedamage != DAMAGE_AIM && toucher.move_movetype == MOVETYPE_NONE))) // stick + else if(WEP_CVAR_PRI(WEP_MORTAR, type) == 2 && (!toucher || (toucher.takedamage != DAMAGE_AIM && toucher.move_movetype == MOVETYPE_NONE))) // stick { spamsound(this, CH_SHOTS, SND_GRENADE_STICK, VOL_BASE, ATTN_NORM); @@ -107,29 +107,29 @@ void W_Mortar_Grenade_Touch1(entity this, entity toucher) // do not respond to any more touches this.solid = SOLID_NOT; - this.nextthink = min(this.nextthink, time + WEP_CVAR_PRI(mortar, lifetime_stick)); + this.nextthink = min(this.nextthink, time + WEP_CVAR_PRI(WEP_MORTAR, lifetime_stick)); } } void W_Mortar_Grenade_Touch2(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); - if(toucher.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile + if(toucher.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(WEP_MORTAR, type) == 0) // always explode when hitting a player, or if normal mortar projectile { this.use(this, NULL, toucher); } - else if(WEP_CVAR_SEC(mortar, type) == 1) // bounce + else if(WEP_CVAR_SEC(WEP_MORTAR, type) == 1) // bounce { spamsound(this, CH_SHOTS, SND_GRENADE_BOUNCE_RANDOM(), VOL_BASE, ATTN_NORM); Send_Effect(EFFECT_HAGAR_BOUNCE, this.origin, this.velocity, 1); this.projectiledeathtype |= HITTYPE_BOUNCE; this.gl_bouncecnt += 1; - if(WEP_CVAR_SEC(mortar, lifetime_bounce) && this.gl_bouncecnt == 1) - this.nextthink = time + WEP_CVAR_SEC(mortar, lifetime_bounce); + if(WEP_CVAR_SEC(WEP_MORTAR, lifetime_bounce) && this.gl_bouncecnt == 1) + this.nextthink = time + WEP_CVAR_SEC(WEP_MORTAR, lifetime_bounce); } - else if(WEP_CVAR_SEC(mortar, type) == 2 && (!toucher || (toucher.takedamage != DAMAGE_AIM && toucher.move_movetype == MOVETYPE_NONE))) // stick + else if(WEP_CVAR_SEC(WEP_MORTAR, type) == 2 && (!toucher || (toucher.takedamage != DAMAGE_AIM && toucher.move_movetype == MOVETYPE_NONE))) // stick { spamsound(this, CH_SHOTS, SND_GRENADE_STICK, VOL_BASE, ATTN_NORM); @@ -143,15 +143,15 @@ void W_Mortar_Grenade_Touch2(entity this, entity toucher) // do not respond to any more touches this.solid = SOLID_NOT; - this.nextthink = min(this.nextthink, time + WEP_CVAR_SEC(mortar, lifetime_stick)); + this.nextthink = min(this.nextthink, time + WEP_CVAR_SEC(WEP_MORTAR, lifetime_stick)); } } void W_Mortar_Attack(Weapon thiswep, entity actor, .entity weaponentity) { - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(mortar, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(WEP_MORTAR, ammo), weaponentity); - W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage), thiswep.m_id); + W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(WEP_MORTAR, damage), thiswep.m_id); w_shotdir = v_forward; // no TrueAim for grenades please W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); @@ -159,37 +159,37 @@ void W_Mortar_Attack(Weapon thiswep, entity actor, .entity weaponentity) entity gren = new(grenade); gren.owner = gren.realowner = actor; gren.bot_dodge = true; - gren.bot_dodgerating = WEP_CVAR_PRI(mortar, damage); + gren.bot_dodgerating = WEP_CVAR_PRI(WEP_MORTAR, damage); set_movetype(gren, MOVETYPE_BOUNCE); - gren.bouncefactor = WEP_CVAR(mortar, bouncefactor); - gren.bouncestop = WEP_CVAR(mortar, bouncestop); + gren.bouncefactor = WEP_CVAR(WEP_MORTAR, bouncefactor); + gren.bouncestop = WEP_CVAR(WEP_MORTAR, bouncestop); PROJECTILE_MAKETRIGGER(gren); gren.projectiledeathtype = thiswep.m_id; gren.weaponentity_fld = weaponentity; setorigin(gren, w_shotorg); setsize(gren, '-3 -3 -3', '3 3 3'); - gren.cnt = time + WEP_CVAR_PRI(mortar, lifetime); + gren.cnt = time + WEP_CVAR_PRI(WEP_MORTAR, lifetime); gren.nextthink = time; setthink(gren, W_Mortar_Grenade_Think1); gren.use = W_Mortar_Grenade_Explode_use; settouch(gren, W_Mortar_Grenade_Touch1); gren.takedamage = DAMAGE_YES; - SetResourceExplicit(gren, RES_HEALTH, WEP_CVAR_PRI(mortar, health)); - gren.damageforcescale = WEP_CVAR_PRI(mortar, damageforcescale); + SetResourceExplicit(gren, RES_HEALTH, WEP_CVAR_PRI(WEP_MORTAR, health)); + gren.damageforcescale = WEP_CVAR_PRI(WEP_MORTAR, damageforcescale); gren.event_damage = W_Mortar_Grenade_Damage; gren.damagedbycontents = true; IL_PUSH(g_damagedbycontents, gren); gren.missile_flags = MIF_SPLASH | MIF_ARC; - W_SetupProjVelocity_UP_PRI(gren, mortar); + W_SetupProjVelocity_UP_PRI(gren, WEP_MORTAR); gren.angles = vectoangles(gren.velocity); gren.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, gren); IL_PUSH(g_bot_dodge, gren); - if(WEP_CVAR_PRI(mortar, type) == 0 || WEP_CVAR_PRI(mortar, type) == 2) + if(WEP_CVAR_PRI(WEP_MORTAR, type) == 0 || WEP_CVAR_PRI(WEP_MORTAR, type) == 2) CSQCProjectile(gren, true, PROJECTILE_GRENADE, true); else CSQCProjectile(gren, true, PROJECTILE_GRENADE_BOUNCING, true); @@ -201,9 +201,9 @@ void W_Mortar_Attack2(Weapon thiswep, entity actor, .entity weaponentity) { entity gren; - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(mortar, ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_MORTAR, ammo), weaponentity); - W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage), thiswep.m_id | HITTYPE_SECONDARY); + W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(WEP_MORTAR, damage), thiswep.m_id | HITTYPE_SECONDARY); w_shotdir = v_forward; // no TrueAim for grenades please W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); @@ -211,36 +211,36 @@ void W_Mortar_Attack2(Weapon thiswep, entity actor, .entity weaponentity) gren = new(grenade); gren.owner = gren.realowner = actor; gren.bot_dodge = true; - gren.bot_dodgerating = WEP_CVAR_SEC(mortar, damage); + gren.bot_dodgerating = WEP_CVAR_SEC(WEP_MORTAR, damage); set_movetype(gren, MOVETYPE_BOUNCE); - gren.bouncefactor = WEP_CVAR(mortar, bouncefactor); - gren.bouncestop = WEP_CVAR(mortar, bouncestop); + gren.bouncefactor = WEP_CVAR(WEP_MORTAR, bouncefactor); + gren.bouncestop = WEP_CVAR(WEP_MORTAR, bouncestop); PROJECTILE_MAKETRIGGER(gren); gren.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; gren.weaponentity_fld = weaponentity; setorigin(gren, w_shotorg); setsize(gren, '-3 -3 -3', '3 3 3'); - gren.nextthink = time + WEP_CVAR_SEC(mortar, lifetime); + gren.nextthink = time + WEP_CVAR_SEC(WEP_MORTAR, lifetime); setthink(gren, adaptor_think2use_hittype_splash); gren.use = W_Mortar_Grenade_Explode2_use; settouch(gren, W_Mortar_Grenade_Touch2); gren.takedamage = DAMAGE_YES; - SetResourceExplicit(gren, RES_HEALTH, WEP_CVAR_SEC(mortar, health)); - gren.damageforcescale = WEP_CVAR_SEC(mortar, damageforcescale); + SetResourceExplicit(gren, RES_HEALTH, WEP_CVAR_SEC(WEP_MORTAR, health)); + gren.damageforcescale = WEP_CVAR_SEC(WEP_MORTAR, damageforcescale); gren.event_damage = W_Mortar_Grenade_Damage; gren.damagedbycontents = true; IL_PUSH(g_damagedbycontents, gren); gren.missile_flags = MIF_SPLASH | MIF_ARC; - W_SetupProjVelocity_UP_SEC(gren, mortar); + W_SetupProjVelocity_UP_SEC(gren, WEP_MORTAR); gren.angles = vectoangles(gren.velocity); gren.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, gren); IL_PUSH(g_bot_dodge, gren); - if(WEP_CVAR_SEC(mortar, type) == 0 || WEP_CVAR_SEC(mortar, type) == 2) + if(WEP_CVAR_SEC(WEP_MORTAR, type) == 0 || WEP_CVAR_SEC(WEP_MORTAR, type) == 2) CSQCProjectile(gren, true, PROJECTILE_GRENADE, true); else CSQCProjectile(gren, true, PROJECTILE_GRENADE_BOUNCING, true); @@ -256,7 +256,7 @@ METHOD(Mortar, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) PHYS_INPUT_BUTTON_ATCK2(actor) = false; if(actor.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH { - if(bot_aim(actor, weaponentity, WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true, true)) + if(bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_MORTAR, speed), WEP_CVAR_PRI(WEP_MORTAR, speed_up), WEP_CVAR_PRI(WEP_MORTAR, lifetime), true, true)) { PHYS_INPUT_BUTTON_ATCK(actor) = true; if(random() < 0.01) actor.bot_secondary_grenademooth = 1; @@ -264,7 +264,7 @@ METHOD(Mortar, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) } else { - if(bot_aim(actor, weaponentity, WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true, true)) + if(bot_aim(actor, weaponentity, WEP_CVAR_SEC(WEP_MORTAR, speed), WEP_CVAR_SEC(WEP_MORTAR, speed_up), WEP_CVAR_SEC(WEP_MORTAR, lifetime), true, true)) { PHYS_INPUT_BUTTON_ATCK2(actor) = true; if(random() < 0.02) actor.bot_secondary_grenademooth = 0; @@ -273,35 +273,35 @@ METHOD(Mortar, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) } /*case WR_CALCINFO: { - wepinfo_pri_refire = max3(sys_frametime, WEP_CVAR_PRI(mortar, refire), WEP_CVAR_PRI(mortar, animtime)); - wepinfo_pri_dps = (WEP_CVAR_PRI(mortar, damage) * (1 / wepinfo_pri_refire)); - wepinfo_pri_speed = (1 / max(1, (10000 / max(1, WEP_CVAR_PRI(mortar, speed))))); + wepinfo_pri_refire = max3(sys_frametime, WEP_CVAR_PRI(WEP_MORTAR, refire), WEP_CVAR_PRI(WEP_MORTAR, animtime)); + wepinfo_pri_dps = (WEP_CVAR_PRI(WEP_MORTAR, damage) * (1 / wepinfo_pri_refire)); + wepinfo_pri_speed = (1 / max(1, (10000 / max(1, WEP_CVAR_PRI(WEP_MORTAR, speed))))); // for the range calculation, closer to 1 is better wepinfo_pri_range_max = 2000 * wepinfo_pri_speed; - wepinfo_pri_range = wepinfo_pri_speed * WEP_CVAR_PRI(mortar, + wepinfo_pri_range = wepinfo_pri_speed * WEP_CVAR_PRI(WEP_MORTAR, - wepinfo_sec_refire = max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime)); - wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / wepinfo_sec_refire)); + wepinfo_sec_refire = max3(sys_frametime, WEP_CVAR_SEC(WEP_MORTAR, refire), WEP_CVAR_SEC(WEP_MORTAR, animtime)); + wepinfo_sec_dps = (WEP_CVAR_SEC(WEP_MORTAR, damage) * (1 / wepinfo_sec_refire)); - wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime)))); + wepinfo_sec_dps = (WEP_CVAR_SEC(WEP_MORTAR, damage) * (1 / max3(sys_frametime, WEP_CVAR_SEC(WEP_MORTAR, refire), WEP_CVAR_SEC(WEP_MORTAR, animtime)))); wepinfo_ter_dps = 0; */ METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if(autocvar_g_balance_mortar_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) { // forced reload + if(autocvar_g_balance_mortar_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(WEP_MORTAR, ammo), WEP_CVAR_SEC(WEP_MORTAR, ammo))) { // forced reload thiswep.wr_reload(thiswep, actor, weaponentity); } else if(fire & 1) { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(mortar, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_MORTAR, refire))) { W_Mortar_Attack(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_MORTAR, animtime), w_ready); } } else if(fire & 2) { - if(WEP_CVAR_SEC(mortar, remote_detonateprimary)) + if(WEP_CVAR_SEC(WEP_MORTAR, remote_detonateprimary)) { bool nadefound = false; IL_EACH(g_projectiles, it.realowner == actor && it.classname == "grenade", @@ -315,28 +315,28 @@ METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity if(nadefound) sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM); } - else if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(mortar, refire))) + else if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_MORTAR, refire))) { W_Mortar_Attack2(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_MORTAR, animtime), w_ready); } } } METHOD(Mortar, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(mortar, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(mortar, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_MORTAR, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_MORTAR, ammo); return ammo_amount; } METHOD(Mortar, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(mortar, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(mortar, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_MORTAR, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_MORTAR, ammo); return ammo_amount; } METHOD(Mortar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND_RELOAD); // WEAPONTODO + W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(WEP_MORTAR, ammo), WEP_CVAR_SEC(WEP_MORTAR, ammo)), SND_RELOAD); // WEAPONTODO } METHOD(Mortar, wr_suicidemessage, Notification(entity thiswep)) { diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index 00999a03f..d54b6a714 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -13,7 +13,7 @@ const int polyline_length = 16; .vector polyline[polyline_length]; void Porto_Draw(entity this) { - if (spectatee_status || intermission == 1 || intermission == 2 || STAT(HEALTH) <= 0 || WEP_CVAR(porto, secondary)) return; + if (spectatee_status || intermission == 1 || intermission == 2 || STAT(HEALTH) <= 0 || WEP_CVAR(WEP_PORTO, secondary)) return; for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { @@ -303,15 +303,15 @@ void W_Porto_Attack(Weapon thiswep, entity actor, .entity weaponentity, float ty setorigin(gren, w_shotorg); setsize(gren, '0 0 0', '0 0 0'); - gren.nextthink = time + WEP_CVAR_BOTH(porto, (type <= 0), lifetime); + gren.nextthink = time + WEP_CVAR_BOTH(WEP_PORTO, (type <= 0), lifetime); setthink(gren, W_Porto_Think); settouch(gren, W_Porto_Touch); // TODO: handle as mutator effect if(StatusEffects_active(STATUSEFFECT_Strength, actor)) - W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(porto, (type <= 0), speed) * autocvar_g_balance_powerup_strength_force, 0); + W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(WEP_PORTO, (type <= 0), speed) * autocvar_g_balance_powerup_strength_force, 0); else - W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(porto, (type <= 0), speed), 0); + W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(WEP_PORTO, (type <= 0), speed), 0); gren.angles = vectoangles(gren.velocity); gren.flags = FL_PROJECTILE; @@ -338,30 +338,30 @@ METHOD(PortoLaunch, wr_aim, void(entity thiswep, entity actor, .entity weaponent { PHYS_INPUT_BUTTON_ATCK(actor) = false; PHYS_INPUT_BUTTON_ATCK2(actor) = false; - if(!WEP_CVAR(porto, secondary)) - if(bot_aim(actor, weaponentity, WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false, true)) + if(!WEP_CVAR(WEP_PORTO, secondary)) + if(bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_PORTO, speed), 0, WEP_CVAR_PRI(WEP_PORTO, lifetime), false, true)) PHYS_INPUT_BUTTON_ATCK(actor) = true; } METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if(WEP_CVAR(porto, secondary)) + if(WEP_CVAR(WEP_PORTO, secondary)) { if(fire & 1) if(!actor.porto_current) if(!actor.porto_forbidden) - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_PORTO, refire))) { W_Porto_Attack(thiswep, actor, weaponentity, 0); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_PORTO, animtime), w_ready); } if(fire & 2) if(!actor.porto_current) if(!actor.porto_forbidden) - if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(porto, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_PORTO, refire))) { W_Porto_Attack(thiswep, actor, weaponentity, 1); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(porto, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_PORTO, animtime), w_ready); } } else @@ -385,10 +385,10 @@ METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weapone if(fire & 1) if(!actor.porto_current) if(!actor.porto_forbidden) - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_PORTO, refire))) { W_Porto_Attack(thiswep, actor, weaponentity, -1); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_PORTO, animtime), w_ready); } } } diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index 265a27b93..a97326954 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -4,18 +4,18 @@ void W_Rifle_FireBullet(Weapon thiswep, .entity weaponentity, int deathtype, Sound pSound, entity actor, bool isprimary) { - float pAmmo = WEP_CVAR_BOTH(rifle, isprimary, ammo); - float pDamage = WEP_CVAR_BOTH(rifle, isprimary, damage); - float pDF_HalfLife = WEP_CVAR_BOTH(rifle, isprimary, damagefalloff_halflife); - float pDF_ForceHalfLife = WEP_CVAR_BOTH(rifle, isprimary, damagefalloff_forcehalflife); - float pDF_MaxDist = WEP_CVAR_BOTH(rifle, isprimary, damagefalloff_maxdist); - float pDF_MinDist = WEP_CVAR_BOTH(rifle, isprimary, damagefalloff_mindist); - float pForce = WEP_CVAR_BOTH(rifle, isprimary, force); - float pHeadshotDamage = WEP_CVAR_BOTH(rifle, isprimary, headshot_multiplier); - float pShots = WEP_CVAR_BOTH(rifle, isprimary, shots); - float pSolidPenetration = WEP_CVAR_BOTH(rifle, isprimary, solidpenetration); - float pSpread = WEP_CVAR_BOTH(rifle, isprimary, spread); - float pTracer = WEP_CVAR_BOTH(rifle, isprimary, tracer); + float pAmmo = WEP_CVAR_BOTH(WEP_RIFLE, isprimary, ammo); + float pDamage = WEP_CVAR_BOTH(WEP_RIFLE, isprimary, damage); + float pDF_HalfLife = WEP_CVAR_BOTH(WEP_RIFLE, isprimary, damagefalloff_halflife); + float pDF_ForceHalfLife = WEP_CVAR_BOTH(WEP_RIFLE, isprimary, damagefalloff_forcehalflife); + float pDF_MaxDist = WEP_CVAR_BOTH(WEP_RIFLE, isprimary, damagefalloff_maxdist); + float pDF_MinDist = WEP_CVAR_BOTH(WEP_RIFLE, isprimary, damagefalloff_mindist); + float pForce = WEP_CVAR_BOTH(WEP_RIFLE, isprimary, force); + float pHeadshotDamage = WEP_CVAR_BOTH(WEP_RIFLE, isprimary, headshot_multiplier); + float pShots = WEP_CVAR_BOTH(WEP_RIFLE, isprimary, shots); + float pSolidPenetration = WEP_CVAR_BOTH(WEP_RIFLE, isprimary, solidpenetration); + float pSpread = WEP_CVAR_BOTH(WEP_RIFLE, isprimary, spread); + float pTracer = WEP_CVAR_BOTH(WEP_RIFLE, isprimary, tracer); W_DecreaseAmmo(thiswep, actor, pAmmo, weaponentity); @@ -125,33 +125,33 @@ METHOD(Rifle, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) } METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if(autocvar_g_balance_rifle_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) { // forced reload + if(autocvar_g_balance_rifle_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(WEP_RIFLE, ammo), WEP_CVAR_SEC(WEP_RIFLE, ammo))) { // forced reload thiswep.wr_reload(thiswep, actor, weaponentity); } else { - actor.(weaponentity).rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.(weaponentity).rifle_accumulator, time); + actor.(weaponentity).rifle_accumulator = bound(time - WEP_CVAR(WEP_RIFLE, bursttime), actor.(weaponentity).rifle_accumulator, time); if(fire & 1) - if(weapon_prepareattack_check(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire))) - if(time >= actor.(weaponentity).rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost)) + if(weapon_prepareattack_check(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_RIFLE, refire))) + if(time >= actor.(weaponentity).rifle_accumulator + WEP_CVAR_PRI(WEP_RIFLE, burstcost)) { - weapon_prepareattack_do(actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire)); - W_Rifle_BulletHail(thiswep, actor, weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire)); - actor.(weaponentity).rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost); + weapon_prepareattack_do(actor, weaponentity, false, WEP_CVAR_PRI(WEP_RIFLE, refire)); + W_Rifle_BulletHail(thiswep, actor, weaponentity, WEP_CVAR_PRI(WEP_RIFLE, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_RIFLE, animtime), WEP_CVAR_PRI(WEP_RIFLE, refire)); + actor.(weaponentity).rifle_accumulator += WEP_CVAR_PRI(WEP_RIFLE, burstcost); } if(fire & 2) { - if(WEP_CVAR(rifle, secondary)) + if(WEP_CVAR(WEP_RIFLE, secondary)) { - if(WEP_CVAR_SEC(rifle, reload)) { + if(WEP_CVAR_SEC(WEP_RIFLE, reload)) { thiswep.wr_reload(thiswep, actor, weaponentity); } else { - if(weapon_prepareattack_check(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire))) - if(time >= actor.(weaponentity).rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost)) + if(weapon_prepareattack_check(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_RIFLE, refire))) + if(time >= actor.(weaponentity).rifle_accumulator + WEP_CVAR_SEC(WEP_RIFLE, burstcost)) { - weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire)); - W_Rifle_BulletHail(thiswep, actor, weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire)); - actor.(weaponentity).rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost); + weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(WEP_RIFLE, refire)); + W_Rifle_BulletHail(thiswep, actor, weaponentity, WEP_CVAR_SEC(WEP_RIFLE, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_RIFLE, animtime), WEP_CVAR_PRI(WEP_RIFLE, refire)); + actor.(weaponentity).rifle_accumulator += WEP_CVAR_SEC(WEP_RIFLE, burstcost); } } } @@ -160,14 +160,14 @@ METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity, } METHOD(Rifle, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(rifle, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(rifle, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_RIFLE, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_RIFLE, ammo); return ammo_amount; } METHOD(Rifle, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(rifle, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(rifle, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_RIFLE, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_RIFLE, ammo); return ammo_amount; } METHOD(Rifle, wr_resetplayer, void(entity thiswep, entity actor)) @@ -175,12 +175,12 @@ METHOD(Rifle, wr_resetplayer, void(entity thiswep, entity actor)) for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { .entity weaponentity = weaponentities[slot]; - actor.(weaponentity).rifle_accumulator = time - WEP_CVAR(rifle, bursttime); + actor.(weaponentity).rifle_accumulator = time - WEP_CVAR(WEP_RIFLE, bursttime); } } METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND_RELOAD); + W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(WEP_RIFLE, ammo), WEP_CVAR_SEC(WEP_RIFLE, ammo)), SND_RELOAD); } METHOD(Rifle, wr_suicidemessage, Notification(entity thiswep)) { @@ -205,7 +205,7 @@ METHOD(Rifle, wr_killmessage, Notification(entity thiswep)) } METHOD(Rifle, wr_zoom, bool(entity thiswep, entity actor)) { - return PHYS_INPUT_BUTTON_ATCK2(actor) && WEP_CVAR(rifle, secondary) == 0; + return PHYS_INPUT_BUTTON_ATCK2(actor) && WEP_CVAR(WEP_RIFLE, secondary) == 0; } #endif @@ -241,7 +241,7 @@ METHOD(Rifle, wr_zoom, bool(entity thiswep, entity actor)) } METHOD(Rifle, wr_zoomdir, bool(entity thiswep)) { - return button_attack2 && !WEP_CVAR(rifle, secondary); + return button_attack2 && !WEP_CVAR(WEP_RIFLE, secondary); } #endif diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 7abb2a43c..f1879efe4 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -8,7 +8,7 @@ void W_Seeker_Missile_Explode(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), NULL, NULL, WEP_CVAR(seeker, missile_force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR(WEP_SEEKER, missile_damage), WEP_CVAR(WEP_SEEKER, missile_edgedamage), WEP_CVAR(WEP_SEEKER, missile_radius), NULL, NULL, WEP_CVAR(WEP_SEEKER, missile_force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -41,9 +41,9 @@ void W_Seeker_Missile_Think(entity this) spd = vlen(this.velocity); spd = bound( - spd - WEP_CVAR(seeker, missile_decel) * frametime, - WEP_CVAR(seeker, missile_speed_max), - spd + WEP_CVAR(seeker, missile_accel) * frametime + spd - WEP_CVAR(WEP_SEEKER, missile_decel) * frametime, + WEP_CVAR(WEP_SEEKER, missile_speed_max), + spd + WEP_CVAR(WEP_SEEKER, missile_accel) * frametime ); if(this.enemy != NULL) @@ -54,13 +54,13 @@ void W_Seeker_Missile_Think(entity this) { e = this.enemy; eorg = 0.5 * (e.absmin + e.absmax); - turnrate = WEP_CVAR(seeker, missile_turnrate); // how fast to turn + turnrate = WEP_CVAR(WEP_SEEKER, missile_turnrate); // how fast to turn desireddir = normalize(eorg - this.origin); olddir = normalize(this.velocity); // get my current direction dist = vlen(eorg - this.origin); // Do evasive maneuvers for world objects? ( this should be a cpu hog. :P ) - if(WEP_CVAR(seeker, missile_smart) && (dist > WEP_CVAR(seeker, missile_smart_mindist))) + if(WEP_CVAR(WEP_SEEKER, missile_smart) && (dist > WEP_CVAR(WEP_SEEKER, missile_smart_mindist))) { // Is it a better idea (shorter distance) to trace to the target itself? if( vdist(this.origin + olddir * this.wait, <, dist)) @@ -69,7 +69,7 @@ void W_Seeker_Missile_Think(entity this) traceline(this.origin, eorg, false, this); // Setup adaptive tracelength - this.wait = bound(WEP_CVAR(seeker, missile_smart_trace_min), vlen(this.origin - trace_endpos), this.wait = WEP_CVAR(seeker, missile_smart_trace_max)); + this.wait = bound(WEP_CVAR(WEP_SEEKER, missile_smart_trace_min), vlen(this.origin - trace_endpos), this.wait = WEP_CVAR(WEP_SEEKER, missile_smart_trace_max)); // Calc how important it is that we turn and add this to the desierd (enemy) dir. desireddir = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5); @@ -82,13 +82,13 @@ void W_Seeker_Missile_Think(entity this) dist = 0; // Proxy - if(WEP_CVAR(seeker, missile_proxy)) + if(WEP_CVAR(WEP_SEEKER, missile_proxy)) { - if(dist <= WEP_CVAR(seeker, missile_proxy_maxrange)) + if(dist <= WEP_CVAR(WEP_SEEKER, missile_proxy_maxrange)) { if(this.cvar_cl_autoswitch == 0) { - this.cvar_cl_autoswitch = time + WEP_CVAR(seeker, missile_proxy_delay); + this.cvar_cl_autoswitch = time + WEP_CVAR(WEP_SEEKER, missile_proxy_delay); } else { @@ -166,7 +166,7 @@ void W_Seeker_Missile_Animate(entity this) void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, .entity weaponentity, vector f_diff, entity m_target) { - W_DecreaseAmmo(thiswep, actor, WEP_CVAR(seeker, missile_ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_SEEKER, missile_ammo), weaponentity); makevectors(actor.v_angle); W_SetupShot_ProjectileSize(actor, weaponentity, '-4 -4 -4', '4 4 4', false, 2, SND_SEEKER_FIRE, CH_WEAPON_A, 0, ((m_target != NULL) ? thiswep.m_id | HITTYPE_SECONDARY : thiswep.m_id)); @@ -178,20 +178,20 @@ void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, .entity weaponentity, v entity missile = new(seeker_missile); missile.owner = missile.realowner = actor; missile.bot_dodge = true; - missile.bot_dodgerating = WEP_CVAR(seeker, missile_damage); + missile.bot_dodgerating = WEP_CVAR(WEP_SEEKER, missile_damage); setthink(missile, W_Seeker_Missile_Think); settouch(missile, W_Seeker_Missile_Touch); missile.event_damage = W_Seeker_Missile_Damage; missile.nextthink = time;// + 0.2;// + cvar("g_balance_seeker_missile_activate_delay"); - missile.cnt = time + WEP_CVAR(seeker, missile_lifetime); + missile.cnt = time + WEP_CVAR(WEP_SEEKER, missile_lifetime); missile.enemy = m_target; missile.solid = SOLID_BBOX; missile.scale = 2; missile.takedamage = DAMAGE_YES; missile.weaponentity_fld = weaponentity; - SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(seeker, missile_health)); - missile.damageforcescale = WEP_CVAR(seeker, missile_damageforcescale); + SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(WEP_SEEKER, missile_health)); + missile.damageforcescale = WEP_CVAR(WEP_SEEKER, missile_damageforcescale); missile.damagedbycontents = true; IL_PUSH(g_damagedbycontents, missile); //missile.think = W_Seeker_Missile_Animate; // csqc projectiles. @@ -210,7 +210,7 @@ void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, .entity weaponentity, v IL_PUSH(g_bot_dodge, missile); missile.missile_flags = MIF_SPLASH | MIF_GUIDED_TAG; - W_SetupProjVelocity_UP_PRE(missile, seeker, missile_); + W_SetupProjVelocity_UP_PRE(missile, WEP_SEEKER, missile_); missile.angles = vectoangles(missile.velocity); @@ -226,7 +226,7 @@ void W_Seeker_Flac_Explode(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR(seeker, flac_damage), WEP_CVAR(seeker, flac_edgedamage), WEP_CVAR(seeker, flac_radius), NULL, NULL, WEP_CVAR(seeker, flac_force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR(WEP_SEEKER, flac_damage), WEP_CVAR(WEP_SEEKER, flac_edgedamage), WEP_CVAR(WEP_SEEKER, flac_radius), NULL, NULL, WEP_CVAR(WEP_SEEKER, flac_force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -247,7 +247,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep, entity actor, .entity weaponentity) vector f_diff; float c; - W_DecreaseAmmo(thiswep, actor, WEP_CVAR(seeker, flac_ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_SEEKER, flac_ammo), weaponentity); c = actor.(weaponentity).bulletcounter % 4; switch(c) @@ -266,7 +266,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep, entity actor, .entity weaponentity) f_diff = '+1.25 +3.75 0'; break; } - W_SetupShot_ProjectileSize(actor, weaponentity, '-2 -2 -2', '2 2 2', false, 2, SND_FLAC_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, flac_damage), thiswep.m_id | HITTYPE_SECONDARY); + W_SetupShot_ProjectileSize(actor, weaponentity, '-2 -2 -2', '2 2 2', false, 2, SND_FLAC_FIRE, CH_WEAPON_A, WEP_CVAR(WEP_SEEKER, flac_damage), thiswep.m_id | HITTYPE_SECONDARY); w_shotorg += f_diff; // uses hagar effects! @@ -275,11 +275,11 @@ void W_Seeker_Fire_Flac(Weapon thiswep, entity actor, .entity weaponentity) missile = new(missile); missile.owner = missile.realowner = actor; missile.bot_dodge = true; - missile.bot_dodgerating = WEP_CVAR(seeker, flac_damage); + missile.bot_dodgerating = WEP_CVAR(WEP_SEEKER, flac_damage); settouch(missile, W_Seeker_Flac_Touch); missile.use = W_Seeker_Flac_Explode_use; setthink(missile, adaptor_think2use_hittype_splash); - missile.nextthink = time + WEP_CVAR(seeker, flac_lifetime) + WEP_CVAR(seeker, flac_lifetime_rand); + missile.nextthink = time + WEP_CVAR(WEP_SEEKER, flac_lifetime) + WEP_CVAR(WEP_SEEKER, flac_lifetime_rand); missile.solid = SOLID_BBOX; set_movetype(missile, MOVETYPE_FLY); missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; @@ -296,7 +296,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep, entity actor, .entity weaponentity) setorigin(missile, w_shotorg); setsize(missile, '-2 -2 -2', '2 2 2'); - W_SetupProjVelocity_UP_PRE(missile, seeker, flac_); + W_SetupProjVelocity_UP_PRE(missile, WEP_SEEKER, flac_); CSQCProjectile(missile, true, PROJECTILE_FLAC, true); MUTATOR_CALLHOOK(EditProjectile, actor, missile); @@ -347,13 +347,13 @@ void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seek Weapon thiswep = WEP_SEEKER; .entity weaponentity = this.weaponentity_fld; - if((!(this.realowner.items & IT_UNLIMITED_AMMO) && GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(seeker, missile_ammo)) || (this.cnt <= -1) || (IS_DEAD(this.realowner)) || (this.realowner.(weaponentity).m_switchweapon != thiswep)) + if((!(this.realowner.items & IT_UNLIMITED_AMMO) && GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(WEP_SEEKER, missile_ammo)) || (this.cnt <= -1) || (IS_DEAD(this.realowner)) || (this.realowner.(weaponentity).m_switchweapon != thiswep)) { delete(this); return; } - this.nextthink = time + WEP_CVAR(seeker, missile_delay) * W_WeaponRateFactor(this.realowner); + this.nextthink = time + WEP_CVAR(WEP_SEEKER, missile_delay) * W_WeaponRateFactor(this.realowner); entity own = this.realowner; @@ -385,7 +385,7 @@ void W_Seeker_Tracker_Think(entity this) .entity weaponentity = this.weaponentity_fld; // commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up if((IS_DEAD(this.realowner)) || (IS_DEAD(this.tag_target)) || (this.realowner.(weaponentity).m_switchweapon != WEP_SEEKER) - || (time > this.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime))) + || (time > this.tag_time + WEP_CVAR(WEP_SEEKER, tag_tracker_lifetime))) { if(this) { @@ -444,7 +444,7 @@ void W_Seeker_Tag_Touch(entity this, entity toucher) if(tag != NULL) { - if(toucher.wps_tag_tracker && (WEP_CVAR(seeker, type) == 1)) // don't attach another waypointsprite without killing the old one first + if(toucher.wps_tag_tracker && (WEP_CVAR(WEP_SEEKER, type) == 1)) // don't attach another waypointsprite without killing the old one first WaypointSprite_Kill(toucher.wps_tag_tracker); tag.tag_time = time; @@ -454,12 +454,12 @@ void W_Seeker_Tag_Touch(entity this, entity toucher) //sprint(this.realowner, strcat("You just tagged ^2", toucher.netname, "^7 with a tracking device!\n")); e = new(tag_tracker); e.weaponentity_fld = this.weaponentity_fld; - e.cnt = WEP_CVAR(seeker, missile_count); + e.cnt = WEP_CVAR(WEP_SEEKER, missile_count); e.owner = this.owner; e.realowner = this.realowner; IL_PUSH(g_seeker_trackers, e); - if(WEP_CVAR(seeker, type) == 1) + if(WEP_CVAR(WEP_SEEKER, type) == 1) { e.tag_target = toucher; e.tag_time = time; @@ -474,9 +474,9 @@ void W_Seeker_Tag_Touch(entity this, entity toucher) e.nextthink = time; } - if(WEP_CVAR(seeker, type) == 1) + if(WEP_CVAR(WEP_SEEKER, type) == 1) { - WaypointSprite_Spawn(WP_Seeker, WEP_CVAR(seeker, tag_tracker_lifetime), 0, toucher, '0 0 64', this.realowner, 0, toucher, wps_tag_tracker, true, RADARICON_TAGGED); + WaypointSprite_Spawn(WP_Seeker, WEP_CVAR(WEP_SEEKER, tag_tracker_lifetime), 0, toucher, '0 0 64', this.realowner, 0, toucher, wps_tag_tracker, true, RADARICON_TAGGED); WaypointSprite_UpdateRule(toucher.wps_tag_tracker, 0, SPRITERULE_DEFAULT); } } @@ -487,9 +487,9 @@ void W_Seeker_Tag_Touch(entity this, entity toucher) void W_Seeker_Fire_Tag(Weapon thiswep, entity actor, .entity weaponentity) { - W_DecreaseAmmo(thiswep, actor, WEP_CVAR(seeker, tag_ammo), weaponentity); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_SEEKER, tag_ammo), weaponentity); - W_SetupShot_ProjectileSize(actor, weaponentity, '-2 -2 -2', '2 2 2', false, 2, SND_TAG_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count), thiswep.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY); + W_SetupShot_ProjectileSize(actor, weaponentity, '-2 -2 -2', '2 2 2', false, 2, SND_TAG_FIRE, CH_WEAPON_A, WEP_CVAR(WEP_SEEKER, missile_damage) * WEP_CVAR(WEP_SEEKER, missile_count), thiswep.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY); entity missile = new(seeker_tag); missile.weaponentity_fld = weaponentity; @@ -498,14 +498,14 @@ void W_Seeker_Fire_Tag(Weapon thiswep, entity actor, .entity weaponentity) missile.bot_dodgerating = 50; settouch(missile, W_Seeker_Tag_Touch); setthink(missile, SUB_Remove); - missile.nextthink = time + WEP_CVAR(seeker, tag_lifetime); + missile.nextthink = time + WEP_CVAR(WEP_SEEKER, tag_lifetime); set_movetype(missile, MOVETYPE_FLY); missile.solid = SOLID_BBOX; missile.takedamage = DAMAGE_YES; missile.event_damage = W_Seeker_Tag_Damage; - SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(seeker, tag_health)); - missile.damageforcescale = WEP_CVAR(seeker, tag_damageforcescale); + SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(WEP_SEEKER, tag_health)); + missile.damageforcescale = WEP_CVAR(WEP_SEEKER, tag_damageforcescale); setorigin(missile, w_shotorg); setsize(missile, '-2 -2 -2', '2 2 2'); @@ -516,7 +516,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep, entity actor, .entity weaponentity) //missile.missile_flags = MIF_..?; set_movetype(missile, MOVETYPE_FLY); - W_SetupProjVelocity_PRE(missile, seeker, tag_); + W_SetupProjVelocity_PRE(missile, WEP_SEEKER, tag_); missile.angles = vectoangles(missile.velocity); CSQCProjectile(missile, true, PROJECTILE_TAG, false); // has sound @@ -530,56 +530,56 @@ void W_Seeker_Fire_Tag(Weapon thiswep, entity actor, .entity weaponentity) METHOD(Seeker, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { - if(WEP_CVAR(seeker, type) == 1) + if(WEP_CVAR(WEP_SEEKER, type) == 1) { if(W_Seeker_Tagged_Info(actor, weaponentity, actor.enemy) != NULL) - PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false, false); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR(WEP_SEEKER, missile_speed_max), 0, WEP_CVAR(WEP_SEEKER, missile_lifetime), false, false); else - PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false, false); + PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR(WEP_SEEKER, tag_speed), 0, WEP_CVAR(WEP_SEEKER, tag_lifetime), false, false); } else - PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false, true); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR(WEP_SEEKER, tag_speed), 0, WEP_CVAR(WEP_SEEKER, tag_lifetime), false, true); } METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if(autocvar_g_balance_seeker_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) { // forced reload + if(autocvar_g_balance_seeker_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR(WEP_SEEKER, missile_ammo), WEP_CVAR(WEP_SEEKER, tag_ammo))) { // forced reload thiswep.wr_reload(thiswep, actor, weaponentity); } else if(fire & 1) { - if(WEP_CVAR(seeker, type) == 1) + if(WEP_CVAR(WEP_SEEKER, type) == 1) { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, missile_refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(WEP_SEEKER, missile_refire))) { W_Seeker_Attack(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, missile_animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(WEP_SEEKER, missile_animtime), w_ready); } } else { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(WEP_SEEKER, tag_refire))) { W_Seeker_Fire_Tag(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(WEP_SEEKER, tag_animtime), w_ready); } } } else if(fire & 2) { - if(WEP_CVAR(seeker, type) == 1) + if(WEP_CVAR(WEP_SEEKER, type) == 1) { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(WEP_SEEKER, tag_refire))) { W_Seeker_Fire_Tag(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(WEP_SEEKER, tag_animtime), w_ready); } } else { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, flac_refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(WEP_SEEKER, flac_refire))) { W_Seeker_Fire_Flac(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(WEP_SEEKER, flac_animtime), w_ready); } } } @@ -587,36 +587,36 @@ METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity METHOD(Seeker, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { float ammo_amount; - if(WEP_CVAR(seeker, type) == 1) + if(WEP_CVAR(WEP_SEEKER, type) == 1) { - ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(seeker, missile_ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(seeker, missile_ammo); + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_SEEKER, missile_ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(WEP_SEEKER, missile_ammo); } else { - ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(seeker, tag_ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(seeker, tag_ammo); + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_SEEKER, tag_ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(WEP_SEEKER, tag_ammo); } return ammo_amount; } METHOD(Seeker, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { float ammo_amount; - if(WEP_CVAR(seeker, type) == 1) + if(WEP_CVAR(WEP_SEEKER, type) == 1) { - ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(seeker, tag_ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(seeker, tag_ammo); + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_SEEKER, tag_ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(WEP_SEEKER, tag_ammo); } else { - ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(seeker, flac_ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(seeker, flac_ammo); + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_SEEKER, flac_ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(WEP_SEEKER, flac_ammo); } return ammo_amount; } METHOD(Seeker, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND_RELOAD); + W_Reload(actor, weaponentity, min(WEP_CVAR(WEP_SEEKER, missile_ammo), WEP_CVAR(WEP_SEEKER, tag_ammo)), SND_RELOAD); } METHOD(Seeker, wr_suicidemessage, Notification(entity thiswep)) { diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index 29dbdb279..df75e0326 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -25,7 +25,7 @@ void W_Shockwave_Melee_Think(entity this) vector targpos; // check to see if we can still continue, otherwise give up now - if(IS_DEAD(this.realowner) && WEP_CVAR(shockwave, melee_no_doubleslap)) + if(IS_DEAD(this.realowner) && WEP_CVAR(WEP_SHOCKWAVE, melee_no_doubleslap)) { delete(this); return; @@ -42,19 +42,19 @@ void W_Shockwave_Melee_Think(entity this) makevectors(this.realowner.v_angle); // calculate swing percentage based on time - meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor(this.realowner); + meleetime = WEP_CVAR(WEP_SHOCKWAVE, melee_time) * W_WeaponRateFactor(this.realowner); swing = bound(0, (this.cnt + meleetime - time) / meleetime, 10); - f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces)); + f = ((1 - swing) * WEP_CVAR(WEP_SHOCKWAVE, melee_traces)); // perform the traces needed for this frame for(i=this.swing_prev; i < f; ++i) { - swing_factor = ((1 - (i / WEP_CVAR(shockwave, melee_traces))) * 2 - 1); + swing_factor = ((1 - (i / WEP_CVAR(WEP_SHOCKWAVE, melee_traces))) * 2 - 1); targpos = (this.realowner.origin + this.realowner.view_ofs - + (v_forward * WEP_CVAR(shockwave, melee_range)) - + (v_up * swing_factor * WEP_CVAR(shockwave, melee_swing_up)) - + (v_right * swing_factor * WEP_CVAR(shockwave, melee_swing_side))); + + (v_forward * WEP_CVAR(WEP_SHOCKWAVE, melee_range)) + + (v_up * swing_factor * WEP_CVAR(WEP_SHOCKWAVE, melee_swing_up)) + + (v_right * swing_factor * WEP_CVAR(WEP_SHOCKWAVE, melee_swing_side))); WarpZone_traceline_antilag( this.realowner, @@ -76,14 +76,14 @@ void W_Shockwave_Melee_Think(entity this) if((trace_fraction < 1) // if trace is good, apply the damage and remove this if necessary && (trace_ent.takedamage == DAMAGE_AIM) && (trace_ent != this.swing_alreadyhit) - && (is_player || WEP_CVAR(shockwave, melee_nonplayerdamage))) + && (is_player || WEP_CVAR(WEP_SHOCKWAVE, melee_nonplayerdamage))) { target_victim = trace_ent; // so it persists through other calls if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught - swing_damage = (WEP_CVAR(shockwave, melee_damage) * min(1, swing_factor + 1)); + swing_damage = (WEP_CVAR(WEP_SHOCKWAVE, melee_damage) * min(1, swing_factor + 1)); else - swing_damage = (WEP_CVAR(shockwave, melee_nonplayerdamage) * min(1, swing_factor + 1)); + swing_damage = (WEP_CVAR(WEP_SHOCKWAVE, melee_nonplayerdamage) * min(1, swing_factor + 1)); // trigger damage with this calculated info Damage( @@ -94,7 +94,7 @@ void W_Shockwave_Melee_Think(entity this) (WEP_SHOCKWAVE.m_id | HITTYPE_SECONDARY), this.weaponentity_fld, (this.realowner.origin + this.realowner.view_ofs), - (v_forward * WEP_CVAR(shockwave, melee_force)) + (v_forward * WEP_CVAR(WEP_SHOCKWAVE, melee_force)) ); // handle accuracy @@ -113,7 +113,7 @@ void W_Shockwave_Melee_Think(entity this) #endif // allow multiple hits with one swing, but not against the same player twice - if(WEP_CVAR(shockwave, melee_multihit)) + if(WEP_CVAR(WEP_SHOCKWAVE, melee_multihit)) { this.swing_alreadyhit = target_victim; continue; // move along to next trace @@ -143,14 +143,14 @@ void W_Shockwave_Melee_Think(entity this) void W_Shockwave_Melee(Weapon thiswep, entity actor, .entity weaponentity, int fire) { sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTN_NORM); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(WEP_SHOCKWAVE, melee_animtime), w_ready); entity meleetemp = new_pure(meleetemp); meleetemp.owner = meleetemp.realowner = actor; setthink(meleetemp, W_Shockwave_Melee_Think); - meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor(actor); + meleetemp.nextthink = time + WEP_CVAR(WEP_SHOCKWAVE, melee_delay) * W_WeaponRateFactor(actor); meleetemp.weaponentity_fld = weaponentity; - W_SetupShot_Range(actor, weaponentity, true, 0, SND_Null, 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range), thiswep.m_id | HITTYPE_SECONDARY); + W_SetupShot_Range(actor, weaponentity, true, 0, SND_Null, 0, WEP_CVAR(WEP_SHOCKWAVE, melee_damage), WEP_CVAR(WEP_SHOCKWAVE, melee_range), thiswep.m_id | HITTYPE_SECONDARY); } // SHOCKWAVE ATTACK MODE @@ -167,9 +167,9 @@ float W_Shockwave_Attack_CheckSpread( spreadlimit = (distance_of_attack ? min(1, (vlen(sw_shotorg - nearest_on_line) / distance_of_attack)) : 1); spreadlimit = ( - (WEP_CVAR(shockwave, blast_spread_min) * (1 - spreadlimit)) + (WEP_CVAR(WEP_SHOCKWAVE, blast_spread_min) * (1 - spreadlimit)) + - (WEP_CVAR(shockwave, blast_spread_max) * spreadlimit) + (WEP_CVAR(WEP_SHOCKWAVE, blast_spread_max) * spreadlimit) ); if( @@ -252,9 +252,9 @@ void W_Shockwave_Send(entity actor) WriteHeader(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE); WriteVector(MSG_BROADCAST, w_shotorg); WriteVector(MSG_BROADCAST, w_shotdir); - WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance)); - WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255)); - WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255)); + WriteShort(MSG_BROADCAST, WEP_CVAR(WEP_SHOCKWAVE, blast_distance)); + WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(WEP_SHOCKWAVE, blast_spread_max), 255)); + WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(WEP_SHOCKWAVE, blast_spread_min), 255)); WriteByte(MSG_BROADCAST, etof(actor)); } @@ -269,8 +269,8 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) float i, queue = 0; // set up the shot direction - W_SetupShot(actor, weaponentity, true, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage), thiswep.m_id); - vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance))); + W_SetupShot(actor, weaponentity, true, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, WEP_CVAR(WEP_SHOCKWAVE, blast_damage), thiswep.m_id); + vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(WEP_SHOCKWAVE, blast_distance))); WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, actor); vector attack_hitpos = trace_endpos; float distance_to_end = vlen(w_shotorg - attack_endpos); @@ -281,10 +281,10 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) W_Shockwave_Send(actor); Damage_DamageInfo( attack_hitpos, - WEP_CVAR(shockwave, blast_splash_damage), - WEP_CVAR(shockwave, blast_splash_edgedamage), - WEP_CVAR(shockwave, blast_splash_radius), - w_shotdir * WEP_CVAR(shockwave, blast_splash_force), + WEP_CVAR(WEP_SHOCKWAVE, blast_splash_damage), + WEP_CVAR(WEP_SHOCKWAVE, blast_splash_edgedamage), + WEP_CVAR(WEP_SHOCKWAVE, blast_splash_radius), + w_shotdir * WEP_CVAR(WEP_SHOCKWAVE, blast_splash_force), thiswep.m_id, 0, actor @@ -294,8 +294,8 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) head = WarpZone_FindRadius( attack_hitpos, max( - WEP_CVAR(shockwave, blast_splash_radius), - WEP_CVAR(shockwave, blast_jump_radius) + WEP_CVAR(WEP_SHOCKWAVE, blast_splash_radius), + WEP_CVAR(WEP_SHOCKWAVE, blast_jump_radius) ), false ); @@ -315,7 +315,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) { float distance_to_head = vlen(attack_hitpos - head.WarpZone_findradius_nearest); - if((head == actor) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius))) + if((head == actor) && (distance_to_head <= WEP_CVAR(WEP_SHOCKWAVE, blast_jump_radius))) { // ======================== // BLAST JUMP CALCULATION @@ -324,7 +324,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) // calculate importance of distance and accuracy for this attack multiplier_from_accuracy = (1 - (distance_to_head ? - min(1, (distance_to_head / WEP_CVAR(shockwave, blast_jump_radius))) + min(1, (distance_to_head / WEP_CVAR(WEP_SHOCKWAVE, blast_jump_radius))) : 0 ) @@ -338,20 +338,20 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) ); multiplier = max( - WEP_CVAR(shockwave, blast_jump_multiplier_min), + WEP_CVAR(WEP_SHOCKWAVE, blast_jump_multiplier_min), ( - (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_jump_multiplier_accuracy)) + (multiplier_from_accuracy * WEP_CVAR(WEP_SHOCKWAVE, blast_jump_multiplier_accuracy)) + - (multiplier_from_distance * WEP_CVAR(shockwave, blast_jump_multiplier_distance)) + (multiplier_from_distance * WEP_CVAR(WEP_SHOCKWAVE, blast_jump_multiplier_distance)) ) ); // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage final_damage = ( - (WEP_CVAR(shockwave, blast_jump_damage) * multiplier) + (WEP_CVAR(WEP_SHOCKWAVE, blast_jump_damage) * multiplier) + - (WEP_CVAR(shockwave, blast_jump_edgedamage) * (1 - multiplier)) + (WEP_CVAR(WEP_SHOCKWAVE, blast_jump_edgedamage) * (1 - multiplier)) ); // figure out the direction of force @@ -360,7 +360,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) ( bound(0, (vlen(vel) / autocvar_sv_maxspeed), 1) * - WEP_CVAR(shockwave, blast_jump_force_velocitybias) + WEP_CVAR(WEP_SHOCKWAVE, blast_jump_force_velocitybias) ); if (autocvar_g_player_damageplayercenter) @@ -379,8 +379,8 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) } // now multiply the direction by force units - final_force *= (WEP_CVAR(shockwave, blast_jump_force) * multiplier); - final_force.z *= WEP_CVAR(shockwave, blast_jump_force_zscale); + final_force *= (WEP_CVAR(WEP_SHOCKWAVE, blast_jump_force) * multiplier); + final_force.z *= WEP_CVAR(WEP_SHOCKWAVE, blast_jump_force_zscale); // trigger damage with this calculated info Damage( @@ -406,7 +406,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) ); #endif } - else if(distance_to_head <= WEP_CVAR(shockwave, blast_splash_radius)) + else if(distance_to_head <= WEP_CVAR(WEP_SHOCKWAVE, blast_splash_radius)) { // ========================== // BLAST SPLASH CALCULATION @@ -415,7 +415,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) // calculate importance of distance and accuracy for this attack multiplier_from_accuracy = (1 - (distance_to_head ? - min(1, (distance_to_head / WEP_CVAR(shockwave, blast_splash_radius))) + min(1, (distance_to_head / WEP_CVAR(WEP_SHOCKWAVE, blast_splash_radius))) : 0 ) @@ -429,24 +429,24 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) ); multiplier = max( - WEP_CVAR(shockwave, blast_splash_multiplier_min), + WEP_CVAR(WEP_SHOCKWAVE, blast_splash_multiplier_min), ( - (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_splash_multiplier_accuracy)) + (multiplier_from_accuracy * WEP_CVAR(WEP_SHOCKWAVE, blast_splash_multiplier_accuracy)) + - (multiplier_from_distance * WEP_CVAR(shockwave, blast_splash_multiplier_distance)) + (multiplier_from_distance * WEP_CVAR(WEP_SHOCKWAVE, blast_splash_multiplier_distance)) ) ); // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage final_damage = ( - (WEP_CVAR(shockwave, blast_splash_damage) * multiplier) + (WEP_CVAR(WEP_SHOCKWAVE, blast_splash_damage) * multiplier) + - (WEP_CVAR(shockwave, blast_splash_edgedamage) * (1 - multiplier)) + (WEP_CVAR(WEP_SHOCKWAVE, blast_splash_edgedamage) * (1 - multiplier)) ); // figure out the direction of force - final_force = (w_shotdir * WEP_CVAR(shockwave, blast_splash_force_forwardbias)); + final_force = (w_shotdir * WEP_CVAR(WEP_SHOCKWAVE, blast_splash_force_forwardbias)); if (autocvar_g_player_damageplayercenter) { //if (head == actor) // was checked for already, is false @@ -462,8 +462,8 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) //te_lightning2(NULL, attack_hitpos, (attack_hitpos + (final_force * 200))); // now multiply the direction by force units - final_force *= (WEP_CVAR(shockwave, blast_splash_force) * multiplier); - final_force.z *= WEP_CVAR(shockwave, blast_force_zscale); + final_force *= (WEP_CVAR(WEP_SHOCKWAVE, blast_splash_force) * multiplier); + final_force.z *= WEP_CVAR(WEP_SHOCKWAVE, blast_force_zscale); // queue damage with this calculated info if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); } @@ -485,7 +485,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) } // cone damage trace - head = WarpZone_FindRadius(w_shotorg, WEP_CVAR(shockwave, blast_distance), false); + head = WarpZone_FindRadius(w_shotorg, WEP_CVAR(WEP_SHOCKWAVE, blast_distance), false); while(head) { if((head != actor) && head.takedamage) @@ -518,7 +518,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) vector nearest_on_line = (w_shotorg + a * w_shotdir); vector nearest_to_attacker = NearestPointOnBoundingBox(center + head.mins, center + head.maxs, nearest_on_line); - if((vdist(head.WarpZone_findradius_dist, <=, WEP_CVAR(shockwave, blast_distance))) + if((vdist(head.WarpZone_findradius_dist, <=, WEP_CVAR(WEP_SHOCKWAVE, blast_distance))) && (W_Shockwave_Attack_IsVisible(actor, head, nearest_on_line, w_shotorg, attack_endpos))) { // calculate importance of distance and accuracy for this attack @@ -539,30 +539,30 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) ); multiplier = max( - WEP_CVAR(shockwave, blast_multiplier_min), + WEP_CVAR(WEP_SHOCKWAVE, blast_multiplier_min), ( - (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_multiplier_accuracy)) + (multiplier_from_accuracy * WEP_CVAR(WEP_SHOCKWAVE, blast_multiplier_accuracy)) + - (multiplier_from_distance * WEP_CVAR(shockwave, blast_multiplier_distance)) + (multiplier_from_distance * WEP_CVAR(WEP_SHOCKWAVE, blast_multiplier_distance)) ) ); // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage final_damage = ( - (WEP_CVAR(shockwave, blast_damage) * multiplier) + (WEP_CVAR(WEP_SHOCKWAVE, blast_damage) * multiplier) + - (WEP_CVAR(shockwave, blast_edgedamage) * (1 - multiplier)) + (WEP_CVAR(WEP_SHOCKWAVE, blast_edgedamage) * (1 - multiplier)) ); // figure out the direction of force - final_force = (w_shotdir * WEP_CVAR(shockwave, blast_force_forwardbias)); + final_force = (w_shotdir * WEP_CVAR(WEP_SHOCKWAVE, blast_force_forwardbias)); final_force = normalize(center - (nearest_on_line - final_force)); //te_lightning2(NULL, nearest_on_line, (attack_hitpos + (final_force * 200))); // now multiply the direction by force units - final_force *= (WEP_CVAR(shockwave, blast_force) * multiplier); - final_force.z *= WEP_CVAR(shockwave, blast_force_zscale); + final_force *= (WEP_CVAR(WEP_SHOCKWAVE, blast_force) * multiplier); + final_force.z *= WEP_CVAR(WEP_SHOCKWAVE, blast_force_zscale); // queue damage with this calculated info if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); } @@ -623,7 +623,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity) METHOD(Shockwave, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { - if(vdist(actor.origin - actor.enemy.origin, <=, WEP_CVAR(shockwave, melee_range))) + if(vdist(actor.origin - actor.enemy.origin, <=, WEP_CVAR(WEP_SHOCKWAVE, melee_range))) { PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false, false); } else { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false, false); } @@ -634,18 +634,18 @@ METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponent { if(time >= actor.(weaponentity).shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(WEP_SHOCKWAVE, blast_animtime))) { W_Shockwave_Attack(thiswep, actor, weaponentity); - actor.(weaponentity).shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor(actor); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready); + actor.(weaponentity).shockwave_blasttime = time + WEP_CVAR(WEP_SHOCKWAVE, blast_refire) * W_WeaponRateFactor(actor); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_SHOCKWAVE, blast_animtime), w_ready); } } } else if(fire & 2) { //if(actor.clip_load >= 0) // we are not currently reloading - if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(WEP_SHOCKWAVE, melee_refire))) { // attempt forcing playback of the anim by switching to another anim (that we never play) here... weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee); diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index b28e3c96a..8bd7efe31 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -63,7 +63,7 @@ void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, if(autocvar_g_casings >= 1) { makevectors(actor.v_angle); // for some reason, this is lost - //for(int sc = 0; sc < WEP_CVAR_PRI(shotgun, ammo); ++sc) + //for(int sc = 0; sc < WEP_CVAR_PRI(WEP_SHOTGUN, ammo); ++sc) SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 30) * v_up), vectoangles(v_forward), 1, actor, weaponentity); } } @@ -86,12 +86,12 @@ void W_Shotgun_Melee_Think(entity this) makevectors(this.realowner.v_angle); // update values for v_* vectors // calculate swing percentage based on time - meleetime = WEP_CVAR_SEC(shotgun, melee_time) * W_WeaponRateFactor(this.realowner); + meleetime = WEP_CVAR_SEC(WEP_SHOTGUN, melee_time) * W_WeaponRateFactor(this.realowner); swing = bound(0, (this.cnt + meleetime - time) / meleetime, 10); - f = ((1 - swing) * WEP_CVAR_SEC(shotgun, melee_traces)); + f = ((1 - swing) * WEP_CVAR_SEC(WEP_SHOTGUN, melee_traces)); // check to see if we can still continue, otherwise give up now - if(IS_DEAD(this.realowner) && WEP_CVAR_SEC(shotgun, melee_no_doubleslap)) + if(IS_DEAD(this.realowner) && WEP_CVAR_SEC(WEP_SHOTGUN, melee_no_doubleslap)) { delete(this); return; @@ -100,12 +100,12 @@ void W_Shotgun_Melee_Think(entity this) // if okay, perform the traces needed for this frame for(i=this.swing_prev; i < f; ++i) { - swing_factor = ((1 - (i / WEP_CVAR_SEC(shotgun, melee_traces))) * 2 - 1); + swing_factor = ((1 - (i / WEP_CVAR_SEC(WEP_SHOTGUN, melee_traces))) * 2 - 1); targpos = (this.realowner.origin + this.realowner.view_ofs - + (v_forward * WEP_CVAR_SEC(shotgun, melee_range)) - + (v_up * swing_factor * WEP_CVAR_SEC(shotgun, melee_swing_up)) - + (v_right * swing_factor * WEP_CVAR_SEC(shotgun, melee_swing_side))); + + (v_forward * WEP_CVAR_SEC(WEP_SHOTGUN, melee_range)) + + (v_up * swing_factor * WEP_CVAR_SEC(WEP_SHOTGUN, melee_swing_up)) + + (v_right * swing_factor * WEP_CVAR_SEC(WEP_SHOTGUN, melee_swing_side))); WarpZone_traceline_antilag(this.realowner, this.realowner.origin + this.realowner.view_ofs, targpos, false, this.realowner, ((IS_CLIENT(this.realowner)) ? ANTILAG_LATENCY(this.realowner) : 0)); @@ -120,21 +120,21 @@ void W_Shotgun_Melee_Think(entity this) if((trace_fraction < 1) // if trace is good, apply the damage and remove this && (trace_ent.takedamage != DAMAGE_NO) && (trace_ent != this.swing_alreadyhit) - && (is_player || WEP_CVAR_SEC(shotgun, melee_nonplayerdamage))) + && (is_player || WEP_CVAR_SEC(WEP_SHOTGUN, melee_nonplayerdamage))) { target_victim = trace_ent; // so it persists through other calls if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught. - swing_damage = (WEP_CVAR_SEC(shotgun, damage) * min(1, swing_factor + 1)); + swing_damage = (WEP_CVAR_SEC(WEP_SHOTGUN, damage) * min(1, swing_factor + 1)); else - swing_damage = (WEP_CVAR_SEC(shotgun, melee_nonplayerdamage) * min(1, swing_factor + 1)); + swing_damage = (WEP_CVAR_SEC(WEP_SHOTGUN, melee_nonplayerdamage) * min(1, swing_factor + 1)); //print(strcat(this.realowner.netname, " hitting ", target_victim.netname, " with ", strcat(ftos(swing_damage), " damage (factor: ", ftos(swing_factor), ") at "), ftos(time), " seconds.\n")); Damage(target_victim, this.realowner, this.realowner, swing_damage, WEP_SHOTGUN.m_id | HITTYPE_SECONDARY, this.weaponentity_fld, this.realowner.origin + this.realowner.view_ofs, - v_forward * WEP_CVAR_SEC(shotgun, force)); + v_forward * WEP_CVAR_SEC(WEP_SHOTGUN, force)); if(accuracy_isgooddamage(this.realowner, target_victim)) { accuracy_add(this.realowner, WEP_SHOTGUN, 0, swing_damage); } @@ -143,7 +143,7 @@ void W_Shotgun_Melee_Think(entity this) te_customflash(targpos, 200, 2, '15 0 0'); #endif - if(WEP_CVAR_SEC(shotgun, melee_multihit)) // allow multiple hits with one swing, but not against the same player twice. + if(WEP_CVAR_SEC(WEP_SHOTGUN, melee_multihit)) // allow multiple hits with one swing, but not against the same player twice. { this.swing_alreadyhit = target_victim; continue; // move along to next trace @@ -173,14 +173,14 @@ void W_Shotgun_Melee_Think(entity this) void W_Shotgun_Attack2(Weapon thiswep, entity actor, .entity weaponentity, int fire) { sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTEN_NORM); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(shotgun, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_SHOTGUN, animtime), w_ready); entity meleetemp = new_pure(meleetemp); meleetemp.realowner = actor; setthink(meleetemp, W_Shotgun_Melee_Think); - meleetemp.nextthink = time + WEP_CVAR_SEC(shotgun, melee_delay) * W_WeaponRateFactor(actor); + meleetemp.nextthink = time + WEP_CVAR_SEC(WEP_SHOTGUN, melee_delay) * W_WeaponRateFactor(actor); meleetemp.weaponentity_fld = weaponentity; - W_SetupShot_Range(actor, weaponentity, true, 0, SND_Null, 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range), WEP_SHOTGUN.m_id | HITTYPE_SECONDARY); + W_SetupShot_Range(actor, weaponentity, true, 0, SND_Null, 0, WEP_CVAR_SEC(WEP_SHOTGUN, damage), WEP_CVAR_SEC(WEP_SHOTGUN, melee_range), WEP_SHOTGUN.m_id | HITTYPE_SECONDARY); } // alternate secondary weapon frames @@ -196,20 +196,20 @@ void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, .entity weaponentity sound(actor, CH_WEAPON_SINGLE, SND_Null, VOL_BASE, ATTN_NORM); // kill previous sound W_Shotgun_Attack(thiswep, actor, weaponentity, true, - WEP_CVAR_PRI(shotgun, ammo), - WEP_CVAR_PRI(shotgun, damage), - WEP_CVAR_PRI(shotgun, damagefalloff_halflife), - WEP_CVAR_PRI(shotgun, damagefalloff_mindist), - WEP_CVAR_PRI(shotgun, damagefalloff_maxdist), - WEP_CVAR_PRI(shotgun, bullets), - WEP_CVAR_PRI(shotgun, spread), - WEP_CVAR_PRI(shotgun, spread_pattern), - WEP_CVAR_PRI(shotgun, spread_pattern_scale), - WEP_CVAR_PRI(shotgun, solidpenetration), - WEP_CVAR_PRI(shotgun, force), - WEP_CVAR_PRI(shotgun, damagefalloff_forcehalflife), + WEP_CVAR_PRI(WEP_SHOTGUN, ammo), + WEP_CVAR_PRI(WEP_SHOTGUN, damage), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_halflife), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_mindist), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_maxdist), + WEP_CVAR_PRI(WEP_SHOTGUN, bullets), + WEP_CVAR_PRI(WEP_SHOTGUN, spread), + WEP_CVAR_PRI(WEP_SHOTGUN, spread_pattern), + WEP_CVAR_PRI(WEP_SHOTGUN, spread_pattern_scale), + WEP_CVAR_PRI(WEP_SHOTGUN, solidpenetration), + WEP_CVAR_PRI(WEP_SHOTGUN, force), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_forcehalflife), EFFECT_BULLET_WEAK); // actually is secondary, but we trick the last shot into playing full reload sound - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(WEP_SHOTGUN, alt_animtime), w_ready); } void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity, int fire) { @@ -222,27 +222,27 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity } W_Shotgun_Attack(thiswep, actor, weaponentity, false, - WEP_CVAR_PRI(shotgun, ammo), - WEP_CVAR_PRI(shotgun, damage), - WEP_CVAR_PRI(shotgun, damagefalloff_halflife), - WEP_CVAR_PRI(shotgun, damagefalloff_mindist), - WEP_CVAR_PRI(shotgun, damagefalloff_maxdist), - WEP_CVAR_PRI(shotgun, bullets), - WEP_CVAR_PRI(shotgun, spread), - WEP_CVAR_PRI(shotgun, spread_pattern), - WEP_CVAR_PRI(shotgun, spread_pattern_scale), - WEP_CVAR_PRI(shotgun, solidpenetration), - WEP_CVAR_PRI(shotgun, force), - WEP_CVAR_PRI(shotgun, damagefalloff_forcehalflife), + WEP_CVAR_PRI(WEP_SHOTGUN, ammo), + WEP_CVAR_PRI(WEP_SHOTGUN, damage), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_halflife), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_mindist), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_maxdist), + WEP_CVAR_PRI(WEP_SHOTGUN, bullets), + WEP_CVAR_PRI(WEP_SHOTGUN, spread), + WEP_CVAR_PRI(WEP_SHOTGUN, spread_pattern), + WEP_CVAR_PRI(WEP_SHOTGUN, spread_pattern_scale), + WEP_CVAR_PRI(WEP_SHOTGUN, solidpenetration), + WEP_CVAR_PRI(WEP_SHOTGUN, force), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_forcehalflife), EFFECT_BULLET_WEAK); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame2); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(WEP_SHOTGUN, alt_animtime), W_Shotgun_Attack3_Frame2); } .float shotgun_primarytime; METHOD(Shotgun, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { - if(vdist(actor.origin - actor.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range))) + if(vdist(actor.origin - actor.enemy.origin, <=, WEP_CVAR_SEC(WEP_SHOTGUN, melee_range))) PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false, false); else PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false, false); @@ -251,7 +251,7 @@ METHOD(Shotgun, wr_aim, void(entity thiswep, entity actor, .entity weaponentity) METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { // force reload weapon when clip is empty or insufficent - if(WEP_CVAR(shotgun, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(shotgun, ammo)) + if(WEP_CVAR(WEP_SHOTGUN, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(WEP_SHOTGUN, ammo)) { if(actor.(weaponentity).clip_load >= 0 && GetResource(actor, thiswep.ammo_type) > 0) { @@ -266,50 +266,50 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit { if(time >= actor.(weaponentity).shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(shotgun, animtime))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_SHOTGUN, animtime))) { W_Shotgun_Attack(thiswep, actor, weaponentity, true, - WEP_CVAR_PRI(shotgun, ammo), - WEP_CVAR_PRI(shotgun, damage), - WEP_CVAR_PRI(shotgun, damagefalloff_halflife), - WEP_CVAR_PRI(shotgun, damagefalloff_mindist), - WEP_CVAR_PRI(shotgun, damagefalloff_maxdist), - WEP_CVAR_PRI(shotgun, bullets), - WEP_CVAR_PRI(shotgun, spread), - WEP_CVAR_PRI(shotgun, spread_pattern), - WEP_CVAR_PRI(shotgun, spread_pattern_scale), - WEP_CVAR_PRI(shotgun, solidpenetration), - WEP_CVAR_PRI(shotgun, force), - WEP_CVAR_PRI(shotgun, damagefalloff_forcehalflife), + WEP_CVAR_PRI(WEP_SHOTGUN, ammo), + WEP_CVAR_PRI(WEP_SHOTGUN, damage), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_halflife), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_mindist), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_maxdist), + WEP_CVAR_PRI(WEP_SHOTGUN, bullets), + WEP_CVAR_PRI(WEP_SHOTGUN, spread), + WEP_CVAR_PRI(WEP_SHOTGUN, spread_pattern), + WEP_CVAR_PRI(WEP_SHOTGUN, spread_pattern_scale), + WEP_CVAR_PRI(WEP_SHOTGUN, solidpenetration), + WEP_CVAR_PRI(WEP_SHOTGUN, force), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_forcehalflife), EFFECT_BULLET_WEAK); - actor.(weaponentity).shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor(actor); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready); + actor.(weaponentity).shotgun_primarytime = time + WEP_CVAR_PRI(WEP_SHOTGUN, refire) * W_WeaponRateFactor(actor); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_SHOTGUN, animtime), w_ready); return; } } } - else if((fire & 2) && WEP_CVAR(shotgun, secondary) == 2) + else if((fire & 2) && WEP_CVAR(WEP_SHOTGUN, secondary) == 2) { if(time >= actor.(weaponentity).shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(shotgun, alt_animtime))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_SHOTGUN, alt_animtime))) { W_Shotgun_Attack(thiswep, actor, weaponentity, false, - WEP_CVAR_PRI(shotgun, ammo), - WEP_CVAR_PRI(shotgun, damage), - WEP_CVAR_PRI(shotgun, damagefalloff_halflife), - WEP_CVAR_PRI(shotgun, damagefalloff_mindist), - WEP_CVAR_PRI(shotgun, damagefalloff_maxdist), - WEP_CVAR_PRI(shotgun, bullets), - WEP_CVAR_PRI(shotgun, spread), - WEP_CVAR_PRI(shotgun, spread_pattern), - WEP_CVAR_PRI(shotgun, spread_pattern_scale), - WEP_CVAR_PRI(shotgun, solidpenetration), - WEP_CVAR_PRI(shotgun, force), - WEP_CVAR_PRI(shotgun, damagefalloff_forcehalflife), + WEP_CVAR_PRI(WEP_SHOTGUN, ammo), + WEP_CVAR_PRI(WEP_SHOTGUN, damage), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_halflife), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_mindist), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_maxdist), + WEP_CVAR_PRI(WEP_SHOTGUN, bullets), + WEP_CVAR_PRI(WEP_SHOTGUN, spread), + WEP_CVAR_PRI(WEP_SHOTGUN, spread_pattern), + WEP_CVAR_PRI(WEP_SHOTGUN, spread_pattern_scale), + WEP_CVAR_PRI(WEP_SHOTGUN, solidpenetration), + WEP_CVAR_PRI(WEP_SHOTGUN, force), + WEP_CVAR_PRI(WEP_SHOTGUN, damagefalloff_forcehalflife), EFFECT_BULLET_WEAK); - actor.(weaponentity).shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor(actor); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1); + actor.(weaponentity).shotgun_primarytime = time + WEP_CVAR_SEC(WEP_SHOTGUN, alt_refire) * W_WeaponRateFactor(actor); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(WEP_SHOTGUN, alt_animtime), W_Shotgun_Attack3_Frame1); return; } } @@ -317,9 +317,9 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit } if(actor.(weaponentity).clip_load >= 0) // we are not currently reloading - if(WEP_CVAR(shotgun, secondary) == 1) + if(WEP_CVAR(WEP_SHOTGUN, secondary) == 1) if(((fire & 1) && !IS_BOT_CLIENT(actor) && GetResource(actor, thiswep.ammo_type) <= 0 && actor.(weaponentity).clip_load == 0 && !(actor.items & IT_UNLIMITED_AMMO)) || (fire & 2)) - if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(shotgun, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_SHOTGUN, refire))) { // melee attack // attempt forcing playback of the anim by switching to another anim (that we never play) here... @@ -328,19 +328,19 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit } METHOD(Shotgun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(shotgun, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(shotgun, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_SHOTGUN, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_SHOTGUN, ammo); return ammo_amount; } METHOD(Shotgun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - switch(WEP_CVAR(shotgun, secondary)) + switch(WEP_CVAR(WEP_SHOTGUN, secondary)) { case 1: return true; // melee does not use ammo case 2: // secondary triple shot { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(shotgun, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(shotgun, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_SHOTGUN, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_SHOTGUN, ammo); return ammo_amount; } default: return false; // secondary unavailable @@ -348,7 +348,7 @@ METHOD(Shotgun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapon } METHOD(Shotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, WEP_CVAR_PRI(shotgun, ammo), SND_RELOAD); // WEAPONTODO + W_Reload(actor, weaponentity, WEP_CVAR_PRI(WEP_SHOTGUN, ammo), SND_RELOAD); // WEAPONTODO } METHOD(Shotgun, wr_suicidemessage, Notification(entity thiswep)) { diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 43e5ca24e..28608a221 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -240,7 +240,7 @@ void W_Tuba_NoteThink(entity this) return; } this.nextthink = time; - dist_mult = WEP_CVAR(tuba, attenuation) / autocvar_snd_soundradius; + dist_mult = WEP_CVAR(WEP_TUBA, attenuation) / autocvar_snd_soundradius; FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != this.realowner, { v = this.origin - (it.origin + it.view_ofs); vol0 = max(0, 1 - vlen(v) * dist_mult); @@ -273,7 +273,7 @@ void W_Tuba_NoteOn(entity actor, .entity weaponentity, float hittype) if(actor.(weaponentity).tuba_instrument & 2) hittype |= HITTYPE_BOUNCE; - W_SetupShot(actor, weaponentity, false, 2, SND_Null, 0, WEP_CVAR(tuba, damage), hittype | WEP_TUBA.m_id); + W_SetupShot(actor, weaponentity, false, 2, SND_Null, 0, WEP_CVAR(WEP_TUBA, damage), hittype | WEP_TUBA.m_id); if(actor.(weaponentity).tuba_note) { @@ -297,10 +297,10 @@ void W_Tuba_NoteOn(entity actor, .entity weaponentity, float hittype) Net_LinkEntity(note, false, 0, W_Tuba_NoteSendEntity); } - actor.(weaponentity).tuba_note.teleport_time = time + WEP_CVAR(tuba, refire) * 2 * W_WeaponRateFactor(actor); // so it can get prolonged safely + actor.(weaponentity).tuba_note.teleport_time = time + WEP_CVAR(WEP_TUBA, refire) * 2 * W_WeaponRateFactor(actor); // so it can get prolonged safely //sound(actor, c, TUBA_NOTE(n), bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1), autocvar_g_balance_tuba_attenuation); - RadiusDamage(actor, actor, WEP_CVAR(tuba, damage), WEP_CVAR(tuba, edgedamage), WEP_CVAR(tuba, radius), NULL, NULL, WEP_CVAR(tuba, force), hittype | WEP_TUBA.m_id, weaponentity, NULL); + RadiusDamage(actor, actor, WEP_CVAR(WEP_TUBA, damage), WEP_CVAR(WEP_TUBA, edgedamage), WEP_CVAR(WEP_TUBA, radius), NULL, NULL, WEP_CVAR(WEP_TUBA, force), hittype | WEP_TUBA.m_id, weaponentity, NULL); if(time > actor.(weaponentity).tuba_smoketime) { @@ -322,7 +322,7 @@ METHOD(Tuba, wr_aim, void(Tuba this, entity actor, .entity weaponentity)) { // bots cannot play the Tuba well yet // I think they should start with the recorder first - if (vdist((actor.origin - actor.enemy.origin), <, WEP_CVAR(tuba, radius))) + if (vdist((actor.origin - actor.enemy.origin), <, WEP_CVAR(WEP_TUBA, radius))) { if (random() > 0.5) PHYS_INPUT_BUTTON_ATCK(actor) = true; @@ -334,16 +334,16 @@ METHOD(Tuba, wr_aim, void(Tuba this, entity actor, .entity weaponentity)) METHOD(Tuba, wr_think, void(Tuba this, entity actor, .entity weaponentity, int fire)) { if (fire & 1) - if (weapon_prepareattack(this, actor, weaponentity, false, WEP_CVAR(tuba, refire))) + if (weapon_prepareattack(this, actor, weaponentity, false, WEP_CVAR(WEP_TUBA, refire))) { W_Tuba_NoteOn(actor, weaponentity, 0); - weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(WEP_TUBA, animtime), w_ready); } if (fire & 2) - if (weapon_prepareattack(this, actor, weaponentity, true, WEP_CVAR(tuba, refire))) + if (weapon_prepareattack(this, actor, weaponentity, true, WEP_CVAR(WEP_TUBA, refire))) { W_Tuba_NoteOn(actor, weaponentity, HITTYPE_SECONDARY); - weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(WEP_TUBA, animtime), w_ready); } if (actor.(weaponentity).tuba_note) { diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index d5ee4cf61..dcc22344c 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -117,7 +117,7 @@ void W_RocketMinsta_Explosion(entity actor, .entity weaponentity, vector loc) void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity) { bool flying = IsFlying(actor); // do this BEFORE to make the trace values from FireRailgunBullet last - float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000); + float vaporizer_damage = ((WEP_CVAR_PRI(WEP_VAPORIZER, damage) > 0) ? WEP_CVAR_PRI(WEP_VAPORIZER, damage) : 10000); W_SetupShot(actor, weaponentity, true, 0, SND_Null, CH_WEAPON_A, vaporizer_damage, thiswep.m_id); // handle sound separately so we can change the volume @@ -126,7 +126,7 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity) yoda = 0; impressive_hits = 0; - FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, vaporizer_damage, true, WEP_CVAR_PRI(vaporizer, force), WEP_CVAR_PRI(vaporizer, damagefalloff_mindist), WEP_CVAR_PRI(vaporizer, damagefalloff_maxdist), WEP_CVAR_PRI(vaporizer, damagefalloff_halflife), WEP_CVAR_PRI(vaporizer, damagefalloff_forcehalflife), thiswep.m_id); + FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, vaporizer_damage, true, WEP_CVAR_PRI(WEP_VAPORIZER, force), WEP_CVAR_PRI(WEP_VAPORIZER, damagefalloff_mindist), WEP_CVAR_PRI(WEP_VAPORIZER, damagefalloff_maxdist), WEP_CVAR_PRI(WEP_VAPORIZER, damagefalloff_halflife), WEP_CVAR_PRI(WEP_VAPORIZER, damagefalloff_forcehalflife), thiswep.m_id); // do this now, as goodhits is disabled below vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); @@ -147,7 +147,7 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity) if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT))) W_RocketMinsta_Explosion(actor, weaponentity, trace_endpos); - W_DecreaseAmmo(thiswep, actor, ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)), weaponentity); + W_DecreaseAmmo(thiswep, actor, ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(WEP_VAPORIZER, ammo)), weaponentity); } void W_RocketMinsta_Laser_Damage(entity this, entity directhitentity) @@ -249,27 +249,27 @@ 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(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false, true); // WEAPONTODO: replace with proper vaporizer cvars + PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_SEC(WEP_VAPORIZER, speed), 0, WEP_CVAR_SEC(WEP_VAPORIZER, lifetime), false, true); // WEAPONTODO: replace with proper vaporizer cvars } METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)); + 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(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.(weaponentity).clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload + if(WEP_CVAR(WEP_VAPORIZER, reload_ammo) && WEP_CVAR_SEC(WEP_VAPORIZER, ammo) && actor.(weaponentity).clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(WEP_VAPORIZER, ammo))) { // forced reload thiswep.wr_reload(thiswep, actor, weaponentity); actor.(weaponentity).hagar_load = false; // rocket minsta exclusive var return; - } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.(weaponentity).clip_load < vaporizer_ammo) { // forced reload + } else if(WEP_CVAR(WEP_VAPORIZER, reload_ammo) && actor.(weaponentity).clip_load < vaporizer_ammo) { // forced reload thiswep.wr_reload(thiswep, actor, weaponentity); actor.(weaponentity).hagar_load = false; // rocket minsta exclusive var return; } if((fire & 1) && (GetResource(actor, RES_CELLS) || !autocvar_g_rm) && !weaponLocked(actor)) { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_VAPORIZER, refire))) { W_Vaporizer_Attack(thiswep, actor, weaponentity); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_VAPORIZER, animtime), w_ready); } } if((fire & 2) || ((fire & 1) && !GetResource(actor, RES_CELLS) && autocvar_g_rm)) @@ -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(vaporizer, refire) * W_WeaponRateFactor(actor); + actor.(weaponentity).jump_interval = time + WEP_CVAR_SEC(WEP_VAPORIZER, refire) * W_WeaponRateFactor(actor); // decrease ammo for the laser? - if(WEP_CVAR_SEC(vaporizer, ammo)) - W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo), weaponentity); + if(WEP_CVAR_SEC(WEP_VAPORIZER, ammo)) + W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_VAPORIZER, ammo), weaponentity); makevectors(actor.v_angle); W_Blaster_Attack(actor, thiswep, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY); // now do normal refire - weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_VAPORIZER, animtime), w_ready); } } else @@ -320,17 +320,17 @@ METHOD(Vaporizer, wr_setup, void(entity thiswep, entity actor, .entity weaponent } METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)); + float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(WEP_VAPORIZER, ammo)); float ammo_amount = GetResource(actor, thiswep.ammo_type) >= vaporizer_ammo; ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= vaporizer_ammo; return ammo_amount; } METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - if(!WEP_CVAR_SEC(vaporizer, ammo)) + if(!WEP_CVAR_SEC(WEP_VAPORIZER, ammo)) return true; - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(vaporizer, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_VAPORIZER, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_VAPORIZER, ammo); return ammo_amount; } METHOD(Vaporizer, wr_resetplayer, void(entity thiswep, entity actor)) @@ -339,10 +339,10 @@ METHOD(Vaporizer, wr_resetplayer, void(entity thiswep, entity actor)) } METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)); + float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(WEP_VAPORIZER, ammo)); float used_ammo; - if(WEP_CVAR_SEC(vaporizer, ammo)) - used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo)); + if(WEP_CVAR_SEC(WEP_VAPORIZER, ammo)) + used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(WEP_VAPORIZER, ammo)); else used_ammo = vaporizer_ammo; diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index d9cacac00..445494b4c 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -1,14 +1,14 @@ #include "vortex.qh" -//REGISTER_STAT(WEP_CVAR_vortex_charge, bool, WEP_CVAR(vortex, charge)) -//REGISTER_STAT(WEP_CVAR_vortex_charge_animlimit, float, WEP_CVAR(vortex, charge_animlimit)) +//REGISTER_STAT(WEP_CVAR_vortex_charge, bool, WEP_CVAR(WEP_VORTEX, charge)) +//REGISTER_STAT(WEP_CVAR_vortex_charge_animlimit, float, WEP_CVAR(WEP_VORTEX, charge_animlimit)) #if defined(GAMEQC) METHOD(Vortex, wr_glow, vector(Vortex this, int actor_colors, entity wepent)) { - if (!WEP_CVAR(vortex, charge)) return '0 0 0'; + if (!WEP_CVAR(WEP_VORTEX, charge)) return '0 0 0'; float charge = max(0.25, wepent.vortex_charge); - float animlimit = WEP_CVAR(vortex, charge_animlimit); + float animlimit = WEP_CVAR(WEP_VORTEX, charge_animlimit); float f = min(1, charge / animlimit); vector mycolors = colormapPaletteColor(actor_colors & 0x0F, true); vector g = f * (mycolors * 0.3); @@ -71,21 +71,21 @@ MUTATOR_HOOKFUNCTION(vortex_charge, GetPressedKeys) entity player = M_ARGV(0, entity); // WEAPONTODO - if(!WEP_CVAR(vortex, charge) || !WEP_CVAR(vortex, charge_velocity_rate)) + if(!WEP_CVAR(WEP_VORTEX, charge) || !WEP_CVAR(WEP_VORTEX, charge_velocity_rate)) return; for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { .entity weaponentity = weaponentities[slot]; - if (player.(weaponentity).m_weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && vdist(vec2(player.velocity), >, WEP_CVAR(vortex, charge_minspeed))) + if (player.(weaponentity).m_weapon == WEP_VORTEX && WEP_CVAR(WEP_VORTEX, charge) && WEP_CVAR(WEP_VORTEX, charge_velocity_rate) && vdist(vec2(player.velocity), >, WEP_CVAR(WEP_VORTEX, charge_minspeed))) { float xyspeed = vlen(vec2(player.velocity)); // add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed - xyspeed = min(xyspeed, WEP_CVAR(vortex, charge_maxspeed)); - float f = (xyspeed - WEP_CVAR(vortex, charge_minspeed)) / (WEP_CVAR(vortex, charge_maxspeed) - WEP_CVAR(vortex, charge_minspeed)); + xyspeed = min(xyspeed, WEP_CVAR(WEP_VORTEX, charge_maxspeed)); + float f = (xyspeed - WEP_CVAR(WEP_VORTEX, charge_minspeed)) / (WEP_CVAR(WEP_VORTEX, charge_maxspeed) - WEP_CVAR(WEP_VORTEX, charge_minspeed)); // add the extra charge - player.(weaponentity).vortex_charge = min(1, player.(weaponentity).vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH); + player.(weaponentity).vortex_charge = min(1, player.(weaponentity).vortex_charge + WEP_CVAR(WEP_VORTEX, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH); } } } @@ -94,25 +94,25 @@ void W_Vortex_Attack(Weapon thiswep, entity actor, .entity weaponentity, float i { float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge; - mydmg = WEP_CVAR_BOTH(vortex, !issecondary, damage); - myforce = WEP_CVAR_BOTH(vortex, !issecondary, force); - mymindist = WEP_CVAR_BOTH(vortex, !issecondary, damagefalloff_mindist); - mymaxdist = WEP_CVAR_BOTH(vortex, !issecondary, damagefalloff_maxdist); - myhalflife = WEP_CVAR_BOTH(vortex, !issecondary, damagefalloff_halflife); - myforcehalflife = WEP_CVAR_BOTH(vortex, !issecondary, damagefalloff_forcehalflife); - myammo = WEP_CVAR_BOTH(vortex, !issecondary, ammo); + mydmg = WEP_CVAR_BOTH(WEP_VORTEX, !issecondary, damage); + myforce = WEP_CVAR_BOTH(WEP_VORTEX, !issecondary, force); + mymindist = WEP_CVAR_BOTH(WEP_VORTEX, !issecondary, damagefalloff_mindist); + mymaxdist = WEP_CVAR_BOTH(WEP_VORTEX, !issecondary, damagefalloff_maxdist); + myhalflife = WEP_CVAR_BOTH(WEP_VORTEX, !issecondary, damagefalloff_halflife); + myforcehalflife = WEP_CVAR_BOTH(WEP_VORTEX, !issecondary, damagefalloff_forcehalflife); + myammo = WEP_CVAR_BOTH(WEP_VORTEX, !issecondary, ammo); float dtype = thiswep.m_id; - if(WEP_CVAR_BOTH(vortex, !issecondary, armorpierce)) + if(WEP_CVAR_BOTH(WEP_VORTEX, !issecondary, armorpierce)) dtype |= HITTYPE_ARMORPIERCE; float flying; flying = IsFlying(actor); // do this BEFORE to make the trace values from FireRailgunBullet last - if(WEP_CVAR(vortex, charge)) + if(WEP_CVAR(WEP_VORTEX, charge)) { - charge = WEP_CVAR(vortex, charge_mindmg) / mydmg + (1 - WEP_CVAR(vortex, charge_mindmg) / mydmg) * actor.(weaponentity).vortex_charge; - actor.(weaponentity).vortex_charge *= WEP_CVAR(vortex, charge_shot_multiplier); // do this AFTER setting mydmg/myforce + charge = WEP_CVAR(WEP_VORTEX, charge_mindmg) / mydmg + (1 - WEP_CVAR(WEP_VORTEX, charge_mindmg) / mydmg) * actor.(weaponentity).vortex_charge; + actor.(weaponentity).vortex_charge *= WEP_CVAR(WEP_VORTEX, charge_shot_multiplier); // do this AFTER setting mydmg/myforce // O RLY? -- divVerent // YA RLY -- FruitieX } @@ -122,9 +122,9 @@ void W_Vortex_Attack(Weapon thiswep, entity actor, .entity weaponentity, float i myforce *= charge; W_SetupShot(actor, weaponentity, true, 5, SND_NEXFIRE, CH_WEAPON_A, mydmg, dtype); - if(charge > WEP_CVAR(vortex, charge_animlimit) && WEP_CVAR(vortex, charge_animlimit)) // if the Vortex is overcharged, we play an extra sound + if(charge > WEP_CVAR(WEP_VORTEX, charge_animlimit) && WEP_CVAR(WEP_VORTEX, charge_animlimit)) // if the Vortex is overcharged, we play an extra sound { - sound(actor, CH_WEAPON_B, SND_NEXCHARGE, VOL_BASE * (charge - 0.5 * WEP_CVAR(vortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(vortex, charge_animlimit)), ATTN_NORM); + sound(actor, CH_WEAPON_B, SND_NEXCHARGE, VOL_BASE * (charge - 0.5 * WEP_CVAR(WEP_VORTEX, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(WEP_VORTEX, charge_animlimit)), ATTN_NORM); } yoda = 0; @@ -153,8 +153,8 @@ void W_Vortex_Attack(Weapon thiswep, entity actor, .entity weaponentity, float i void W_Vortex_Charge(entity actor, .entity weaponentity, float dt) { - if(WEP_CVAR(vortex, charge) && actor.(weaponentity).vortex_charge < WEP_CVAR(vortex, charge_limit)) - actor.(weaponentity).vortex_charge = min(1, actor.(weaponentity).vortex_charge + WEP_CVAR(vortex, charge_rate) * dt); + if(WEP_CVAR(WEP_VORTEX, charge) && actor.(weaponentity).vortex_charge < WEP_CVAR(WEP_VORTEX, charge_limit)) + actor.(weaponentity).vortex_charge = min(1, actor.(weaponentity).vortex_charge + WEP_CVAR(WEP_VORTEX, charge_rate) * dt); } METHOD(Vortex, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) @@ -164,99 +164,99 @@ METHOD(Vortex, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) } METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if(!WEP_CVAR(vortex, charge_always)) + if(!WEP_CVAR(WEP_VORTEX, charge_always)) W_Vortex_Charge(actor, weaponentity, frametime / W_TICSPERFRAME); - if(WEP_CVAR_SEC(vortex, chargepool)) + if(WEP_CVAR_SEC(WEP_VORTEX, chargepool)) if(actor.(weaponentity).vortex_chargepool_ammo < 1) { if(actor.vortex_chargepool_pauseregen_finished < time) - actor.(weaponentity).vortex_chargepool_ammo = min(1, actor.(weaponentity).vortex_chargepool_ammo + WEP_CVAR_SEC(vortex, chargepool_regen) * frametime / W_TICSPERFRAME); - actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(vortex, chargepool_pause_regen)); + actor.(weaponentity).vortex_chargepool_ammo = min(1, actor.(weaponentity).vortex_chargepool_ammo + WEP_CVAR_SEC(WEP_VORTEX, chargepool_regen) * frametime / W_TICSPERFRAME); + actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(WEP_VORTEX, chargepool_pause_regen)); } - if(autocvar_g_balance_vortex_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload + if(autocvar_g_balance_vortex_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(WEP_VORTEX, ammo), WEP_CVAR_SEC(WEP_VORTEX, ammo))) { // forced reload thiswep.wr_reload(thiswep, actor, weaponentity); } else { if(fire & 1) { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vortex, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_VORTEX, refire))) { W_Vortex_Attack(thiswep, actor, weaponentity, 0); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_VORTEX, animtime), w_ready); } } - if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2)) + if((WEP_CVAR(WEP_VORTEX, charge) && !WEP_CVAR(WEP_VORTEX, secondary)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2)) { - if(WEP_CVAR(vortex, charge)) + if(WEP_CVAR(WEP_VORTEX, charge)) { - actor.(weaponentity).vortex_charge_rottime = time + WEP_CVAR(vortex, charge_rot_pause); + actor.(weaponentity).vortex_charge_rottime = time + WEP_CVAR(WEP_VORTEX, charge_rot_pause); float dt = frametime / W_TICSPERFRAME; if(actor.(weaponentity).vortex_charge < 1) { - if(WEP_CVAR_SEC(vortex, chargepool)) + if(WEP_CVAR_SEC(WEP_VORTEX, chargepool)) { - if(WEP_CVAR_SEC(vortex, ammo)) + if(WEP_CVAR_SEC(WEP_VORTEX, ammo)) { // always deplete if secondary is held - actor.(weaponentity).vortex_chargepool_ammo = max(0, actor.(weaponentity).vortex_chargepool_ammo - WEP_CVAR_SEC(vortex, ammo) * dt); + actor.(weaponentity).vortex_chargepool_ammo = max(0, actor.(weaponentity).vortex_chargepool_ammo - WEP_CVAR_SEC(WEP_VORTEX, ammo) * dt); - dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(vortex, charge_rate)); - actor.vortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(vortex, chargepool_pause_regen); + dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(WEP_VORTEX, charge_rate)); + actor.vortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(WEP_VORTEX, chargepool_pause_regen); dt = min(dt, actor.(weaponentity).vortex_chargepool_ammo); dt = max(0, dt); - actor.(weaponentity).vortex_charge += dt * WEP_CVAR(vortex, charge_rate); + actor.(weaponentity).vortex_charge += dt * WEP_CVAR(WEP_VORTEX, charge_rate); } } - else if(WEP_CVAR_SEC(vortex, ammo)) + else if(WEP_CVAR_SEC(WEP_VORTEX, ammo)) { if(fire & 2) // only eat ammo when the button is pressed { - dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(vortex, charge_rate)); + dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(WEP_VORTEX, charge_rate)); if(!(actor.items & IT_UNLIMITED_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(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo)); + dt = min(dt, (actor.(weaponentity).clip_load - WEP_CVAR_PRI(WEP_VORTEX, ammo)) / WEP_CVAR_SEC(WEP_VORTEX, ammo)); dt = max(0, dt); if(dt > 0) { - actor.(weaponentity).clip_load = max(WEP_CVAR_SEC(vortex, ammo), actor.(weaponentity).clip_load - WEP_CVAR_SEC(vortex, ammo) * dt); + actor.(weaponentity).clip_load = max(WEP_CVAR_SEC(WEP_VORTEX, ammo), actor.(weaponentity).clip_load - WEP_CVAR_SEC(WEP_VORTEX, ammo) * dt); } actor.(weaponentity).(weapon_load[thiswep.m_id]) = actor.(weaponentity).clip_load; } else { - dt = min(dt, (GetResource(actor, thiswep.ammo_type) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo)); + dt = min(dt, (GetResource(actor, thiswep.ammo_type) - WEP_CVAR_PRI(WEP_VORTEX, ammo)) / WEP_CVAR_SEC(WEP_VORTEX, ammo)); dt = max(0, dt); if(dt > 0) { - SetResource(actor, thiswep.ammo_type, max(WEP_CVAR_SEC(vortex, ammo), GetResource(actor, thiswep.ammo_type) - WEP_CVAR_SEC(vortex, ammo) * dt)); + SetResource(actor, thiswep.ammo_type, max(WEP_CVAR_SEC(WEP_VORTEX, ammo), GetResource(actor, thiswep.ammo_type) - WEP_CVAR_SEC(WEP_VORTEX, ammo) * dt)); } } } - actor.(weaponentity).vortex_charge += dt * WEP_CVAR(vortex, charge_rate); + actor.(weaponentity).vortex_charge += dt * WEP_CVAR(WEP_VORTEX, charge_rate); } } else { - dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(vortex, charge_rate)); - actor.(weaponentity).vortex_charge += dt * WEP_CVAR(vortex, charge_rate); + dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(WEP_VORTEX, charge_rate)); + actor.(weaponentity).vortex_charge += dt * WEP_CVAR(WEP_VORTEX, charge_rate); } } } - else if(WEP_CVAR(vortex, secondary)) + else if(WEP_CVAR(WEP_VORTEX, secondary)) { - if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(vortex, refire))) + if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_VORTEX, refire))) { W_Vortex_Attack(thiswep, actor, weaponentity, 1); - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(WEP_VORTEX, animtime), w_ready); } } } @@ -268,17 +268,17 @@ METHOD(Vortex, wr_setup, void(entity thiswep, entity actor, .entity weaponentity } METHOD(Vortex, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(vortex, ammo); - ammo_amount += (autocvar_g_balance_vortex_reload_ammo && actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(vortex, ammo)); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_VORTEX, ammo); + ammo_amount += (autocvar_g_balance_vortex_reload_ammo && actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_VORTEX, ammo)); return ammo_amount; } METHOD(Vortex, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - if(WEP_CVAR(vortex, secondary)) + if(WEP_CVAR(WEP_VORTEX, secondary)) { // don't allow charging if we don't have enough ammo - float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(vortex, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(vortex, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_VORTEX, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_VORTEX, ammo); return ammo_amount; } else @@ -288,13 +288,13 @@ METHOD(Vortex, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapone } METHOD(Vortex, wr_resetplayer, void(entity thiswep, entity actor)) { - if (WEP_CVAR(vortex, charge)) { + if (WEP_CVAR(WEP_VORTEX, charge)) { for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { .entity weaponentity = weaponentities[slot]; - actor.(weaponentity).vortex_charge = WEP_CVAR(vortex, charge_start); + actor.(weaponentity).vortex_charge = WEP_CVAR(WEP_VORTEX, charge_start); - if (WEP_CVAR_SEC(vortex, chargepool)) + if (WEP_CVAR_SEC(WEP_VORTEX, chargepool)) actor.(weaponentity).vortex_chargepool_ammo = 1; } } @@ -302,7 +302,7 @@ METHOD(Vortex, wr_resetplayer, void(entity thiswep, entity actor)) } METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND_RELOAD); + W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(WEP_VORTEX, ammo), WEP_CVAR_SEC(WEP_VORTEX, ammo)), SND_RELOAD); } METHOD(Vortex, wr_suicidemessage, Notification(entity thiswep)) { @@ -314,7 +314,7 @@ METHOD(Vortex, wr_killmessage, Notification(entity thiswep)) } METHOD(Vortex, wr_zoom, bool(entity thiswep, entity actor)) { - return PHYS_INPUT_BUTTON_ATCK2(actor) && !WEP_CVAR(vortex, secondary); + return PHYS_INPUT_BUTTON_ATCK2(actor) && !WEP_CVAR(WEP_VORTEX, secondary); } #endif @@ -337,7 +337,7 @@ METHOD(Vortex, wr_init, void(entity thiswep)) } METHOD(Vortex, wr_zoom, bool(entity thiswep, entity actor)) { - if(button_zoom || zoomscript_caught || (!WEP_CVAR(vortex, secondary) && button_attack2)) + if(button_zoom || zoomscript_caught || (!WEP_CVAR(WEP_VORTEX, secondary) && button_attack2)) { return true; } @@ -349,7 +349,7 @@ METHOD(Vortex, wr_zoom, bool(entity thiswep, entity actor)) } METHOD(Vortex, wr_zoomdir, bool(entity thiswep)) { - return button_attack2 && !WEP_CVAR(vortex, secondary); + return button_attack2 && !WEP_CVAR(WEP_VORTEX, secondary); } #endif diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index e7bf9e5a3..51774e148 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -615,7 +615,7 @@ void havocbot_movetogoal(entity this) // If there is a trigger_hurt right below try to use the jetpack or make a rocketjump if (skill > 6 && !(IS_ONGROUND(this))) { - #define ROCKETJUMP_DAMAGE() WEP_CVAR(devastator, damage) * 0.8 \ + #define ROCKETJUMP_DAMAGE() WEP_CVAR(WEP_DEVASTATOR, damage) * 0.8 \ * ((StatusEffects_active(STATUSEFFECT_Strength, this)) ? autocvar_g_balance_powerup_strength_selfdamage : 1) \ * ((StatusEffects_active(STATUSEFFECT_Shield, this)) ? autocvar_g_balance_powerup_invincible_takedamage : 1) @@ -706,7 +706,7 @@ void havocbot_movetogoal(entity this) this.(weaponentity).m_switchweapon = WEP_DEVASTATOR; this.v_angle_x = 90; PHYS_INPUT_BUTTON_ATCK(this) = true; - this.rocketjumptime = time + WEP_CVAR(devastator, detonatedelay); + this.rocketjumptime = time + WEP_CVAR(WEP_DEVASTATOR, detonatedelay); return; } } diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 189ba57e5..c5dd18268 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2399,7 +2399,7 @@ bool PlayerThink(entity this) for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { .entity weaponentity = weaponentities[slot]; - if(WEP_CVAR(vortex, charge_always)) + if(WEP_CVAR(WEP_VORTEX, charge_always)) W_Vortex_Charge(this, weaponentity, frametime); W_WeaponFrame(this, weaponentity); } @@ -2412,8 +2412,8 @@ bool PlayerThink(entity this) for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { .entity weaponentity = weaponentities[slot]; - if (WEP_CVAR(vortex, charge_rot_rate) && this.(weaponentity).vortex_charge > WEP_CVAR(vortex, charge_limit) && this.(weaponentity).vortex_charge_rottime < time) - this.(weaponentity).vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.(weaponentity).vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1); + if (WEP_CVAR(WEP_VORTEX, charge_rot_rate) && this.(weaponentity).vortex_charge > WEP_CVAR(WEP_VORTEX, charge_limit) && this.(weaponentity).vortex_charge_rottime < time) + this.(weaponentity).vortex_charge = bound(WEP_CVAR(WEP_VORTEX, charge_limit), this.(weaponentity).vortex_charge - WEP_CVAR(WEP_VORTEX, charge_rot_rate) * frametime / W_TICSPERFRAME, 1); } player_regen(this); diff --git a/qcsrc/server/weapons/tracing.qh b/qcsrc/server/weapons/tracing.qh index 94b3be212..c88bf0064 100644 --- a/qcsrc/server/weapons/tracing.qh +++ b/qcsrc/server/weapons/tracing.qh @@ -48,27 +48,27 @@ void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float p #define W_SetupProjVelocity_Basic(ent,pspeed,pspread) \ W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, pspeed, 0, 0, pspread, false) -#define W_SetupProjVelocity_UP_PRE(ent, wepname, prefix) \ - W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wepname, prefix##speed), WEP_CVAR(wepname, prefix##speed_up), WEP_CVAR(wepname, prefix##speed_z), WEP_CVAR(wepname, prefix##spread), false) -#define W_SetupProjVelocity_UP_PRI(ent, wepname) \ - W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wepname, speed), WEP_CVAR_PRI(wepname, speed_up), WEP_CVAR_PRI(wepname, speed_z), WEP_CVAR_PRI(wepname, spread), false) -#define W_SetupProjVelocity_UP_SEC(ent, wepname) \ - W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wepname, speed), WEP_CVAR_SEC(wepname, speed_up), WEP_CVAR_SEC(wepname, speed_z), WEP_CVAR_SEC(wepname, spread), false) - -#define W_SetupProjVelocity_UP_BOTH(ent, wepname, isprimary) \ - if(isprimary) { W_SetupProjVelocity_UP_PRI(ent, wepname); } \ - else { W_SetupProjVelocity_UP_SEC(ent, wepname); } - -#define W_SetupProjVelocity_PRE(ent, wepname, prefix) \ - W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wepname, prefix##speed), 0, 0, WEP_CVAR(wepname, prefix##spread), false) -#define W_SetupProjVelocity_PRI(ent, wepname) \ - W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wepname, speed), 0, 0, WEP_CVAR_PRI(wepname, spread), false) -#define W_SetupProjVelocity_SEC(ent, wepname) \ - W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wepname, speed), 0, 0, WEP_CVAR_SEC(wepname, spread), false) - -#define W_SetupProjVelocity_BOTH(ent, wepname, isprimary) \ - if(isprimary) { W_SetupProjVelocity_PRI(ent, wepname); } \ - else { W_SetupProjVelocity_SEC(ent, wepname); } +#define W_SetupProjVelocity_UP_PRE(ent, wep, prefix) \ + W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wep, prefix##speed), WEP_CVAR(wep, prefix##speed_up), WEP_CVAR(wep, prefix##speed_z), WEP_CVAR(wep, prefix##spread), false) +#define W_SetupProjVelocity_UP_PRI(ent, wep) \ + W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wep, speed), WEP_CVAR_PRI(wep, speed_up), WEP_CVAR_PRI(wep, speed_z), WEP_CVAR_PRI(wep, spread), false) +#define W_SetupProjVelocity_UP_SEC(ent, wep) \ + W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wep, speed), WEP_CVAR_SEC(wep, speed_up), WEP_CVAR_SEC(wep, speed_z), WEP_CVAR_SEC(wep, spread), false) + +#define W_SetupProjVelocity_UP_BOTH(ent, wep, isprimary) \ + if(isprimary) { W_SetupProjVelocity_UP_PRI(ent, wep); } \ + else { W_SetupProjVelocity_UP_SEC(ent, wep); } + +#define W_SetupProjVelocity_PRE(ent, wep, prefix) \ + W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wep, prefix##speed), 0, 0, WEP_CVAR(wep, prefix##spread), false) +#define W_SetupProjVelocity_PRI(ent, wep) \ + W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wep, speed), 0, 0, WEP_CVAR_PRI(wep, spread), false) +#define W_SetupProjVelocity_SEC(ent, wep) \ + W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wep, speed), 0, 0, WEP_CVAR_SEC(wep, spread), false) + +#define W_SetupProjVelocity_BOTH(ent, wep, isprimary) \ + if(isprimary) { W_SetupProjVelocity_PRI(ent, wep); } \ + else { W_SetupProjVelocity_SEC(ent, wep); } // ==================== // Ballistics Tracing diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 7cfade409..dc3045256 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -243,7 +243,7 @@ bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, bool secondary } if (thiswep == WEP_SHOTGUN) - if (!secondary && WEP_CVAR(shotgun, secondary) == 1) return false; // no clicking, just allow + if (!secondary && WEP_CVAR(WEP_SHOTGUN, secondary) == 1) return false; // no clicking, just allow if (thiswep == actor.(weaponentity).m_switchweapon && time - actor.prevdryfire > 1) // only play once BEFORE starting to switch weapons { -- 2.39.2