#ifdef REGISTER_WEAPON
-REGISTER_WEAPON(CRYLINK, w_crylink, IT_CELLS, 6, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "crylink", "crylink", _("Crylink"));
+REGISTER_WEAPON(
+/* WEP_##id */ CRYLINK,
+/* function */ w_crylink,
+/* ammotype */ IT_CELLS,
+/* impulse */ 6,
+/* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH,
+/* rating */ BOT_PICKUP_RATING_MID,
+/* model */ "crylink",
+/* shortname */ "crylink",
+/* fullname */ _("Crylink")
+);
#else
#ifdef SVQC
.float gravity;
// stored in w_crylink_linkjoin_time.
// could possibly network this origin and time, and display a special particle
// effect when projectiles meet there :P
-// jspeed: MINIMUM jing speed
-// jtime: MAXIMUM jing time (0: none)
+// jspeed: joining speed (calculate this as join spread * initial speed)
float w_crylink_linkjoin_time;
-vector W_Crylink_LinkJoin(entity e, float jspeed, float jtime)
+vector W_Crylink_LinkJoin(entity e, float jspeed)
{
vector avg_origin, avg_velocity;
vector targ_origin;
if(avg_dist == 0)
return avg_origin; // no change needed
- if(jspeed == 0 && jtime == 0)
+ if(jspeed == 0)
{
e.velocity = avg_velocity;
UpdateCSQCProjectile(e);
}
else
{
- if(jtime)
- {
- if(jspeed)
- w_crylink_linkjoin_time = min(jtime, avg_dist / jspeed);
- else
- w_crylink_linkjoin_time = jtime;
- }
- else
w_crylink_linkjoin_time = avg_dist / jspeed;
targ_origin = avg_origin + w_crylink_linkjoin_time * avg_velocity;
float W_Crylink_Touch_WouldHitFriendly(entity projectile, float rad)
{
entity head = WarpZone_FindRadius((projectile.origin + (projectile.mins + projectile.maxs) * 0.5), rad + MAX_DAMAGEEXTRARADIUS, FALSE);
- float hit_friendly;
- float hit_enemy;
+ float hit_friendly = 0;
+ float hit_enemy = 0;
while(head)
{
if((head.takedamage != DAMAGE_NO) && (head.deadflag == DEAD_NO))
{
- if(IsDifferentTeam(head, projectile.realowner))
- ++hit_enemy;
- else
+ if(SAME_TEAM(head, projectile.realowner))
++hit_friendly;
+ else
+ ++hit_enemy;
}
head = head.chain;
other = proj; MUTATOR_CALLHOOK(EditProjectile);
}
- if(autocvar_g_balance_crylink_primary_joinspread != 0 || autocvar_g_balance_crylink_primary_jointime != 0)
+ if(autocvar_g_balance_crylink_primary_joinspread != 0)
{
self.crylink_lastgroup = proj;
W_Crylink_CheckLinks(proj);
other = proj; MUTATOR_CALLHOOK(EditProjectile);
}
- if(autocvar_g_balance_crylink_secondary_joinspread != 0 || autocvar_g_balance_crylink_secondary_jointime != 0)
+ if(autocvar_g_balance_crylink_secondary_joinspread != 0)
{
self.crylink_lastgroup = proj;
W_Crylink_CheckLinks(proj);
if(self.crylink_waitrelease == 1)
{
- pos = W_Crylink_LinkJoin(self.crylink_lastgroup, autocvar_g_balance_crylink_primary_joinspread * autocvar_g_balance_crylink_primary_speed, autocvar_g_balance_crylink_primary_jointime);
+ pos = W_Crylink_LinkJoin(self.crylink_lastgroup, autocvar_g_balance_crylink_primary_joinspread * autocvar_g_balance_crylink_primary_speed);
}
else
{
- pos = W_Crylink_LinkJoin(self.crylink_lastgroup, autocvar_g_balance_crylink_secondary_joinspread * autocvar_g_balance_crylink_secondary_speed, autocvar_g_balance_crylink_secondary_jointime);
+ pos = W_Crylink_LinkJoin(self.crylink_lastgroup, autocvar_g_balance_crylink_secondary_joinspread * autocvar_g_balance_crylink_secondary_speed);
}
linkjoineffect = spawn();
}
self.crylink_waitrelease = 0;
if(!w_crylink(WR_CHECKAMMO1) && !w_crylink(WR_CHECKAMMO2))
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
+ if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
{
// ran out of ammo!
self.cnt = WEP_CRYLINK;
{
W_Reload(min(autocvar_g_balance_crylink_primary_ammo, autocvar_g_balance_crylink_secondary_ammo), autocvar_g_balance_crylink_reload_ammo, autocvar_g_balance_crylink_reload_time, "weapons/reload.wav");
}
+ else if (req == WR_SUICIDEMESSAGE)
+ {
+ return WEAPON_CRYLINK_SUICIDE;
+ }
+ else if (req == WR_KILLMESSAGE)
+ {
+ return WEAPON_CRYLINK_MURDER;
+ }
return TRUE;
}
#endif
{
pointparticles(particleeffectnum("crylink_impact"), org2, '0 0 0', 1);
if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM);
+ sound(self, CH_SHOTS, "weapons/crylink_impact2.wav", VOL_BASE, ATTEN_NORM);
}
else
{
pointparticles(particleeffectnum("crylink_impactbig"), org2, '0 0 0', 1);
if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
+ sound(self, CH_SHOTS, "weapons/crylink_impact.wav", VOL_BASE, ATTEN_NORM);
}
}
else if(req == WR_PRECACHE)
precache_sound("weapons/crylink_impact2.wav");
precache_sound("weapons/crylink_impact.wav");
}
- else if (req == WR_SUICIDEMESSAGE)
- {
- w_deathtypestring = _("%s succeeded at self-destructing themself with the Crylink");
- }
- else if (req == WR_KILLMESSAGE)
- {
- if(w_deathtype & HITTYPE_BOUNCE)
- w_deathtypestring = _("%s could not hide from %s's Crylink"); // unchecked: SPLASH (SECONDARY can't be)
- else if(w_deathtype & HITTYPE_SPLASH)
- w_deathtypestring = _("%s was too close to %s's Crylink"); // unchecked: SECONDARY
- else
- w_deathtypestring = _("%s took a close look at %s's Crylink"); // unchecked: SECONDARY
- }
return TRUE;
}
#endif