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";
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:
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';
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:
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)
{
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;
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))
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) ||
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);
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))
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;
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))
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) ||
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);
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;
}
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))
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);
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);
}
}
}
{
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
}
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;
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) ||
}
}
- 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);
}
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);
}
}
}
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
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;
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))
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
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;
}
METHOD(OverkillNex, wr_zoomdir, bool(entity thiswep))
{
- return button_attack2 && !WEP_CVAR(oknex, secondary);
+ return button_attack2 && !WEP_CVAR(WEP_OVERKILL_NEX, secondary);
}
#endif
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);
{
// 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;
{
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);
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);
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) ||
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);
}
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))
#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);
}
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) ||
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);
}
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;
}
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))
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);
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);
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);
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);
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)
{
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);
{
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);
{
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);
{
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);
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);
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;
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;
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);
// 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)
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));
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;
}
{
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);
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++;
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);
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);
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;
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;
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);
}
}
}
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;
|| !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);
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;
}
{
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)
{
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);
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
);
// 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
// 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;
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
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,
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)
);
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))
{
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;
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);
// 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)
{
}
}
}
- 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 );
}
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
);
}
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)
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
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;
}
}
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.
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;
}
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))
{
(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
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);
}
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);
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);
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);
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
{
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;
{
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);
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);
{
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
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)
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)
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;
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);
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);
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)
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;
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);
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);
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);
}
}
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;
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))
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))
{
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
.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;
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
);
{
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)
);
}
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
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
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;
{
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);
// 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;
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
// 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);
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);
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);
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",
}
// 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;
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;
}
}
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;
}
#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
}
}
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))
{
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")
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)
// 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;
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
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
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
}
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
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)
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)
// 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;
}
// 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;
{
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,
2,
SND_ELECTRO_FIRE,
CH_WEAPON_A,
- WEP_CVAR_PRI(electro, damage),
+ WEP_CVAR_PRI(WEP_ELECTRO, damage),
thiswep.m_id
);
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;
// 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');
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;
}
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!
{
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);
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
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,
2,
SND_ELECTRO_FIRE2,
CH_WEAPON_A,
- WEP_CVAR_SEC(electro, damage),
+ WEP_CVAR_SEC(WEP_ELECTRO, damage),
thiswep.m_id | HITTYPE_SECONDARY
);
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;
//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
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);
{
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);
}
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;
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)
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))
{
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
);
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))
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);
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;
}
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');
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)
// 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)
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;
}
{
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;
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;
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);
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;
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;
}
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;
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);
}
}
}
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);
}
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);
}
&& (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.
{
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);
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;
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;
{
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);
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;
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;
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;
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);
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;
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;
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;
}
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;
{
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
// 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);
}
}
}
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
{
}
// 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);
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
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);
}
}
}
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))
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))
{
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);
}
{
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)
{
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);
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);
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);
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);
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))
{
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);
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;
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';
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;
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))
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 )
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));
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))
{
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)
{
}
// 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);
}
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
}
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);
}
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;
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);
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);
}
}
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))
}
float ammo_available;
- if (WEP_CVAR(machinegun, reload_ammo) > 0)
+ if (WEP_CVAR(WEP_MACHINEGUN, reload_ammo) > 0)
{
ammo_available = actor.(weaponentity).clip_load;
}
// 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.
{
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;
}
{
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))
{
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;
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;
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);
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))
// 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.
}
}
// 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))
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;
}
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);
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);
{
// 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;
{
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);
}
}
// 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;
}
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))
{
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);
}
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);
}
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);
// 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);
// 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);
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);
{
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);
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);
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;
}
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;
}
/*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",
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))
{
.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)
{
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;
{
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
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);
}
}
}
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);
}
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);
}
}
}
}
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))
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))
{
}
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
}
METHOD(Rifle, wr_zoomdir, bool(entity thiswep))
{
- return button_attack2 && !WEP_CVAR(rifle, secondary);
+ return button_attack2 && !WEP_CVAR(WEP_RIFLE, secondary);
}
#endif
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);
}
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)
{
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))
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);
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
{
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));
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.
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);
{
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);
}
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)
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!
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;
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);
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;
.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)
{
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;
//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;
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);
}
}
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;
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');
//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
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);
}
}
}
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))
{
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;
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,
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(
(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
#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
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
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(
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));
}
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);
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
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
);
{
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
// 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
)
);
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
(
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)
}
// 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(
);
#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
// 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
)
);
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
//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); }
}
// 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)
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
);
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); }
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); }
{
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);
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);
}
}
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;
// 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));
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); }
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
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
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)
{
}
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);
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)
{
{
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;
}
}
}
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...
}
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
}
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))
{
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);
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)
{
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)
{
{
// 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;
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)
{
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
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);
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)
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))
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
}
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))
}
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;
#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);
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);
}
}
}
{
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
}
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;
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))
}
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);
}
}
}
}
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
}
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;
}
}
}
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))
{
}
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
}
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;
}
}
METHOD(Vortex, wr_zoomdir, bool(entity thiswep))
{
- return button_attack2 && !WEP_CVAR(vortex, secondary);
+ return button_attack2 && !WEP_CVAR(WEP_VORTEX, secondary);
}
#endif
// 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)
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;
}
}
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);
}
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);
#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
}
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
{