Weapons using blaster as secondary attack now load settings from blaster primary
set g_balance_blaster_primary_shotangle 0
set g_balance_blaster_primary_speed 6000
set g_balance_blaster_primary_spread 0
-set g_balance_blaster_secondary 0
-set g_balance_blaster_secondary_animtime 0.2
-set g_balance_blaster_secondary_damage 25
-set g_balance_blaster_secondary_delay 0
-set g_balance_blaster_secondary_edgedamage 12.5
-set g_balance_blaster_secondary_force 360
-set g_balance_blaster_secondary_force_zscale 1
-set g_balance_blaster_secondary_lifetime 5
-set g_balance_blaster_secondary_radius 70
-set g_balance_blaster_secondary_refire 0.7
-set g_balance_blaster_secondary_shotangle 0
-set g_balance_blaster_secondary_speed 6000
-set g_balance_blaster_secondary_spread 0
set g_balance_blaster_switchdelay_drop 0.2
set g_balance_blaster_switchdelay_raise 0.2
set g_balance_blaster_weaponreplace ""
set g_balance_blaster_primary_shotangle 0
set g_balance_blaster_primary_speed 9000
set g_balance_blaster_primary_spread 0
-set g_balance_blaster_secondary 0
-set g_balance_blaster_secondary_animtime 0.3
-set g_balance_blaster_secondary_damage 35
-set g_balance_blaster_secondary_delay 0
-set g_balance_blaster_secondary_edgedamage 10
-set g_balance_blaster_secondary_force 400
-set g_balance_blaster_secondary_force_zscale 1
-set g_balance_blaster_secondary_lifetime 30
-set g_balance_blaster_secondary_radius 70
-set g_balance_blaster_secondary_refire 0.7
-set g_balance_blaster_secondary_shotangle 0
-set g_balance_blaster_secondary_speed 9000
-set g_balance_blaster_secondary_spread 0
set g_balance_blaster_switchdelay_drop 0.15
set g_balance_blaster_switchdelay_raise 0.15
set g_balance_blaster_weaponreplace ""
set g_balance_blaster_primary_shotangle 0
set g_balance_blaster_primary_speed 6000
set g_balance_blaster_primary_spread 0
-set g_balance_blaster_secondary 0
-set g_balance_blaster_secondary_animtime 0.2
-set g_balance_blaster_secondary_damage 25
-set g_balance_blaster_secondary_delay 0
-set g_balance_blaster_secondary_edgedamage 12.5
-set g_balance_blaster_secondary_force 300
-set g_balance_blaster_secondary_force_zscale 1
-set g_balance_blaster_secondary_lifetime 5
-set g_balance_blaster_secondary_radius 70
-set g_balance_blaster_secondary_refire 0.7
-set g_balance_blaster_secondary_shotangle 0
-set g_balance_blaster_secondary_speed 6000
-set g_balance_blaster_secondary_spread 0
set g_balance_blaster_switchdelay_drop 0.15
set g_balance_blaster_switchdelay_raise 0.15
set g_balance_blaster_weaponreplace ""
set g_balance_blaster_primary_shotangle 0
set g_balance_blaster_primary_speed 6000
set g_balance_blaster_primary_spread 0
-set g_balance_blaster_secondary 0
-set g_balance_blaster_secondary_animtime 0.2
-set g_balance_blaster_secondary_damage 25
-set g_balance_blaster_secondary_delay 0
-set g_balance_blaster_secondary_edgedamage 12.5
-set g_balance_blaster_secondary_force 360
-set g_balance_blaster_secondary_force_zscale 1
-set g_balance_blaster_secondary_lifetime 5
-set g_balance_blaster_secondary_radius 70
-set g_balance_blaster_secondary_refire 0.7
-set g_balance_blaster_secondary_shotangle 0
-set g_balance_blaster_secondary_speed 6000
-set g_balance_blaster_secondary_spread 0
set g_balance_blaster_switchdelay_drop 0
set g_balance_blaster_switchdelay_raise 0
set g_balance_blaster_weaponreplace ""
set g_balance_blaster_primary_shotangle 0
set g_balance_blaster_primary_speed 6000
set g_balance_blaster_primary_spread 0
-set g_balance_blaster_secondary 0
-set g_balance_blaster_secondary_animtime 0.2
-set g_balance_blaster_secondary_damage 25
-set g_balance_blaster_secondary_delay 0
-set g_balance_blaster_secondary_edgedamage 12.5
-set g_balance_blaster_secondary_force 360
-set g_balance_blaster_secondary_force_zscale 1
-set g_balance_blaster_secondary_lifetime 5
-set g_balance_blaster_secondary_radius 70
-set g_balance_blaster_secondary_refire 0.7
-set g_balance_blaster_secondary_shotangle 0
-set g_balance_blaster_secondary_speed 6000
-set g_balance_blaster_secondary_spread 0
set g_balance_blaster_switchdelay_drop 0.2
set g_balance_blaster_switchdelay_raise 0.2
set g_balance_blaster_weaponreplace ""
if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER))
{
- if(frag_deathtype & HITTYPE_SECONDARY)
+ if(!autocvar_g_instagib_blaster_keepdamage || frag_attacker == frag_target)
{
- if(!autocvar_g_instagib_blaster_keepdamage || frag_attacker == frag_target)
- {
- frag_damage = 0;
- if(!autocvar_g_instagib_mirrordamage)
- frag_mirrordamage = 0; // never do mirror damage on enemies
- }
-
- if(frag_target != frag_attacker)
- {
- if(!autocvar_g_instagib_blaster_keepforce)
- frag_force = '0 0 0';
- }
+ frag_damage = 0;
+ if(!autocvar_g_instagib_mirrordamage)
+ frag_mirrordamage = 0; // never do mirror damage on enemies
+ }
+
+ if(frag_target != frag_attacker)
+ {
+ if(!autocvar_g_instagib_blaster_keepforce)
+ frag_force = '0 0 0';
}
}
}
if ((WEP_CVAR_SEC(WEP_OVERKILL_HMG, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval))
{
// Secondary uses it's own refire timer if refire_type is 1.
- actor.jump_interval = time + WEP_CVAR_SEC(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
+ actor.jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
makevectors(actor.v_angle);
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+ W_Blaster_Attack(actor, weaponentity);
if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
(actor.(weaponentity).wframe == WFRAME_FIRE2))
{
}
if ((fire & 2) && (WEP_CVAR_SEC(WEP_OVERKILL_HMG, refire_type) == 0)) // Secondary attack
{
- if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_BLASTER, refire)))
+ if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_BLASTER, refire)))
{
return;
}
makevectors(actor.v_angle);
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready);
+ W_Blaster_Attack(actor, weaponentity);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready);
}
}
METHOD(OverkillHeavyMachineGun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
{
- float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_BLASTER, ammo);
+ float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_BLASTER, ammo);
if (autocvar_g_balance_okhmg_reload_ammo)
{
- ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_HMG.m_id]) >= WEP_CVAR_SEC(WEP_BLASTER, ammo);
+ ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_HMG.m_id]) >= WEP_CVAR_PRI(WEP_BLASTER, ammo);
}
return ammo_amount;
}
if ((WEP_CVAR_SEC(WEP_OVERKILL_MACHINEGUN, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval))
{
// Secondary uses it's own refire timer if refire_type is 1.
- actor.jump_interval = time + WEP_CVAR_SEC(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
+ actor.jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
makevectors(actor.v_angle);
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+ W_Blaster_Attack(actor, weaponentity);
if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
(actor.(weaponentity).wframe == WFRAME_FIRE2))
{
}
if ((fire & 2) && (WEP_CVAR_SEC(WEP_OVERKILL_MACHINEGUN, refire_type) == 0)) // Secondary attack
{
- if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_BLASTER, refire)))
+ if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_PRI(WEP_BLASTER, refire)))
{
return;
}
makevectors(actor.v_angle);
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready);
+ W_Blaster_Attack(actor, weaponentity);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready);
}
}
if ((WEP_CVAR_SEC(WEP_OVERKILL_NEX, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval))
{
// Secondary uses it's own refire timer if refire_type is 1.
- actor.jump_interval = time + WEP_CVAR_SEC(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
+ actor.jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
makevectors(actor.v_angle);
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+ W_Blaster_Attack(actor, weaponentity);
if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
(actor.(weaponentity).wframe == WFRAME_FIRE2))
{
if ((fire & 2) && (WEP_CVAR(WEP_OVERKILL_NEX, secondary) == 2) && (WEP_CVAR_SEC(WEP_OVERKILL_NEX, refire_type) == 0))
{
// Secondary attack
- if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_BLASTER, refire)))
+ if (!weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_PRI(WEP_BLASTER, refire)))
{
return;
}
makevectors(actor.v_angle);
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready);
+ W_Blaster_Attack(actor, weaponentity);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready);
return;
}
{
if(WEP_CVAR_SEC(WEP_OVERKILL_NEX, chargepool))
{
- if(WEP_CVAR_SEC(WEP_BLASTER, ammo))
+ if(WEP_CVAR_PRI(WEP_BLASTER, ammo))
{
// always deplete if secondary is held
- actor.(weaponentity).oknex_chargepool_ammo = max(0, actor.(weaponentity).oknex_chargepool_ammo - WEP_CVAR_SEC(WEP_BLASTER, ammo) * dt);
+ actor.(weaponentity).oknex_chargepool_ammo = max(0, actor.(weaponentity).oknex_chargepool_ammo - WEP_CVAR_PRI(WEP_BLASTER, ammo) * dt);
dt = min(dt, (1 - actor.(weaponentity).oknex_charge) / WEP_CVAR(WEP_OVERKILL_NEX, charge_rate));
actor.oknex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(WEP_OVERKILL_NEX, chargepool_pause_regen);
}
}
- else if(WEP_CVAR_SEC(WEP_BLASTER, ammo))
+ else if(WEP_CVAR_PRI(WEP_BLASTER, ammo))
{
if(fire & 2) // only eat ammo when the button is pressed
{
// if this weapon is reloadable, decrease its load. Else decrease the player's ammo
if(autocvar_g_balance_vortex_reload_ammo)
{
- dt = min(dt, (actor.(weaponentity).clip_load - WEP_CVAR_PRI(WEP_OVERKILL_NEX, ammo)) / WEP_CVAR_SEC(WEP_BLASTER, ammo));
+ dt = min(dt, (actor.(weaponentity).clip_load - WEP_CVAR_PRI(WEP_OVERKILL_NEX, ammo)) / WEP_CVAR_PRI(WEP_BLASTER, ammo));
dt = max(0, dt);
if(dt > 0)
{
- actor.(weaponentity).clip_load = max(WEP_CVAR_SEC(WEP_BLASTER, ammo), actor.(weaponentity).clip_load - WEP_CVAR_SEC(WEP_BLASTER, ammo) * dt);
+ actor.(weaponentity).clip_load = max(WEP_CVAR_PRI(WEP_BLASTER, ammo), actor.(weaponentity).clip_load - WEP_CVAR_PRI(WEP_BLASTER, ammo) * dt);
}
actor.(weaponentity).(weapon_load[WEP_OVERKILL_NEX.m_id]) = actor.(weaponentity).clip_load;
}
else
{
- dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(WEP_OVERKILL_NEX, ammo)) / WEP_CVAR_SEC(WEP_BLASTER, ammo));
+ dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(WEP_OVERKILL_NEX, ammo)) / WEP_CVAR_PRI(WEP_BLASTER, ammo));
dt = max(0, dt);
if(dt > 0)
{
- actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(WEP_BLASTER, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(WEP_BLASTER, ammo) * dt);
+ actor.(thiswep.ammo_field) = max(WEP_CVAR_PRI(WEP_BLASTER, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_PRI(WEP_BLASTER, ammo) * dt);
}
}
}
}
else if(WEP_CVAR(WEP_OVERKILL_NEX, secondary))
{
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_BLASTER, refire)))
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_BLASTER, refire)))
{
W_OverkillNex_Attack(thiswep, actor, weaponentity, 1);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready);
}
}
}
if (WEP_CVAR(WEP_OVERKILL_NEX, secondary))
{
// don't allow charging if we don't have enough ammo
- float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_BLASTER, ammo);
- ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_BLASTER, ammo);
+ float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_BLASTER, ammo);
+ ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_BLASTER, ammo);
return ammo_amount;
}
else
P(class, prefix, refire, float, PRI) \
P(class, prefix, secondary, float, NONE) \
P(class, prefix, reload_ammo, float, NONE) \
- P(class, prefix, reload_time, float, NONE) \
- P(class, prefix, switchdelay_raise, float, NONE) \
- P(class, prefix, switchdelay_drop, float, NONE) \
- P(class, prefix, weaponreplace, string, NONE) \
- P(class, prefix, weaponstart, float, NONE) \
- P(class, prefix, weaponstartoverride, float, NONE) \
- P(class, prefix, weaponthrowable, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
P(class, prefix, refire_type, float, SEC) \
END()
- W_PROPS(X, OverkillNex, oknex)
+ W_PROPS(X, OverkillNex, oknex)
#undef X
ENDCLASS(OverkillNex)
if ((WEP_CVAR_SEC(WEP_OVERKILL_RPC, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval))
{
// Secondary uses it's own refire timer if refire_type is 1.
- actor.jump_interval = time + WEP_CVAR_SEC(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
+ actor.jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
makevectors(actor.v_angle);
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+ W_Blaster_Attack(actor, weaponentity);
if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
(actor.(weaponentity).wframe == WFRAME_FIRE2))
{
}
if ((fire & 2) && (WEP_CVAR_SEC(WEP_OVERKILL_RPC, refire_type) == 0)) // Secondary attack
{
- if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_BLASTER, refire)))
+ if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_BLASTER, refire)))
{
return;
}
makevectors(actor.v_angle);
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready);
+ W_Blaster_Attack(actor, weaponentity);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready);
}
}
METHOD(OverkillRocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
{
- float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_BLASTER, ammo);
- ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_BLASTER, ammo);
+ float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_BLASTER, ammo);
+ ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_BLASTER, ammo);
return ammo_amount;
}
if ((WEP_CVAR_SEC(WEP_OVERKILL_SHOTGUN, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval))
{
// Secondary uses it's own refire timer if refire_type is 1.
- actor.jump_interval = time + WEP_CVAR_SEC(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
+ actor.jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
makevectors(actor.v_angle);
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+ W_Blaster_Attack(actor, weaponentity);
if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
(actor.(weaponentity).wframe == WFRAME_FIRE2))
{
}
if ((fire & 2) && (WEP_CVAR_SEC(WEP_OVERKILL_SHOTGUN, refire_type) == 0)) // Secondary attack
{
- if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(WEP_BLASTER, refire)))
+ if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_BLASTER, refire)))
{
return;
}
makevectors(actor.v_angle);
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready);
+ W_Blaster_Attack(actor, weaponentity);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready);
}
}
PROJECTILE_TOUCH(this, toucher);
this.event_damage = func_null;
- bool isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY);
RadiusDamageForSource(
this,
(this.origin + (this.mins + this.maxs) * 0.5),
this.velocity,
this.realowner,
- WEP_CVAR_BOTH(WEP_BLASTER, isprimary, damage),
- WEP_CVAR_BOTH(WEP_BLASTER, isprimary, edgedamage),
- WEP_CVAR_BOTH(WEP_BLASTER, isprimary, radius),
+ WEP_CVAR_PRI(WEP_BLASTER, damage),
+ WEP_CVAR_PRI(WEP_BLASTER, edgedamage),
+ WEP_CVAR_PRI(WEP_BLASTER, radius),
NULL,
NULL,
false,
- WEP_CVAR_BOTH(WEP_BLASTER, isprimary, force),
- WEP_CVAR_BOTH(WEP_BLASTER, isprimary, force_zscale),
+ WEP_CVAR_PRI(WEP_BLASTER, force),
+ WEP_CVAR_PRI(WEP_BLASTER, force_zscale),
this.projectiledeathtype,
this.weaponentity_fld,
toucher
{
set_movetype(this, MOVETYPE_FLY);
setthink(this, SUB_Remove);
- bool isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY);
- this.nextthink = time + WEP_CVAR_BOTH(WEP_BLASTER, isprimary, lifetime);
+ this.nextthink = time + WEP_CVAR_PRI(WEP_BLASTER, lifetime);
CSQCProjectile(this, true, PROJECTILE_BLASTER, true);
}
-void W_Blaster_Attack(entity actor, .entity weaponentity, int atk_deathtype)
+void W_Blaster_Attack(entity actor, .entity weaponentity)
{
- bool isprimary = !(atk_deathtype & HITTYPE_SECONDARY);
- float atk_shotangle_rad = WEP_CVAR_BOTH(WEP_BLASTER, isprimary, shotangle) * DEG2RAD;
- float atk_damage = WEP_CVAR_BOTH(WEP_BLASTER, isprimary, damage);
- vector s_forward = v_forward * cos(atk_shotangle_rad) + v_up * sin(atk_shotangle_rad);
+ float atk_shotangle = WEP_CVAR_PRI(WEP_BLASTER, shotangle) * DEG2RAD;
+ float atk_damage = WEP_CVAR_PRI(WEP_BLASTER, damage);
+ vector s_forward = v_forward * cos(atk_shotangle) + v_up * sin(atk_shotangle);
+ int atk_deathtype = WEP_BLASTER.m_id;
W_SetupShot_Dir(actor, weaponentity, s_forward, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, atk_damage, atk_deathtype);
W_MuzzleFlash(WEP_BLASTER, actor, weaponentity, w_shotorg, w_shotdir);
setorigin(missile, w_shotorg);
setsize(missile, '0 0 0', '0 0 0');
- float atk_speed = WEP_CVAR_BOTH(WEP_BLASTER, isprimary, speed);
- float atk_spread = WEP_CVAR_BOTH(WEP_BLASTER, isprimary, spread);
+ float atk_speed = WEP_CVAR_PRI(WEP_BLASTER, speed);
+ float atk_spread = WEP_CVAR_PRI(WEP_BLASTER, spread);
W_SetupProjVelocity_Explicit(missile, w_shotdir, v_up, atk_speed, 0, 0, atk_spread, false);
missile.angles = vectoangles(missile.velocity);
missile.projectiledeathtype = atk_deathtype;
missile.weaponentity_fld = weaponentity;
setthink(missile, W_Blaster_Think);
- missile.nextthink = time + WEP_CVAR_BOTH(WEP_BLASTER, isprimary, delay);
+ missile.nextthink = time + WEP_CVAR_PRI(WEP_BLASTER, delay);
MUTATOR_CALLHOOK(EditProjectile, actor, missile);
METHOD(Blaster, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
{
- if(WEP_CVAR(WEP_BLASTER, secondary))
- {
- if((random() * (WEP_CVAR_PRI(WEP_BLASTER, damage) + WEP_CVAR_SEC(WEP_BLASTER, damage))) > WEP_CVAR_PRI(WEP_BLASTER, damage))
- { PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_SEC(WEP_BLASTER, speed), 0, WEP_CVAR_SEC(WEP_BLASTER, lifetime), false, true); }
- else
- { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_BLASTER, speed), 0, WEP_CVAR_PRI(WEP_BLASTER, lifetime), false, true); }
- }
- else
- { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_BLASTER, speed), 0, WEP_CVAR_PRI(WEP_BLASTER, lifetime), false, true); }
+ PHYS_INPUT_BUTTON_ATCK(actor) =
+ bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_BLASTER, speed), 0, WEP_CVAR_PRI(WEP_BLASTER, lifetime), false, true);
}
METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire))
{
- if(fire & 1)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_BLASTER, refire)))
- {
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready);
- }
- }
- else if(fire & 2)
- {
- switch(WEP_CVAR(WEP_BLASTER, secondary))
- {
- case 0: // switch to last used weapon
- {
- if(actor.(weaponentity).m_switchweapon == WEP_BLASTER) // don't do this if already switching
- W_LastWeapon(actor, weaponentity);
- break;
- }
-
- case 1: // normal projectile secondary
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_BLASTER, refire)))
- {
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready);
- }
-
- break;
- }
- }
- }
+ if(fire & 1)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_BLASTER, refire)))
+ {
+ W_Blaster_Attack(actor, weaponentity);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready);
+ }
+ }
+ else if(fire & 2)
+ {
+ if(actor.(weaponentity).m_switchweapon == WEP_BLASTER) // don't do this if already switching
+ W_LastWeapon(actor, weaponentity);
+ }
}
METHOD(Blaster, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
{
- return true; // infinite ammo
+ return true; // infinite ammo
}
METHOD(Blaster, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
{
- return true; // blaster has infinite ammo
+ return true; // blaster has infinite ammo
}
METHOD(Blaster, wr_suicidemessage, Notification(entity thiswep))
{
- return WEAPON_BLASTER_SUICIDE;
+ return WEAPON_BLASTER_SUICIDE;
}
METHOD(Blaster, wr_killmessage, Notification(entity thiswep))
{
- return WEAPON_BLASTER_MURDER;
+ return WEAPON_BLASTER_MURDER;
}
METHOD(OffhandBlaster, offhand_think, void(OffhandBlaster this, entity actor, bool key_pressed))
{
return;
}
- actor.jump_interval = time + WEP_CVAR_SEC(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
+ actor.jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
.entity weaponentity = weaponentities[1];
makevectors(actor.v_angle);
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+ W_Blaster_Attack(actor, weaponentity);
}
#endif
METHOD(Blaster, wr_impacteffect, void(entity thiswep, entity actor))
{
- vector org2 = w_org + w_backoff * 2;
- pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
- if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
+ vector org2 = w_org + w_backoff * 2;
+ pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+ if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
}
#endif
#define X(BEGIN, P, END, class, prefix) \
BEGIN(class) \
- P(class, prefix, animtime, float, BOTH) \
- P(class, prefix, damage, float, BOTH) \
- P(class, prefix, delay, float, BOTH) \
- P(class, prefix, edgedamage, float, BOTH) \
- P(class, prefix, force, float, BOTH) \
- P(class, prefix, force_zscale, float, BOTH) \
- P(class, prefix, lifetime, float, BOTH) \
- P(class, prefix, radius, float, BOTH) \
- P(class, prefix, refire, float, BOTH) \
- P(class, prefix, secondary, float, NONE) \
- P(class, prefix, shotangle, float, BOTH) \
- P(class, prefix, speed, float, BOTH) \
- P(class, prefix, spread, float, BOTH) \
- P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, animtime, float, PRI) \
+ P(class, prefix, damage, float, PRI) \
+ P(class, prefix, delay, float, PRI) \
+ P(class, prefix, edgedamage, float, PRI) \
+ P(class, prefix, force, float, PRI) \
+ P(class, prefix, force_zscale, float, PRI) \
+ P(class, prefix, lifetime, float, PRI) \
+ P(class, prefix, radius, float, PRI) \
+ P(class, prefix, refire, float, PRI) \
+ P(class, prefix, shotangle, float, PRI) \
+ P(class, prefix, speed, float, PRI) \
+ P(class, prefix, spread, float, PRI) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
P(class, prefix, switchdelay_raise, float, NONE) \
- P(class, prefix, weaponreplace, string, NONE) \
- P(class, prefix, weaponstartoverride, float, NONE) \
- P(class, prefix, weaponstart, float, NONE) \
- P(class, prefix, weaponthrowable, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
END()
W_PROPS(X, Blaster, blaster)
#undef X
if((actor.items & IT_UNLIMITED_AMMO) || GetResource(actor, thiswep.ammo_type) > 0)
PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 1, false, true);
else
- PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_SEC(WEP_BLASTER, speed), 0, WEP_CVAR_SEC(WEP_BLASTER, lifetime), false, true); // WEAPONTODO: replace with proper vaporizer cvars
+ PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_BLASTER, speed), 0, WEP_CVAR_PRI(WEP_BLASTER, lifetime), false, true);
}
METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(WEP_VAPORIZER, ammo));
// if the laser uses load, we also consider its ammo for reloading
- if(WEP_CVAR(WEP_VAPORIZER, reload_ammo) && WEP_CVAR_SEC(WEP_BLASTER, ammo) && actor.(weaponentity).clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(WEP_BLASTER, ammo))) { // forced reload
+ if(WEP_CVAR(WEP_VAPORIZER, reload_ammo) && WEP_CVAR_PRI(WEP_BLASTER, ammo) && actor.(weaponentity).clip_load < min(vaporizer_ammo, WEP_CVAR_PRI(WEP_BLASTER, ammo))) { // forced reload
thiswep.wr_reload(thiswep, actor, weaponentity);
actor.(weaponentity).hagar_load = false; // rocket minsta exclusive var
return;
else if (actor.(weaponentity).jump_interval <= time)
{
// handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
- actor.(weaponentity).jump_interval = time + WEP_CVAR_SEC(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
+ actor.(weaponentity).jump_interval = time + WEP_CVAR_PRI(WEP_BLASTER, refire) * W_WeaponRateFactor(actor);
// decrease ammo for the laser?
- if(WEP_CVAR_SEC(WEP_BLASTER, ammo))
- W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_BLASTER, ammo), weaponentity);
+ if(WEP_CVAR_PRI(WEP_BLASTER, ammo))
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(WEP_BLASTER, ammo), weaponentity);
makevectors(actor.v_angle);
- W_Blaster_Attack(actor, weaponentity, WEP_BLASTER.m_id | HITTYPE_SECONDARY);
+ W_Blaster_Attack(actor, weaponentity);
// now do normal refire
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_BLASTER, animtime), w_ready);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_PRI(WEP_BLASTER, animtime), w_ready);
}
}
else
}
METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
{
- if(!WEP_CVAR_SEC(WEP_BLASTER, ammo))
+ if(!WEP_CVAR_PRI(WEP_BLASTER, ammo))
return true;
- float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_BLASTER, ammo);
- ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_BLASTER, ammo);
+ float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(WEP_BLASTER, ammo);
+ ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(WEP_BLASTER, ammo);
return ammo_amount;
}
METHOD(Vaporizer, wr_resetplayer, void(entity thiswep, entity actor))
{
float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(WEP_VAPORIZER, ammo));
float used_ammo;
- if(WEP_CVAR_SEC(WEP_BLASTER, ammo))
- used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(WEP_BLASTER, ammo));
+ if(WEP_CVAR_PRI(WEP_BLASTER, ammo))
+ used_ammo = min(vaporizer_ammo, WEP_CVAR_PRI(WEP_BLASTER, ammo));
else
used_ammo = vaporizer_ammo;