]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/crylink.qc
Improve indentation consistency in weapon code
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / crylink.qc
index 3589146352e18d6fe74b3616147cc6233b3d7958..51d17575074cfe405ca1afe5896de162655c517b 100644 (file)
@@ -43,9 +43,15 @@ void W_Crylink_Dequeue(entity e)
        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);
 }
 
@@ -263,7 +269,6 @@ void W_Crylink_Touch(entity this, entity toucher)
        else if(finalhit)
        {
                // just unlink
-               W_Crylink_Dequeue(this);
                delete(this);
                return;
        }
@@ -278,7 +283,6 @@ void W_Crylink_Touch(entity this, entity toucher)
 
 void W_Crylink_Fadethink(entity this)
 {
-       W_Crylink_Dequeue(this);
        delete(this);
 }
 
@@ -303,11 +307,12 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        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;
@@ -415,11 +420,12 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
        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;
@@ -499,7 +505,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
                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);
 
@@ -568,7 +574,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit
             }
             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 = thiswep.m_id;