]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Purge SELFPARAM from the turret code
authorMario <mario@smbclan.net>
Fri, 10 Jun 2016 10:44:11 +0000 (20:44 +1000)
committerMario <mario@smbclan.net>
Fri, 10 Jun 2016 10:44:11 +0000 (20:44 +1000)
qcsrc/common/turrets/sv_turrets.qh
qcsrc/common/turrets/targettrigger.qc
qcsrc/common/turrets/turret/hk.qc
qcsrc/common/turrets/turret/hk_weapon.qc
qcsrc/common/turrets/turret/tesla_weapon.qc
qcsrc/common/turrets/util.qc

index 14b5b8853526f52774c8ab6e4732a316a2051e81..29d08c6290fd6a0699204197e2484283b591c669 100644 (file)
@@ -92,7 +92,7 @@ bool turret_initialize(entity this, Turret tur);
 /// Function to use for target evaluation. usualy turret_targetscore_generic
 .float(entity _turret, entity _target) turret_score_target;
 
-.float(entity e_target,entity e_sender) turret_addtarget;
+.bool(entity this, entity e_target,entity e_sender) turret_addtarget;
 
 .entity pathcurrent;
 
index 4828bf0b34c17b078126affea19477e9d7929014..362cd0883771310cf7b6e1b3f8ce4332c3fb18af 100644 (file)
@@ -7,7 +7,7 @@ void turret_targettrigger_touch(entity this)
     FOREACH_ENTITY_STRING_ORDERED(targetname, this.target, {
         if (!(it.turret_flags & TUR_FLAG_RECIEVETARGETS)) continue;
         if (!it.turret_addtarget) continue;
-        WITHSELF(it, it.turret_addtarget(other, this));
+        it.turret_addtarget(it, other, this);
     });
     this.cnt = time + 0.5;
 }
index e7fc07030f01b4b91146bd73ea1e0619106b10fc..da107922f19e5c9cc46cf0a6d3d71e93f9b9ef55 100644 (file)
@@ -39,7 +39,7 @@ METHOD(HunterKiller, tr_think, void(HunterKiller thistur, entity it))
         it.tur_head.frame = 0;
 }
 
-float turret_hk_addtarget(entity e_target,entity e_sender);
+bool turret_hk_addtarget(entity this, entity e_target,entity e_sender);
 METHOD(HunterKiller, tr_setup, void(HunterKiller this, entity it))
 {
     it.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
@@ -52,18 +52,18 @@ METHOD(HunterKiller, tr_setup, void(HunterKiller this, entity it))
     it.turret_addtarget = turret_hk_addtarget;
 }
 
-float turret_hk_addtarget(entity e_target,entity e_sender)
-{SELFPARAM();
+bool turret_hk_addtarget(entity this, entity e_target,entity e_sender)
+{
     if (e_target)
     {
-        if (turret_validate_target(self,e_target,self.target_validate_flags) > 0)
+        if (turret_validate_target(this,e_target,this.target_validate_flags) > 0)
         {
-            self.enemy = e_target;
-            return 1;
+            this.enemy = e_target;
+            return true;
         }
     }
 
-    return 0;
+    return false;
 }
 
 #endif // SVQC
index 7d14757a1c3c64b44005bdeb56c268510c343045..b1658923e97a80269effd93e370e729d6948defc 100644 (file)
@@ -44,7 +44,7 @@ METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, .entity
        }
 }
 
-bool hk_is_valid_target(entity e_target);
+bool hk_is_valid_target(entity this, entity e_target);
 void turret_hk_missile_think(entity this)
 {
     vector vu, vd, vf, vl, vr, ve;  // Vector (direction)
@@ -72,7 +72,7 @@ void turret_hk_missile_think(entity this)
         e = findradius(self.origin, 5000);
         while (e)
         {
-            if (hk_is_valid_target(e))
+            if (hk_is_valid_target(this, e))
             {
                 if (!self.enemy)
                     self.enemy = e;
@@ -246,38 +246,38 @@ void turret_hk_missile_think(entity this)
     UpdateCSQCProjectile(self);
 }
 
-bool hk_is_valid_target(entity e_target)
-{SELFPARAM();
+bool hk_is_valid_target(entity this, entity e_target)
+{
     if (e_target == world)
-        return 0;
+        return false;
 
     // If only this was used more..
     if (e_target.flags & FL_NOTARGET)
-        return 0;
+        return false;
 
     // Cant touch this
     if ((e_target.takedamage == DAMAGE_NO) || (e_target.health < 0))
-        return 0;
+        return false;
 
     // player
     if (IS_CLIENT(e_target))
     {
-        if (self.owner.target_select_playerbias < 0)
-            return 0;
+        if (this.owner.target_select_playerbias < 0)
+            return false;
 
         if (IS_DEAD(e_target))
-            return 0;
+            return false;
     }
 
     // Missile
-    if ((e_target.flags & FL_PROJECTILE) && (self.owner.target_select_missilebias < 0))
-        return 0;
+    if ((e_target.flags & FL_PROJECTILE) && (this.owner.target_select_missilebias < 0))
+        return false;
 
     // Team check
-    if ((e_target.team == self.owner.team) || (self.owner.team == e_target.owner.team))
-        return 0;
+    if ((e_target.team == this.owner.team) || (this.owner.team == e_target.owner.team))
+        return false;
 
-    return 1;
+    return true;
 }
 
 #endif
index a283a738f2c79c93737698d02d86ff849c7e52c6..a2d11d53cce9a5a941b63ac0327aca5886d6ddde 100644 (file)
@@ -4,7 +4,7 @@
 
 #ifdef SVQC
 
-entity toast(entity from, float range, float damage);
+entity toast(entity actor, entity from, float range, float damage);
 SOUND(TeslaCoilTurretAttack_FIRE, W_Sound("electro_fire"));
 METHOD(TeslaCoilTurretAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
@@ -26,7 +26,7 @@ METHOD(TeslaCoilTurretAttack, wr_think, void(entity thiswep, entity actor, .enti
 
         actor.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK;
 
-        entity t = toast(e,r,d);
+        entity t = toast(actor, e,r,d);
         remove(e);
 
         if (t == NULL) return;
@@ -37,7 +37,7 @@ METHOD(TeslaCoilTurretAttack, wr_think, void(entity thiswep, entity actor, .enti
         for (int i = 0; i < 10; ++i) {
             d *= 0.75;
             r *= 0.85;
-            t = toast(t, r, d);
+            t = toast(actor, t, r, d);
             if (t == world) break;
 
         }
@@ -51,8 +51,8 @@ METHOD(TeslaCoilTurretAttack, wr_think, void(entity thiswep, entity actor, .enti
     }
 }
 
-entity toast(entity from, float range, float damage)
-{SELFPARAM();
+entity toast(entity actor, entity from, float range, float damage)
+{
     entity e;
     entity etarget = world;
     float d,dd;
@@ -65,7 +65,7 @@ entity toast(entity from, float range, float damage)
     {
         if ((e.railgunhit != 1) && (e != from))
         {
-            r = turret_validate_target(self,e,self.target_validate_flags);
+            r = turret_validate_target(actor,e,actor.target_validate_flags);
             if (r > 0)
             {
                 traceline(from.origin,0.5 * (e.absmin + e.absmax),MOVE_WORLDONLY,from);
@@ -86,7 +86,7 @@ entity toast(entity from, float range, float damage)
     if (etarget)
     {
         te_csqc_lightningarc(from.origin,etarget.origin);
-        Damage(etarget, self, self, damage, DEATH_TURRET_TESLA.m_id, etarget.origin, '0 0 0');
+        Damage(etarget, actor, actor, damage, DEATH_TURRET_TESLA.m_id, etarget.origin, '0 0 0');
         etarget.railgunhit = 1;
     }
 
index 0d178a5cba654f3a9606b810dfeafc835faeb648..805e13012b2328f095fbf4e0cb47c22ef9c95667 100644 (file)
@@ -93,21 +93,21 @@ void FireImoBeam(entity this, vector start, vector end, vector smin, vector smax
 }
 
 #ifdef TURRET_DEBUG
-void marker_think()
-{SELFPARAM();
-       if(self.cnt)
-       if(self.cnt < time)
+void marker_think(entity this, )
+{
+       if(this.cnt)
+       if(this.cnt < time)
        {
-               setthink(self, SUB_Remove);
-               self.nextthink = time;
+               setthink(this, SUB_Remove);
+               this.nextthink = time;
                return;
        }
 
-       self.frame += 1;
-       if(self.frame > 29)
-               self.frame = 0;
+       this.frame += 1;
+       if(this.frame > 29)
+               this.frame = 0;
 
-       self.nextthink = time;
+       this.nextthink = time;
 }
 
 void mark_error(vector where,float lifetime)