[nexuiz-commits] r7679 - in branches/nexuiz-2.0: . data/qcsrc/server/tturrets/system

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Sep 7 03:00:11 EDT 2009


Author: div0
Date: 2009-09-07 03:00:07 -0400 (Mon, 07 Sep 2009)
New Revision: 7679

Modified:
   branches/nexuiz-2.0/.patchsets
   branches/nexuiz-2.0/data/qcsrc/server/tturrets/system/system_main.qc
Log:
r7676 | tzork | 2009-09-06 17:46:39 -0400 (Sun, 06 Sep 2009) | 1 line
Make turrets faster, part 1.
r7678 | div0 | 2009-09-07 02:55:38 -0400 (Mon, 07 Sep 2009) | 2 lines
remove a print from turrets


Modified: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets	2009-09-07 06:55:38 UTC (rev 7678)
+++ branches/nexuiz-2.0/.patchsets	2009-09-07 07:00:07 UTC (rev 7679)
@@ -1,2 +1,2 @@
 master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-7563,7565-7586,7589-7589,7592-7592,7595-7595,7597-7597,7601-7602,7605-7610,7612-7615,7619-7620,7623-7623,7626-7628,7644-7651,7658-7660,7663-7665,7670-7670,7672-7673
+revisions_applied = 1-7563,7565-7586,7589-7589,7592-7592,7595-7595,7597-7597,7601-7602,7605-7610,7612-7615,7619-7620,7623-7623,7626-7628,7644-7651,7658-7660,7663-7665,7670-7670,7672-7676,7678-7678

Modified: branches/nexuiz-2.0/data/qcsrc/server/tturrets/system/system_main.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/tturrets/system/system_main.qc	2009-09-07 06:55:38 UTC (rev 7678)
+++ branches/nexuiz-2.0/data/qcsrc/server/tturrets/system/system_main.qc	2009-09-07 07:00:07 UTC (rev 7679)
@@ -28,13 +28,13 @@
     if (ent == world)
         return;
 
-    if (!ent.turret_scale_damage)    ent.turret_scale_damage  = 1;
-    if (!ent.turret_scale_range)     ent.turret_scale_range   = 1;
-    if (!ent.turret_scale_refire)    ent.turret_scale_refire  = 1;
-    if (!ent.turret_scale_ammo)      ent.turret_scale_ammo    = 1;
-    if (!ent.turret_scale_aim)       ent.turret_scale_aim     = 1;
-    if (!ent.turret_scale_health)    ent.turret_scale_health  = 1;
-    if (!ent.turret_scale_respawn)   ent.turret_scale_respawn = 1;
+    if not (ent.turret_scale_damage)    ent.turret_scale_damage  = 1;
+    if not (ent.turret_scale_range)     ent.turret_scale_range   = 1;
+    if not (ent.turret_scale_refire)    ent.turret_scale_refire  = 1;
+    if not (ent.turret_scale_ammo)      ent.turret_scale_ammo    = 1;
+    if not (ent.turret_scale_aim)       ent.turret_scale_aim     = 1;
+    if not (ent.turret_scale_health)    ent.turret_scale_health  = 1;
+    if not (ent.turret_scale_respawn)   ent.turret_scale_respawn = 1;
 
     sbase = strcat(cvar_base,unitname);
     if (is_reload)
@@ -134,17 +134,12 @@
     {
         oldpos = self.enemy.origin;
         setorigin(self.enemy,self.tur_aimpos);
+        tracebox(self.tur_shotorg, '-1 -1 -1','1 1 1',self.tur_shotorg + (self.tur_shotdir_updated * self.tur_dist_aimpos),MOVE_NORMAL,self);
+        setorigin(self.enemy,oldpos);
     }
+    else
+        tracebox(self.tur_shotorg, '-1 -1 -1','1 1 1',self.tur_shotorg + (self.tur_shotdir_updated * self.tur_dist_aimpos),MOVE_NORMAL,self);
 
-    //dprint("NN: ", self.netname," THVN: ",self.tur_head.classname," frame:",ftos(self.tur_head.frame),"\n");
-    //dprint("self.tur_shotorg: ",vtos(self.tur_shotorg),"\n");
-    tracebox(self.tur_shotorg, '-1 -1 -1','1 1 1',self.tur_shotorg + (self.tur_shotdir_updated * self.tur_dist_aimpos),MOVE_NORMAL,self);
-
-    if(self.firecheck_flags & TFL_FIRECHECK_VERIFIED)
-        if(self.enemy)
-            setorigin(self.enemy,oldpos);
-
-    //self.tur_impactpoint           = trace_endpos;
     self.tur_impactent             = trace_ent;
     self.tur_dist_impact_to_aimpos = vlen(trace_endpos - self.tur_aimpos) - (vlen(self.enemy.maxs - self.enemy.mins)*0.5);
     self.tur_impacttime            = vlen(self.tur_shotorg - trace_endpos) / self.shot_speed;
@@ -227,12 +222,13 @@
 {
     vector target_angle; // This is where we want to aim
     vector move_angle;   // This is where we can aim
+    vector a_off;
     float f_tmp;
 
     if (self.track_flags == TFL_TRACK_NO)
         return;
 
-    if(!self.tur_active)
+    if not (self.tur_active)
         target_angle = self.idle_aim - ('1 0 0' * self.aim_maxpitch);
     else if (self.enemy == world)
     {
@@ -255,9 +251,6 @@
     self.tur_head.angles_y = safeangle(self.tur_head.angles_y);
 
     // Find the diffrence between where we currently aim and where we want to aim
-    vector a_off;
-
-
     if (self.turrcaps_flags & TFL_TURRCAPS_HEADATTACHED)
     {
         move_angle = target_angle - (self.angles + self.tur_head.angles);
@@ -384,24 +377,29 @@
         if (self.attack_finished_single >= time) return 0;
 
     // Special case: volly fire turret that has to fire a full volly if a shot was fired.
-    if((self.shoot_flags & TFL_SHOOT_VOLLYALWAYS) && (self.volly_counter != self.shot_volly))
-        return 1;
+    if (self.shoot_flags & TFL_SHOOT_VOLLYALWAYS)
+        if not (self.volly_counter == self.shot_volly)
+            return 1;
 
     // Lack of zombies makes shooting dead things unnecessary :P
     if (self.firecheck_flags & TFL_FIRECHECK_DEAD)
-        if (self.enemy.deadflag != DEAD_NO) return 0;
+        if (self.enemy.deadflag != DEAD_NO)
+            return 0;
 
     // Plz stop killing the world!
     if (self.firecheck_flags & TFL_FIRECHECK_WORLD)
-        if (self.enemy == world) return 0;
+        if (self.enemy == world)
+            return 0;
 
     // Own ammo?
     if (self.firecheck_flags & TFL_FIRECHECK_OWM_AMMO)
-        if (self.ammo < self.shot_dmg) return 0;
+        if (self.ammo < self.shot_dmg)
+            return 0;
 
     // Other's ammo? (support-supply units)
     if (self.firecheck_flags & TFL_FIRECHECK_OTHER_AMMO)
-        if (self.enemy.ammo >= self.enemy.ammo_max) return 0;
+        if (self.enemy.ammo >= self.enemy.ammo_max)
+            return 0;
 
     if (self.firecheck_flags & TFL_FIRECHECK_DISTANCES)
     {
@@ -409,12 +407,14 @@
         //if (self.tur_dist_aimpos > self.target_range_fire) return 0;
 
         // To close?
-        if (self.tur_dist_aimpos < self.target_range_min) return 0;
+        if (self.tur_dist_aimpos < self.target_range_min)
+            return 0;
     }
 
     // Try to avoid FF?
     if (self.firecheck_flags & TFL_FIRECHECK_AFF)
-        if (self.tur_impactent.team == self.team) return 0;
+        if (self.tur_impactent.team == self.team)
+            return 0;
 
     // aim<->predicted impact
     if (self.firecheck_flags & TFL_FIRECHECK_AIMDIST)
@@ -450,6 +450,7 @@
 
 /**
 ** Evaluate a entity for target valitity based on validate_flags
+** NOTE: the caller must check takedamage before calling this, to inline this check.
 **/
 float turret_validate_target(entity e_turret,entity e_target,float validate_flags)
 {
@@ -479,7 +480,7 @@
         return -5;
 
     // Cant touch this
-    if ((e_target.takedamage == DAMAGE_NO) || (e_target.health < 0))
+    if (e_target.health < 0)
         return -6;
 
     // player
@@ -602,6 +603,7 @@
 
     m_score = 0;
     if(self.enemy)
+	if(self.enemy.takedamage)
     if(turret_validate_target(self,self.enemy,self.target_validate_flags) > 0)
     {
         e_enemy = self.enemy;
@@ -615,16 +617,19 @@
 
     while (e)
     {
-        f = turret_validate_target(self,e,self.target_select_flags);
-        if (f > 0)
-        {
-            score = self.turret_score_target(self,e);
-            if ((score > m_score) && (score > 0))
-            {
-                e_enemy = e;
-                m_score = score;
-            }
-        }
+		if(e.takedamage)
+		{
+			f = turret_validate_target(self,e,self.target_select_flags);
+			if (f > 0)
+			{
+				score = self.turret_score_target(self,e);
+				if ((score > m_score) && (score > 0))
+				{
+					e_enemy = e;
+					m_score = score;
+				}
+			}
+		}
         e = e.chain;
     }
 
@@ -706,25 +711,29 @@
     // turret_fusionreactor uses this to recharge friendlys.
     if (self.shoot_flags & TFL_SHOOT_HITALLVALID)
     {
-
         // Do a self.turret_fire for every valid target.
         e = findradius(self.origin,self.target_range);
         while (e)
         {
-            if (turret_validate_target(self,e,self.target_validate_flags))
-            {
-                self.enemy = e;
+			if(e.takedamage)
+			{
+				if (turret_validate_target(self,e,self.target_validate_flags))
+				{
+					self.enemy = e;
 
-                turret_do_updates(self);
+					turret_do_updates(self);
 
-                if (self.turret_firecheckfunc())
-                    turret_fire();
-            }
+					if (self.turret_firecheckfunc())
+						turret_fire();
+				}
+			}
 
             e = e.chain;
         }
         self.enemy = world;
     }
+    /*
+    // not used
     else if(self.shoot_flags & TFL_SHOOT_CUSTOM)
     {
         // This one is doing something.. oddball. assume its handles what needs to be handled.
@@ -743,6 +752,7 @@
         if (self.turret_firecheckfunc())
             turret_fire();
     }
+    */
     else
     {
         // Special case for volly always. if it fired once it must compleate the volly.
@@ -771,6 +781,7 @@
 
         // Check if we have a vailid enemy, and try to find one if we dont.
         if( ((self.target_select_time + cvar("g_turrets_targetscan_maxdelay")) < time)
+		  || !self.enemy.takedamage
           || (turret_validate_target(self,self.enemy,self.target_validate_flags) <= 0) )
         if not (self.target_select_time + cvar("g_turrets_targetscan_mindelay") > time)
         {
@@ -780,7 +791,6 @@
 
         }
 
-
         // No target, just go to idle, do any custom stuff and bail.
         if (self.enemy == world)
         {



More information about the nexuiz-commits mailing list