#include <common/vehicles/all.qh>
#include <common/weapons/_all.qh>
+#include <common/mutators/mutator/overkill/okvortex.qh>
#include <common/viewloc.qh>
#include <common/minigames/cl_minigames.qh>
#include <common/minigames/cl_minigames_hud.qh>
{
entity wepent = viewmodels[slot];
if(wepent.switchweapon == wepent.activeweapon)
- if((wepent.activeweapon == WEP_VORTEX && !WEP_CVAR(vortex, secondary)) || (wepent.activeweapon == WEP_RIFLE && !WEP_CVAR(rifle, secondary))) // do NOT use switchweapon here
+ if(((wepent.activeweapon == WEP_VORTEX || wepent.activeweapon == WEP_OVERKILL_VORTEX) && !WEP_CVAR(vortex, secondary)) || (wepent.activeweapon == WEP_RIFLE && !WEP_CVAR(rifle, secondary))) // do NOT use switchweapon here
zoomdir += button_attack2;
}
}
case WEP_MORTAR: // toss curve
return SHOTTYPE_HITWORLD;
case WEP_VORTEX:
+ case WEP_OVERKILL_VORTEX:
case WEP_VAPORIZER:
mv = MOVE_NORMAL;
break;
entity wepent = viewmodels[0]; // TODO: unhardcode
// handle the values
- if (autocvar_crosshair_ring && wepent.activeweapon == WEP_VORTEX && vortex_charge && autocvar_crosshair_ring_vortex) // ring around crosshair representing velocity-dependent damage for the vortex
+ if (autocvar_crosshair_ring && (wepent.activeweapon == WEP_VORTEX || wepent.activeweapon == WEP_OVERKILL_VORTEX) && vortex_charge && autocvar_crosshair_ring_vortex) // ring around crosshair representing velocity-dependent damage for the vortex
{
if (vortex_chargepool || use_vortex_chargepool) {
use_vortex_chargepool = 1;
// generated file; do not modify
#include <common/mutators/mutator/overkill/hmg.qc>
+#include <common/mutators/mutator/overkill/okmachinegun.qc>
+#include <common/mutators/mutator/overkill/okshotgun.qc>
+#include <common/mutators/mutator/overkill/okvortex.qc>
#include <common/mutators/mutator/overkill/overkill.qc>
#ifdef CSQC
#include <common/mutators/mutator/overkill/cl_overkill.qc>
// generated file; do not modify
#include <common/mutators/mutator/overkill/hmg.qh>
+#include <common/mutators/mutator/overkill/okmachinegun.qh>
+#include <common/mutators/mutator/overkill/okshotgun.qh>
+#include <common/mutators/mutator/overkill/okvortex.qh>
#include <common/mutators/mutator/overkill/overkill.qh>
#ifdef CSQC
#include <common/mutators/mutator/overkill/cl_overkill.qh>
--- /dev/null
+#include "okmachinegun.qh"
+
+#ifdef SVQC
+
+spawnfunc(weapon_okmachinegun)
+{
+ if(autocvar_sv_q3acompat_machineshotgunswap)
+ if(this.classname != "droppedweapon")
+ {
+ weapon_defaultspawnfunc(this, WEP_SHOCKWAVE);
+ return;
+ }
+ weapon_defaultspawnfunc(this, WEP_OVERKILL_MACHINEGUN);
+}
+
+void W_OverkillMachineGun_MuzzleFlash_Think(entity this)
+{
+ this.frame += 2;
+ this.scale *= 0.5;
+ this.alpha -= 0.25;
+ this.nextthink = time + 0.05;
+
+ if(this.alpha <= 0)
+ {
+ setthink(this, SUB_Remove);
+ this.nextthink = time;
+ this.realowner.muzzle_flash = NULL;
+ return;
+ }
+
+}
+
+void W_OverkillMachineGun_MuzzleFlash(entity actor, .entity weaponentity)
+{
+ entity wepent = actor.(weaponentity);
+
+ if(wepent.muzzle_flash == NULL)
+ wepent.muzzle_flash = spawn();
+
+ // muzzle flash for 1st person view
+ setmodel(wepent.muzzle_flash, MDL_MACHINEGUN_MUZZLEFLASH); // precision set below
+
+ wepent.muzzle_flash.scale = 0.75;
+ setthink(wepent.muzzle_flash, W_OverkillMachineGun_MuzzleFlash_Think);
+ wepent.muzzle_flash.nextthink = time + 0.02;
+ wepent.muzzle_flash.frame = 2;
+ wepent.muzzle_flash.alpha = 0.75;
+ wepent.muzzle_flash.angles_z = random() * 180;
+ wepent.muzzle_flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
+ wepent.muzzle_flash.owner = wepent.muzzle_flash.realowner = wepent;
+}
+
+void W_OverkillMachineGun_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(okmachinegun, first_damage) : WEP_CVAR(okmachinegun, sustained_damage)));
+ if(!autocvar_g_norecoil)
+ {
+ actor.punchangle_x = random() - 0.5;
+ actor.punchangle_y = random() - 0.5;
+ }
+ int slot = weaponslot(weaponentity);
+ // this attack_finished just enforces a cooldown at the end of a burst
+ ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(okmachinegun, first_refire) * W_WeaponRateFactor(actor);
+
+ if(actor.(weaponentity).misc_bulletcounter == 1)
+ fireBullet(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(okmachinegun, first_spread), WEP_CVAR(okmachinegun, solidpenetration), WEP_CVAR(okmachinegun, first_damage), WEP_CVAR(okmachinegun, first_force), deathtype, 0);
+ else
+ fireBullet(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(okmachinegun, sustained_spread), WEP_CVAR(okmachinegun, solidpenetration), WEP_CVAR(okmachinegun, sustained_damage), WEP_CVAR(okmachinegun, sustained_force), deathtype, 0);
+
+ Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+
+ W_OverkillMachineGun_MuzzleFlash(actor, weaponentity);
+ W_AttachToShotorg(actor, weaponentity, actor.(weaponentity).muzzle_flash, '5 0 0');
+
+ // casing code
+ if(autocvar_g_casings >= 2)
+ {
+ makevectors(actor.v_angle); // for some reason, this is lost
+ SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor, weaponentity);
+ }
+
+ if(actor.(weaponentity).misc_bulletcounter == 1)
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR(okmachinegun, first_ammo), weaponentity);
+ else
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR(okmachinegun, sustained_ammo), weaponentity);
+}
+
+// weapon frames
+void W_OverkillMachineGun_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int fire)
+{
+ if(actor.(weaponentity).m_weapon != actor.(weaponentity).m_switchweapon) // abort immediately if switching
+ {
+ w_ready(thiswep, actor, weaponentity, fire);
+ return;
+ }
+ if(PHYS_INPUT_BUTTON_ATCK(actor))
+ {
+ if(!thiswep.wr_checkammo2(thiswep, actor, weaponentity))
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+ {
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
+ w_ready(thiswep, actor, weaponentity, fire);
+ return;
+ }
+ actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
+ W_OverkillMachineGun_Attack(WEP_OVERKILL_MACHINEGUN, WEP_OVERKILL_MACHINEGUN.m_id, actor, weaponentity);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(okmachinegun, sustained_refire), W_OverkillMachineGun_Attack_Frame);
+ }
+ else
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(okmachinegun, sustained_refire), w_ready);
+}
+
+void W_OverkillMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire)
+{
+ float okmachinegun_spread;
+
+ if(!(fire & 1))
+ {
+ w_ready(thiswep, actor, weaponentity, fire);
+ return;
+ }
+
+ if(!thiswep.wr_checkammo1(thiswep, actor, weaponentity))
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+ {
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
+ w_ready(thiswep, actor, weaponentity, fire);
+ return;
+ }
+
+ W_DecreaseAmmo(WEP_OVERKILL_MACHINEGUN, actor, WEP_CVAR(okmachinegun, sustained_ammo), weaponentity);
+
+ W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(okmachinegun, sustained_damage));
+ if(!autocvar_g_norecoil)
+ {
+ actor.punchangle_x = random() - 0.5;
+ actor.punchangle_y = random() - 0.5;
+ }
+
+ okmachinegun_spread = bound(WEP_CVAR(okmachinegun, spread_min), WEP_CVAR(okmachinegun, spread_min) + (WEP_CVAR(okmachinegun, spread_add) * actor.(weaponentity).misc_bulletcounter), WEP_CVAR(okmachinegun, spread_max));
+ fireBullet(actor, weaponentity, w_shotorg, w_shotdir, okmachinegun_spread, WEP_CVAR(okmachinegun, solidpenetration), WEP_CVAR(okmachinegun, sustained_damage), WEP_CVAR(okmachinegun, sustained_force), WEP_OVERKILL_MACHINEGUN.m_id, 0);
+
+ actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
+
+ Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+
+ W_OverkillMachineGun_MuzzleFlash(actor, weaponentity);
+ W_AttachToShotorg(actor, weaponentity, actor.(weaponentity).muzzle_flash, '5 0 0');
+
+ if(autocvar_g_casings >= 2) // casing code
+ {
+ makevectors(actor.v_angle); // for some reason, this is lost
+ SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor, weaponentity);
+ }
+
+ int slot = weaponslot(weaponentity);
+ ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(okmachinegun, first_refire) * W_WeaponRateFactor(actor);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(okmachinegun, sustained_refire), W_OverkillMachineGun_Attack_Auto);
+}
+
+void W_OverkillMachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentity, int fire)
+{
+ W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(okmachinegun, sustained_damage));
+ if(!autocvar_g_norecoil)
+ {
+ actor.punchangle_x = random() - 0.5;
+ actor.punchangle_y = random() - 0.5;
+ }
+
+ fireBullet(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(okmachinegun, burst_speed), WEP_CVAR(okmachinegun, solidpenetration), WEP_CVAR(okmachinegun, sustained_damage), WEP_CVAR(okmachinegun, sustained_force), WEP_OVERKILL_MACHINEGUN.m_id, 0);
+
+ Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+
+ W_OverkillMachineGun_MuzzleFlash(actor, weaponentity);
+ W_AttachToShotorg(actor, weaponentity, actor.(weaponentity).muzzle_flash, '5 0 0');
+
+ if(autocvar_g_casings >= 2) // casing code
+ {
+ makevectors(actor.v_angle); // for some reason, this is lost
+ SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor, weaponentity);
+ }
+
+ actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
+ if(actor.(weaponentity).misc_bulletcounter == 0)
+ {
+ int slot = weaponslot(weaponentity);
+ ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(okmachinegun, burst_refire2) * W_WeaponRateFactor(actor);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(okmachinegun, burst_animtime), w_ready);
+ }
+ else
+ {
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(okmachinegun, burst_refire), W_OverkillMachineGun_Attack_Burst);
+ }
+
+}
+
+METHOD(OverkillMachineGun, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
+{
+ if(vdist(actor.origin - actor.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
+ PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false);
+ else
+ PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false);
+}
+
+METHOD(OverkillMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+ if (WEP_CVAR(okmachinegun, reload_ammo) && actor.(weaponentity).clip_load < min(max(WEP_CVAR(okmachinegun, sustained_ammo), WEP_CVAR(okmachinegun, first_ammo)), WEP_CVAR(okmachinegun, burst_ammo)))
+ { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ }
+ else if (WEP_CVAR(okmachinegun, mode) == 1)
+ {
+ if(fire & 1)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
+ {
+ actor.(weaponentity).misc_bulletcounter = 0;
+ W_OverkillMachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
+ }
+
+ if (fire & 2)
+ {
+ if (WEP_CVAR_SEC(okmachinegun, type) == 1)
+ {
+ if (weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
+ {
+ if (!thiswep.wr_checkammo2(thiswep, actor, weaponentity))
+ if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+ {
+ W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
+ w_ready(thiswep, actor, weaponentity, fire);
+ return;
+ }
+
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR(okmachinegun, burst_ammo), weaponentity);
+
+ actor.(weaponentity).misc_bulletcounter = WEP_CVAR(okmachinegun, burst) * -1;
+ W_OverkillMachineGun_Attack_Burst(thiswep, actor, weaponentity, fire);
+ }
+ }
+ else
+ {
+ if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okmachinegun, refire)))
+ {
+ return;
+ }
+ // ugly instagib hack to reuse the fire mode of the laser
+ makevectors(actor.v_angle);
+ Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack
+ actor.(weaponentity).m_weapon = WEP_BLASTER;
+ W_Blaster_Attack(
+ actor,
+ weaponentity,
+ WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+ WEP_CVAR_SEC(okmachinegun, shotangle),
+ WEP_CVAR_SEC(okmachinegun, damage),
+ WEP_CVAR_SEC(okmachinegun, edgedamage),
+ WEP_CVAR_SEC(okmachinegun, radius),
+ WEP_CVAR_SEC(okmachinegun, force),
+ WEP_CVAR_SEC(okmachinegun, speed),
+ WEP_CVAR_SEC(okmachinegun, spread),
+ WEP_CVAR_SEC(okmachinegun, delay),
+ WEP_CVAR_SEC(okmachinegun, lifetime)
+ );
+ actor.(weaponentity).m_weapon = oldwep;
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okmachinegun, animtime), w_ready);
+ }
+ }
+ }
+ else
+ {
+ if(fire & 1)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
+ {
+ actor.(weaponentity).misc_bulletcounter = 1;
+ W_OverkillMachineGun_Attack(WEP_OVERKILL_MACHINEGUN, WEP_OVERKILL_MACHINEGUN.m_id, actor, weaponentity); // sets attack_finished
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(okmachinegun, sustained_refire), W_OverkillMachineGun_Attack_Frame);
+ }
+
+ if (fire & 2)
+ {
+ if (WEP_CVAR_SEC(okmachinegun, type) == 1)
+ {
+ if (WEP_CVAR(okmachinegun, first))
+ {
+ if (weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
+ {
+ actor.(weaponentity).misc_bulletcounter = 1;
+ W_OverkillMachineGun_Attack(WEP_OVERKILL_MACHINEGUN, WEP_OVERKILL_MACHINEGUN.m_id | HITTYPE_SECONDARY, actor, weaponentity); // sets attack_finished
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(okmachinegun, first_refire), w_ready);
+ }
+ }
+ }
+ else
+ {
+ if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okmachinegun, refire)))
+ {
+ return;
+ }
+ // ugly instagib hack to reuse the fire mode of the laser
+ makevectors(actor.v_angle);
+ Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack
+ actor.(weaponentity).m_weapon = WEP_BLASTER;
+ W_Blaster_Attack(
+ actor,
+ weaponentity,
+ WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+ WEP_CVAR_SEC(okmachinegun, shotangle),
+ WEP_CVAR_SEC(okmachinegun, damage),
+ WEP_CVAR_SEC(okmachinegun, edgedamage),
+ WEP_CVAR_SEC(okmachinegun, radius),
+ WEP_CVAR_SEC(okmachinegun, force),
+ WEP_CVAR_SEC(okmachinegun, speed),
+ WEP_CVAR_SEC(okmachinegun, spread),
+ WEP_CVAR_SEC(okmachinegun, delay),
+ WEP_CVAR_SEC(okmachinegun, lifetime)
+ );
+ actor.(weaponentity).m_weapon = oldwep;
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okmachinegun, animtime), w_ready);
+ }
+ }
+ }
+}
+
+METHOD(OverkillMachineGun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
+{
+ float ammo_amount;
+ if(WEP_CVAR(okmachinegun, mode) == 1)
+ ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(okmachinegun, sustained_ammo);
+ else
+ ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(okmachinegun, first_ammo);
+
+ if(WEP_CVAR(okmachinegun, reload_ammo))
+ {
+ if(WEP_CVAR(okmachinegun, mode) == 1)
+ ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_MACHINEGUN.m_id]) >= WEP_CVAR(okmachinegun, sustained_ammo);
+ else
+ ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_MACHINEGUN.m_id]) >= WEP_CVAR(okmachinegun, first_ammo);
+ }
+ return ammo_amount;
+}
+
+METHOD(OverkillMachineGun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
+{
+ float ammo_amount;
+ if(WEP_CVAR(okmachinegun, mode) == 1)
+ ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(okmachinegun, burst_ammo);
+ else
+ ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(okmachinegun, first_ammo);
+
+ if(WEP_CVAR(okmachinegun, reload_ammo))
+ {
+ if(WEP_CVAR(okmachinegun, mode) == 1)
+ ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_MACHINEGUN.m_id]) >= WEP_CVAR(okmachinegun, burst_ammo);
+ else
+ ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_MACHINEGUN.m_id]) >= WEP_CVAR(okmachinegun, first_ammo);
+ }
+ return ammo_amount;
+}
+
+METHOD(OverkillMachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+ W_Reload(actor, weaponentity, min(max(WEP_CVAR(okmachinegun, sustained_ammo), WEP_CVAR(okmachinegun, first_ammo)), WEP_CVAR(okmachinegun, burst_ammo)), SND_RELOAD);
+}
+
+METHOD(OverkillMachineGun, wr_suicidemessage, Notification(entity thiswep))
+{
+ return WEAPON_THINKING_WITH_PORTALS;
+}
+
+METHOD(OverkillMachineGun, wr_killmessage, Notification(entity thiswep))
+{
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_MACHINEGUN_MURDER_SNIPE;
+ else
+ return WEAPON_MACHINEGUN_MURDER_SPRAY;
+}
+
+#endif
+#ifdef CSQC
+
+METHOD(OverkillMachineGun, wr_impacteffect, void(entity thiswep, entity actor))
+{
+ vector org2;
+ org2 = w_org + w_backoff * 2;
+ pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
+ if(!w_issilent)
+ sound(actor, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM);
+}
+
+#endif
+
--- /dev/null
+#pragma once
+
+CLASS(OverkillMachineGun, Weapon)
+/* ammotype */ ATTRIB(OverkillMachineGun, ammo_field, .int, ammo_nails);
+/* impulse */ ATTRIB(OverkillMachineGun, impulse, int, 3);
+/* flags */ ATTRIB(OverkillMachineGun, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN);
+/* rating */ ATTRIB(OverkillMachineGun, bot_pickupbasevalue, float, 7000);
+/* color */ ATTRIB(OverkillMachineGun, wpcolor, vector, '1 1 0');
+/* modelname */ ATTRIB(OverkillMachineGun, mdl, string, "ok_mg");
+#ifdef GAMEQC
+/* model */ ATTRIB(OverkillMachineGun, m_model, Model, MDL_MACHINEGUN_ITEM);
+#endif
+/* crosshair */ ATTRIB(OverkillMachineGun, w_crosshair, string, "gfx/crosshairuzi");
+/* crosshair */ ATTRIB(OverkillMachineGun, w_crosshair_size, float, 0.6);
+/* wepimg */ ATTRIB(OverkillMachineGun, model2, string, "weaponuzi");
+/* refname */ ATTRIB(OverkillMachineGun, netname, string, "okmachinegun");
+/* wepname */ ATTRIB(OverkillMachineGun, m_name, string, _("Overkill MachineGun"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, burst, float, NONE) \
+ P(class, prefix, burst_ammo, float, NONE) \
+ P(class, prefix, burst_animtime, float, NONE) \
+ P(class, prefix, burst_refire2, float, NONE) \
+ P(class, prefix, burst_refire, float, NONE) \
+ P(class, prefix, burst_speed, float, NONE) \
+ P(class, prefix, first, float, NONE) \
+ P(class, prefix, first_ammo, float, NONE) \
+ P(class, prefix, first_damage, float, NONE) \
+ P(class, prefix, first_force, float, NONE) \
+ P(class, prefix, first_refire, float, NONE) \
+ P(class, prefix, first_spread, float, NONE) \
+ P(class, prefix, mode, float, NONE) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, solidpenetration, float, NONE) \
+ P(class, prefix, spread_add, float, NONE) \
+ P(class, prefix, spread_max, float, NONE) \
+ P(class, prefix, spread_min, float, NONE) \
+ P(class, prefix, sustained_ammo, float, NONE) \
+ P(class, prefix, sustained_damage, float, NONE) \
+ P(class, prefix, sustained_force, float, NONE) \
+ P(class, prefix, sustained_refire, float, NONE) \
+ P(class, prefix, sustained_spread, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string,NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ P(class, prefix, ammo, float, SEC) \
+ P(class, prefix, animtime, float, SEC) \
+ P(class, prefix, damage, float, SEC) \
+ P(class, prefix, delay, float, SEC) \
+ P(class, prefix, edgedamage, float, SEC) \
+ P(class, prefix, force, float, SEC) \
+ P(class, prefix, lifetime, float, SEC) \
+ P(class, prefix, radius, float, SEC) \
+ P(class, prefix, refire, float, SEC) \
+ P(class, prefix, shotangle, float, SEC) \
+ P(class, prefix, speed, float, SEC) \
+ P(class, prefix, spread, float, SEC) \
+ P(class, prefix, type, float, SEC) \
+ END()
+ W_PROPS(X, OverkillMachineGun, okmachinegun)
+#undef X
+
+ENDCLASS(OverkillMachineGun)
+REGISTER_WEAPON(OVERKILL_MACHINEGUN, okmachinegun, NEW(OverkillMachineGun));
+
--- /dev/null
+#include "okshotgun.qh"
+
+#ifdef SVQC
+spawnfunc(weapon_okshotgun) { weapon_defaultspawnfunc(this, WEP_OVERKILL_SHOTGUN); }
+
+void W_OverkillShotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, float isprimary)
+{
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(okshotgun, ammo), weaponentity);
+
+ W_SetupShot(actor, weaponentity, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(okshotgun, damage) * WEP_CVAR_PRI(okshotgun, bullets));
+ for(int sc = 0;sc < WEP_CVAR_PRI(okshotgun, bullets);sc = sc + 1)
+ fireBullet(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR_PRI(okshotgun, spread), WEP_CVAR_PRI(okshotgun, solidpenetration), WEP_CVAR_PRI(okshotgun, damage), WEP_CVAR_PRI(okshotgun, force), WEP_OVERKILL_SHOTGUN.m_id, 0);
+
+ Send_Effect(EFFECT_SHOTGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, WEP_CVAR_PRI(okshotgun, ammo));
+
+ // casing code
+ 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 = sc + 1)
+ SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1, actor, weaponentity);
+ }
+
+ // muzzle flash for 1st person view
+ entity flash = spawn();
+ setmodel(flash, MDL_SHOTGUN_MUZZLEFLASH); // precision set below
+ setthink(flash, SUB_Remove);
+ flash.nextthink = time + 0.06;
+ flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
+ W_AttachToShotorg(actor, weaponentity, flash, '5 0 0');
+}
+
+.float okshotgun_primarytime;
+
+METHOD(OverkillShotgun, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
+{
+ if (vdist(actor.origin - actor.enemy.origin, >, WEP_CVAR_PRI(okshotgun, bot_range)))
+ {
+ PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false);
+ }
+ else
+ {
+ PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false);
+ }
+}
+
+METHOD(OverkillShotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+ if (WEP_CVAR(okshotgun, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(okshotgun, ammo)) // forced reload
+ {
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ return;
+ }
+ if (fire & 1) // Primary attack
+ {
+ if (time >= actor.(weaponentity).okshotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
+ {
+ if (weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(okshotgun, animtime)))
+ {
+ W_OverkillShotgun_Attack(thiswep, actor, weaponentity, true);
+ actor.(weaponentity).okshotgun_primarytime = time + WEP_CVAR_PRI(okshotgun, refire) * W_WeaponRateFactor(actor);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okshotgun, animtime), w_ready);
+ }
+ }
+ }
+ else if (fire & 2) // Secondary attack
+ {
+ if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okshotgun, refire)))
+ {
+ return;
+ }
+ // ugly instagib hack to reuse the fire mode of the laser
+ makevectors(actor.v_angle);
+ Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack
+ actor.(weaponentity).m_weapon = WEP_BLASTER;
+ W_Blaster_Attack(
+ actor,
+ weaponentity,
+ WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+ WEP_CVAR_SEC(okshotgun, shotangle),
+ WEP_CVAR_SEC(okshotgun, damage),
+ WEP_CVAR_SEC(okshotgun, edgedamage),
+ WEP_CVAR_SEC(okshotgun, radius),
+ WEP_CVAR_SEC(okshotgun, force),
+ WEP_CVAR_SEC(okshotgun, speed),
+ WEP_CVAR_SEC(okshotgun, spread),
+ WEP_CVAR_SEC(okshotgun, delay),
+ WEP_CVAR_SEC(okshotgun, lifetime)
+ );
+ actor.(weaponentity).m_weapon = oldwep;
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okshotgun, animtime), w_ready);
+ }
+}
+
+METHOD(OverkillShotgun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
+{
+ float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(okshotgun, ammo);
+ ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_SHOTGUN.m_id]) >= WEP_CVAR_PRI(okshotgun, ammo);
+ return ammo_amount;
+}
+
+METHOD(OverkillShotgun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
+{
+ if (WEP_CVAR_SEC(okshotgun, ammo) == 0)
+ {
+ return true;
+ }
+ float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(okshotgun, ammo);
+ ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_SHOTGUN.m_id]) >= WEP_CVAR_SEC(okshotgun, ammo);
+ return ammo_amount;
+}
+
+METHOD(OverkillShotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+ W_Reload(actor, weaponentity, WEP_CVAR_PRI(okshotgun, ammo), SND_RELOAD); // WEAPONTODO
+}
+
+METHOD(OverkillShotgun, wr_suicidemessage, Notification(entity thiswep))
+{
+ return WEAPON_THINKING_WITH_PORTALS;
+}
+
+METHOD(OverkillShotgun, wr_killmessage, Notification(entity thiswep))
+{
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_BLASTER_MURDER;
+ else
+ return WEAPON_SHOTGUN_MURDER;
+}
+
+#endif
+#ifdef CSQC
+.float prevric;
+
+METHOD(OverkillShotgun, wr_impacteffect, void(entity thiswep, entity actor))
+{
+ vector org2 = w_org + w_backoff * 2;
+ pointparticles(EFFECT_SHOTGUN_IMPACT, org2, w_backoff * 1000, 1);
+ if(!w_issilent && time - actor.prevric > 0.25)
+ {
+ if(w_random < 0.05)
+ sound(actor, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+ actor.prevric = time;
+ }
+}
+
+#endif
--- /dev/null
+#pragma once
+
+CLASS(OverkillShotgun, Weapon)
+/* ammotype */ ATTRIB(OverkillShotgun, ammo_field, .int, ammo_shells);
+/* impulse */ ATTRIB(OverkillShotgun, impulse, int, 2);
+/* flags */ ATTRIB(OverkillShotgun, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN);
+/* rating */ ATTRIB(OverkillShotgun, bot_pickupbasevalue, float, 6000);
+/* color */ ATTRIB(OverkillShotgun, wpcolor, vector, '0.5 0.25 0');
+/* modelname */ ATTRIB(OverkillShotgun, mdl, string, "ok_shotgun");
+#ifdef GAMEQC
+/* model */ ATTRIB(OverkillShotgun, m_model, Model, MDL_SHOTGUN_ITEM);
+#endif
+/* crosshair */ ATTRIB(OverkillShotgun, w_crosshair, string, "gfx/crosshairshotgun");
+/* crosshair */ ATTRIB(OverkillShotgun, w_crosshair_size, float, 0.65);
+/* wepimg */ ATTRIB(OverkillShotgun, model2, string, "weaponshotgun");
+/* refname */ ATTRIB(OverkillShotgun, netname, string, "okshotgun");
+/* wepname */ ATTRIB(OverkillShotgun, m_name, string, _("Overkill Shotgun"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, PRI) \
+ P(class, prefix, animtime, float, PRI) \
+ P(class, prefix, bot_range, float, PRI) \
+ P(class, prefix, bullets, float, PRI) \
+ P(class, prefix, damage, float, PRI) \
+ P(class, prefix, force, float, PRI) \
+ P(class, prefix, refire, float, PRI) \
+ P(class, prefix, solidpenetration, float, PRI) \
+ P(class, prefix, spread, float, PRI) \
+ P(class, prefix, ammo, float, SEC) \
+ P(class, prefix, animtime, float, SEC) \
+ P(class, prefix, damage, float, SEC) \
+ P(class, prefix, delay, float, SEC) \
+ P(class, prefix, edgedamage, float, SEC) \
+ P(class, prefix, force, float, SEC) \
+ P(class, prefix, lifetime, float, SEC) \
+ P(class, prefix, radius, float, SEC) \
+ P(class, prefix, refire, float, SEC) \
+ P(class, prefix, shotangle, float, SEC) \
+ P(class, prefix, speed, float, SEC) \
+ P(class, prefix, spread, float, SEC) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string,NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, OverkillShotgun, okshotgun)
+#undef X
+
+ENDCLASS(OverkillShotgun)
+REGISTER_WEAPON(OVERKILL_SHOTGUN, okshotgun, NEW(OverkillShotgun));
--- /dev/null
+#include "okvortex.qh"
+
+#ifdef SVQC
+
+.float okvortex_lasthit;
+#endif
+
+#if defined(GAMEQC)
+
+METHOD(OverkillVortex, wr_glow, vector(OverkillVortex this, entity actor, entity wepent))
+{
+ if (!WEP_CVAR(okvortex, charge)) return '0 0 0';
+ float charge = wepent.vortex_charge;
+ float animlimit = WEP_CVAR(okvortex, charge_animlimit);
+ vector g;
+ g.x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, charge / animlimit);
+ g.y = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_half * min(1, charge / animlimit);
+ g.z = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_half * min(1, charge / animlimit);
+ if (charge > animlimit)
+ {
+ g.x += autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (charge - animlimit) / (1 - animlimit);
+ g.y += autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (charge - animlimit) / (1 - animlimit);
+ g.z += autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (charge - animlimit) / (1 - animlimit);
+ }
+ return g;
+}
+#endif
+
+#ifdef SVQC
+spawnfunc(weapon_okvortex) { weapon_defaultspawnfunc(this, WEP_OVERKILL_VORTEX); }
+
+REGISTER_MUTATOR(okvortex_charge, true);
+
+MUTATOR_HOOKFUNCTION(okvortex_charge, GetPressedKeys)
+{
+ entity player = M_ARGV(0, entity);
+
+ // WEAPONTODO
+ if(!WEP_CVAR(okvortex, charge) || !WEP_CVAR(okvortex, charge_velocity_rate))
+ return;
+
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ .entity weaponentity = weaponentities[slot];
+
+ if (player.(weaponentity).m_weapon == WEP_OVERKILL_VORTEX && WEP_CVAR(okvortex, charge) && WEP_CVAR(okvortex, charge_velocity_rate) && vdist(vec2(player.velocity), >, WEP_CVAR(okvortex, 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(okvortex, charge_maxspeed));
+ float f = (xyspeed - WEP_CVAR(okvortex, charge_minspeed)) / (WEP_CVAR(okvortex, charge_maxspeed) - WEP_CVAR(okvortex, charge_minspeed));
+ // add the extra charge
+ player.(weaponentity).vortex_charge = min(1, player.(weaponentity).vortex_charge + WEP_CVAR(okvortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
+ }
+ }
+}
+
+void W_OverkillVortex_Attack(Weapon thiswep, entity actor, .entity weaponentity, float issecondary)
+{
+ float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge;
+
+ mydmg = WEP_CVAR_BOTH(okvortex, !issecondary, damage);
+ myforce = WEP_CVAR_BOTH(okvortex, !issecondary, force);
+ mymindist = WEP_CVAR_BOTH(okvortex, !issecondary, damagefalloff_mindist);
+ mymaxdist = WEP_CVAR_BOTH(okvortex, !issecondary, damagefalloff_maxdist);
+ myhalflife = WEP_CVAR_BOTH(okvortex, !issecondary, damagefalloff_halflife);
+ myforcehalflife = WEP_CVAR_BOTH(okvortex, !issecondary, damagefalloff_forcehalflife);
+ myammo = WEP_CVAR_BOTH(okvortex, !issecondary, ammo);
+
+ float flying;
+ flying = IsFlying(actor); // do this BEFORE to make the trace values from FireRailgunBullet last
+
+ if(WEP_CVAR(okvortex, charge))
+ {
+ charge = WEP_CVAR(okvortex, charge_mindmg) / mydmg + (1 - WEP_CVAR(okvortex, charge_mindmg) / mydmg) * actor.(weaponentity).vortex_charge;
+ actor.(weaponentity).vortex_charge *= WEP_CVAR(okvortex, charge_shot_multiplier); // do this AFTER setting mydmg/myforce
+ // O RLY? -- divVerent
+ // YA RLY -- FruitieX
+ }
+ else
+ charge = 1;
+ mydmg *= charge;
+ myforce *= charge;
+
+ W_SetupShot(actor, weaponentity, true, 5, SND_NEXFIRE, CH_WEAPON_A, mydmg);
+ if(charge > WEP_CVAR(okvortex, charge_animlimit) && WEP_CVAR(okvortex, charge_animlimit)) // if the OverkillVortex is overcharged, we play an extra sound
+ {
+ sound(actor, CH_WEAPON_B, SND_NEXCHARGE, VOL_BASE * (charge - 0.5 * WEP_CVAR(okvortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(okvortex, charge_animlimit)), ATTN_NORM);
+ }
+
+ yoda = 0;
+ damage_goodhits = 0;
+ FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_OVERKILL_VORTEX.m_id);
+
+ if(yoda && flying)
+ Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
+ if(damage_goodhits && actor.okvortex_lasthit)
+ {
+ Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
+ damage_goodhits = 0; // only every second time
+ }
+
+ actor.okvortex_lasthit = damage_goodhits;
+
+ //beam and muzzle flash done on client
+ SendCSQCVortexBeamParticle(charge);
+
+ W_DecreaseAmmo(thiswep, actor, myammo, weaponentity);
+}
+
+.float okvortex_chargepool_pauseregen_finished;
+
+METHOD(OverkillVortex, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
+{
+ if(bot_aim(actor, weaponentity, 1000000, 0, 1, false))
+ PHYS_INPUT_BUTTON_ATCK(actor) = true;
+ else
+ {
+ if(WEP_CVAR(okvortex, charge))
+ PHYS_INPUT_BUTTON_ATCK2(actor) = true;
+ }
+}
+
+METHOD(OverkillVortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+ if(WEP_CVAR(okvortex, charge) && actor.(weaponentity).vortex_charge < WEP_CVAR(okvortex, charge_limit))
+ actor.(weaponentity).vortex_charge = min(1, actor.(weaponentity).vortex_charge + WEP_CVAR(okvortex, charge_rate) * frametime / W_TICSPERFRAME);
+
+ if(weaponslot(weaponentity) == 0)
+ actor.vortex_charge = actor.(weaponentity).vortex_charge;
+
+ if(WEP_CVAR_SEC(okvortex, chargepool))
+ if(actor.(weaponentity).vortex_chargepool_ammo < 1)
+ {
+ if(actor.okvortex_chargepool_pauseregen_finished < time)
+ actor.(weaponentity).vortex_chargepool_ammo = min(1, actor.(weaponentity).vortex_chargepool_ammo + WEP_CVAR_SEC(okvortex, chargepool_regen) * frametime / W_TICSPERFRAME);
+ actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(okvortex, chargepool_pause_regen));
+ }
+
+ if(weaponslot(weaponentity) == 0)
+ actor.vortex_chargepool_ammo = actor.(weaponentity).vortex_chargepool_ammo;
+
+ if(autocvar_g_balance_vortex_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(okvortex, ammo), WEP_CVAR_SEC(okvortex, ammo))) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else
+ {
+ if (fire & 1)
+ {
+ if (weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(okvortex, refire)))
+ {
+ W_OverkillVortex_Attack(thiswep, actor, weaponentity, 0);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okvortex, animtime), w_ready);
+ }
+ }
+ else if ((fire & 2) && (WEP_CVAR(okvortex, secondary) == 2))
+ {
+ if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okshotgun, refire)))
+ {
+ return;
+ }
+ // ugly instagib hack to reuse the fire mode of the laser
+ makevectors(actor.v_angle);
+ Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack
+ actor.(weaponentity).m_weapon = WEP_BLASTER;
+ W_Blaster_Attack(
+ actor,
+ weaponentity,
+ WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+ WEP_CVAR_SEC(okshotgun, shotangle),
+ WEP_CVAR_SEC(okshotgun, damage),
+ WEP_CVAR_SEC(okshotgun, edgedamage),
+ WEP_CVAR_SEC(okshotgun, radius),
+ WEP_CVAR_SEC(okshotgun, force),
+ WEP_CVAR_SEC(okshotgun, speed),
+ WEP_CVAR_SEC(okshotgun, spread),
+ WEP_CVAR_SEC(okshotgun, delay),
+ WEP_CVAR_SEC(okshotgun, lifetime)
+ );
+ actor.(weaponentity).m_weapon = oldwep;
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okshotgun, animtime), w_ready);
+ return;
+ }
+ if((WEP_CVAR(okvortex, charge) && !WEP_CVAR(okvortex, secondary)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2))
+ {
+ if(WEP_CVAR(okvortex, charge))
+ {
+ actor.(weaponentity).vortex_charge_rottime = time + WEP_CVAR(okvortex, charge_rot_pause);
+ float dt = frametime / W_TICSPERFRAME;
+
+ if(actor.(weaponentity).vortex_charge < 1)
+ {
+ if(WEP_CVAR_SEC(okvortex, chargepool))
+ {
+ if(WEP_CVAR_SEC(okvortex, ammo))
+ {
+ // always deplete if secondary is held
+ actor.vortex_chargepool_ammo = max(0, actor.vortex_chargepool_ammo - WEP_CVAR_SEC(okvortex, ammo) * dt);
+
+ dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(okvortex, charge_rate));
+ actor.okvortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(okvortex, chargepool_pause_regen);
+ dt = min(dt, actor.vortex_chargepool_ammo);
+ dt = max(0, dt);
+
+ actor.(weaponentity).vortex_charge += dt * WEP_CVAR(okvortex, charge_rate);
+ }
+ }
+
+ else if(WEP_CVAR_SEC(okvortex, ammo))
+ {
+ if(fire & 2) // only eat ammo when the button is pressed
+ {
+ dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(okvortex, charge_rate));
+ if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+ {
+ // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
+ if(autocvar_g_balance_vortex_reload_ammo)
+ {
+ dt = min(dt, (actor.(weaponentity).clip_load - WEP_CVAR_PRI(okvortex, ammo)) / WEP_CVAR_SEC(okvortex, ammo));
+ dt = max(0, dt);
+ if(dt > 0)
+ {
+ actor.(weaponentity).clip_load = max(WEP_CVAR_SEC(okvortex, ammo), actor.(weaponentity).clip_load - WEP_CVAR_SEC(okvortex, ammo) * dt);
+ }
+ actor.(weaponentity).(weapon_load[WEP_OVERKILL_VORTEX.m_id]) = actor.(weaponentity).clip_load;
+ }
+ else
+ {
+ dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(okvortex, ammo)) / WEP_CVAR_SEC(okvortex, ammo));
+ dt = max(0, dt);
+ if(dt > 0)
+ {
+ actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(okvortex, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(okvortex, ammo) * dt);
+ }
+ }
+ }
+ actor.(weaponentity).vortex_charge += dt * WEP_CVAR(okvortex, charge_rate);
+ }
+ }
+
+ else
+ {
+ dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(okvortex, charge_rate));
+ actor.(weaponentity).vortex_charge += dt * WEP_CVAR(okvortex, charge_rate);
+ }
+ }
+ }
+ else if(WEP_CVAR(okvortex, secondary))
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okvortex, refire)))
+ {
+ W_OverkillVortex_Attack(thiswep, actor, weaponentity, 1);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(okvortex, animtime), w_ready);
+ }
+ }
+ }
+ }
+}
+METHOD(OverkillVortex, wr_setup, void(entity thiswep, entity actor, .entity weaponentity))
+{
+ actor.okvortex_lasthit = 0;
+}
+METHOD(OverkillVortex, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
+{
+ float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(okvortex, ammo);
+ ammo_amount += (autocvar_g_balance_okvortex_reload_ammo && actor.(weaponentity).(weapon_load[WEP_OVERKILL_VORTEX.m_id]) >= WEP_CVAR_PRI(okvortex, ammo));
+ return ammo_amount;
+}
+METHOD(OverkillVortex, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
+{
+ if(WEP_CVAR(okvortex, secondary))
+ {
+ // don't allow charging if we don't have enough ammo
+ float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(okvortex, ammo);
+ ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_VORTEX.m_id]) >= WEP_CVAR_SEC(okvortex, ammo);
+ return ammo_amount;
+ }
+ else
+ {
+ return false; // zoom is not a fire mode
+ }
+}
+METHOD(OverkillVortex, wr_resetplayer, void(entity thiswep, entity actor))
+{
+ if (WEP_CVAR(okvortex, charge)) {
+ if (WEP_CVAR_SEC(okvortex, chargepool)) {
+ actor.vortex_chargepool_ammo = 1;
+ }
+ actor.vortex_charge = WEP_CVAR(okvortex, charge_start);
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ .entity weaponentity = weaponentities[slot];
+ actor.(weaponentity).vortex_charge = WEP_CVAR(okvortex, charge_start);
+
+ if (WEP_CVAR_SEC(okvortex, chargepool))
+ actor.(weaponentity).vortex_chargepool_ammo = 1;
+ }
+ }
+ actor.okvortex_lasthit = 0;
+}
+METHOD(OverkillVortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+ W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(okvortex, ammo), WEP_CVAR_SEC(okvortex, ammo)), SND_RELOAD);
+}
+METHOD(OverkillVortex, wr_suicidemessage, Notification(entity thiswep))
+{
+ return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(OverkillVortex, wr_killmessage, Notification(entity thiswep))
+{
+ return WEAPON_VORTEX_MURDER;
+}
+METHOD(OverkillVortex, wr_zoom, bool(entity thiswep, entity actor))
+{
+ return PHYS_INPUT_BUTTON_ATCK2(actor) && !WEP_CVAR(okvortex, secondary);
+}
+
+#endif
+#ifdef CSQC
+
+METHOD(OverkillVortex, wr_impacteffect, void(entity thiswep, entity actor))
+{
+ entity this = actor;
+ vector org2 = w_org + w_backoff * 6;
+ pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(this, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
+}
+METHOD(OverkillVortex, wr_init, void(entity thiswep))
+{
+ if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
+ {
+ precache_pic("gfx/reticle_nex");
+ }
+}
+METHOD(OverkillVortex, wr_zoom, bool(entity thiswep, entity actor))
+{
+ if(button_zoom || zoomscript_caught || (!WEP_CVAR(okvortex, secondary) && button_attack2))
+ {
+ return true;
+ }
+ else
+ {
+ // no weapon specific image for this weapon
+ return false;
+ }
+}
+
+#endif
--- /dev/null
+#pragma once
+
+CLASS(OverkillVortex, Weapon)
+/* ammotype */ ATTRIB(OverkillVortex, ammo_field, .int, ammo_cells);
+/* impulse */ ATTRIB(OverkillVortex, impulse, int, 7);
+/* flags */ ATTRIB(OverkillVortex, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN);
+/* rating */ ATTRIB(OverkillVortex, bot_pickupbasevalue, float, 8000);
+/* color */ ATTRIB(OverkillVortex, wpcolor, vector, '0.5 1 1');
+/* modelname */ ATTRIB(OverkillVortex, mdl, string, "ok_sniper");
+#ifdef GAMEQC
+/* model */ ATTRIB(OverkillVortex, m_model, Model, MDL_VORTEX_ITEM);
+#endif
+/* crosshair */ ATTRIB(OverkillVortex, w_crosshair, string, "gfx/crosshairnex");
+/* crosshair */ ATTRIB(OverkillVortex, w_crosshair_size, float, 0.65);
+/* reticle */ ATTRIB(OverkillVortex, w_reticle, string, "gfx/reticle_nex");
+/* wepimg */ ATTRIB(OverkillVortex, model2, string, "weaponnex");
+/* refname */ ATTRIB(OverkillVortex, netname, string, "okvortex");
+/* wepname */ ATTRIB(OverkillVortex, m_name, string, _("Overkill Vortex"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, PRI) \
+ P(class, prefix, animtime, float, PRI) \
+ P(class, prefix, chargepool, float, SEC) \
+ P(class, prefix, chargepool_pause_regen, float, SEC) \
+ P(class, prefix, chargepool_regen, float, SEC) \
+ P(class, prefix, charge, float, NONE) \
+ P(class, prefix, charge_animlimit, float, NONE) \
+ P(class, prefix, charge_limit, float, NONE) \
+ P(class, prefix, charge_maxspeed, float, NONE) \
+ P(class, prefix, charge_mindmg, float, NONE) \
+ P(class, prefix, charge_minspeed, float, NONE) \
+ P(class, prefix, charge_rate, float, NONE) \
+ P(class, prefix, charge_rot_pause, float, NONE) \
+ P(class, prefix, charge_rot_rate, float, NONE) \
+ P(class, prefix, charge_shot_multiplier, float, NONE) \
+ P(class, prefix, charge_start, float, NONE) \
+ P(class, prefix, charge_velocity_rate, float, NONE) \
+ P(class, prefix, damagefalloff_forcehalflife, float, BOTH) \
+ P(class, prefix, damagefalloff_halflife, float, BOTH) \
+ P(class, prefix, damagefalloff_maxdist, float, BOTH) \
+ P(class, prefix, damagefalloff_mindist, float, BOTH) \
+ P(class, prefix, damage, float, PRI) \
+ P(class, prefix, force, float, PRI) \
+ P(class, prefix, refire, float, PRI) \
+ P(class, prefix, secondary, float, NONE) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ P(class, prefix, ammo, float, SEC) \
+ P(class, prefix, animtime, float, SEC) \
+ P(class, prefix, damage, float, SEC) \
+ P(class, prefix, delay, float, SEC) \
+ P(class, prefix, edgedamage, float, SEC) \
+ P(class, prefix, force, float, SEC) \
+ P(class, prefix, lifetime, float, SEC) \
+ P(class, prefix, radius, float, SEC) \
+ P(class, prefix, refire, float, SEC) \
+ P(class, prefix, shotangle, float, SEC) \
+ P(class, prefix, speed, float, SEC) \
+ P(class, prefix, spread, float, SEC) \
+ END()
+ W_PROPS(X, OverkillVortex, okvortex)
+#undef X
+
+ENDCLASS(OverkillVortex)
+REGISTER_WEAPON(OVERKILL_VORTEX, okvortex, NEW(OverkillVortex));
+