Better walker and ewheel.
authortzork <tzork@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Fri, 27 Mar 2009 09:36:50 +0000 (09:36 +0000)
committertzork <tzork@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Fri, 27 Mar 2009 09:36:50 +0000 (09:36 +0000)
Better fix for NaN angles (fixed turret_stdproc_track)
Fix unhanded damage type 0 on turret blow up
Support TFL_SHOOT_CUSTOM
Fix broken support units with TFL_TARGETSELECT_NOTURRETS
Fix idle_aim / defend aim
Fix missed body damage on support units
Fix in turret_tag_setup/turret_tag_fire_update for mangled md3 tags
Make tesla use te_csqc_lightningarc.
Restructure tela to conform a bit better.
Removed some un/rarely used crap
Updated units for above changes.
Fix harmless warning in pathlib

git-svn-id: svn://svn.icculus.org/nexuiz/trunk@6319 f962a42d-fe04-0410-a3ab-8c8b0445ebaa

17 files changed:
data/qcsrc/server/pathlib.qc
data/qcsrc/server/tturrets/include/turrets_early.qh
data/qcsrc/server/tturrets/system/system_damage.qc
data/qcsrc/server/tturrets/system/system_main.qc
data/qcsrc/server/tturrets/system/system_misc.qc
data/qcsrc/server/tturrets/units/unit_ewheel.qc
data/qcsrc/server/tturrets/units/unit_flac.qc
data/qcsrc/server/tturrets/units/unit_fusionreactor.qc
data/qcsrc/server/tturrets/units/unit_hellion.qc
data/qcsrc/server/tturrets/units/unit_hk.qc
data/qcsrc/server/tturrets/units/unit_machinegun.qc
data/qcsrc/server/tturrets/units/unit_mlrs.qc
data/qcsrc/server/tturrets/units/unit_phaser.qc
data/qcsrc/server/tturrets/units/unit_plasma.qc
data/qcsrc/server/tturrets/units/unit_targettrigger.qc
data/qcsrc/server/tturrets/units/unit_tessla.qc
data/qcsrc/server/tturrets/units/unit_walker.qc

index 606ab49..64aa906 100644 (file)
@@ -9,6 +9,8 @@
 \r
 #define medium spawnshieldtime\r
 \r
+//#define DEBUGPATHING\r
+\r
 entity openlist;\r
 entity closedlist;\r
 entity scraplist;\r
@@ -24,6 +26,10 @@ float pathlib_merge_cnt;
 float pathlib_recycle_cnt;\r
 float pathlib_searched_cnt;\r
 \r
+#ifdef DEBUGPATHING\r
+\r
+#endif\r
+\r
 float pathlib_bestopen_seached;\r
 float pathlib_bestcash_hits;\r
 float pathlib_bestcash_saved;\r
@@ -42,7 +48,7 @@ entity goal_node;
 entity best_open_node;\r
 .float is_path_node;\r
 \r
-//#define DEBUGPATHING\r
+\r
 #ifdef DEBUGPATHING\r
 float edge_show(vector point,float fsize);\r
 void mark_error(vector where,float lifetime);\r
@@ -900,14 +906,15 @@ entity pathlib_astar(vector from,vector to)
     if not(scraplist)\r
         scraplist      = spawn();\r
 \r
-    pathlib_closed_cnt     = 0;\r
-    pathlib_open_cnt       = 0;\r
-    pathlib_made_cnt       = 0;\r
-    pathlib_merge_cnt      = 0;\r
-    pathlib_searched_cnt   = 0;\r
-    pathlib_bestcash_hits  = 0;\r
-    pathlib_bestcash_saved = 0;\r
-    pathlib_recycle_cnt    = 0;\r
+    pathlib_closed_cnt       = 0;\r
+    pathlib_open_cnt         = 0;\r
+    pathlib_made_cnt         = 0;\r
+    pathlib_merge_cnt        = 0;\r
+    pathlib_searched_cnt     = 0;\r
+    pathlib_bestopen_seached = 0;\r
+    pathlib_bestcash_hits    = 0;\r
+    pathlib_bestcash_saved   = 0;\r
+    pathlib_recycle_cnt      = 0;\r
 \r
     pathlib_gridsize       = 128;\r
     pathlib_movecost       = pathlib_gridsize;\r
index eca0ade..7c5bf66 100644 (file)
@@ -448,11 +448,11 @@ wkacked to save mem.
 * Stuff to plug into requierd but unused callbacks.\r
 */\r
 /// Always return 1\r
-float turret_stdproc_true();\r
+//float turret_stdproc_true();\r
 /// Always return 0\r
-float turret_stdproc_false();\r
+//float turret_stdproc_false();\r
 /// Always return nothing at all\r
-void turret_stdproc_nothing();\r
+//void turret_stdproc_nothing();\r
 \r
 /*\r
 * Target selection\r
index 4c18d52..3a50575 100644 (file)
@@ -180,7 +180,7 @@ void turret_stdproc_die()
     }\r
 \r
 // Go boom\r
-    RadiusDamage (self,self, min(self.ammo,50),min(self.ammo,50) * 0.25,250,world,min(self.ammo,50)*5,0,world);\r
+    RadiusDamage (self,self, min(self.ammo,50),min(self.ammo,50) * 0.25,250,world,min(self.ammo,50)*5,DEATH_TURRET,world);\r
 \r
     if(self.damage_flags & TFL_DMG_DEATH_NORESPAWN)\r
     {\r
@@ -336,5 +336,3 @@ void turret_stdproc_damage (entity inflictor, entity attacker, float damage, flo
         baseent.think = turret_stdproc_die;\r
     }\r
 }\r
-\r
-\r
index 9f5981c..f690cbe 100644 (file)
@@ -1,13 +1,5 @@
 #define cvar_base "g_turrets_unit_"\r
 \r
-#define cvar_gets(s_base,s_add) strcat(s_base,s_add)\r
-/*\r
-string cvar_gets(string s_base,string s_add)\r
-{\r
-    return strcat(s_base,s_add);\r
-}\r
-*/\r
-\r
 void load_unit_settings(entity ent,string unitname,float is_reload)\r
 {\r
 \r
@@ -31,43 +23,48 @@ void load_unit_settings(entity ent,string unitname,float is_reload)
     {\r
         ent.enemy = world;\r
         ent.tur_head.avelocity = '0 0 0';\r
-        ent.tur_head.angles = ent.angles;\r
+\r
+        if (ent.turrcaps_flags & TFL_TURRCAPS_HEADATTACHED)\r
+            ent.tur_head.angles = '0 0 0';\r
+        else\r
+            ent.tur_head.angles = ent.angles;\r
     }\r
-    ent.health      = cvar(cvar_gets(sbase,"_health")) * ent.turret_scale_health;\r
-    ent.respawntime = cvar(cvar_gets(sbase,"_respawntime")) * ent.turret_scale_respawn;\r
-\r
-    ent.shot_dmg          = cvar(cvar_gets(sbase,"_shot_dmg")) * ent.turret_scale_damage;\r
-    ent.shot_refire       = cvar(cvar_gets(sbase,"_shot_refire")) * ent.turret_scale_refire;\r
-    ent.shot_radius       = cvar(cvar_gets(sbase,"_shot_radius")) * ent.turret_scale_damage;\r
-    ent.shot_speed        = cvar(cvar_gets(sbase,"_shot_speed"));\r
-    ent.shot_spread       = cvar(cvar_gets(sbase,"_shot_spread"));\r
-    ent.shot_force        = cvar(cvar_gets(sbase,"_shot_force")) * ent.turret_scale_damage;\r
-    ent.shot_volly        = cvar(cvar_gets(sbase,"_shot_volly"));\r
-    ent.shot_volly_refire = cvar(cvar_gets(sbase,"_shot_volly_refire")) * ent.turret_scale_refire;\r
-\r
-    ent.target_range         = cvar(cvar_gets(sbase,"_target_range")) * ent.turret_scale_range;\r
-    ent.target_range_min     = cvar(cvar_gets(sbase,"_target_range_min")) * ent.turret_scale_range;\r
-    ent.target_range_fire    = cvar(cvar_gets(sbase,"_target_range_fire")) * ent.turret_scale_range;\r
-    ent.target_range_optimal = cvar(cvar_gets(sbase,"_target_range_optimal")) * ent.turret_scale_range;\r
-\r
-    ent.target_select_rangebias  = cvar(cvar_gets(sbase,"_target_select_rangebias"));\r
-    ent.target_select_samebias   = cvar(cvar_gets(sbase,"_target_select_samebias"));\r
-    ent.target_select_anglebias  = cvar(cvar_gets(sbase,"_target_select_anglebias"));\r
-    ent.target_select_playerbias = cvar(cvar_gets(sbase,"_target_select_playerbias"));\r
+\r
+    ent.health      = cvar(strcat(sbase,"_health")) * ent.turret_scale_health;\r
+    ent.respawntime = cvar(strcat(sbase,"_respawntime")) * ent.turret_scale_respawn;\r
+\r
+    ent.shot_dmg          = cvar(strcat(sbase,"_shot_dmg")) * ent.turret_scale_damage;\r
+    ent.shot_refire       = cvar(strcat(sbase,"_shot_refire")) * ent.turret_scale_refire;\r
+    ent.shot_radius       = cvar(strcat(sbase,"_shot_radius")) * ent.turret_scale_damage;\r
+    ent.shot_speed        = cvar(strcat(sbase,"_shot_speed"));\r
+    ent.shot_spread       = cvar(strcat(sbase,"_shot_spread"));\r
+    ent.shot_force        = cvar(strcat(sbase,"_shot_force")) * ent.turret_scale_damage;\r
+    ent.shot_volly        = cvar(strcat(sbase,"_shot_volly"));\r
+    ent.shot_volly_refire = cvar(strcat(sbase,"_shot_volly_refire")) * ent.turret_scale_refire;\r
+\r
+    ent.target_range         = cvar(strcat(sbase,"_target_range")) * ent.turret_scale_range;\r
+    ent.target_range_min     = cvar(strcat(sbase,"_target_range_min")) * ent.turret_scale_range;\r
+    ent.target_range_fire    = cvar(strcat(sbase,"_target_range_fire")) * ent.turret_scale_range;\r
+    ent.target_range_optimal = cvar(strcat(sbase,"_target_range_optimal")) * ent.turret_scale_range;\r
+\r
+    ent.target_select_rangebias  = cvar(strcat(sbase,"_target_select_rangebias"));\r
+    ent.target_select_samebias   = cvar(strcat(sbase,"_target_select_samebias"));\r
+    ent.target_select_anglebias  = cvar(strcat(sbase,"_target_select_anglebias"));\r
+    ent.target_select_playerbias = cvar(strcat(sbase,"_target_select_playerbias"));\r
     //ent.target_select_fov = cvar(cvar_gets(sbase,"_target_select_fov"));\r
 \r
-    ent.ammo_max      = cvar(cvar_gets(sbase,"_ammo_max")) * ent.turret_scale_ammo;\r
-    ent.ammo_recharge = cvar(cvar_gets(sbase,"_ammo_recharge")) * ent.turret_scale_ammo;\r
+    ent.ammo_max      = cvar(strcat(sbase,"_ammo_max")) * ent.turret_scale_ammo;\r
+    ent.ammo_recharge = cvar(strcat(sbase,"_ammo_recharge")) * ent.turret_scale_ammo;\r
 \r
-    ent.aim_firetolerance_dist = cvar(cvar_gets(sbase,"_aim_firetolerance_dist"));\r
-    ent.aim_speed    = cvar(cvar_gets(sbase,"_aim_speed")) * ent.turret_scale_aim;\r
-    ent.aim_maxrot   = cvar(cvar_gets(sbase,"_aim_maxrot"));\r
-    ent.aim_maxpitch = cvar(cvar_gets(sbase,"_aim_maxpitch"));\r
+    ent.aim_firetolerance_dist = cvar(strcat(sbase,"_aim_firetolerance_dist"));\r
+    ent.aim_speed    = cvar(strcat(sbase,"_aim_speed")) * ent.turret_scale_aim;\r
+    ent.aim_maxrot   = cvar(strcat(sbase,"_aim_maxrot"));\r
+    ent.aim_maxpitch = cvar(strcat(sbase,"_aim_maxpitch"));\r
 \r
-    ent.track_type        = cvar(cvar_gets(sbase,"_track_type"));\r
-    ent.track_accel_pitch = cvar(cvar_gets(sbase,"_track_accel_pitch"));\r
-    ent.track_accel_rot   = cvar(cvar_gets(sbase,"_track_accel_rot"));\r
-    ent.track_blendrate   = cvar(cvar_gets(sbase,"_track_blendrate"));\r
+    ent.track_type        = cvar(strcat(sbase,"_track_type"));\r
+    ent.track_accel_pitch = cvar(strcat(sbase,"_track_accel_pitch"));\r
+    ent.track_accel_rot   = cvar(strcat(sbase,"_track_accel_rot"));\r
+    ent.track_blendrate   = cvar(strcat(sbase,"_track_blendrate"));\r
 \r
     if(is_reload)\r
         if(ent.turret_respawnhook)\r
@@ -75,6 +72,7 @@ void load_unit_settings(entity ent,string unitname,float is_reload)
 \r
 }\r
 \r
+/*\r
 float turret_stdproc_true()\r
 {\r
     return 1;\r
@@ -85,10 +83,12 @@ float turret_stdproc_false()
     return 0;\r
 }\r
 \r
+\r
 void turret_stdproc_nothing()\r
 {\r
     return;\r
 }\r
+*/\r
 \r
 /**\r
 ** updates enemy distances, predicted impact point/time\r
@@ -102,21 +102,6 @@ void turret_do_updates(entity t_turret)
     oldself = self;\r
     self = t_turret;\r
 \r
-    if (self.turrcaps_flags & TFL_TURRCAPS_HEADATTACHED)\r
-    {\r
-        self.tur_head.angles_x = self.tur_head.angles_x * -1;\r
-        self.angles_x = self.angles_x * -1;\r
-        makevectors(self.tur_head.angles + self.angles);\r
-        self.tur_head.angles_x = self.tur_head.angles_x * -1;\r
-        self.angles_x = self.angles_x * -1;\r
-    }\r
-    else\r
-    {\r
-        self.tur_head.angles_x = self.tur_head.angles_x * -1;\r
-        makevectors(self.tur_head.angles);\r
-        self.tur_head.angles_x = self.tur_head.angles_x * -1;\r
-    }\r
-\r
     enemy_pos = real_origin(self.enemy);\r
 \r
     turret_tag_fire_update();\r
@@ -222,149 +207,133 @@ vector turret_fovsearch_random()
 //.entity aim_mark;\r
 void turret_stdproc_track()\r
 {\r
-    vector wish_angle;  // This is where we want to aim\r
-\r
-    vector real_angle;  // This is where we can aim\r
+    vector target_angle; // This is where we want to aim\r
+    vector move_angle;   // This is where we can aim\r
     float f_tmp;\r
 \r
     if (self.track_flags == TFL_TRACK_NO)\r
         return;\r
 \r
-\r
     if(!self.tur_active)\r
-    {\r
-        wish_angle = self.idle_aim - ('1 0 0' * self.aim_maxpitch);\r
-    }\r
+        target_angle = self.idle_aim - ('1 0 0' * self.aim_maxpitch);\r
     else if (self.enemy == world)\r
     {\r
         if(time > self.lip)\r
             if (self.turrcaps_flags & TFL_TURRCAPS_HEADATTACHED)\r
-                wish_angle = self.idle_aim + self.angles;\r
+                target_angle = self.idle_aim + self.angles;\r
             else\r
-                wish_angle = self.idle_aim;\r
+                target_angle = self.idle_aim;\r
         else\r
-            wish_angle = vectoangles(normalize(self.tur_aimpos - self.tur_head.origin));\r
+            target_angle = vectoangles(normalize(self.tur_aimpos - self.tur_shotorg));\r
     }\r
     else\r
     {\r
         // Find the direction\r
-        /*\r
-        if (self.turrcaps_flags & TFL_TURRCAPS_HEADATTACHED)\r
-            wish_angle = normalize(self.tur_aimpos - self.tur_shotorg);\r
-        else\r
-        */\r
-        wish_angle = normalize(self.tur_aimpos - self.tur_shotorg);\r
-        wish_angle = vectoangles(wish_angle); // And make a angle\r
+        target_angle = normalize(self.tur_aimpos - self.tur_shotorg);\r
+        target_angle = vectoangles(target_angle); // And make a angle\r
     }\r
 \r
-    self.tur_head.angles_x = anglemods(self.tur_head.angles_x);\r
-    self.tur_head.angles_y = anglemods(self.tur_head.angles_y);\r
+    self.tur_head.angles_x = safeangle(self.tur_head.angles_x);\r
+    self.tur_head.angles_y = safeangle(self.tur_head.angles_y);\r
 \r
     // Find the diffrence between where we currently aim and where we want to aim\r
+    vector a_off;\r
+\r
+\r
     if (self.turrcaps_flags & TFL_TURRCAPS_HEADATTACHED)\r
     {\r
-            real_angle = wish_angle - (self.angles + self.tur_head.angles);\r
-            real_angle = shortangle_v(real_angle,(self.angles + self.tur_head.angles));\r
+        move_angle = target_angle - (self.angles + self.tur_head.angles);\r
+        move_angle = shortangle_vxy(move_angle,(self.angles + self.tur_head.angles));\r
+        a_off = '0 0 0';\r
+\r
     }\r
     else\r
     {\r
-        real_angle = wish_angle - self.tur_head.angles;\r
-        real_angle = shortangle_v(real_angle,self.tur_head.angles);\r
+        move_angle = target_angle - self.tur_head.angles;\r
+        move_angle = shortangle_vxy(move_angle,self.tur_head.angles);\r
+        a_off = self.angles;\r
     }\r
 \r
-    // Limit pitch\r
-    if (self.track_flags & TFL_TRACK_PITCH)\r
-        real_angle_x = bound(self.aim_maxpitch * -1,real_angle_x,self.aim_maxpitch);\r
-\r
-    // Limit rot\r
-    if (self.track_flags & TFL_TRACK_ROT)\r
-        real_angle_y = bound(self.aim_maxrot * -1,real_angle_y,self.aim_maxrot);\r
-\r
     switch(self.track_type)\r
     {\r
         case TFL_TRACKTYPE_STEPMOTOR:\r
-\r
-            /*\r
-            setorigin(self.aim_mark,self.tur_aimpos);\r
-            wish_angle = normalize(self.tur_aimpos -  self.tur_shotorg_updated);\r
-            real_angle = vectoangles(wish_angle);\r
-            self.tur_head.angles = real_angle;\r
-            return;\r
-            */\r
             f_tmp = self.aim_speed * self.ticrate; // dgr/sec -> dgr/tic\r
-\r
-            // Limit turning speed\r
-            real_angle_x = bound((-1 * f_tmp),real_angle_x, f_tmp);\r
-            real_angle_y = bound((-1 * f_tmp),real_angle_y, f_tmp);\r
-\r
-            // Limit pich and rot.\r
             if (self.track_flags & TFL_TRACK_PITCH)\r
-                self.tur_head.angles_x = bound((-1 * self.aim_maxpitch),self.tur_head.angles_x + real_angle_x,self.aim_maxpitch);\r
+            {\r
+                self.tur_head.angles_x += bound(-f_tmp,move_angle_x, f_tmp);\r
+                if(self.tur_head.angles_x + a_off_x > self.aim_maxpitch)\r
+                    self.tur_head.angles_x = a_off_x + self.aim_maxpitch;\r
+\r
+                if(self.tur_head.angles_x + a_off_x < -self.aim_maxpitch)\r
+                    self.tur_head.angles_x = a_off_x - self.aim_maxpitch;\r
+            }\r
 \r
             if (self.track_flags & TFL_TRACK_ROT)\r
-                self.tur_head.angles_y = bound((-1 * self.aim_maxrot),self.tur_head.angles_y  + real_angle_y,self.aim_maxrot);\r
+            {\r
+                self.tur_head.angles_y += bound(-f_tmp, move_angle_y, f_tmp);\r
+                if((self.tur_head.angles_y - a_off_y) > self.aim_maxrot)\r
+                    self.tur_head.angles_y = a_off_y + self.aim_maxrot;\r
+\r
+                if((self.tur_head.angles_y - a_off_y) < -self.aim_maxrot)\r
+                    self.tur_head.angles_y = a_off_y - self.aim_maxrot;\r
+            }\r
 \r
             return;\r
 \r
+        case TFL_TRACKTYPE_FLUIDINERTIA:\r
+            f_tmp = self.aim_speed * self.ticrate; // dgr/sec -> dgr/tic\r
+            move_angle_x = bound(-self.aim_speed, move_angle_x * self.track_accel_pitch * f_tmp,self.aim_speed);\r
+            move_angle_y = bound(-self.aim_speed, move_angle_y * self.track_accel_rot * f_tmp,self.aim_speed);\r
+            move_angle = (self.tur_head.avelocity * self.track_blendrate) + (move_angle * (1 - self.track_blendrate));\r
             break;\r
 \r
         case TFL_TRACKTYPE_FLUIDPRECISE:\r
 \r
-            real_angle_y = bound(self.aim_speed * -1,real_angle_y ,self.aim_speed);\r
-            real_angle_x = bound(self.aim_speed * -1,real_angle_x ,self.aim_speed);\r
-\r
-            break;\r
-\r
-        case TFL_TRACKTYPE_FLUIDINERTIA:\r
-\r
-            f_tmp = self.aim_speed * self.ticrate;\r
-\r
-            real_angle_y = bound(self.aim_speed * -1,real_angle_y * self.track_accel_rot * f_tmp,self.aim_speed);\r
-            real_angle_x = bound(self.aim_speed * -1,real_angle_x * self.track_accel_pitch * f_tmp,self.aim_speed);\r
-            real_angle = (self.tur_head.avelocity * self.track_blendrate) + (real_angle * (1 - self.track_blendrate));\r
-\r
-            self.tur_head.avelocity_z = real_angle_z;\r
+            move_angle_y = bound(-self.aim_speed, move_angle_y, self.aim_speed);\r
+            move_angle_x = bound(-self.aim_speed, move_angle_x, self.aim_speed);\r
 \r
             break;\r
     }\r
 \r
-    // Limit pitch\r
+    //  pitch\r
     if (self.track_flags & TFL_TRACK_PITCH)\r
     {\r
-        self.tur_head.avelocity_x = real_angle_x;\r
-        if (self.tur_head.angles_x > 360)\r
+        self.tur_head.avelocity_x = move_angle_x;\r
+        if((self.tur_head.angles_x + self.tur_head.avelocity_x * self.ticrate) + a_off_x > self.aim_maxpitch)\r
         {\r
-            self.tur_head.angles_x -= floor(self.tur_head.angles_x / 360) * 360;\r
-            //self.tur_head.angles_x = self.aim_maxpitch;\r
-            //self.tur_head.avelocity_x = 0;\r
+            self.tur_head.avelocity_x = 0;\r
+            self.tur_head.angles_x = a_off_x + self.aim_maxpitch;\r
         }\r
-        else if (self.tur_head.angles_x < -360)\r
+        if((self.tur_head.angles_x + self.tur_head.avelocity_x * self.ticrate) + a_off_x < -self.aim_maxpitch)\r
         {\r
-            self.tur_head.angles_x += floor(self.tur_head.angles_x / 360) * 360;\r
-            //self.tur_head.angles_x = (self.aim_maxpitch * -1);\r
-            //self.tur_head.avelocity_x = 0;\r
+            self.tur_head.avelocity_x = 0;\r
+            self.tur_head.angles_x = a_off_x - self.aim_maxpitch;\r
         }\r
+\r
     }\r
 \r
-    // Limit rot\r
+    //  rot\r
     if (self.track_flags & TFL_TRACK_ROT)\r
     {\r
-        self.tur_head.avelocity_y = real_angle_y;\r
-        if (self.tur_head.angles_y > 360)\r
+        self.tur_head.avelocity_y = move_angle_y;\r
+\r
+        if(((self.tur_head.angles_y + self.tur_head.avelocity_y * self.ticrate)- a_off_y) > self.aim_maxrot)\r
         {\r
-            self.tur_head.angles_y -= floor(self.tur_head.angles_y / 360) * 360;\r
-            //self.tur_head.angles_y = self.aim_maxrot;\r
-            //self.tur_head.avelocity_y = 0;\r
+            self.tur_head.avelocity_y = 0;\r
+            self.tur_head.angles_y = a_off_y + self.aim_maxrot;\r
         }\r
-        else if (self.tur_head.angles_y < -360)\r
+\r
+        if(((self.tur_head.angles_y + self.tur_head.avelocity_y * self.ticrate) - a_off_y) < -self.aim_maxrot)\r
         {\r
-            self.tur_head.angles_y += floor(self.tur_head.angles_y / 360) * 360;\r
-            //self.tur_head.angles_y = (self.aim_maxrot * -1);\r
-            //self.tur_head.avelocity_y = 0;\r
+            self.tur_head.avelocity_y = 0;\r
+            self.tur_head.angles_y = a_off_y - self.aim_maxrot;\r
         }\r
+\r
     }\r
+\r
 }\r
 \r
+\r
 /*\r
  + = implemented\r
  - = not implemented\r
@@ -400,7 +369,7 @@ float turret_stdproc_firecheck()
     if((self.shoot_flags & TFL_SHOOT_VOLLYALWAYS) && (self.volly_counter != self.shot_volly))\r
         return 1;\r
 \r
-    //\r
+    // Lack of zombies makes shooting dead things unnecessary :P\r
     if (self.firecheck_flags & TFL_FIRECHECK_DEAD)\r
         if (self.enemy.deadflag != DEAD_NO) return 0;\r
 \r
@@ -506,7 +475,8 @@ float turret_validate_target(entity e_turret,entity e_target,float validate_flag
        // enemy turrets\r
        if (validate_flags & TFL_TARGETSELECT_NOTURRETS)\r
         if (e_target.turret_firefunc || e_target.owner.tur_head == e_target)\r
-                       return -9;\r
+            if(e_target.team != e_turret.team) // Dont break support units.\r
+                return -9;\r
 \r
     // Missile\r
     if (e_target.flags & FL_PROJECTILE)\r
@@ -691,7 +661,7 @@ void turret_think()
 \r
     // Inactive turrets needs to run the think loop,\r
     // So they can handle animation and wake up if need be.\r
-    if(!self.tur_active)\r
+    if not (self.tur_active)\r
     {\r
         turret_stdproc_track();\r
         return;\r
@@ -700,7 +670,7 @@ void turret_think()
     //This is just wrong :|\r
     if(self.deadflag != DEAD_NO)\r
     {\r
-        dprint("Warning:dead turret running the think function!\n");\r
+        dprint("WARNING: dead turret running the think function!\n");\r
         return;\r
     }\r
 \r
@@ -727,6 +697,24 @@ void turret_think()
         }\r
         self.enemy = world;\r
     }\r
+    else if(self.shoot_flags & TFL_SHOOT_CUSTOM)\r
+    {\r
+        // This one is doing something oddball. assume its handles what needs to be handled.\r
+\r
+        // Predict?\r
+        if not((self.aim_flags & TFL_AIM_NO))\r
+            self.tur_aimpos = turret_stdproc_aim_generic();\r
+\r
+        // Turn & pitch?\r
+        if (!self.track_flags & TFL_TRACK_NO)\r
+            turret_stdproc_track();\r
+\r
+        turret_do_updates(self);\r
+\r
+        // Fire?\r
+        if (self.turret_firecheckfunc())\r
+            turret_fire();\r
+    }\r
     else\r
     {\r
         // Special case for volly always. if it fired once it must compleate the volly.\r
@@ -737,7 +725,6 @@ void turret_think()
                 if not((self.aim_flags & TFL_AIM_NO))\r
                     self.tur_aimpos = turret_stdproc_aim_generic();\r
 \r
-\r
                 // Turn & pitch\r
                 if (!self.track_flags & TFL_TRACK_NO)\r
                     turret_stdproc_track();\r
@@ -777,20 +764,11 @@ void turret_think()
         else\r
             self.lip = time + cvar("g_turrets_aimidle_delay"); // Keep track of the last time we had a target.\r
 \r
-\r
-        /*\r
-        turret_do_updates(self);\r
-        if (self.turret_firecheckfunc() > 0)\r
-            turret_fire();\r
-        */\r
-\r
-        //turret_do_updates(self);\r
-        // Predict or whatnot\r
+        // Predict?\r
         if not((self.aim_flags & TFL_AIM_NO))\r
             self.tur_aimpos = turret_stdproc_aim_generic();\r
 \r
-        //turret_do_updates(self);\r
-        // Turn & pitch\r
+        // Turn & pitch?\r
         if (!self.track_flags & TFL_TRACK_NO)\r
             turret_stdproc_track();\r
 \r
@@ -798,13 +776,11 @@ void turret_think()
         // Fire?\r
         if (self.turret_firecheckfunc())\r
             turret_fire();\r
-\r
-\r
-\r
     }\r
 \r
     // do any per-turret stuff\r
-    self.turret_postthink();\r
+    if(self.turret_postthink)\r
+        self.turret_postthink();\r
 }\r
 \r
 void turret_fire()\r
@@ -1132,18 +1108,27 @@ float turret_stdproc_init (string cvar_base_name)
         }\r
     }\r
 \r
-\r
 // Put pices in place\r
-    if (!(self.turrcaps_flags & TFL_TURRCAPS_HEADATTACHED))\r
+    if not (self.turrcaps_flags & TFL_TURRCAPS_HEADATTACHED)\r
         setorigin(self.tur_head,self.origin);\r
 \r
-    // In target defense mode, aim on the spot to defens when idle.\r
-    if (self.tur_defend)\r
-        self.idle_aim  = self.tur_head.angles + angleofs(self.tur_head,self.tur_defend);\r
+    // In target defend mode, aim on the spot to defend when idle.\r
+    if(self.turrcaps_flags & TFL_TURRCAPS_HEADATTACHED)\r
+    {\r
+        if (self.tur_defend)\r
+            self.idle_aim  = self.tur_head.angles + angleofs(self.tur_head,self.tur_defend);\r
+        else\r
+            self.idle_aim  = '0 0 0';\r
+    }\r
     else\r
-        self.idle_aim  = self.angles;\r
+    {\r
+        if (self.tur_defend)\r
+            self.idle_aim  = self.tur_head.angles + angleofs(self.tur_head,self.tur_defend);\r
+        else\r
+            self.idle_aim  = self.angles;\r
+    }\r
 \r
-    if (!(self.turrcaps_flags & TFL_TURRCAPS_HEADATTACHED))\r
+    if not (self.turrcaps_flags & TFL_TURRCAPS_HEADATTACHED)\r
         self.tur_head.angles    = self.idle_aim;\r
 \r
     if (!self.health)\r
@@ -1171,7 +1156,8 @@ float turret_stdproc_init (string cvar_base_name)
         self.turret_score_target    = turret_stdproc_targetscore_support;\r
         self.turret_firecheckfunc   = turret_stdproc_firecheck;\r
         self.turret_firefunc        = turret_stdproc_fire;\r
-        self.turret_postthink       = turret_stdproc_nothing;\r
+        //self.turret_postthink       = turret_stdproc_nothing;\r
+        self.event_damage           = turret_stdproc_damage;\r
         self.tur_head.event_damage  = turret_stdproc_damage;\r
     }\r
     else\r
@@ -1179,10 +1165,10 @@ float turret_stdproc_init (string cvar_base_name)
         self.turret_score_target    = turret_stdproc_targetscore_generic;\r
         self.turret_firecheckfunc   = turret_stdproc_firecheck;\r
         self.turret_firefunc        = turret_stdproc_fire;\r
-        self.turret_postthink       = turret_stdproc_nothing;\r
+        //self.turret_postthink       = turret_stdproc_nothing;\r
         self.event_damage           = turret_stdproc_damage;\r
         self.tur_head.event_damage  = turret_stdproc_damage;\r
-        self.turret_addtarget       = turret_stdproc_false;\r
+        //self.turret_addtarget       = turret_stdproc_false;\r
     }\r
 \r
     self.use = turret_stdproc_use;\r
index a5e2e42..20bea1e 100644 (file)
@@ -1,6 +1,20 @@
-//--// Some supptort routines //--//\r
+//--// Some support routines //--//\r
 \r
-#define anglemods(a) (a - floor(a / 360) * 360)\r
+#define anglemodss(a) (a - floor(a / 360) * 360)\r
+float(float v) anglemods =\r
+{\r
+       v = v - 360 * floor(v / 360);\r
+       return v;\r
+};\r
+float safeangle(float a)\r
+{\r
+    if((a > -361) && (a < 361))\r
+        return a;\r
+\r
+    a -= (360 * floor(a / 360));\r
+\r
+    return a;\r
+}\r
 \r
 float shortangle_f(float ang1,float ang2)\r
 {\r
@@ -29,6 +43,16 @@ vector shortangle_v(vector ang1,vector ang2)
     return vtmp;\r
 }\r
 \r
+vector shortangle_vxy(vector ang1,vector ang2)\r
+{\r
+    vector vtmp;\r
+\r
+    vtmp_x = shortangle_f(ang1_x,ang2_x);\r
+    vtmp_y = shortangle_f(ang1_y,ang2_y);\r
+\r
+    return vtmp;\r
+}\r
+\r
 // Get real origin\r
 vector real_origin(entity ent)\r
 {\r
@@ -235,15 +259,20 @@ vector angleofs3(vector from,vector from_a, entity to)
     return v_res;\r
 }\r
 \r
-float turret_tag_setup(float linked)\r
+float turret_tag_setup()\r
 {\r
-    // Laters dooz\r
-    if (linked)\r
+    if(!self.tur_head)\r
+    {\r
+        dprint("Call to turret_tag_setup with self.tur_head missing!\n");\r
+        self.tur_shotorg = '0 0 0';\r
         return 0;\r
+    }\r
 \r
     setorigin(self.tur_head,gettaginfo(self,gettagindex(self,"tag_head")));\r
     self.tur_shotorg = gettaginfo(self.tur_head,gettagindex(self.tur_head,"tag_fire"));\r
 \r
+    v_forward = normalize(v_forward);\r
+\r
     return 1;\r
 }\r
 \r
@@ -251,11 +280,14 @@ float turret_tag_fire_update()
 {\r
     if(!self.tur_head)\r
     {\r
+        dprint("Call to turret_tag_fire_update with self.tur_head missing!\n");\r
         self.tur_shotorg = '0 0 0';\r
-        return 1;\r
+        return 0;\r
     }\r
 \r
     self.tur_shotorg = gettaginfo(self.tur_head,gettagindex(self.tur_head,"tag_fire"));\r
+    v_forward = normalize(v_forward);\r
+\r
     //dprint("update: tur_shotorg: ",vtos(self.tur_shotorg)," origin:", vtos(self.tur_head.origin), " angels: ", vtos(self.tur_head.angles),"\n");\r
 \r
     return 1;\r
index 3cdce87..4968fec 100644 (file)
@@ -4,7 +4,7 @@ void turret_ewheel_projectile_explode()
 \r
     org2 = findbetterlocation (self.origin, 8);\r
     pointparticles(particleeffectnum("laser_impact"), org2, trace_plane_normal * 1000, 1);\r
-\r
+    //w_deathtypestring = "saw the eweel. to late.";\r
 #ifdef TURRET_DEBUG\r
     float d;\r
 \r
@@ -61,183 +61,277 @@ void ewheel_attack()
 \r
 }\r
 \r
-#define EWHEEL_MASS 25\r
-#define EWHEEL_MAXSPEED 800\r
-#define EWHEEL_ACCEL_SLOW 100\r
-#define EWHEEL_ACCEL_FAST 350\r
-#define EWHEEL_BREAK_SLOW 150\r
-#define EWHEEL_BREAK_FAST 250\r
-#define EWHEEL_DRAG 0.25\r
-\r
-void ewheel_enemymove()\r
+float ewheel_moveverb_path(float eval)\r
 {\r
-    vector wish_angle,real_angle,steer,avoid;\r
-    float turn_limit,angle_ofs;\r
+    switch (eval)\r
+    {\r
+    case VCM_EVAL:\r
 \r
-    //steer = steerlib_attract2(point,0.5,2000,0.95);\r
-    steer = steerlib_pull(self.enemy.origin);\r
-    avoid = steerlib_traceavoid(0.3,350);\r
+        if (self.pathcurrent)\r
+            return verb.verb_static_value;\r
 \r
-    wish_angle = normalize(avoid * 0.5 + steer);\r
-    wish_angle = vectoangles(wish_angle);\r
-    real_angle = wish_angle - self.angles;\r
+        return VS_CALL_NO;\r
+        break;\r
 \r
-    if (real_angle_x > self.angles_x)\r
-    {\r
-        if (real_angle_x >= 180)\r
-            real_angle_x -= 360;\r
-    }\r
-    else\r
-    {\r
-        if (real_angle_x <= -180)\r
-            real_angle_x += 360;\r
-    }\r
+    case VCM_DO:\r
+        // Do we have a path?\r
+        if not(self.pathcurrent)\r
+            return VS_CALL_NO;\r
+        else\r
+        {\r
+            // Are we close enougth to a path node to switch to the next?\r
+            if (vlen(self.origin  - self.pathcurrent.origin) < 32)\r
+                if (self.pathcurrent.path_next == world)\r
+                {\r
+                    // Path endpoint reached\r
+                    pathlib_deletepath(self.pathcurrent.owner);\r
+                    self.pathcurrent = world;\r
+\r
+                    if (self.pathgoal)\r
+                    {\r
+                        if (self.pathgoal.use)\r
+                            self.pathgoal.use();\r
+\r
+                        if (self.pathgoal.enemy)\r
+                        {\r
+                            self.pathcurrent = pathlib_astar(self.pathgoal.origin,self.pathgoal.enemy.origin);\r
+                            self.pathgoal = self.pathgoal.enemy;\r
+                        }\r
+                    }\r
+                    else\r
+                        self.pathgoal = world;\r
+                }\r
+                else\r
+                    self.pathcurrent = self.pathcurrent.path_next;\r
+        }\r
 \r
-    if (real_angle_y > self.tur_head.angles_y)\r
-    {\r
-        if (real_angle_y >= 180)\r
-            real_angle_y -= 360;\r
+\r
+        if (self.pathcurrent)\r
+        {\r
+            switch (self.waterlevel)\r
+            {\r
+            case 0:\r
+            case 1:\r
+            case 2:\r
+            case 3:\r
+            }\r
+\r
+            self.moveto = self.pathcurrent.origin;\r
+            self.steerto = steerlib_attract2(self.moveto,0.5,500,0.95);\r
+\r
+            self.frame += 1;\r
+            movelib_move_simple(v_forward,cvar("g_turrets_unit_ewheel_speed_slow"),0.4);\r
+\r
+            return VS_CALL_YES_DOING;\r
+        }\r
+        else\r
+            return VS_CALL_YES_DONE;\r
+\r
+        break;\r
+\r
+    case VCM_REMOVE:\r
+\r
+        if (self.pathcurrent)\r
+            pathlib_deletepath(self.pathcurrent.owner);\r
+\r
+        self.pathcurrent = world;\r
+\r
+        return VS_CALL_YES_DONE;\r
+\r
+        break;\r
     }\r
-    else\r
+\r
+    return VS_CALL_YES_DONE;\r
+}\r
+\r
+float ewheel_moveverb_enemy(float eval)\r
+{\r
+    switch (eval)\r
     {\r
-        if (real_angle_y <= -180)\r
-            real_angle_y += 360;\r
-    }\r
+    case VCM_EVAL:\r
+            if(self.enemy)\r
+                return verb.verb_static_value;\r
 \r
-    turn_limit = cvar("g_turrets_unit_ewheel_turnrate");\r
-    // Convert from dgr / sec to dgr / tic\r
-    turn_limit    = turn_limit / (1 / self.ticrate);\r
-    angle_ofs     = fabs(real_angle_y);\r
-    real_angle_y  = bound(turn_limit * -1,real_angle_y,turn_limit);\r
-    self.angles_y = (self.angles_y + real_angle_y);\r
+        return VS_CALL_NO;\r
 \r
-    // Simulate banking\r
-    self.angles_z = bound(-45,real_angle_y * -2,45);\r
+        break;\r
 \r
-    if (self.frame > 40)\r
-        self.frame = 1;\r
+    case VCM_DO:\r
 \r
-    makevectors(self.angles);\r
-    if (self.tur_dist_aimpos > self.target_range_optimal)\r
-    {\r
-        if ( angle_ofs < 1 )\r
+        self.moveto  = self.enemy.origin;\r
+        self.steerto = steerlib_arrive(self.enemy.origin,self.target_range_optimal);\r
+\r
+        if (self.tur_dist_enemy > self.target_range_optimal)\r
         {\r
-            self.frame += 2;\r
-            movelib_move(v_forward * EWHEEL_ACCEL_FAST,EWHEEL_MAXSPEED,EWHEEL_DRAG,EWHEEL_MASS,0);\r
+            if ( self.tur_head.spawnshieldtime < 1 )\r
+            {\r
+                self.frame += 2;\r
+                movelib_move_simple(v_forward ,cvar("g_turrets_unit_ewheel_speed_fast"),0.4);\r
+            }\r
+            else if (self.tur_head.spawnshieldtime < 2)\r
+            {\r
+                self.frame += 1;\r
+                movelib_move_simple(v_forward,cvar("g_turrets_unit_ewheel_speed_slow"),0.4);\r
+            }\r
+            else\r
+            {\r
+                self.frame += 1;\r
+                movelib_move_simple(v_forward,cvar("g_turrets_unit_ewheel_speed_slower"),0.4);\r
+            }\r
         }\r
-        else if (angle_ofs < 2)\r
+        else if (self.tur_dist_enemy < self.target_range_min)\r
         {\r
-            self.frame += 1;\r
-            movelib_move(v_forward * EWHEEL_ACCEL_SLOW,EWHEEL_MAXSPEED,EWHEEL_DRAG,EWHEEL_MASS,EWHEEL_BREAK_SLOW);\r
+            self.frame -= 1;\r
+            movelib_move_simple(v_forward * -1,cvar("g_turrets_unit_ewheel_speed_slow"),0.4);\r
         }\r
         else\r
         {\r
-            movelib_move('0 0 0',EWHEEL_MAXSPEED,EWHEEL_DRAG,EWHEEL_MASS,EWHEEL_BREAK_FAST);\r
+            movelib_beak_simple(cvar("g_turrets_unit_ewheel_speed_stop"));\r
         }\r
+\r
+        return VS_CALL_YES_DOING;\r
     }\r
-    else\r
-        movelib_move('0 0 0',EWHEEL_MAXSPEED,EWHEEL_DRAG,EWHEEL_MASS,EWHEEL_BREAK_FAST);\r
+\r
+\r
+    return VS_CALL_YES_DONE;\r
 }\r
 \r
-void ewheel_roammove()\r
+float ewheel_moveverb_runaway(float eval)\r
 {\r
-    movelib_move(v_forward,EWHEEL_MAXSPEED,0,EWHEEL_MASS,EWHEEL_BREAK_SLOW);\r
-    self.angles_z = 0;\r
+    switch (eval)\r
+    {\r
+    case VCM_EVAL:\r
+            if(self.enemy)\r
+            if(self.health < 50)\r
+                return verb.verb_static_value;\r
 \r
-    /*\r
-    vector wish_angle,real_angle,steer,avoid;\r
-    float turn_limit,angle_ofs;\r
-    float dist;\r
+            return VS_CALL_NO;\r
+        break;\r
 \r
-    return;\r
+    case VCM_DO:\r
+        self.steerto = (steerlib_push(self.enemy.origin) * 0.7) + (steerlib_traceavoid_flat(0.3, 500, '0 0 128') * 0.3);\r
+        self.moveto  = self.origin + self.steerto * 1000;\r
 \r
-    dist = vlen(self.origin - self.pos1);\r
+        self.frame += 2;\r
+        movelib_move_simple(v_forward ,cvar("g_turrets_unit_ewheel_speed_fast"),0.4);\r
 \r
-    //steer = steerlib_attract2(point,0.5,2000,0.95);\r
-    steer = steerlib_pull(self.pos1);\r
-    avoid = steerlib_traceavoid(0.3,350);\r
+        return VS_CALL_YES_DOING;\r
 \r
-    wish_angle = normalize(avoid * 0.5 + steer);\r
-    wish_angle = vectoangles(wish_angle);\r
-    real_angle = wish_angle - self.angles;\r
+        break;\r
+    }\r
 \r
-    real_angle_y = shortangle_f(real_angle_y,self.angles_y);\r
+    return VS_CALL_YES_DONE;\r
+}\r
 \r
-    turn_limit = cvar("g_turrets_unit_ewheel_turnrate");\r
-    // Convert from dgr/sec to dgr/tic\r
-    turn_limit  = turn_limit / (1 / self.ticrate);\r
-    angle_ofs = fabs(real_angle_y);\r
+float ewheel_moveverb_idle(float eval)\r
+{\r
+    switch (eval)\r
+    {\r
+    case VCM_EVAL:\r
+            if(self.enemy)\r
+                return VS_CALL_NO;\r
 \r
-    real_angle_y = bound(turn_limit * -1,real_angle_y,turn_limit);\r
-    self.angles_y = (self.angles_y + real_angle_y);\r
+        return verb.verb_static_value;\r
 \r
-    self.angles_z = bound(-12,real_angle_y * -1,12);\r
+        break;\r
 \r
-    if(self.frame > 40)\r
-        self.frame = 1;\r
+    case VCM_DO:\r
+        self.moveto = self.origin;\r
 \r
-    makevectors(self.angles);\r
-    float lspeed;\r
-    lspeed = vlen(self.velocity);\r
+        if(vlen(self.velocity))\r
+            movelib_beak_simple(cvar("g_turrets_unit_ewheel_speed_stop"));\r
 \r
-    if((dist < 64)||(self.phase < time))\r
-    {\r
-        movelib_move('0 0 0',150,0,50,200);\r
-        self.pos1 = self.origin + v_forward * 256 + randomvec() * 128;\r
-        self.pos1_z = self.origin_z;\r
-        self.phase = time + 5;\r
+        return VS_CALL_YES_DOING;\r
     }\r
-    else if(dist < 128)\r
-    {\r
-        self.frame += 1;\r
-        if(lspeed > 100)\r
-            movelib_move(v_forward * 50,150,0,50,50);\r
-        else\r
-            movelib_move(v_forward * 100,150,0,50,0);\r
-    }\r
-    else\r
-    {\r
-        self.frame += 1;\r
-        if(angle_ofs > 10)\r
-            movelib_move(v_forward * 50,150,0,50,50);\r
-        else\r
-            movelib_move(v_forward * 250,150,0,50,0);\r
-    }\r
-    */\r
+\r
+    return VS_CALL_YES_DONE;\r
 }\r
 \r
 void ewheel_postthink()\r
 {\r
-    if (self.enemy)\r
-        ewheel_enemymove();\r
-    else\r
-        ewheel_roammove();\r
+    float vz;\r
+    vector wish_angle,real_angle;\r
 \r
-}\r
+    vz = self.velocity_z;\r
 \r
+    self.angles_x = anglemods(self.angles_x);\r
+    self.angles_y = anglemods(self.angles_y);\r
+\r
+    self.angles_x *= -1;\r
+    makevectors(self.angles);\r
+    self.angles_x *= -1;\r
+\r
+    wish_angle = normalize(self.steerto);\r
+    wish_angle = vectoangles(wish_angle);\r
+    real_angle = wish_angle - self.angles;\r
+    real_angle = shortangle_vxy(real_angle,self.tur_head.angles);\r
+\r
+    self.tur_head.spawnshieldtime = fabs(real_angle_y);\r
+    real_angle_y  = bound(self.tur_head.aim_speed * -1,real_angle_y,self.tur_head.aim_speed);\r
+    self.angles_y = (self.angles_y + real_angle_y);\r
+\r
+    // Simulate banking\r
+    self.angles_z = bound(-45,real_angle_y * -2.5,45);\r
+\r
+    verbstack_pop(self.verbs_move);\r
+\r
+    if (self.frame > 40)\r
+        self.frame = 1;\r
+\r
+    if (self.frame < 1)\r
+        self.frame = 40;\r
+\r
+\r
+    self.velocity_z = vz;\r
+}\r
 \r
 void ewheel_respawnhook()\r
 {\r
+    entity e;\r
+\r
     setorigin(self,self.pos1);\r
+\r
+    if (self.target != "")\r
+    {\r
+        e = find(world,targetname,self.target);\r
+        if (!e)\r
+        {\r
+            dprint("Initital waypoint for ewheel does NOT exsist, fix your map!\n");\r
+            self.target = "";\r
+        }\r
+\r
+        if (e.classname != "turret_checkpoint")\r
+            dprint("Warning: not a turrret path\n");\r
+        else\r
+        {\r
+            self.pathcurrent = WALKER_PATH(self.origin,e.origin);\r
+            self.pathgoal = e;\r
+        }\r
+    }\r
 }\r
 \r
 void ewheel_diehook()\r
 {\r
-}\r
+    turret_trowgib2(self.origin,self.velocity + v_up * 400,'-0.6 -0.2 -02',self,time + random() * 2 +3);\r
+\r
+    if (self.pathcurrent)\r
+        pathlib_deletepath(self.pathcurrent.owner);\r
+\r
+    self.pathcurrent = world;\r
+\r
+    if (self.damage_flags & TFL_DMG_DEATH_NORESPAWN)\r
+    {\r
+        verbstack_flush(self.verbs_move);\r
+        remove(self.verbs_move);\r
+    }\r
 \r
-float ewheel_firecheck()\r
-{\r
-    bprint("Firecheck\n");\r
-    return 1;\r
 }\r
 \r
 void turret_ewheel_dinit()\r
 {\r
     entity e;\r
 \r
-    if (self.netname == "")      self.netname     = "Ewheel Turret";\r
-\r
-    // self.ticrate = 0.05;\r
+    if (self.netname == "")      self.netname     = "eWheel Turret";\r
 \r
     if (self.target != "")\r
     {\r
@@ -261,28 +355,23 @@ void turret_ewheel_dinit()
     self.turret_respawnhook = ewheel_respawnhook;\r
     self.turret_diehook = ewheel_diehook;\r
 \r
-    self.ticrate = 0.05;\r
     if (turret_stdproc_init("ewheel_std") == 0)\r
     {\r
         remove(self);\r
         return;\r
     }\r
-    //self.turret_firecheckfunc = ewheel_firecheck;\r
 \r
-    self.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;\r
+    self.target_select_flags   = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;\r
     self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;\r
-    self.damage_flags |= TFL_DMG_DEATH_NOGIBS;\r
+    self.damage_flags          |= TFL_DMG_DEATH_NOGIBS;\r
 \r
-    //self.flags      = FL_CLIENT;\r
     self.iscreature = TRUE;\r
     self.movetype   = MOVETYPE_WALK;\r
-    self.gravity = 0.01;\r
     self.solid      = SOLID_SLIDEBOX;\r
     self.takedamage = DAMAGE_AIM;\r
 \r
     setmodel(self,"models/turrets/ewheel-base.md3");\r
     setmodel(self.tur_head,"models/turrets/ewheel-gun1.md3");\r
-\r
     setattachment(self.tur_head,self,"tag_head");\r
 \r
     self.pos1 = self.origin;\r
@@ -293,8 +382,35 @@ void turret_ewheel_dinit()
     self.turret_firefunc  = ewheel_attack;\r
     self.turret_postthink = ewheel_postthink;\r
     self.tur_head.frame = 1;\r
-}\r
 \r
+    self.verbs_move = spawn();\r
+    verbstack_push(self.verbs_move, ewheel_moveverb_idle,   WVM_IDLE,  0);\r
+    verbstack_push(self.verbs_move, ewheel_moveverb_enemy,  WVM_ENEMY, 0);\r
+    verbstack_push(self.verbs_move, ewheel_moveverb_path,   WVM_PATH,  0);\r
+    verbstack_push(self.verbs_move, ewheel_moveverb_runaway,WVM_PANIC,  0);\r
+\r
+    // Convert from dgr / sec to dgr / tic\r
+    self.tur_head.aim_speed = cvar("g_turrets_unit_ewheel_turnrate");\r
+    self.tur_head.aim_speed = self.tur_head.aim_speed / (1 / self.ticrate);\r
+\r
+    if (self.target != "")\r
+    {\r
+        e = find(world,targetname,self.target);\r
+        if (!e)\r
+        {\r
+            dprint("Initital waypoint for ewheel does NOT exsist, fix your map!\n");\r
+            self.target = "";\r
+        }\r
+\r
+        if (e.classname != "turret_checkpoint")\r
+            dprint("Warning: not a turrret path\n");\r
+        else\r
+        {\r
+            self.pathcurrent = WALKER_PATH(self.origin,e.origin);\r
+            self.pathgoal = e;\r
+        }\r
+    }\r
+}\r
 \r
 void spawnfunc_turret_ewheel()\r
 {\r
index 55198b9..6c2329f 100644 (file)
@@ -45,6 +45,8 @@ void turret_flac_projectile_explode()
 \r
     // FIXME: tur_impacttime is not accurate enougth, this is a dirty hakk to make flac work.\r
 \r
+    //w_deathtypestring = "got caught in the flack.";\r
+\r
     if(self.enemy != world)\r
     if(self.cnt < time)\r
     if(vlen(self.origin - self.enemy.origin) > self.owner.shot_radius * 0.25)\r
@@ -100,7 +102,7 @@ void turret_flac_dinit()
     setmodel(self,"models/turrets/base.md3");\r
     setmodel(self.tur_head,"models/turrets/flac.md3");\r
 \r
-    if (!turret_tag_setup(0))\r
+    if (!turret_tag_setup())\r
         dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");\r
 \r
     // Our fire routine\r
index 32b3699..3a76f6e 100644 (file)
@@ -58,7 +58,7 @@ void turret_fusionreactor_dinit()
     setmodel(self,"models/turrets/base.md3");\r
     setmodel(self.tur_head,"models/turrets/reactor.md3");\r
 \r
-    //if(!turret_tag_setup(0))\r
+    //if(!turret_tag_setup())\r
     //    dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");\r
 \r
     self.tur_head.scale = 0.75;\r
index add5f91..30882f4 100644 (file)
@@ -159,6 +159,7 @@ void turret_hellion_missile_explode()
     WriteCoord (MSG_BROADCAST, org2_y);\r
     WriteCoord (MSG_BROADCAST, org2_z);\r
 \r
+    //w_deathtypestring = "could not dodge the twin missiles.";\r
     self.event_damage = SUB_Null;\r
     d = RadiusDamage (self, self.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, world, self.owner.shot_force, DEATH_TURRET, world);\r
 \r
@@ -196,7 +197,7 @@ void turret_hellion_dinit()
     setmodel(self,"models/turrets/base.md3");\r
     setmodel(self.tur_head,"models/turrets/hellion.md3");\r
 \r
-    if (!turret_tag_setup(0))\r
+    if (!turret_tag_setup())\r
         dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");\r
 \r
     // Our fire routine\r
index 9769172..0d1aa91 100644 (file)
@@ -363,6 +363,7 @@ void turret_hk_missile_explode()
     if ((other == self.owner)||(other == self.owner.tur_head))\r
         return;\r
 \r
+    //w_deathtypestring = "got hunted to extinction";\r
     //vector   org2;\r
     sound (self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);\r
     org2 = findbetterlocation (self.origin, 16);\r
@@ -443,7 +444,7 @@ void turret_hk_dinit()
     setmodel(self,"models/turrets/base.md3");\r
     setmodel(self.tur_head,"models/turrets/hk.md3");\r
 \r
-    if (!turret_tag_setup(0))\r
+    if (!turret_tag_setup())\r
         dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");\r
 \r
     // Our fire routine\r
index e145d52..fcb381b 100644 (file)
@@ -11,6 +11,7 @@ void turret_machinegun_attack()
     sound (self, CHAN_WEAPON, "weapons/uzi_fire.wav", VOL_BASE, ATTN_NORM);\r
     fireBallisticBullet (self.tur_shotorg, self.tur_shotdir_updated,self.shot_spread, self.shot_speed, 5, self.shot_dmg, 0, self.shot_force, DEATH_TURRET, 0, 1, cvar("g_balance_uzi_bulletconstant"));\r
 \r
+    //w_deathtypestring = "had an alergic reaction due to 10 kilos of led";\r
     te_smallflash(self.tur_shotorg);\r
     //  trailparticles(self,particleeffectnum("EF_MGTURRETTRAIL"),self.tur_shotorg_updated,trace_endpos);\r
 \r
@@ -52,7 +53,7 @@ void turret_machinegun_std_init()
     setmodel(self,"models/turrets/base.md3");\r
     setmodel(self.tur_head,"models/turrets/machinegun.md3");\r
 \r
-    if (!turret_tag_setup(0))\r
+    if (!turret_tag_setup())\r
         dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");\r
 \r
     // Our fire routine\r
index 3ee8f02..465cf43 100644 (file)
@@ -77,7 +77,7 @@ void turret_mlrs_rocket_explode()
     sound (self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);\r
     org2 = findbetterlocation (self.origin, 16);\r
     pointparticles(particleeffectnum("rocket_explode"), org2, '0 0 0', 1);\r
-\r
+    //w_deathtypestring = "dident escape the rocket barrage";\r
 #ifdef TURRET_DEBUG\r
     float d;\r
 \r
@@ -117,7 +117,7 @@ void turret_mlrs_dinit()
     setmodel(self,"models/turrets/base.md3");\r
     setmodel(self.tur_head,"models/turrets/mlrs.md3");\r
 \r
-    if (!turret_tag_setup(0))\r
+    if (!turret_tag_setup())\r
         dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");\r
 \r
     // Our fire routine\r
index d01f038..eb99202 100644 (file)
@@ -60,6 +60,7 @@ void beam_think()
     entity oldself;\r
     oldself = self;\r
     self = self.owner;\r
+    //w_deathtypestring = "was phased out of existence";\r
     FireImoBeam (   self.tur_shotorg,\r
                     self.tur_shotorg + self.tur_shotdir_updated * self.target_range_fire,\r
                     '-1 -1 -1' * self.shot_radius,\r
@@ -124,7 +125,7 @@ void turret_phaser_dinit()
     setmodel(self,"models/turrets/base.md3");\r
     setmodel(self.tur_head,"models/turrets/phaser.md3");\r
 \r
-    if (!turret_tag_setup(0))\r
+    if (!turret_tag_setup())\r
         dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");\r
 \r
     self.turret_firecheckfunc = turret_phaser_firecheck;\r
index cfc2804..ad749c8 100644 (file)
@@ -9,30 +9,11 @@ void turret_plasma_projectile_explode();
 \r
 void turret_plasma_postthink()\r
 {\r
-\r
-\r
     if (self.tur_head.frame != 0)\r
         self.tur_head.frame = self.tur_head.frame + 1;\r
 \r
     if (self.tur_head.frame > 5)\r
         self.tur_head.frame = 0;\r
-\r
-    setsize(self,self.mins,self.maxs);\r
-    setsize(self.tur_head,self.tur_head.mins,self.tur_head.maxs);\r
-\r
-    /*\r
-    float h;\r
-    h = self.health / self.tur_health;\r
-    if(h<0.95)\r
-    {\r
-        if( (0.5 + random()) > h)\r
-        {\r
-            //bprint("Spark!\n");\r
-            //void(vector org, vector vel, float howmany) te_spark = #411;\r
-            te_spark(0.5 * (self.absmin + self.absmax) + (randomvec() * 64),randomvec() * 256,(1 - h) * 50);\r
-        }\r
-    }\r
-    */\r
 }\r
 \r
 void turret_plasma_dual_postthink()\r
@@ -48,15 +29,12 @@ void turret_plasma_attack()
 {\r
     entity proj;\r
 \r
-    turret_tag_fire_update();\r
-\r
     sound (self, CHAN_WEAPON, "weapons/hagar_fire.wav", VOL_BASE, ATTN_NORM);\r
     pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);\r
 \r
     proj                    = spawn ();\r
     setorigin(proj, self.tur_shotorg);\r
     setsize(proj, '-1 -1 -1', '1 1 1');\r
-    //setmodel(proj, "models/elaser.mdl"); // precision set above\r
     proj.classname       = "plasmabomb";\r
     proj.owner           = self;\r
     proj.bot_dodge       = TRUE;\r
@@ -82,8 +60,6 @@ void turret_plasma_dual_attack()
 {\r
     entity proj;\r
 \r
-    //turret_tag_fire_update();\r
-\r
     sound (self, CHAN_WEAPON, "weapons/hagar_fire.wav", VOL_BASE, ATTN_NORM);\r
     proj                    = spawn ();\r
     setorigin(proj, self.tur_shotorg);\r
@@ -124,7 +100,7 @@ void turret_plasma_projectile_explode()
     WriteByte (MSG_BROADCAST, 155);\r
 \r
     self.event_damage = SUB_Null;\r
-\r
+    //w_deathtypestring = "ate to much plasma";\r
 #ifdef TURRET_DEBUG\r
     float d;\r
 \r
@@ -147,9 +123,9 @@ void turret_plasma_std_init()
     self.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIVE;\r
 \r
     // How to aim\r
-    //self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;// | TFL_AIM_ZPREDICT | TFL_AIM_GROUND2;\r
+    //self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE | TFL_AIM_ZPREDICT | TFL_AIM_GROUND2;\r
     self.aim_flags      = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE | TFL_AIM_GROUND2;\r
-    self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_MEDPROJ | TFL_TURRCAPS_PLAYERKILL;// | TFL_TURRCAPS_MISSILEKILL;\r
+    self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_MEDPROJ | TFL_TURRCAPS_PLAYERKILL | TFL_TURRCAPS_MISSILEKILL;\r
 \r
     if (turret_stdproc_init("plasma_std") == 0)\r
     {\r
@@ -158,8 +134,9 @@ void turret_plasma_std_init()
     }\r
 \r
     self.damage_flags    |= TFL_DMG_HEADSHAKE;\r
+\r
     //self.firecheck_flags |= (TFL_FIRECHECK_AFF | TFL_FIRECHECK_VERIFIED);\r
-    //  self.firecheck_flags |= TFL_FIRECHECK_AFF;\r
+    self.firecheck_flags |= TFL_FIRECHECK_AFF;\r
 \r
     //self.target_select_flags |= TFL_TARGETSELECT_FOV;\r
     //self.target_select_fov    = 45;\r
@@ -167,7 +144,7 @@ void turret_plasma_std_init()
     setmodel(self,"models/turrets/base.md3");\r
     setmodel(self.tur_head,"models/turrets/plasma.md3");\r
 \r
-    if (!turret_tag_setup(0))\r
+    if (!turret_tag_setup())\r
         dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");\r
 \r
     // Our fireing routine\r
@@ -204,7 +181,7 @@ void turret_plasma_dual_init()
     setmodel(self.tur_head,"models/turrets/plasmad.md3");\r
 \r
 \r
-    if (!turret_tag_setup(0))\r
+    if (!turret_tag_setup())\r
         dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");\r
 \r
     // Our fireing routine\r
index 321fe4f..ee3dab3 100644 (file)
@@ -14,7 +14,8 @@ void turret_targettrigger_touch()
         if (e.turrcaps_flags & TFL_TURRCAPS_RECIVETARGETS)\r
         {\r
             self = e;\r
-            e.turret_addtarget(other,oldself);\r
+            if(e.turret_addtarget)\r
+                e.turret_addtarget(other,oldself);\r
         }\r
 \r
         e = find(e, targetname, oldself.target);\r
index f76998d..54606ef 100644 (file)
@@ -17,9 +17,8 @@ entity toast(entity from, float range, float damage)
         if ((e.toasted != 1) && (e != from))\r
             if (turret_validate_target(self,e,self.target_validate_flags) > 0)\r
             {\r
-\r
-                traceline(from.origin,e.origin,0,from);\r
-                if (trace_fraction > 0.9)\r
+                traceline(from.origin,e.origin,MOVE_WORLDONLY,from);\r
+                if (trace_fraction == 1.0)\r
                 {\r
                     d = vlen(e.origin - from.origin);\r
                     if (d < dd)\r
@@ -35,7 +34,7 @@ entity toast(entity from, float range, float damage)
     if (etarget)\r
     {\r
         te_smallflash(etarget.origin);\r
-        te_lightning1(world,from.origin,etarget.origin);\r
+        te_csqc_lightningarc(from.origin,etarget.origin);\r
         Damage(etarget,self,self,damage,DEATH_TURRET,etarget.origin,'0 0 0');\r
         etarget.toasted = 1;\r
     }\r
@@ -43,20 +42,34 @@ entity toast(entity from, float range, float damage)
     return etarget;\r
 }\r
 \r
+float turret_tesla_firecheck()\r
+{\r
+    if not (turret_stdproc_firecheck())\r
+        return 0;\r
+\r
+    self.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES |\r
+                                 TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK;\r
+\r
+    self.enemy = turret_select_target();\r
+\r
+    if(self.enemy)\r
+        return 1;\r
+\r
+    return 0;\r
+\r
+}\r
+\r
 void turret_tesla_fire()\r
 {\r
     entity e,t;\r
     float d,r,i;\r
 \r
-    if (cvar("g_turrets_nofire") != 0)\r
-        return;\r
-\r
-    if (self.attack_finished_single > time) return;\r
+    //w_deathtypestring = "discoverd how a tesla coil works";\r
 \r
     d = self.shot_dmg;\r
     r = self.target_range;\r
     e = spawn();\r
-    setorigin(e,self.origin + self.tur_shotorg);\r
+    setorigin(e,self.tur_shotorg);\r
 \r
 \r
     self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES |\r
@@ -71,11 +84,10 @@ void turret_tesla_fire()
                                  TFL_TARGETSELECT_TEAMCHECK;\r
 \r
     self.attack_finished_single = time + self.shot_refire;\r
-    self.ammo = self.ammo - self.shot_dmg;\r
-    for (i = 0;i < 10;i = i + 1)\r
+    for (i = 0; i < 10; ++i)\r
     {\r
         d *= 0.5;\r
-        r *= 0.75;\r
+        r *= 0.85;\r
         t = toast(t,r,d);\r
         if (t == world) break;\r
     }\r
@@ -90,15 +102,30 @@ void turret_tesla_fire()
 \r
 void turret_tesla_postthink()\r
 {\r
-    turret_tesla_fire();\r
+    if not (self.tur_active)\r
+    {\r
+        self.tur_head.avelocity = '0 0 0';\r
+        return;\r
+    }\r
 \r
-    self.tur_head.frame = self.tur_head.frame + 1;\r
+    if(self.ammo < self.shot_dmg)\r
+    {\r
+        self.tur_head.avelocity = '0 9 0' * (self.ammo / self.shot_dmg);\r
+    }\r
+    else\r
+    {\r
+        self.tur_head.avelocity = '0 90 0' * (self.ammo / self.shot_dmg);\r
 \r
-    if (self.tur_head.frame >= 11)\r
-        self.tur_head.frame = 0;\r
+        if(self.attack_finished_single > time)\r
+            return;\r
 \r
-    if (self.tur_head.avelocity == '0 0 0')\r
-        self.tur_head.avelocity = '0 35 0';\r
+        float f;\r
+        f = (self.ammo / self.ammo_max);\r
+        f = f*f;\r
+        if(f > random())\r
+            if(random() < 0.1)\r
+                te_csqc_lightningarc(self.tur_shotorg,self.tur_shotorg + (randomvec() * 350));\r
+    }\r
 }\r
 \r
 \r
@@ -106,13 +133,16 @@ void turret_tesla_dinit()
 {\r
     if (self.netname == "")      self.netname     = "Tesla Coil";\r
 \r
-    self.turrcaps_flags = TFL_TURRCAPS_HITSCAN | TFL_TURRCAPS_PLAYERKILL | TFL_TURRCAPS_MISSILEKILL;\r
-    self.target_select_flags = TFL_TARGETSELECT_NO;\r
-    self.firecheck_flags = TFL_FIRECHECK_REFIRE;\r
-    self.shoot_flags = TFL_SHOOT_CUSTOM;\r
-    self.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIVE;\r
-    self.aim_flags = TFL_AIM_NO;\r
-    self.track_flags = TFL_TRACK_NO;\r
+    self.turrcaps_flags      = TFL_TURRCAPS_HITSCAN | TFL_TURRCAPS_PLAYERKILL | TFL_TURRCAPS_MISSILEKILL;\r
+\r
+    self.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES |\r
+                               TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK;\r
+\r
+    self.firecheck_flags     = TFL_FIRECHECK_REFIRE | TFL_FIRECHECK_OWM_AMMO;\r
+    self.shoot_flags         = TFL_SHOOT_CUSTOM;\r
+    self.ammo_flags          = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIVE;\r
+    self.aim_flags           = TFL_AIM_NO;\r
+    self.track_flags         = TFL_TRACK_NO;\r
 \r
     if (turret_stdproc_init("tesla_std") == 0)\r
     {\r
@@ -126,11 +156,12 @@ void turret_tesla_dinit()
     self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES |\r
                                  TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK;\r
 \r
-    if (!turret_tag_setup(0))\r
+    if (!turret_tag_setup())\r
         dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");\r
 \r
-    self.turret_firefunc = turret_stdproc_nothing;\r
-    self.turret_postthink = turret_tesla_postthink;\r
+    self.turret_firefunc      = turret_tesla_fire;\r
+    self.turret_postthink     = turret_tesla_postthink;\r
+    self.turret_firecheckfunc = turret_tesla_firecheck;\r
 }\r
 \r
 /*QUAKED turret_tesla (0 .5 .8) ?\r
index f6b1cef..8c47d01 100644 (file)
@@ -1,16 +1,16 @@
-#define ANIM_NO 0\r
-#define ANIM_REVERSE 1\r
-#define ANIM_WALK 2\r
-#define ANIM_RUN 3\r
-#define ANIM_STRAFE_L 4\r
-#define ANIM_STRAFE_R 5\r
-#define ANIM_TURN 6\r
-#define ANIM_JUMP 7\r
-#define ANIM_LAND 8\r
-#define ANIM_PAIN 9\r
-#define ANIM_MEELE 10\r
-#define ANIM_SWIM 11\r
-#define ANIM_ROAM 12\r
+#define ANIM_NO         0\r
+#define ANIM_REVERSE    1\r
+#define ANIM_WALK       2\r
+#define ANIM_RUN        3\r
+#define ANIM_STRAFE_L   4\r
+#define ANIM_STRAFE_R   5\r
+#define ANIM_TURN       6\r
+#define ANIM_JUMP       7\r
+#define ANIM_LAND       8\r
+#define ANIM_PAIN       9\r
+#define ANIM_MEELE      10\r
+#define ANIM_SWIM       11\r
+#define ANIM_ROAM       12\r
 \r
 #define WVM_IDLE_UP 25\r
 #define WVM_IDLE    50\r
 #define WVM_ENEMY 2000\r
 #define WVM_STOP  3000\r
 #define WVM_DODGE 4000\r
+#define  WVM_PANIC 10000\r
 #define walker_verbs_move verbs_move\r
 \r
-#define WVA_MINIGUN 1\r
-#define WVA_ROCKET  10\r
-#define WVA_MEELE   20\r
+#define WVA_MINIGUN 100\r
+#define WVA_ROCKET  500\r
+#define WVA_MEELE   1000\r
 #define walker_verbs_attack verbs_attack\r
 \r
 #define WVI_IDLE 1\r
@@ -31,7 +32,6 @@
 #define walker_verbs_idle verbs_idle\r
 \r
 .float animflag;\r
-.entity wkr_props;\r
 .entity wkr_spawn;\r
 \r
 #define WALKER_MIN '-70 -70 5'\r
@@ -41,6 +41,9 @@
 \r
 float walker_firecheck()\r
 {\r
+    if (self.animflag == ANIM_MEELE)\r
+        return 0;\r
+\r
     return turret_stdproc_firecheck();\r
 }\r
 \r
@@ -51,6 +54,7 @@ void walker_meele_do_dmg()
     makevectors(self.angles);\r
     where = self.origin + v_forward * 128;\r
 \r
+    //w_deathtypestring = "tried to hug the cute spider thingy.";\r
     e = findradius(where,64);\r
     while (e)\r
     {\r
@@ -62,16 +66,13 @@ void walker_meele_do_dmg()
     }\r
 }\r
 \r
-.vector moveto;\r
-.vector steerto;\r
 void walker_animate()\r
 {\r
-    vector wish_angle,real_angle;\r
-    float vz;\r
+    vector real_angle;\r
+    float  vz;\r
 \r
-    wish_angle = self.steerto;\r
-    real_angle = wish_angle - self.angles;\r
-    vz = self.velocity_z;\r
+    real_angle = vectoangles(self.steerto) - self.angles;\r
+    vz         = self.velocity_z;\r
 \r
     if (self.tur_head.frame != 0)\r
         self.tur_head.frame = self.tur_head.frame +1;\r
@@ -81,27 +82,30 @@ void walker_animate()
 \r
     switch (self.animflag)\r
     {\r
+\r
     case ANIM_NO:\r
-        if(self.frame != 0)\r
+        if (self.frame != 0)\r
             self.frame = 0;\r
 \r
         movelib_beak_simple(cvar("g_turrets_unit_walker_speed_stop"));\r
+\r
         break;\r
 \r
     case ANIM_REVERSE:\r
         if ((self.frame < 5) || (self.frame > 25))\r
-            self.frame = 5;\r
+            self.frame = 25;\r
 \r
-        self.frame = self.frame +1;\r
+        self.frame = self.frame -1;\r
         movelib_move_simple(v_forward * -1 ,cvar("g_turrets_unit_walker_speed_walk"),0.6);\r
 \r
-        if (self.frame > 25)\r
-            self.frame = 5;\r
+        if (self.frame < 5)\r
+            self.frame = 25;\r
+\r
         break;\r
 \r
     case ANIM_TURN:\r
 \r
-        if (self.frame < 30)\r
+        if ((self.frame < 30) || (self.frame > 55))\r
             self.frame = 30;\r
 \r
         self.frame = self.frame + 1;\r
@@ -125,6 +129,7 @@ void walker_animate()
 \r
         if (self.frame > 25)\r
             self.frame = 5;\r
+\r
         break;\r
 \r
     case ANIM_ROAM:\r
@@ -133,26 +138,30 @@ void walker_animate()
 \r
         self.frame = self.frame +1;\r
 \r
-        self.angles_y += bound(-15,shortangle_f(real_angle_y,self.angles_y),15);\r
+        self.angles_y += bound(-5,shortangle_f(real_angle_y,self.angles_y),5);\r
 \r
         movelib_move_simple(v_forward ,cvar("g_turrets_unit_walker_speed_roam"),0.5);\r
 \r
         if (self.frame > 25)\r
             self.frame = 5;\r
+\r
         break;\r
 \r
     case ANIM_SWIM:\r
-        if (self.frame < 142)\r
+        if ((self.frame < 142) || (self.frame > 151))\r
             self.frame = 142;\r
 \r
         self.frame = self.frame +1;\r
+\r
         self.angles_y += bound(-10,shortangle_f(real_angle_y,self.angles_y),10);\r
         self.angles_x += bound(-10,shortangle_f(real_angle_x,self.angles_x),10);\r
+\r
         movelib_move_simple(v_forward, cvar("g_turrets_unit_walker_speed_swim"),0.3);\r
         vz = self.velocity_z + sin(time * 4) * 8;\r
 \r
         if (self.frame > 151)\r
             self.frame = 146;\r
+\r
         break;\r
 \r
     case ANIM_RUN:\r
@@ -165,10 +174,11 @@ void walker_animate()
 \r
         if (self.frame > 25)\r
             self.frame = 5;\r
+\r
         break;\r
 \r
     case ANIM_STRAFE_L:\r
-        if (self.frame < 30)\r
+        if ((self.frame < 30) || (self.frame > 55))\r
             self.frame = 30;\r
 \r
         self.frame = self.frame + 1;\r
@@ -180,7 +190,7 @@ void walker_animate()
         break;\r
 \r
     case ANIM_STRAFE_R:\r
-        if (self.frame < 60)\r
+        if ((self.frame < 60) || (self.frame > 65))\r
             self.frame = 60;\r
 \r
         self.frame = self.frame + 1;\r
@@ -193,7 +203,7 @@ void walker_animate()
         break;\r
 \r
     case ANIM_JUMP:\r
-        if (self.frame < 95)\r
+        if ((self.frame < 95) || (self.frame > 100))\r
             self.frame = 95;\r
 \r
         self.velocity += '0 0 1' * cvar("g_turrets_unit_walker_speed_jump");\r
@@ -204,7 +214,7 @@ void walker_animate()
         break;\r
 \r
     case ANIM_LAND:\r
-        if (self.frame < 100)\r
+        if ((self.frame < 100) || (self.frame > 107))\r
             self.frame = 100;\r
 \r
         self.frame = self.frame + 1;\r
@@ -215,7 +225,7 @@ void walker_animate()
         break;\r
 \r
     case ANIM_PAIN:\r
-        if (self.frame < 60)\r
+        if ((self.frame < 60) || (self.frame > 95))\r
             self.frame = 90;\r
 \r
         self.frame = self.frame + 1;\r
@@ -226,11 +236,11 @@ void walker_animate()
         break;\r
 \r
     case ANIM_MEELE:\r
-        movelib_beak_simple(250);\r
-\r
-        if (self.frame < 123)\r
+        if ((self.frame < 123) || (self.frame > 140))\r
             self.frame = 123;\r
 \r
+        movelib_beak_simple(cvar("g_turrets_unit_walker_speed_stop"));\r
+\r
         self.frame = self.frame + 2;\r
 \r
         if (self.frame == 133)\r
@@ -242,9 +252,10 @@ void walker_animate()
             self.frame = 0;\r
         }\r
     }\r
+\r
     self.velocity_z = vz;\r
 \r
-    if(self.flags & FL_ONGROUND)\r
+    if (self.flags & FL_ONGROUND)\r
         movelib_groundalign4point(300,100);\r
 \r
 }\r
@@ -254,7 +265,7 @@ void walker_rocket_explode()
 {\r
     vector org2;\r
 \r
-    if(self.event_damage != SUB_Null)\r
+    if (self.event_damage != SUB_Null)\r
     {\r
         self.event_damage = SUB_Null;\r
         self.think = walker_rocket_explode;\r
@@ -266,7 +277,7 @@ void walker_rocket_explode()
     org2 = findbetterlocation (self.origin, 16);\r
 \r
     pointparticles(particleeffectnum("rocket_explode"), org2, '0 0 0', 1);\r
-\r
+    //w_deathtypestring = "got blasted to oblivion";\r
     RadiusDamage (self, self.owner, cvar("g_turrets_unit_walker_std_rocket_dmg"), 0, cvar("g_turrets_unit_walker_std_rocket_radius"), world, cvar("g_turrets_unit_walker_std_rocket_force"), DEATH_TURRET, world);\r
 \r
     remove (self);\r
@@ -280,7 +291,7 @@ void walker_rocket_damage (entity inflictor, entity attacker, float damage, floa
         walker_rocket_explode();\r
 }\r
 \r
-#define WALKER_ROCKET_MOVE movelib_move_simple(newdir,1000,cvar("g_turrets_unit_walker_std_rocket_tunrate")); UpdateCSQCProjectile(self)\r
+#define WALKER_ROCKET_MOVE movelib_move_simple(newdir,cvar("g_turrets_unit_walker_std_rocket_speed"),cvar("g_turrets_unit_walker_std_rocket_tunrate")); UpdateCSQCProjectile(self)\r
 void walker_rocket_loop();\r
 void walker_rocket_think()\r
 {\r
@@ -316,11 +327,11 @@ void walker_rocket_think()
     }\r
 \r
     if (self.shot_dmg != 1337)\r
-    if (random() < 0.01)\r
-    {\r
-        walker_rocket_loop();\r
-        return;\r
-    }\r
+        if (random() < 0.01)\r
+        {\r
+            walker_rocket_loop();\r
+            return;\r
+        }\r
 \r
     m_speed = vlen(self.velocity) + cvar("g_turrets_unit_walker_std_rocket_speed_add");\r
 \r
@@ -361,7 +372,6 @@ void walker_rocket_loop3()
         return;\r
     }\r
 \r
-\r
     newdir = steerlib_pull(self.tur_shotorg);\r
     WALKER_ROCKET_MOVE;\r
 \r
@@ -386,6 +396,7 @@ void walker_rocket_loop2()
         self.think = walker_rocket_loop3;\r
         return;\r
     }\r
+\r
     newdir = steerlib_pull(self.tur_shotorg);\r
     WALKER_ROCKET_MOVE;\r
 }\r
@@ -446,7 +457,7 @@ void walker_fire_rocket(vector org)
     rocket.solid              = SOLID_BBOX;\r
     rocket.tur_health         = time + 9;\r
 \r
-       CSQCProjectile(rocket, FALSE, PROJECTILE_ROCKET, FALSE); // no culling, has fly sound\r
+    CSQCProjectile(rocket, FALSE, PROJECTILE_ROCKET, FALSE); // no culling, has fly sound\r
 }\r
 \r
 void rv_think()\r
@@ -455,7 +466,7 @@ void rv_think()
     vector org;\r
     entity oldself;\r
 \r
-    if(self.owner.deadflag != DEAD_NO)\r
+    if (self.owner.deadflag != DEAD_NO)\r
     {\r
         remove(self);\r
         return;\r
@@ -483,300 +494,280 @@ void rv_think()
     self = oldself;\r
 }\r
 \r
-/*\r
-void walker_move()\r
-{\r
-    vector major,minor,f,b,l,r;\r
-    float lf,lb,lr,ll,bl,tl;\r
-\r
-    if(self.animflag == ANIM_MEELE)\r
-        return;\r
-\r
-    tl = vlen(self.origin - self.moveto);\r
-    switch(self.waterlevel)\r
-    {\r
-        case 0:\r
-            self.animflag = ANIM_WALK;\r
-        case 1:\r
-        case 2:\r
-            if(self.animflag == ANIM_WALK)\r
-                self.animflag = ANIM_WALK;\r
-            else\r
-                self.animflag = ANIM_SWIM;\r
-            break;\r
-        case 3:\r
-            self.animflag = ANIM_SWIM;\r
-    }\r
-\r
-    if(self.animflag == ANIM_SWIM)\r
-    {\r
-        self.steerto = vectoangles(steerlib_attract2(self.moveto,0.5,500,0.95));\r
-        return;\r
-    }\r
-\r
-    if(tl < 250)\r
-    {\r
-        self.animflag = ANIM_WALK;\r
-    }\r
-    else\r
-    {\r
-        self.animflag = ANIM_RUN;\r
-    }\r
-\r
-    self.steerto = vectoangles(steerlib_attract2(self.moveto,0.5,500,0.95));\r
-    f = self.origin + v_forward;\r
-    lf = vlen(self.moveto - f);\r
-    bl = lf;\r
-    major = v_forward;\r
-    minor = major;\r
-\r
-    b = self.origin - v_forward;\r
-    lb = vlen(self.moveto - b);\r
-    if(bl > lb)\r
-    {\r
-        minor = major;\r
-        major = v_forward * -1;\r
-        bl = lb;\r
-    }\r
-\r
-    r = self.origin + v_right;\r
-    lr = vlen(self.moveto - r);\r
-    if(bl > lr)\r
-    {\r
-\r
-        minor = major;\r
-        major = v_right;\r
-        bl = lr;\r
-        self.steerto = vectoangles(v_right);\r
-        self.animflag = ANIM_STRAFE_R;\r
-\r
-    }\r
-\r
-    l = self.origin - v_right;\r
-    ll = vlen(self.moveto - l);\r
-    if(bl > ll)\r
-    {\r
-\r
-        minor = major;\r
-        major = v_right * -1;\r
-        bl = ll;\r
-        self.steerto = vectoangles(v_right*-1);\r
-        self.animflag = ANIM_STRAFE_L;\r
-\r
-    }\r
-\r
-}\r
-*/\r
-\r
 float walker_moveverb_path(float eval)\r
 {\r
-    if(eval)\r
+    switch (eval)\r
     {\r
-        if(self.animflag == ANIM_MEELE)\r
+    case VCM_EVAL:\r
+\r
+        if (self.animflag == ANIM_MEELE)\r
             return VS_CALL_NO;\r
 \r
-        if(self.pathcurrent)\r
+        if (self.pathcurrent)\r
             return verb.verb_static_value;\r
 \r
         return VS_CALL_NO;\r
-    }\r
-\r
-    // Do we have a path?\r
-    if not(self.pathcurrent)\r
-    {\r
-        return VS_CALL_NO;\r
-    }\r
-    else\r
-    {\r
-        // Are we close enougth to a path node to switch to the next?\r
-        if (vlen(self.origin  - self.pathcurrent.origin) < 64)\r
-            if (self.pathcurrent.path_next == world)\r
-            {\r
-                // Path endpoint reached\r
-                pathlib_deletepath(self.pathcurrent.owner);\r
-                self.pathcurrent = world;\r
+        break;\r
 \r
-                if(self.pathgoal)\r
+    case VCM_DO:\r
+        // Do we have a path?\r
+        if not(self.pathcurrent)\r
+        {\r
+            return VS_CALL_NO;\r
+        }\r
+        else\r
+        {\r
+            // Are we close enougth to a path node to switch to the next?\r
+            if (vlen(self.origin  - self.pathcurrent.origin) < 64)\r
+                if (self.pathcurrent.path_next == world)\r
                 {\r
-                    if(self.pathgoal.use)\r
-                        self.pathgoal.use();\r
+                    // Path endpoint reached\r
+                    pathlib_deletepath(self.pathcurrent.owner);\r
+                    self.pathcurrent = world;\r
 \r
-                    if(self.pathgoal.enemy)\r
+                    if (self.pathgoal)\r
                     {\r
-                        self.pathcurrent = WALKER_PATH(self.pathgoal.origin,self.pathgoal.enemy.origin);\r
-                        self.pathgoal = self.pathgoal.enemy;\r
+                        if (self.pathgoal.use)\r
+                            self.pathgoal.use();\r
+\r
+                        if (self.pathgoal.enemy)\r
+                        {\r
+                            self.pathcurrent = WALKER_PATH(self.pathgoal.origin,self.pathgoal.enemy.origin);\r
+                            self.pathgoal = self.pathgoal.enemy;\r
+                        }\r
                     }\r
+                    else\r
+                        self.pathgoal = world;\r
                 }\r
                 else\r
-                    self.pathgoal = world;\r
-            }\r
-            else\r
-                self.pathcurrent = self.pathcurrent.path_next;\r
-    }\r
+                    self.pathcurrent = self.pathcurrent.path_next;\r
+        }\r
 \r
 \r
-    if (self.pathcurrent)\r
-    {\r
-        switch(self.waterlevel)\r
+        if (self.pathcurrent)\r
         {\r
+            switch (self.waterlevel)\r
+            {\r
             case 0:\r
                 self.animflag = ANIM_WALK;\r
             case 1:\r
             case 2:\r
-                if(self.animflag == ANIM_WALK)\r
+                if (self.animflag == ANIM_WALK)\r
                     self.animflag = ANIM_WALK;\r
                 else\r
                     self.animflag = ANIM_SWIM;\r
                 break;\r
             case 3:\r
                 self.animflag = ANIM_SWIM;\r
+            }\r
+\r
+            self.moveto = self.pathcurrent.origin;\r
+            self.steerto = steerlib_attract2(self.moveto,0.5,500,0.95);\r
+\r
+            return VS_CALL_YES_DOING;\r
         }\r
+        else\r
+            return VS_CALL_YES_DONE;\r
 \r
-        self.moveto = self.pathcurrent.origin;\r
-        self.steerto = vectoangles(steerlib_attract2(self.moveto,0.5,500,0.95));\r
+        break;\r
+\r
+    case VCM_REMOVE:\r
+\r
+        if (self.pathcurrent)\r
+            pathlib_deletepath(self.pathcurrent.owner);\r
+\r
+        self.pathcurrent = world;\r
 \r
-        return VS_CALL_YES_DOING;\r
-    }\r
-    else\r
         return VS_CALL_YES_DONE;\r
+\r
+        break;\r
+    }\r
+\r
+    return VS_CALL_YES_DONE;\r
 }\r
 \r
 float walker_moveverb_enemy(float eval)\r
 {\r
-    if(eval)\r
+    switch (eval)\r
     {\r
-        if(self.animflag == ANIM_MEELE)\r
+    case VCM_EVAL:\r
+\r
+        if (self.animflag == ANIM_MEELE)\r
             return VS_CALL_NO;\r
 \r
-        if(self.enemy == world)\r
+        if (self.enemy == world)\r
             return VS_CALL_NO;\r
 \r
-        if(tracewalk(self.enemy, self.origin, self.mins, self.maxs, self.enemy.origin, MOVE_NORMAL))\r
+        if (tracewalk(self.enemy, self.origin, self.mins, self.maxs, self.enemy.origin, MOVE_NORMAL))\r
             return verb.verb_static_value;\r
 \r
         return VS_CALL_NO;\r
-    }\r
 \r
-    switch(self.waterlevel)\r
-    {\r
+        break;\r
+\r
+    case VCM_DO:\r
+        switch (self.waterlevel)\r
+        {\r
         case 0:\r
-            if(self.tur_dist_enemy > 500)\r
+            if (self.tur_dist_enemy > 500)\r
                 self.animflag = ANIM_RUN;\r
             else\r
                 self.animflag = ANIM_WALK;\r
         case 1:\r
         case 2:\r
-            if(self.animflag == ANIM_WALK)\r
+            if (self.animflag != ANIM_SWIM)\r
                 self.animflag = ANIM_WALK;\r
             else\r
                 self.animflag = ANIM_SWIM;\r
             break;\r
         case 3:\r
             self.animflag = ANIM_SWIM;\r
-    }\r
+        }\r
 \r
-    self.moveto = self.enemy.origin;\r
-    self.steerto = vectoangles(steerlib_attract2(self.moveto,0.5,500,0.95));\r
+        self.moveto = self.enemy.origin;\r
+        self.steerto = steerlib_attract2(self.moveto,0.5,500,0.95);\r
 \r
-    return VS_CALL_YES_DOING;\r
+        return VS_CALL_YES_DOING;\r
+        break;\r
+    }\r
+\r
+    return VS_CALL_YES_DONE;\r
 }\r
 \r
 float walker_moveverb_idle_pause(float eval)\r
 {\r
-    if(eval)\r
+    switch (eval)\r
     {\r
-        if(self.animflag == ANIM_MEELE)\r
+    case VCM_EVAL:\r
+\r
+        if (self.animflag == ANIM_MEELE)\r
             return VS_CALL_NO;\r
 \r
         return verb.verb_static_value;\r
+        break;\r
 \r
-    }\r
+    case VCM_DO:\r
+\r
+        self.moveto   = self.origin;\r
+        self.steerto  = v_forward;\r
+        self.animflag = ANIM_NO;\r
 \r
-    self.moveto = self.origin;\r
-    self.steerto = v_forward;\r
-    self.animflag = ANIM_NO;\r
+        return VS_CALL_YES_DOING;\r
+        break;\r
+    }\r
 \r
-    return VS_CALL_YES_DOING;\r
+    return VS_CALL_YES_DONE;\r
 }\r
 \r
 float walker_moveverb_idle_roam(float eval)\r
 {\r
-    if(eval)\r
+    switch (eval)\r
     {\r
-        if(self.animflag == ANIM_MEELE)\r
+    case VCM_EVAL:\r
+\r
+        if (self.animflag == ANIM_MEELE)\r
             return VS_CALL_NO;\r
 \r
         return verb.verb_static_value;\r
-    }\r
+        break;\r
+\r
+    case VCM_DO:\r
+        if(verb.wait < time)\r
+        {\r
+            trace_fraction = 0;\r
+            while(trace_fraction != 1.0)\r
+            {\r
+                self.moveto = self.origin + (v_forward * 256);\r
+                self.moveto += v_right * (random() * 256);\r
+                self.moveto -= v_right * (random() * 256);\r
+\r
+                tracebox(self.origin+'0 0 64',self.mins,self.maxs,self.moveto + '0 0 64',MOVE_NORMAL,self);\r
+            }\r
+            verb.wait = time + 10;\r
+        }\r
+        else\r
+        {\r
+            if(verb.wait - time < 9)\r
+                if(vlen(self.moveto - self.origin) < 32)\r
+                {\r
+                    verbstack_push(self.walker_verbs_move, walker_moveverb_idle_pause,   WVM_IDLE + WVM_IDLE_UP, random() * (verb.wait - time));\r
+                    self.animflag = ANIM_NO;\r
+                    return VS_CALL_REMOVE;\r
+                }\r
+        }\r
 \r
-    vector v;\r
-    v_x = (random() * 32) - (random() * 32);\r
-    v_y = (random() * 32) - (random() * 32);\r
-    v = self.origin + v_forward * 64 + v;\r
-    self.pos1 = self.pos1 * 0.9 + v * 0.1;\r
+        self.steerto = steerlib_attract(self.moveto,256);\r
+        te_lightning1(self,self.origin + '0 0 64',self.moveto + '0 0 64');\r
 \r
-    self.moveto = self.origin + v_forward * 10;\r
-    v = self.angles;\r
-    v_y += random() * 15;\r
-    v_y -= random() * 15;\r
-    self.steerto = v;\r
 \r
 \r
-    switch(self.waterlevel)\r
-    {\r
+        switch (self.waterlevel)\r
+        {\r
         case 0:\r
             self.animflag = ANIM_ROAM;\r
         case 1:\r
         case 2:\r
-            if(self.animflag != ANIM_SWIM)\r
+            if (self.animflag != ANIM_SWIM)\r
                 self.animflag = ANIM_ROAM;\r
 \r
             break;\r
         case 3:\r
             self.animflag = ANIM_SWIM;\r
+        }\r
+\r
+        return VS_CALL_YES_DOING;\r
+\r
+        break;\r
     }\r
 \r
-    return VS_CALL_YES_DOING;\r
+    return VS_CALL_YES_DONE;\r
 }\r
 \r
 float walker_moveverb_idle(float eval)\r
 {\r
-    if(eval)\r
+    switch (eval)\r
     {\r
-        if(self.animflag == ANIM_MEELE)\r
+    case VCM_EVAL:\r
+\r
+        if (self.animflag == ANIM_MEELE)\r
             return VS_CALL_NO;\r
 \r
         return verb.verb_static_value;\r
-    }\r
 \r
-    if(verb.wait < time)\r
-    {\r
-        verb.wait = random() * 10;\r
+        break;\r
 \r
-        if(random() < 0.5)\r
-            verbstack_push(self.walker_verbs_move, walker_moveverb_idle_pause,   WVM_IDLE + WVM_IDLE_UP, verb.wait);\r
-        else\r
-            verbstack_push(self.walker_verbs_move, walker_moveverb_idle_roam,   WVM_IDLE + WVM_IDLE_UP, verb.wait);\r
+    case VCM_DO:\r
 \r
-        verb.wait += time;\r
+        //if (random() < 0.5)\r
+            verbstack_push(self.walker_verbs_move, walker_moveverb_idle_pause,   WVM_IDLE + WVM_IDLE_UP, random() * 5);\r
+        //else\r
+        //    verbstack_push(self.walker_verbs_move, walker_moveverb_idle_roam,   WVM_IDLE + WVM_IDLE_UP,  random() * 15);\r
+\r
+        return VS_CALL_YES_DOING;\r
+\r
+        break;\r
     }\r
 \r
-    return VS_CALL_YES_DOING;\r
+    return VS_CALL_YES_DONE;\r
 }\r
+\r
 float walker_attackverb_meele(float eval)\r
 {\r
-    if(eval)\r
+    switch (eval)\r
     {\r
-        if(cvar("g_turrets_nofire"))\r
+    case VCM_EVAL:\r
+\r
+        vector wish_angle;\r
+\r
+        if (cvar("g_turrets_nofire"))\r
             return VS_CALL_NO;\r
 \r
-        if(self.animflag == ANIM_SWIM || self.animflag == ANIM_MEELE)\r
+        if (self.animflag == ANIM_SWIM || self.animflag == ANIM_MEELE)\r
             return VS_CALL_NO;\r
 \r
-        if(!self.enemy)\r
+        if (!self.enemy)\r
             return VS_CALL_NO;\r
 \r
-        vector wish_angle;\r
         wish_angle = angleofs(self,self.enemy);\r
 \r
         if (self.tur_dist_enemy < cvar("g_turrets_unit_walker_std_meele_range"))\r
@@ -784,20 +775,28 @@ float walker_attackverb_meele(float eval)
                 return verb.verb_static_value;\r
 \r
         return VS_CALL_NO;\r
-    }\r
 \r
-    self.moveto = self.enemy.origin;\r
-    self.steerto = vectoangles(steerlib_attract2(self.moveto,0.5,500,0.95));\r
+        break;\r
+\r
+    case VCM_DO:\r
 \r
-    self.animflag = ANIM_MEELE;\r
+        self.moveto   = self.enemy.origin;\r
+        self.steerto  = steerlib_attract2(self.moveto,0.5,500,0.95);\r
+        self.animflag = ANIM_MEELE;\r
 \r
-    return VS_CALL_YES_DOING;\r
+        return VS_CALL_YES_DOING;\r
+\r
+        break;\r
+    }\r
+\r
+    return VS_CALL_YES_DONE;\r
 }\r
 \r
 float walker_attackverb_rockets(float eval)\r
 {\r
-    if(eval)\r
+    switch (eval)\r
     {\r
+    case VCM_EVAL:\r
         if (self.tur_head.attack_finished_single > time)\r
             return VS_CALL_NO;\r
 \r
@@ -814,19 +813,27 @@ float walker_attackverb_rockets(float eval)
             return VS_CALL_NO;\r
 \r
         return verb.verb_static_value;\r
-    }\r
 \r
-    entity rv;\r
-    rv           = spawn();\r
-    rv.think     = rv_think;\r
-    rv.nextthink = time;\r
-    rv.cnt       = 4;\r
-    rv.owner     = self;\r
+        break;\r
 \r
-    self.tur_head.attack_finished_single = time + cvar("g_turrets_unit_walker_std_rocket_refire");\r
+    case VCM_DO:\r
 \r
-    return VS_CALL_YES_DONE;\r
+        entity rv;\r
+\r
+        rv           = spawn();\r
+        rv.think     = rv_think;\r
+        rv.nextthink = time;\r
+        rv.cnt       = 4;\r
+        rv.owner     = self;\r
 \r
+        self.tur_head.attack_finished_single = time + cvar("g_turrets_unit_walker_std_rocket_refire");\r
+\r
+        return VS_CALL_YES_DONE;\r
+\r
+        break;\r
+    }\r
+\r
+    return VS_CALL_YES_DONE;\r
 }\r
 \r
 void walker_postthink()\r
@@ -846,33 +853,30 @@ void walker_attack()
 {\r
     entity flash;\r
 \r
-    //turret_do_updates(self);\r
-\r
-    self.tur_head.frame = self.tur_head.frame + 1;\r
-\r
+    //w_deathtypestring = "was miniguned";\r
     sound (self, CHAN_WEAPON, "weapons/uzi_fire.wav", VOL_BASE, ATTN_NORM);\r
-\r
     fireBallisticBullet (self.tur_shotorg, self.tur_shotdir_updated,self.shot_spread, self.shot_speed, 5, self.shot_dmg, 0, self.shot_force, DEATH_TURRET, 0, 1, cvar("g_balance_uzi_bulletconstant"));\r
-    //te_smallflash(self.tur_shotorg_updated);\r
-\r
-    if (!(self.uzi_bulletcounter & 3))\r
+    if (self.uzi_bulletcounter == 2)\r
     {\r
 \r
-        //trailparticles(self,particleeffectnum("EF_MGTURRETTRAIL"),self.tur_shotorg_updated,trace_endpos);\r
-        // te_lightning1(self,self.tur_shotorg_updated,trace_endpos);\r
         flash = spawn();\r
-        setmodel(flash, "models/uziflash.md3"); // precision set below\r
+\r
+        setmodel(flash, "models/uziflash.md3");\r
         setattachment(flash, self.tur_head, "tag_fire");\r
-        flash.scale = 3;\r
-        flash.think = W_Uzi_Flash_Go;\r
+\r
+        flash.scale     = 3;\r
+        flash.think     = W_Uzi_Flash_Go;\r
         flash.nextthink = time + 0.02;\r
-        flash.frame = 2;\r
-        flash.angles_z = flash.v_angle_z + random() * 180;\r
-        flash.alpha = 1;\r
-        flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;\r
+        flash.frame     = 2;\r
+        flash.angles_z  = flash.v_angle_z + random() * 180;\r
+        flash.alpha     = 1;\r
+        flash.effects   = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;\r
+\r
+        self.uzi_bulletcounter = self.uzi_bulletcounter = 0;\r
     }\r
 \r
     self.uzi_bulletcounter = self.uzi_bulletcounter + 1;\r
+    self.tur_head.frame    = self.tur_head.frame + 1;\r
 }\r
 \r
 \r
@@ -882,8 +886,8 @@ void walker_respawnhook()
     entity e;\r
 \r
     self.origin = self.wkr_spawn.origin;\r
-    self.wkr_props.solid = SOLID_BBOX;\r
-    self.wkr_props.alpha = 1;\r
+    //self.wkr_props.solid = SOLID_BBOX;\r
+    //self.wkr_props.alpha = 1;\r
 \r
     self.angles = self.wkr_spawn.angles;\r
     vtmp = self.wkr_spawn.origin;\r
@@ -910,18 +914,22 @@ void walker_respawnhook()
 }\r
 void walker_diehook()\r
 {\r
-    if(self.pathcurrent)\r
+    turret_trowgib2(self.origin,self.velocity + v_up * 200,'-0.6 -0.2 -02',self,time + random() * 1);\r
+    turret_trowgib2(self.origin + '0 0 64',self.velocity + v_forward * 150 + v_up * 150,'-0.2 -0.2 -02',self.tur_head,time + random() * 2 + 3);\r
+\r
+    if (self.pathcurrent)\r
         pathlib_deletepath(self.pathcurrent.owner);\r
 \r
     self.pathcurrent = world;\r
 \r
-    self.wkr_props.solid = SOLID_NOT;\r
-    self.wkr_props.alpha = -1;\r
-\r
-    if(self.damage_flags & TFL_DMG_DEATH_NORESPAWN)\r
+    if (self.damage_flags & TFL_DMG_DEATH_NORESPAWN)\r
     {\r
-        remove(self.wkr_props);\r
         remove(self.wkr_spawn);\r
+\r
+        verbstack_flush(self.walker_verbs_move);\r
+        verbstack_flush(self.walker_verbs_attack);\r
+        verbstack_flush(self.walker_verbs_idle);\r
+\r
         remove(self.walker_verbs_move);\r
         remove(self.walker_verbs_attack);\r
         remove(self.walker_verbs_idle);\r
@@ -935,15 +943,13 @@ void turret_walker_dinit()
     entity e;\r
 \r
     if (self.netname == "")      self.netname     = "Walker Turret";\r
-\r
-    self.wkr_props = spawn();\r
     self.wkr_spawn = spawn();\r
 \r
     self.ammo_flags = TFL_AMMO_BULLETS | TFL_AMMO_RECHARGE | TFL_AMMO_RECIVE;\r
     self.turrcaps_flags = TFL_TURRCAPS_PLAYERKILL | TFL_TURRCAPS_MOVE | TFL_TURRCAPS_HEADATTACHED;\r
     self.aim_flags = TFL_AIM_LEAD;\r
 \r
-    if(cvar("g_antilag_bullets"))\r
+    if (cvar("g_antilag_bullets"))\r
         self.turrcaps_flags |= TFL_TURRCAPS_HITSCAN;\r
     else\r
         self.aim_flags      |= TFL_AIM_SHOTTIMECOMPENSATE;\r
@@ -963,7 +969,7 @@ void turret_walker_dinit()
     self.walker_verbs_attack = spawn();\r
     self.walker_verbs_idle   = spawn();\r
 \r
-    verbstack_push(self.walker_verbs_move, walker_moveverb_idle,   WVM_IDLE, 0);\r
+    verbstack_push(self.walker_verbs_move, walker_moveverb_idle,   WVM_IDLE,  0);\r
     verbstack_push(self.walker_verbs_move, walker_moveverb_enemy,  WVM_ENEMY, 0);\r
     verbstack_push(self.walker_verbs_move, walker_moveverb_path,   WVM_PATH,  0);\r
 \r
@@ -972,10 +978,9 @@ void turret_walker_dinit()
 \r
     self.damage_flags |= TFL_DMG_DEATH_NOGIBS;\r
 \r
-    self.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;\r
-    self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK    | TFL_TARGETSELECT_LOS;\r
+    //self.target_select_flags   = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;\r
+    //self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;\r
 \r
-    //self.flags      = FL_CLIENT;\r
     self.iscreature = TRUE;\r
     self.movetype   = MOVETYPE_WALK;\r
     self.solid      = SOLID_SLIDEBOX;\r
@@ -983,16 +988,14 @@ void turret_walker_dinit()
 \r
     setmodel(self,"models/turrets/walker_body.md3");\r
     setmodel(self.tur_head,"models/turrets/walker_head_minigun.md3");\r
-    setmodel(self.wkr_props,"models/turrets/walker_props.md3");\r
     setmodel(self.wkr_spawn,"models/turrets/walker_spawn.md3");\r
-    setorigin(self.wkr_spawn,self.origin);\r
+\r
     setattachment(self.tur_head,self,"tag_head");\r
-    setattachment(self.wkr_props,self,"tag_head");\r
 \r
     self.wkr_spawn.angles   = self.angles;\r
     self.wkr_spawn.solid    = SOLID_NOT;\r
 \r
-    traceline(self.wkr_spawn.origin + '0 0 16', self.wkr_spawn.origin - '0 0 10000', MOVE_WORLDONLY, self);\r
+    traceline(self.origin + '0 0 16', self.origin - '0 0 10000', MOVE_WORLDONLY, self);\r
     setorigin(self.wkr_spawn,trace_endpos + '0 0 4');\r
     setorigin(self,self.wkr_spawn.origin);\r
 \r
@@ -1020,21 +1023,20 @@ void turret_walker_dinit()
             self.pathgoal = e;\r
         }\r
     }\r
-\r
-    //self.solid    = SOLID_NOT;\r
-\r
 }\r
 \r
 \r
 void spawnfunc_turret_walker()\r
 {\r
     g_turrets_common_precash();\r
+\r
     precache_model ("models/turrets/walker_head_minigun.md3");\r
     precache_model ("models/turrets/walker_body.md3");\r
     precache_model ("models/turrets/walker_props.md3");\r
     precache_model ("models/turrets/walker_spawn.md3");\r
     precache_model ( "models/turrets/rocket.md3");\r
     precache_sound ( "weapons/rocket_impact.wav" );\r
+\r
     self.think = turret_walker_dinit;\r
     self.nextthink = time + 0.5;\r
 }\r