]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/crylink.qc
Remove remove()
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / crylink.qc
index 89a2cea429202d5227a56c92aed268d45cecc843..eb35652ab6c2414ca4cbcd2ff91c3e251db36eda 100644 (file)
@@ -76,8 +76,8 @@ void W_Crylink_CheckLinks(entity e)
        float i;
        entity p;
 
-       if(e == world)
-               error("W_Crylink_CheckLinks: entity is world");
+       if(e == NULL)
+               error("W_Crylink_CheckLinks: entity is NULL");
        if(e.classname != "spike" || wasfreed(e))
                error(sprintf("W_Crylink_CheckLinks: entity is not a spike but a %s (freed: %d)", e.classname, wasfreed(e)));
 
@@ -98,7 +98,7 @@ void W_Crylink_Dequeue_Raw(entity own, entity prev, entity me, entity next)
 {
        W_Crylink_CheckLinks(next);
        if(me == own.crylink_lastgroup)
-               own.crylink_lastgroup = ((me == next) ? world : next);
+               own.crylink_lastgroup = ((me == next) ? NULL : next);
        prev.queuenext = next;
        next.queueprev = prev;
        me.classname = "spike_oktoremove";
@@ -114,11 +114,11 @@ void W_Crylink_Dequeue(entity e)
 void W_Crylink_Reset(entity this)
 {
        W_Crylink_Dequeue(this);
-       remove(this);
+       delete(this);
 }
 
 // force projectile to explode
-void W_Crylink_LinkExplode(entity e, entity e2)
+void W_Crylink_LinkExplode(entity e, entity e2, entity directhitentity)
 {
        float a;
 
@@ -128,16 +128,17 @@ void W_Crylink_LinkExplode(entity e, entity e2)
        a = bound(0, 1 - (time - e.fade_time) * e.fade_rate, 1);
 
        if(e == e.realowner.crylink_lastgroup)
-               e.realowner.crylink_lastgroup = world;
+               e.realowner.crylink_lastgroup = NULL;
 
        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);
+       RadiusDamage(e, e.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * a, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * a, WEP_CVAR_BOTH(crylink, isprimary, radius), 
+                               NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * a, e.projectiledeathtype, directhitentity);
 
-       W_Crylink_LinkExplode(e.queuenext, e2);
+       W_Crylink_LinkExplode(e.queuenext, e2, directhitentity);
 
        e.classname = "spike_oktoremove";
-       remove(e);
+       delete(e);
 }
 
 // adjust towards center
@@ -258,16 +259,16 @@ void W_Crylink_LinkJoinEffect_Think(entity this)
                                        WEP_CVAR_BOTH(crylink, isprimary, joinexplode_edgedamage) * n,
                                        WEP_CVAR_BOTH(crylink, isprimary, joinexplode_radius) * n,
                                        e.realowner,
-                                       world,
+                                       NULL,
                                        WEP_CVAR_BOTH(crylink, isprimary, joinexplode_force) * n,
                                        e.projectiledeathtype,
-                                       other
+                                       NULL
                                );
                                Send_Effect(EFFECT_CRYLINK_JOINEXPLODE, this.origin, '0 0 0', n);
                        }
                }
        }
-       remove(this);
+       delete(this);
 }
 
 float W_Crylink_Touch_WouldHitFriendly(entity projectile, float rad)
@@ -293,17 +294,17 @@ float W_Crylink_Touch_WouldHitFriendly(entity projectile, float rad)
 }
 
 // NO bounce protection, as bounces are limited!
-void W_Crylink_Touch(entity this)
+void W_Crylink_Touch(entity this, entity toucher)
 {
        float finalhit;
        float f;
        float isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY);
-       PROJECTILE_TOUCH(this);
+       PROJECTILE_TOUCH(this, toucher);
 
        float a;
        a = bound(0, 1 - (time - this.fade_time) * this.fade_rate, 1);
 
-       finalhit = ((this.cnt <= 0) || (other.takedamage != DAMAGE_NO));
+       finalhit = ((this.cnt <= 0) || (toucher.takedamage != DAMAGE_NO));
        if(finalhit)
                f = 1;
        else
@@ -311,27 +312,27 @@ void W_Crylink_Touch(entity this)
        if(a)
                f *= a;
 
-       float totaldamage = RadiusDamage(this, this.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, this.projectiledeathtype, other);
+       float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * f, this.projectiledeathtype, toucher);
 
        if(totaldamage && ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(this, WEP_CVAR_BOTH(crylink, isprimary, radius)))))
        {
                if(this == this.realowner.crylink_lastgroup)
-                       this.realowner.crylink_lastgroup = world;
-               W_Crylink_LinkExplode(this.queuenext, this);
+                       this.realowner.crylink_lastgroup = NULL;
+               W_Crylink_LinkExplode(this.queuenext, this, toucher);
                this.classname = "spike_oktoremove";
-               remove(this);
+               delete(this);
                return;
        }
        else if(finalhit)
        {
                // just unlink
                W_Crylink_Dequeue(this);
-               remove(this);
+               delete(this);
                return;
        }
        this.cnt = this.cnt - 1;
        this.angles = vectoangles(this.velocity);
-       this.owner = world;
+       this.owner = NULL;
        this.projectiledeathtype |= HITTYPE_BOUNCE;
        // commented out as it causes a little hitch...
        //if(proj.cnt == 0)
@@ -341,7 +342,7 @@ void W_Crylink_Touch(entity this)
 void W_Crylink_Fadethink(entity this)
 {
        W_Crylink_Dequeue(this);
-       remove(this);
+       delete(this);
 }
 
 void W_Crylink_Attack(Weapon thiswep, entity actor)
@@ -366,7 +367,7 @@ void W_Crylink_Attack(Weapon thiswep, entity actor)
 
        shots = WEP_CVAR_PRI(crylink, shots);
        Send_Effect(EFFECT_CRYLINK_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, shots);
-       proj = prevproj = firstproj = world;
+       proj = prevproj = firstproj = NULL;
        for(counter = 0; counter < shots; ++counter)
        {
                proj = new(spike);
@@ -394,7 +395,7 @@ void W_Crylink_Attack(Weapon thiswep, entity actor)
 
                prevproj = proj;
 
-               proj.movetype = MOVETYPE_BOUNCEMISSILE;
+               set_movetype(proj, MOVETYPE_BOUNCEMISSILE);
                PROJECTILE_MAKETRIGGER(proj);
                proj.projectiledeathtype = WEP_CRYLINK.m_id;
                //proj.gravity = 0.001;
@@ -474,7 +475,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor)
 
        shots = WEP_CVAR_SEC(crylink, shots);
        Send_Effect(EFFECT_CRYLINK_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, shots);
-       proj = prevproj = firstproj = world;
+       proj = prevproj = firstproj = NULL;
        for(counter = 0; counter < shots; ++counter)
        {
                proj = new(spike);
@@ -502,7 +503,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor)
 
                prevproj = proj;
 
-               proj.movetype = MOVETYPE_BOUNCEMISSILE;
+               set_movetype(proj, MOVETYPE_BOUNCEMISSILE);
                PROJECTILE_MAKETRIGGER(proj);
                proj.projectiledeathtype = WEP_CRYLINK.m_id | HITTYPE_SECONDARY;
                //proj.gravity = 0.001;