-#ifdef REGISTER_WEAPON
+#ifndef IMPLEMENTATION
REGISTER_WEAPON(
/* WEP_##id */ CRYLINK,
/* function */ W_Crylink,
/* color */ '1 0.5 1',
/* modelname */ "crylink",
/* simplemdl */ "foobar",
-/* crosshair */ "gfx/crosshaircrylink 0.4",
+/* crosshair */ "gfx/crosshaircrylink 0.5",
/* wepimg */ "weaponcrylink",
/* refname */ "crylink",
/* wepname */ _("Crylink")
.entity queuenext;
.entity queueprev;
#endif
-#else
+#endif
+#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_crylink(void) { weapon_defaultspawnfunc(WEP_CRYLINK); }
+void spawnfunc_weapon_crylink(void) { weapon_defaultspawnfunc(WEP_CRYLINK.m_id); }
void W_Crylink_CheckLinks(entity e)
{
if(e == e.realowner.crylink_lastgroup)
e.realowner.crylink_lastgroup = world;
-
+
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), world, world, WEP_CVAR_BOTH(crylink, isprimary, force) * a, e.projectiledeathtype, other);
W_Crylink_LinkExplode(e.queuenext, e2);
if(n >= 2)
{
float isprimary = !(e.projectiledeathtype & HITTYPE_SECONDARY);
-
+
if(WEP_CVAR_BOTH(crylink, isprimary, joinexplode))
{
n /= WEP_CVAR_BOTH(crylink, isprimary, shots);
e.projectiledeathtype,
other
);
- pointparticles(particleeffectnum("crylink_joinexplode"), self.origin, '0 0 0', n);
+ Send_Effect(EFFECT_CRYLINK_JOINEXPLODE, self.origin, '0 0 0', n);
}
}
}
else
++hit_enemy;
}
-
+
head = head.chain;
}
f *= a;
float totaldamage = RadiusDamage(self, self.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), world, world, WEP_CVAR_BOTH(crylink, isprimary, force) * f, self.projectiledeathtype, other);
-
+
if(totaldamage && ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(self, WEP_CVAR_BOTH(crylink, isprimary, radius)))))
{
if(self == self.realowner.crylink_lastgroup)
if(WEP_CVAR_PRI(crylink, joinexplode))
maxdmg += WEP_CVAR_PRI(crylink, joinexplode_damage);
- W_SetupShot(self, false, 2, "weapons/crylink_fire.wav", CH_WEAPON_A, maxdmg);
+ W_SetupShot(self, false, 2, W_Sound("crylink_fire"), CH_WEAPON_A, maxdmg);
forward = v_forward;
right = v_right;
up = v_up;
shots = WEP_CVAR_PRI(crylink, shots);
- pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
+ Send_Effect(EFFECT_CRYLINK_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, shots);
proj = prevproj = firstproj = world;
for(counter = 0; counter < shots; ++counter)
{
proj.movetype = MOVETYPE_BOUNCEMISSILE;
PROJECTILE_MAKETRIGGER(proj);
- proj.projectiledeathtype = WEP_CRYLINK;
+ proj.projectiledeathtype = WEP_CRYLINK.m_id;
//proj.gravity = 0.001;
setorigin(proj, w_shotorg);
else
{
makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
- s_y = v_forward.x;
- s_z = v_forward.y;
+ s.y = v_forward.x;
+ s.z = v_forward.y;
}
s = s * WEP_CVAR_PRI(crylink, spread) * 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);
proj.flags = FL_PROJECTILE;
proj.missile_flags = MIF_SPLASH;
-
+
CSQCProjectile(proj, true, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), true);
- other = proj; MUTATOR_CALLHOOK(EditProjectile);
+ MUTATOR_CALLHOOK(EditProjectile, self, proj);
}
if(WEP_CVAR_PRI(crylink, joinspread) != 0)
{
if(WEP_CVAR_SEC(crylink, joinexplode))
maxdmg += WEP_CVAR_SEC(crylink, joinexplode_damage);
- W_SetupShot(self, false, 2, "weapons/crylink_fire2.wav", CH_WEAPON_A, maxdmg);
+ W_SetupShot(self, false, 2, W_Sound("crylink_fire2"), CH_WEAPON_A, maxdmg);
forward = v_forward;
right = v_right;
up = v_up;
shots = WEP_CVAR_SEC(crylink, shots);
- pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
+ Send_Effect(EFFECT_CRYLINK_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, shots);
proj = prevproj = firstproj = world;
for(counter = 0; counter < shots; ++counter)
{
proj.movetype = MOVETYPE_BOUNCEMISSILE;
PROJECTILE_MAKETRIGGER(proj);
- proj.projectiledeathtype = WEP_CRYLINK | HITTYPE_SECONDARY;
+ proj.projectiledeathtype = WEP_CRYLINK.m_id | HITTYPE_SECONDARY;
//proj.gravity = 0.001;
setorigin(proj, w_shotorg);
else
{
makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
- s_y = v_forward.x;
- s_z = v_forward.y;
+ s.y = v_forward.x;
+ s.z = v_forward.y;
}
s = s * WEP_CVAR_SEC(crylink, spread) * g_weaponspreadfactor;
s = w_shotdir + right * s.y + up * s.z;
proj.flags = FL_PROJECTILE;
proj.missile_flags = MIF_SPLASH;
-
+
CSQCProjectile(proj, true, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), true);
- other = proj; MUTATOR_CALLHOOK(EditProjectile);
+ MUTATOR_CALLHOOK(EditProjectile, self, proj);
}
if(WEP_CVAR_SEC(crylink, joinspread) != 0)
{
}
}
-float W_Crylink(float req)
+bool W_Crylink(int req)
{
float ammo_amount;
switch(req)
self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
else
self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
-
+
return true;
}
case WR_THINK:
vector pos;
entity linkjoineffect;
float isprimary = (self.crylink_waitrelease == 1);
-
+
pos = W_Crylink_LinkJoin(self.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
linkjoineffect = spawn();
if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
{
// ran out of ammo!
- self.cnt = WEP_CRYLINK;
+ self.cnt = WEP_CRYLINK.m_id;
self.switchweapon = w_getbestweapon(self);
}
}
}
-
+
return true;
}
case WR_INIT:
{
- precache_model("models/weapons/g_crylink.md3");
- precache_model("models/weapons/v_crylink.md3");
- precache_model("models/weapons/h_crylink.iqm");
- precache_sound("weapons/crylink_fire.wav");
- precache_sound("weapons/crylink_fire2.wav");
- precache_sound("weapons/crylink_linkjoin.wav");
+ precache_model(W_Model("g_crylink.md3"));
+ precache_model(W_Model("v_crylink.md3"));
+ precache_model(W_Model("h_crylink.iqm"));
+ precache_sound(W_Sound("crylink_fire"));
+ precache_sound(W_Sound("crylink_fire2"));
+ precache_sound(W_Sound("crylink_linkjoin"));
CRYLINK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
return true;
}
return true;
ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_PRI(crylink, ammo);
- ammo_amount += self.(weapon_load[WEP_CRYLINK]) >= WEP_CVAR_PRI(crylink, ammo);
+ ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
return ammo_amount;
}
case WR_CHECKAMMO2:
return true;
ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_SEC(crylink, ammo);
- ammo_amount += self.(weapon_load[WEP_CRYLINK]) >= WEP_CVAR_SEC(crylink, ammo);
+ ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
return ammo_amount;
}
case WR_CONFIG:
}
case WR_RELOAD:
{
- W_Reload(min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), "weapons/reload.wav");
+ W_Reload(min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), W_Sound("reload"));
return true;
}
case WR_SUICIDEMESSAGE:
}
#endif
#ifdef CSQC
-float W_Crylink(float req)
+bool W_Crylink(int req)
{
switch(req)
{
org2 = w_org + w_backoff * 2;
if(w_deathtype & HITTYPE_SECONDARY)
{
- pointparticles(particleeffectnum("crylink_impact"), org2, '0 0 0', 1);
+ pointparticles(particleeffectnum(EFFECT_CRYLINK_IMPACT2), org2, '0 0 0', 1);
if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM);
+ sound(self, CH_SHOTS, W_Sound("crylink_impact2"), VOL_BASE, ATTN_NORM);
}
else
{
- pointparticles(particleeffectnum("crylink_impactbig"), org2, '0 0 0', 1);
+ pointparticles(particleeffectnum(EFFECT_CRYLINK_IMPACT), org2, '0 0 0', 1);
if(!w_issilent)
- sound(self, CH_SHOTS, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
+ sound(self, CH_SHOTS, W_Sound("crylink_impact"), VOL_BASE, ATTN_NORM);
}
-
+
return true;
}
case WR_INIT:
{
- precache_sound("weapons/crylink_impact2.wav");
- precache_sound("weapons/crylink_impact.wav");
+ precache_sound(W_Sound("crylink_impact2"));
+ precache_sound(W_Sound("crylink_impact"));
return true;
}
case WR_ZOOMRETICLE: