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 charge = wepent.okvortex_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);
#endif
#ifdef SVQC
-spawnfunc(weapon_okvortex) { weapon_defaultspawnfunc(this, WEP_OVERKILL_VORTEX); }
-
REGISTER_MUTATOR(okvortex_charge, true);
MUTATOR_HOOKFUNCTION(okvortex_charge, GetPressedKeys)
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);
+ player.(weaponentity).okvortex_charge = min(1, player.(weaponentity).okvortex_charge + WEP_CVAR(okvortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
}
}
}
float flying;
flying = IsFlying(actor); // do this BEFORE to make the trace values from FireRailgunBullet last
- if(WEP_CVAR(okvortex, charge))
+ 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
+ charge = WEP_CVAR(okvortex, charge_mindmg) / mydmg + (1 - WEP_CVAR(okvortex, charge_mindmg) / mydmg) * actor.(weaponentity).okvortex_charge;
+ actor.(weaponentity).okvortex_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;
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 (WEP_CVAR(okvortex, charge) && actor.(weaponentity).okvortex_charge < WEP_CVAR(okvortex, charge_limit))
+ {
+ actor.(weaponentity).okvortex_charge = min(1, actor.(weaponentity).okvortex_charge + WEP_CVAR(okvortex, charge_rate) * frametime / W_TICSPERFRAME);
+ }
- if(weaponslot(weaponentity) == 0)
- actor.vortex_charge = actor.(weaponentity).vortex_charge;
+ if (weaponslot(weaponentity) == 0)
+ {
+ actor.okvortex_charge = actor.(weaponentity).okvortex_charge;
+ }
- if(WEP_CVAR_SEC(okvortex, chargepool))
- if(actor.(weaponentity).vortex_chargepool_ammo < 1)
+ if (WEP_CVAR_SEC(okvortex, chargepool))
+ if (actor.(weaponentity).okvortex_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);
+ if (actor.okvortex_chargepool_pauseregen_finished < time)
+ actor.(weaponentity).okvortex_chargepool_ammo = min(1, actor.(weaponentity).okvortex_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;
+ actor.okvortex_chargepool_ammo = actor.(weaponentity).okvortex_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 ((WEP_CVAR_SEC(okvortex, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval))
{
- if (fire & 1)
+ // Secondary uses it's own refire timer if refire_type is 1.
+ actor.jump_interval = time + WEP_CVAR_SEC(okvortex, refire) * W_WeaponRateFactor(actor);
+ // Ugly hack to reuse the fire mode of the blaster.
+ makevectors(actor.v_angle);
+ Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack
+ actor.(weaponentity).m_weapon = WEP_BLASTER;
+ W_Blaster_Attack(
+ actor,
+ weaponentity,
+ WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+ WEP_CVAR_SEC(okvortex, shotangle),
+ WEP_CVAR_SEC(okvortex, damage),
+ WEP_CVAR_SEC(okvortex, edgedamage),
+ WEP_CVAR_SEC(okvortex, radius),
+ WEP_CVAR_SEC(okvortex, force),
+ WEP_CVAR_SEC(okvortex, speed),
+ WEP_CVAR_SEC(okvortex, spread),
+ WEP_CVAR_SEC(okvortex, delay),
+ WEP_CVAR_SEC(okvortex, lifetime)
+ );
+ actor.(weaponentity).m_weapon = oldwep;
+ if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
+ (actor.(weaponentity).wframe == WFRAME_FIRE2))
{
- 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);
- }
+ // Set secondary fire animation.
+ vector a = '0 0 0';
+ actor.(weaponentity).wframe = WFRAME_FIRE2;
+ a = actor.(weaponentity).anim_fire2;
+ a.z *= g_weaponratefactor;
+ FOREACH_CLIENT(true, LAMBDA(
+ if (it == actor || (IS_SPEC(it) && it.enemy == actor))
+ {
+ wframe_send(it, actor.(weaponentity), a, true);
+ }
+ ));
+ animdecide_setaction(actor, ANIMACTION_SHOOT, true);
}
- else if ((fire & 2) && (WEP_CVAR(okvortex, secondary) == 2))
+ }
+
+ if (autocvar_g_balance_okvortex_reload_ammo && actor.(weaponentity).clip_load < WEP_CVAR_PRI(okvortex, ammo))
+ {
+ // Rorced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ return;
+ }
+ if (fire & 1) // Primary attack
+ {
+ if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(okvortex, refire)))
{
- if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okshotgun, refire)))
- {
- return;
- }
- // ugly instagib hack to reuse the fire mode of the laser
- makevectors(actor.v_angle);
- Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack
- actor.(weaponentity).m_weapon = WEP_BLASTER;
- W_Blaster_Attack(
- actor,
- weaponentity,
- WEP_BLASTER.m_id | HITTYPE_SECONDARY,
- WEP_CVAR_SEC(okshotgun, shotangle),
- WEP_CVAR_SEC(okshotgun, damage),
- WEP_CVAR_SEC(okshotgun, edgedamage),
- WEP_CVAR_SEC(okshotgun, radius),
- WEP_CVAR_SEC(okshotgun, force),
- WEP_CVAR_SEC(okshotgun, speed),
- WEP_CVAR_SEC(okshotgun, spread),
- WEP_CVAR_SEC(okshotgun, delay),
- WEP_CVAR_SEC(okshotgun, lifetime)
- );
- actor.(weaponentity).m_weapon = oldwep;
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okshotgun, animtime), w_ready);
return;
}
- if((WEP_CVAR(okvortex, charge) && !WEP_CVAR(okvortex, secondary)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2))
+ W_OverkillVortex_Attack(thiswep, actor, weaponentity, 0);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okvortex, animtime), w_ready);
+ return;
+ }
+ if ((fire & 2) && (WEP_CVAR(okvortex, secondary) == 2) && (WEP_CVAR_SEC(okvortex, refire_type) == 0))
+ {
+ // Secondary attack
+ if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(okshotgun, refire)))
{
- if(WEP_CVAR(okvortex, charge))
- {
- actor.(weaponentity).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);
- }
- }
+ return;
}
+ // ugly instagib hack to reuse the fire mode of the laser
+ makevectors(actor.v_angle);
+ Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack
+ actor.(weaponentity).m_weapon = WEP_BLASTER;
+ W_Blaster_Attack(
+ actor,
+ weaponentity,
+ WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+ WEP_CVAR_SEC(okvortex, shotangle),
+ WEP_CVAR_SEC(okvortex, damage),
+ WEP_CVAR_SEC(okvortex, edgedamage),
+ WEP_CVAR_SEC(okvortex, radius),
+ WEP_CVAR_SEC(okvortex, force),
+ WEP_CVAR_SEC(okvortex, speed),
+ WEP_CVAR_SEC(okvortex, spread),
+ WEP_CVAR_SEC(okvortex, delay),
+ WEP_CVAR_SEC(okvortex, lifetime)
+ );
+ actor.(weaponentity).m_weapon = oldwep;
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okvortex, animtime), w_ready);
+ return;
}
+ //if ((WEP_CVAR(okvortex, charge) && (WEP_CVAR(okvortex, secondary) == 1)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2))
+ //{
+ // if(WEP_CVAR(okvortex, charge))
+ // {
+ // actor.(weaponentity).okvortex_charge_rottime = time + WEP_CVAR(okvortex, charge_rot_pause);
+ // float dt = frametime / W_TICSPERFRAME;
+ //
+ // if(actor.(weaponentity).okvortex_charge < 1)
+ // {
+ // if(WEP_CVAR_SEC(okvortex, chargepool))
+ // {
+ // if(WEP_CVAR_SEC(okvortex, ammo))
+ // {
+ // // always deplete if secondary is held
+ // actor.okvortex_chargepool_ammo = max(0, actor.okvortex_chargepool_ammo - WEP_CVAR_SEC(okvortex, ammo) * dt);
+
+ // dt = min(dt, (1 - actor.(weaponentity).okvortex_charge) / WEP_CVAR(okvortex, charge_rate));
+ // actor.okvortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(okvortex, chargepool_pause_regen);
+ // dt = min(dt, actor.okvortex_chargepool_ammo);
+ // dt = max(0, dt);
+
+ // actor.(weaponentity).okvortex_charge += dt * WEP_CVAR(okvortex, charge_rate);
+ // }
+ // }
+
+ // else if(WEP_CVAR_SEC(okvortex, ammo))
+ // {
+ // if(fire & 2) // only eat ammo when the button is pressed
+ // {
+ // dt = min(dt, (1 - actor.(weaponentity).okvortex_charge) / WEP_CVAR(okvortex, charge_rate));
+ // if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+ // {
+ // // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
+ // if(autocvar_g_balance_vortex_reload_ammo)
+ // {
+ // dt = min(dt, (actor.(weaponentity).clip_load - WEP_CVAR_PRI(okvortex, ammo)) / WEP_CVAR_SEC(okvortex, ammo));
+ // dt = max(0, dt);
+ // if(dt > 0)
+ // {
+ // actor.(weaponentity).clip_load = max(WEP_CVAR_SEC(okvortex, ammo), actor.(weaponentity).clip_load - WEP_CVAR_SEC(okvortex, ammo) * dt);
+ // }
+ // actor.(weaponentity).(weapon_load[WEP_OVERKILL_VORTEX.m_id]) = actor.(weaponentity).clip_load;
+ // }
+ // else
+ // {
+ // dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(okvortex, ammo)) / WEP_CVAR_SEC(okvortex, ammo));
+ // dt = max(0, dt);
+ // if(dt > 0)
+ // {
+ // actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(okvortex, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(okvortex, ammo) * dt);
+ // }
+ // }
+ // }
+ // actor.(weaponentity).okvortex_charge += dt * WEP_CVAR(okvortex, charge_rate);
+ // }
+ // }
+
+ // else
+ // {
+ // dt = min(dt, (1 - actor.(weaponentity).okvortex_charge) / WEP_CVAR(okvortex, charge_rate));
+ // actor.(weaponentity).okvortex_charge += dt * WEP_CVAR(okvortex, charge_rate);
+ // }
+ // }
+ // }
+ // else if(WEP_CVAR(okvortex, secondary))
+ // {
+ // if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okvortex, refire)))
+ // {
+ // W_OverkillVortex_Attack(thiswep, actor, weaponentity, 1);
+ // weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(okvortex, animtime), w_ready);
+ // }
+ // }
+ //}
}
+
METHOD(OverkillVortex, wr_setup, void(entity thiswep, entity actor, .entity weaponentity))
{
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);
+ float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= 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))
+ 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);
+ float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(okvortex, ammo);
ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_VORTEX.m_id]) >= WEP_CVAR_SEC(okvortex, ammo);
return ammo_amount;
}
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.okvortex_chargepool_ammo = 1;
}
- actor.vortex_charge = WEP_CVAR(okvortex, charge_start);
+ actor.okvortex_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);
+ actor.(weaponentity).okvortex_charge = WEP_CVAR(okvortex, charge_start);
if (WEP_CVAR_SEC(okvortex, chargepool))
- actor.(weaponentity).vortex_chargepool_ammo = 1;
+ actor.(weaponentity).okvortex_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);
+ W_Reload(actor, weaponentity, WEP_CVAR_PRI(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);
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))