W_Crylink_Dequeue_Raw(e.crylink_owner, e.queueprev, e, e.queuenext);
}
+void W_Crylink_DeleteLink(entity this)
+{
+ if(this.classname != "spike_oktoremove")
+ W_Crylink_Dequeue(this);
+ delete_fn(this);
+}
+
void W_Crylink_Reset(entity this)
{
- W_Crylink_Dequeue(this);
delete(this);
}
else if(finalhit)
{
// just unlink
- W_Crylink_Dequeue(this);
delete(this);
return;
}
void W_Crylink_Fadethink(entity this)
{
- W_Crylink_Dequeue(this);
delete(this);
}
if(WEP_CVAR_PRI(crylink, joinexplode))
maxdmg += WEP_CVAR_PRI(crylink, joinexplode_damage);
- W_SetupShot(actor, weaponentity, false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, maxdmg, WEP_CRYLINK.m_id);
+ 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);
- Send_Effect(EFFECT_CRYLINK_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, shots);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
proj = prevproj = firstproj = NULL;
for(counter = 0; counter < shots; ++counter)
{
proj = new(spike);
+ proj.dtor = W_Crylink_DeleteLink;
proj.reset = W_Crylink_Reset;
proj.realowner = proj.owner = actor;
proj.crylink_owner = actor;
set_movetype(proj, MOVETYPE_BOUNCEMISSILE);
PROJECTILE_MAKETRIGGER(proj);
- proj.projectiledeathtype = WEP_CRYLINK.m_id;
+ proj.projectiledeathtype = thiswep.m_id;
//proj.gravity = 0.001;
setorigin(proj, w_shotorg);
s.y = v_forward.x;
s.z = v_forward.y;
}
- s = s * WEP_CVAR_PRI(crylink, spread) * g_weaponspreadfactor;
+ 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);
settouch(proj, W_Crylink_Touch);
if(WEP_CVAR_SEC(crylink, joinexplode))
maxdmg += WEP_CVAR_SEC(crylink, joinexplode_damage);
- W_SetupShot(actor, weaponentity, false, 2, SND_CRYLINK_FIRE2, CH_WEAPON_A, maxdmg, WEP_CRYLINK.m_id | HITTYPE_SECONDARY);
+ 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);
- Send_Effect(EFFECT_CRYLINK_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, shots);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
proj = prevproj = firstproj = NULL;
for(counter = 0; counter < shots; ++counter)
{
proj = new(spike);
+ proj.dtor = W_Crylink_DeleteLink;
proj.weaponentity_fld = weaponentity;
proj.reset = W_Crylink_Reset;
proj.realowner = proj.owner = actor;
set_movetype(proj, MOVETYPE_BOUNCEMISSILE);
PROJECTILE_MAKETRIGGER(proj);
- proj.projectiledeathtype = WEP_CRYLINK.m_id | HITTYPE_SECONDARY;
+ proj.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY;
//proj.gravity = 0.001;
setorigin(proj, w_shotorg);
s.y = v_forward.x;
s.z = v_forward.y;
}
- s = s * WEP_CVAR_SEC(crylink, spread) * g_weaponspreadfactor;
+ s = s * WEP_CVAR_SEC(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) * g_weaponspreadfactor);
+ s = (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * WEP_CVAR_SEC(crylink, spread) * autocvar_g_weaponspreadfactor);
}
W_SetupProjVelocity_Explicit(proj, s, v_up, WEP_CVAR_SEC(crylink, speed), 0, 0, 0, false);
proj.flags = FL_PROJECTILE;
IL_PUSH(g_projectiles, proj);
IL_PUSH(g_bot_dodge, proj);
- proj.missile_flags = MIF_SPLASH;
+ proj.missile_flags = MIF_SPLASH;
CSQCProjectile(proj, true, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), true);
}
actor.(weaponentity).crylink_waitrelease = 0;
if(!thiswep.wr_checkammo1(thiswep, actor, weaponentity) && !thiswep.wr_checkammo2(thiswep, actor, weaponentity))
- if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+ if(!(actor.items & IT_UNLIMITED_AMMO))
{
// ran out of ammo!
- actor.cnt = WEP_CRYLINK.m_id;
+ actor.cnt = thiswep.m_id;
actor.(weaponentity).m_switchweapon = w_getbestweapon(actor, weaponentity);
}
}
if(actor.(weaponentity).crylink_lastgroup && actor.(weaponentity).crylink_waitrelease)
return true;
- float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(crylink, ammo);
- ammo_amount += actor.(weaponentity).(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
+ 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);
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 = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(crylink, ammo);
- ammo_amount += actor.(weaponentity).(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
+ 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);
return ammo_amount;
}
METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))