#ifdef REGISTER_WEAPON
-REGISTER_WEAPON(HAGAR, w_hagar, IT_ROCKETS, 8, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "hagar", "hagar", _("Hagar"))
+REGISTER_WEAPON(
+/* WEP_##id */ HAGAR,
+/* function */ w_hagar,
+/* ammotype */ IT_ROCKETS,
+/* impulse */ 8,
+/* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH,
+/* rating */ BOT_PICKUP_RATING_MID,
+/* model */ "hagar",
+/* shortname */ "hagar",
+/* fullname */ _("Hagar")
+);
#else
#ifdef SVQC
// NO bounce protection, as bounces are limited!
void W_Hagar_Explode (void)
{
- self.event_damage = SUB_Null;
+ self.event_damage = func_null;
RadiusDamage (self, self.realowner, autocvar_g_balance_hagar_primary_damage, autocvar_g_balance_hagar_primary_edgedamage, autocvar_g_balance_hagar_primary_radius, world, autocvar_g_balance_hagar_primary_force, self.projectiledeathtype, other);
remove (self);
void W_Hagar_Explode2 (void)
{
- self.event_damage = SUB_Null;
+ self.event_damage = func_null;
RadiusDamage (self, self.realowner, autocvar_g_balance_hagar_secondary_damage, autocvar_g_balance_hagar_secondary_edgedamage, autocvar_g_balance_hagar_secondary_radius, world, autocvar_g_balance_hagar_secondary_force, self.projectiledeathtype, other);
remove (self);
{
if (self.health <= 0)
return;
-
- float is_linkexplode = ((inflictor.realowner == self.realowner)
- && (inflictor.projectiledeathtype & HITTYPE_SECONDARY)
+
+ float is_linkexplode = ( ((inflictor.owner != world) ? (inflictor.owner == self.owner) : TRUE)
+ && (inflictor.projectiledeathtype & HITTYPE_SECONDARY)
&& (self.projectiledeathtype & HITTYPE_SECONDARY));
-
+
if(is_linkexplode)
is_linkexplode = (is_linkexplode && autocvar_g_balance_hagar_secondary_load_linkexplode);
else
is_linkexplode = -1; // not secondary load, so continue as normal without exception.
-
+
if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, is_linkexplode))
return; // g_projectiles_damage says to halt
self.health = self.health - damage;
self.angles = vectoangles(self.velocity);
-
+
if (self.health <= 0)
W_PrepareExplosionByDamage(attacker, self.think);
}
missile.classname = "missile";
missile.bot_dodge = TRUE;
missile.bot_dodgerating = autocvar_g_balance_hagar_primary_damage;
-
+
missile.takedamage = DAMAGE_YES;
missile.health = autocvar_g_balance_hagar_primary_health;
missile.damageforcescale = autocvar_g_balance_hagar_primary_damageforcescale;
missile.event_damage = W_Hagar_Damage;
missile.damagedbycontents = TRUE;
-
+
missile.touch = W_Hagar_Touch;
missile.use = W_Hagar_Explode;
missile.think = adaptor_think2use_hittype_splash;
missile.angles = vectoangles (missile.velocity);
missile.flags = FL_PROJECTILE;
+ missile.missile_flags = MIF_SPLASH;
CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR, TRUE);
missile.classname = "missile";
missile.bot_dodge = TRUE;
missile.bot_dodgerating = autocvar_g_balance_hagar_secondary_damage;
-
+
missile.takedamage = DAMAGE_YES;
missile.health = autocvar_g_balance_hagar_secondary_health;
missile.damageforcescale = autocvar_g_balance_hagar_secondary_damageforcescale;
missile.angles = vectoangles (missile.velocity);
missile.flags = FL_PROJECTILE;
+ missile.missile_flags = MIF_SPLASH;
CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR_BOUNCING, TRUE);
shots = self.hagar_load;
missile = world;
- while (counter < shots)
+ for(counter = 0; counter < shots; ++counter)
{
missile = spawn ();
missile.owner = missile.realowner = self;
missile.classname = "missile";
missile.bot_dodge = TRUE;
missile.bot_dodgerating = autocvar_g_balance_hagar_secondary_damage;
-
+
missile.takedamage = DAMAGE_YES;
missile.health = autocvar_g_balance_hagar_secondary_health;
missile.damageforcescale = autocvar_g_balance_hagar_secondary_damageforcescale;
setorigin (missile, w_shotorg);
setsize(missile, '0 0 0', '0 0 0');
missile.movetype = MOVETYPE_FLY;
-
+ 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) / (autocvar_g_balance_hagar_secondary_load_max - 1));
+ spread_pershot = ((shots - 1) / (autocvar_g_balance_hagar_secondary_load_max - 1));
spread_pershot = (1 - (spread_pershot * autocvar_g_balance_hagar_secondary_load_spread_bias));
spread_pershot = (autocvar_g_balance_hagar_secondary_spread * spread_pershot * g_weaponspreadfactor);
-
+
// pattern spread calculation
s = '0 0 0';
if (counter == 0)
s_z = v_forward_y;
}
s = s * autocvar_g_balance_hagar_secondary_load_spread * g_weaponspreadfactor;
-
+
W_SetupProjectileVelocityEx(missile, w_shotdir + right * s_y + up * s_z, v_up, autocvar_g_balance_hagar_secondary_speed, 0, 0, spread_pershot, FALSE);
missile.angles = vectoangles (missile.velocity);
CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR, TRUE);
other = missile; MUTATOR_CALLHOOK(EditProjectile);
-
- counter = counter + 1;
}
weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hagar_secondary_load_animtime, w_ready);
{
// loadable hagar secondary attack, must always run each frame
+ if(time < game_starttime)
+ return;
+
float loaded, enough_ammo;
loaded = self.hagar_load >= autocvar_g_balance_hagar_secondary_load_max;
self.weaponentity.state = WS_READY;
W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_hagar_secondary_ammo * self.hagar_load * -1, autocvar_g_balance_hagar_reload_ammo); // give back ammo
self.hagar_load = 0;
- sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM);
+ sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTEN_NORM);
// pause until we can load rockets again, once we re-press the alt fire button
self.hagar_loadstep = time + autocvar_g_balance_hagar_secondary_load_speed * W_WeaponRateFactor();
W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_hagar_secondary_ammo, autocvar_g_balance_hagar_reload_ammo);
self.weaponentity.state = WS_INUSE;
self.hagar_load += 1;
- sound(self, CH_WEAPON_B, "weapons/hagar_load.wav", VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most
+ sound(self, CH_WEAPON_B, "weapons/hagar_load.wav", VOL_BASE * 0.8, ATTEN_NORM); // sound is too loud according to most
if (self.hagar_load >= autocvar_g_balance_hagar_secondary_load_max)
self.hagar_loadstep = time + autocvar_g_balance_hagar_secondary_load_hold * W_WeaponRateFactor();
else if(!self.hagar_loadbeep && self.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(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM);
+ sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTEN_NORM);
self.hagar_loadbeep = TRUE;
}
}
if(!self.hagar_warning && self.hagar_load) // prevents the beep from playing each frame
{
// we're about to automatically release after holding time, play a beep sound to notify the player
- sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM);
+ sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTEN_NORM);
self.hagar_warning = TRUE;
}
}
-
+
// release if player let go of button or if they've held it in too long
if(!self.BUTTON_ATCK2 || ((loaded || !enough_ammo) && self.hagar_loadstep < time && autocvar_g_balance_hagar_secondary_load_hold >= 0))
{
}
// we aren't checking ammo during an attack, so we must do it here
- if not(weapon_action(self.weapon, WR_CHECKAMMO1) + weapon_action(self.weapon, WR_CHECKAMMO2))
+ if (!(weapon_action(self.weapon, WR_CHECKAMMO1) + weapon_action(self.weapon, WR_CHECKAMMO2)))
{
// note: this doesn't force the switch
W_SwitchToOtherWeapon(self);
else if (req == WR_THINK)
{
float loadable_secondary;
- loadable_secondary = autocvar_g_balance_hagar_secondary_load && autocvar_g_balance_hagar_secondary;
+ loadable_secondary = (autocvar_g_balance_hagar_secondary_load && autocvar_g_balance_hagar_secondary);
if (loadable_secondary)
W_Hagar_Attack2_Load(); // must always run each frame
}
else if (req == WR_RELOAD)
{
- if not(self.hagar_load) // require releasing loaded rockets first
+ if (!self.hagar_load) // require releasing loaded rockets first
W_Reload(min(autocvar_g_balance_hagar_primary_ammo, autocvar_g_balance_hagar_secondary_ammo), autocvar_g_balance_hagar_reload_ammo, autocvar_g_balance_hagar_reload_time, "weapons/reload.wav");
}
+ else if (req == WR_SUICIDEMESSAGE)
+ {
+ return WEAPON_HAGAR_SUICIDE;
+ }
+ else if (req == WR_KILLMESSAGE)
+ {
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_HAGAR_MURDER_BURST;
+ else
+ return WEAPON_HAGAR_MURDER_SPRAY;
+ }
return TRUE;
}
#endif
if(!w_issilent)
{
if (w_random<0.15)
- sound(self, CH_SHOTS, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
+ sound(self, CH_SHOTS, "weapons/hagexp1.wav", VOL_BASE, ATTEN_NORM);
else if (w_random<0.7)
- sound(self, CH_SHOTS, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
+ sound(self, CH_SHOTS, "weapons/hagexp2.wav", VOL_BASE, ATTEN_NORM);
else
- sound(self, CH_SHOTS, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
+ sound(self, CH_SHOTS, "weapons/hagexp3.wav", VOL_BASE, ATTEN_NORM);
}
}
else if(req == WR_PRECACHE)
precache_sound("weapons/hagexp2.wav");
precache_sound("weapons/hagexp3.wav");
}
- else if (req == WR_SUICIDEMESSAGE)
- w_deathtypestring = _("%s played with tiny hagar rockets");
- else if (req == WR_KILLMESSAGE)
- {
- if(w_deathtype & HITTYPE_BOUNCE) // must be secondary; unchecked: SPLASH
- w_deathtypestring = _("%s was pummeled with a burst of hagar rockets by %s");
- else // unchecked: SPLASH, SECONDARY
- w_deathtypestring = _("%s was pummeled with hagar rockets by %s");
- }
return TRUE;
}
#endif