]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove some unused files
authorMario <zacjardine@y7mail.com>
Tue, 7 Apr 2015 10:38:50 +0000 (20:38 +1000)
committerMario <zacjardine@y7mail.com>
Tue, 7 Apr 2015 10:38:50 +0000 (20:38 +1000)
qcsrc/client/vehicles/vehicles.qc [deleted file]
qcsrc/server/tturrets/system/system_main.qc [deleted file]
qcsrc/server/tturrets/system/system_misc.qc [deleted file]
qcsrc/server/vehicles/racer.qc [deleted file]
qcsrc/server/vehicles/vehicles.qc [deleted file]

diff --git a/qcsrc/client/vehicles/vehicles.qc b/qcsrc/client/vehicles/vehicles.qc
deleted file mode 100644 (file)
index 69afac8..0000000
+++ /dev/null
@@ -1,1057 +0,0 @@
-#if defined(CSQC)
-    #include "../../dpdefs/csprogsdefs.qh"
-    #include "../defs.qh"
-    #include "../../common/constants.qh"
-    #include "../../common/stats.qh"
-    #include "../../common/util.qh"
-    #include "../../common/buffs.qh"
-    #include "../autocvars.qh"
-    #include "../../common/movetypes/movetypes.qh"
-    #include "../prandom.qh"
-    #include "../main.qh"
-    #include "vehicles.qh"
-    #include "../../csqcmodellib/cl_model.qh"
-    #include "../../server/t_items.qh"
-#elif defined(MENUQC)
-#elif defined(SVQC)
-#endif
-
-const string hud_bg = "gfx/vehicles/frame.tga";
-const string hud_sh = "gfx/vehicles/vh-shield.tga";
-
-const string hud_hp_bar = "gfx/vehicles/bar_up_left.tga";
-const string hud_hp_ico = "gfx/vehicles/health.tga";
-const string hud_sh_bar = "gfx/vehicles/bar_dwn_left.tga";
-const string hud_sh_ico = "gfx/vehicles/shield.tga";
-
-const string hud_ammo1_bar = "gfx/vehicles/bar_up_right.tga";
-const string hud_ammo1_ico = "gfx/vehicles/bullets.tga";
-const string hud_ammo2_bar = "gfx/vehicles/bar_dwn_right.tga";
-const string hud_ammo2_ico = "gfx/vehicles/rocket.tga";
-const string hud_energy = "gfx/vehicles/energy.tga";
-
-const int SBRM_FIRST = 1;
-const int SBRM_VOLLY = 1;
-const int SBRM_GUIDE = 2;
-const int SBRM_ARTILLERY = 3;
-const int SBRM_LAST = 3;
-
-const int RSM_FIRST = 1;
-const int RSM_BOMB = 1;
-const int RSM_FLARE = 2;
-const int RSM_LAST = 2;
-
-entity dropmark;
-float autocvar_cl_vehicles_hudscale = 0.5;
-float autocvar_cl_vehicles_hudalpha = 0.75;
-
-const string raptor_ico =  "gfx/vehicles/raptor.tga";
-const string raptor_gun =  "gfx/vehicles/raptor_guns.tga";
-const string raptor_bomb = "gfx/vehicles/raptor_bombs.tga";
-const string raptor_drop = "gfx/vehicles/axh-dropcross.tga";
-string raptor_xhair;
-
-void CSQC_WAKIZASHI_HUD();
-void CSQC_SPIDER_HUD();
-void CSQC_RAPTOR_HUD();
-void CSQC_BUMBLE_HUD();
-void CSQC_BUMBLE_GUN_HUD();
-
-const int MAX_AXH = 4;
-entity AuxiliaryXhair[MAX_AXH];
-
-.string axh_image;
-.float  axh_fadetime;
-.float  axh_drawflag;
-.float  axh_scale;
-
-const string bumb_ico =  "gfx/vehicles/bumb.tga";
-const string bumb_lgun =  "gfx/vehicles/bumb_lgun.tga";
-const string bumb_rgun =  "gfx/vehicles/bumb_rgun.tga";
-
-const string bumb_gun_ico =  "gfx/vehicles/bumb_side.tga";
-const string bumb_gun_gun =  "gfx/vehicles/bumb_side_gun.tga";
-
-const string spider_ico =  "gfx/vehicles/sbot.tga";
-const string spider_rkt =  "gfx/vehicles/sbot_rpods.tga";
-const string spider_mgun = "gfx/vehicles/sbot_mguns.tga";
-string spider_xhair; // = "gfx/vehicles/axh-special1.tga";
-
-const string waki_ico = "gfx/vehicles/waki.tga";
-const string waki_eng = "gfx/vehicles/waki_e.tga";
-const string waki_gun = "gfx/vehicles/waki_guns.tga";
-const string waki_rkt = "gfx/vehicles/waki_rockets.tga";
-const string waki_xhair = "gfx/vehicles/axh-special1.tga";
-
-float alarm1time;
-float alarm2time;
-int weapon2mode;
-
-void AuxiliaryXhair_Draw2D()
-{
-    vector loc, psize;
-
-    psize = self.axh_scale * draw_getimagesize(self.axh_image);
-    loc = project_3d_to_2d(self.move_origin) - 0.5 * psize;
-    if (!(loc.z < 0 || loc.x < 0 || loc.y < 0 || loc.x > vid_conwidth || loc.y > vid_conheight))
-    {
-        loc.z = 0;
-        psize.z = 0;
-        drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
-    }
-
-    if(time - self.cnt > self.axh_fadetime)
-        self.draw2d = func_null;
-}
-
-void Net_AuXair2(bool bIsNew)
-{
-    int axh_id = bound(0, ReadByte(), MAX_AXH);
-    entity axh                 = AuxiliaryXhair[axh_id];
-
-    if(axh == world || wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
-    {
-        axh                                    = spawn();
-               axh.draw2d                      = func_null;
-               axh.drawmask            = MASK_NORMAL;
-               axh.axh_drawflag        = DRAWFLAG_ADDITIVE;
-               axh.axh_fadetime        = 0.1;
-               axh.axh_image           = "gfx/vehicles/axh-ring.tga";
-               axh.axh_scale           = 1;
-        axh.alpha                      = 1;
-               AuxiliaryXhair[axh_id] = axh;
-    }
-
-       axh.move_origin_x = ReadCoord();
-       axh.move_origin_y = ReadCoord();
-       axh.move_origin_z = ReadCoord();
-       axh.colormod_x = ReadByte() / 255;
-       axh.colormod_y = ReadByte() / 255;
-       axh.colormod_z = ReadByte() / 255;
-    axh.cnt                    = time;
-    axh.draw2d                 = AuxiliaryXhair_Draw2D;
-}
-
-void Net_VehicleSetup()
-{
-    int hud_id = ReadByte();
-
-    // Weapon update?
-    if(hud_id > HUD_VEHICLE_LAST)
-    {
-        weapon2mode = hud_id - HUD_VEHICLE_LAST;
-        return;
-    }
-
-    // hud_id == 0 means we exited a vehicle, so stop alarm sound/s
-    if(hud_id == 0)
-    {
-        sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-        sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-        return;
-    }
-
-    hud_id  = bound(HUD_VEHICLE_FIRST, hud_id, HUD_VEHICLE_LAST);
-
-    // Init auxiliary crosshairs
-    int i;
-    for(i = 0; i < MAX_AXH; ++i)
-    {
-        entity axh = AuxiliaryXhair[i];
-        if(axh != world && !wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
-            remove(axh);
-
-        axh                                    = spawn();
-               axh.draw2d                      = func_null;
-               axh.drawmask            = MASK_NORMAL;
-               axh.axh_drawflag        = DRAWFLAG_NORMAL;
-               axh.axh_fadetime        = 0.1;
-               axh.axh_image           = "gfx/vehicles/axh-ring.tga";
-               axh.axh_scale           = 1;
-        axh.alpha                      = 1;
-               AuxiliaryXhair[i]       = axh;
-    }
-
-    switch(hud_id)
-    {
-        case HUD_SPIDERBOT:
-            // Minigun1
-            AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-ring.tga";
-            AuxiliaryXhair[0].axh_scale   = 0.25;
-            // Minigun2
-            AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-ring.tga";
-            AuxiliaryXhair[1].axh_scale   = 0.25;
-            // Rocket
-            AuxiliaryXhair[2].axh_image   = "gfx/vehicles/axh-special1.tga";
-            AuxiliaryXhair[2].axh_scale   = 0.5;
-            break;
-
-        case HUD_WAKIZASHI:
-            AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
-            AuxiliaryXhair[0].axh_scale   = 0.25;
-            break;
-
-        case HUD_RAPTOR:
-            AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-special2.tga";
-            AuxiliaryXhair[0].axh_scale   = 0.5;
-            //AuxiliaryXhair[0].alpha       = 0.5;
-
-            AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-bracket.tga";
-            AuxiliaryXhair[1].axh_scale   = 0.25;
-            //AuxiliaryXhair[1].alpha       = 0.75;
-            //AuxiliaryXhair[1].axh_drawflag  = DRAWFLAG_NORMAL;
-            break;
-
-        case HUD_BUMBLEBEE:
-            // Raygun-locked
-            AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
-            AuxiliaryXhair[0].axh_scale   = 0.5;
-
-            // Gunner1
-            AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-target.tga";
-            AuxiliaryXhair[1].axh_scale   = 0.75;
-
-            // Gunner2
-            AuxiliaryXhair[2].axh_image   = "gfx/vehicles/axh-target.tga";
-            AuxiliaryXhair[2].axh_scale   = 0.75;
-            break;
-        case HUD_BUMBLEBEE_GUN:
-            // Plasma cannons
-            AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
-            AuxiliaryXhair[0].axh_scale   = 0.25;
-            // Raygun
-            AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-bracket.tga";
-            AuxiliaryXhair[1].axh_scale   = 0.25;
-            break;
-    }
-}
-#define HUD_GETSTATS \
-    int vh_health       = getstati(STAT_VEHICLESTAT_HEALTH);  \
-       float shield        = getstati(STAT_VEHICLESTAT_SHIELD);  \
-       noref int energy    = getstati(STAT_VEHICLESTAT_ENERGY);  \
-       noref float ammo1   = getstati(STAT_VEHICLESTAT_AMMO1);   \
-       noref float reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \
-       noref int ammo2     = getstati(STAT_VEHICLESTAT_AMMO2);   \
-       noref int reload2   = getstati(STAT_VEHICLESTAT_RELOAD2);
-
-void CSQC_BUMBLE_HUD()
-{
-/*
-    drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0'  * (1 - health), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0'  * (1 - energy), 1, DRAWFLAG_NORMAL);
-*/
-       if(autocvar_r_letterbox)
-        return;
-
-    vector picsize, hudloc = '0 0 0', pic2size, picloc;
-
-    // Fetch health & ammo stats
-       HUD_GETSTATS
-
-    picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc.y = vid_conheight - picsize.y;
-    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
-
-    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
-
-    shield  *= 0.01;
-    vh_health  *= 0.01;
-    energy  *= 0.01;
-    reload1 *= 0.01;
-
-    pic2size = draw_getimagesize(bumb_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
-    picloc = picsize * 0.5 - pic2size * 0.5;
-
-    if(vh_health < 0.25)
-        drawpic(hudloc + picloc, bumb_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, bumb_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
-
-    drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
-
-// Health bar
-    picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
-    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
-    if(vh_health < 0.25)
-    {
-        if(alarm1time < time)
-        {
-            alarm1time = time + 2;
-            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm1time)
-        {
-            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm1time = 0;
-        }
-    }
-
-// Shield bar
-    picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
-    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
-    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
-    if(shield < 0.25)
-    {
-        if(alarm2time < time)
-        {
-            alarm2time = time + 1;
-            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm2time)
-        {
-            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm2time = 0;
-        }
-    }
-
-       ammo1 *= 0.01;
-       ammo2 *= 0.01;
-
-// Gunner1 bar
-    picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight);
-    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-
-// Right gunner slot occupied?
-       if(!AuxiliaryXhair[1].draw2d)
-       {
-               shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No right gunner!"), false, '1 0 0' * picsize.y + '0 1 0' * picsize.y));
-               drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
-               drawstring(hudloc + picloc + '1 0 0' * shield, _("No right gunner!"), '1 0 0' * picsize.y + '0 1 0' * picsize.y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL);
-       }
-
-// ..  and icon
-    picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
-    if(ammo1 < 0.2)
-        drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-// Gunner2 bar
-    picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo2, vid_conheight);
-    drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// Left gunner slot occupied?
-       if(!AuxiliaryXhair[2].draw2d)
-       {
-               shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No left gunner!"), false, '1 0 0' * picsize.y + '0 1 0' * picsize.y));
-               drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
-               drawstring(hudloc + picloc + '1 0 0' * shield, _("No left gunner!"), '1 0 0' * picsize.y + '0 1 0' * picsize.y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL);
-       }
-
-// ..  and icon
-    picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
-    if(ammo2 < 0.2)
-        drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-       if (scoreboard_showscores)
-               HUD_DrawScoreboard();
-    else
-    {
-        picsize = draw_getimagesize(waki_xhair);
-        picsize.x *= 0.5;
-        picsize.y *= 0.5;
-        drawpic('0.5 0 0' * (vid_conwidth - picsize.x) + '0 0.5 0' * (vid_conheight - picsize.y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    }
-
-}
-
-void CSQC_BUMBLE_GUN_HUD()
-{
-
-       if(autocvar_r_letterbox)
-        return;
-
-    vector picsize, hudloc = '0 0 0', pic2size, picloc;
-
-    // Fetch health & ammo stats
-       HUD_GETSTATS
-
-    picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc.y = vid_conheight - picsize.y;
-    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
-
-    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
-
-    shield  *= 0.01;
-    vh_health  *= 0.01;
-    energy  *= 0.01;
-    reload1 *= 0.01;
-
-    pic2size = draw_getimagesize(bumb_gun_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
-    picloc = picsize * 0.5 - pic2size * 0.5;
-
-    if(vh_health < 0.25)
-        drawpic(hudloc + picloc, bumb_gun_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, bumb_gun_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
-
-    drawpic(hudloc + picloc, bumb_gun_gun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
-
-// Health bar
-    picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
-    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
-    if(vh_health < 0.25)
-    {
-        if(alarm1time < time)
-        {
-            alarm1time = time + 2;
-            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm1time)
-        {
-            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm1time = 0;
-        }
-    }
-
-// Shield bar
-    picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
-    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
-    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
-    if(shield < 0.25)
-    {
-        if(alarm2time < time)
-        {
-            alarm2time = time + 1;
-            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm2time)
-        {
-            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm2time = 0;
-        }
-    }
-
-// Gun bar
-    picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
-    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-
-// ..  and icon
-    picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
-    if(energy < 0.2)
-        drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-       if (scoreboard_showscores)
-               HUD_DrawScoreboard();
-    /*
-    else
-    {
-        picsize = draw_getimagesize(waki_xhair);
-        picsize_x *= 0.5;
-        picsize_y *= 0.5;
-
-
-        drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    }
-    */
-}
-
-
-
-void CSQC_SPIDER_HUD()
-{
-       if(autocvar_r_letterbox)
-        return;
-
-    vector picsize, hudloc = '0 0 0', pic2size, picloc;
-    int i;
-
-    // Fetch health & ammo stats
-       HUD_GETSTATS
-
-    picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc.y = vid_conheight - picsize.y;
-    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
-
-    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
-
-    ammo1   *= 0.01;
-    shield  *= 0.01;
-    vh_health  *= 0.01;
-    reload2 *= 0.01;
-
-    pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
-    picloc = picsize * 0.5 - pic2size * 0.5;
-    if(vh_health < 0.25)
-        drawpic(hudloc + picloc, spider_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, spider_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, spider_rkt, pic2size,  '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, spider_mgun, pic2size, '1 1 1' * ammo1   + '1 0 0' * (1 - ammo1),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
-
-// Health bar
-    picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
-    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
-    if(vh_health < 0.25)
-    {
-        if(alarm1time < time)
-        {
-            alarm1time = time + 2;
-            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm1time)
-        {
-            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm1time = 0;
-        }
-    }
-// Shield bar
-    picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
-    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
-    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
-    if(shield < 0.25)
-    {
-        if(alarm2time < time)
-        {
-            alarm2time = time + 1;
-            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm2time)
-        {
-            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm2time = 0;
-        }
-    }
-
-// Minigun bar
-    picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight);
-    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
-    if(ammo1 < 0.2)
-        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-// Rocket ammo bar
-    picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
-    ammo1 = picsize.x / 8;
-    picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload2, vid_conheight);
-    drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-
-// ..  and icons
-    pic2size = 0.35 * draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
-    picloc.x -= pic2size.x;
-    picloc.y += pic2size.y * 2.25;
-    if(ammo2 == 9)
-    {
-        for(i = 1; i < 9; ++i)
-        {
-            picloc.x += ammo1;
-            drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((8 * reload2 <= i) ? '0 0 0' : '1 1 1'), 0.75, DRAWFLAG_NORMAL);
-        }
-    }
-    else
-    {
-        for(i = 1; i < 9; ++i)
-        {
-            picloc.x += ammo1;
-            drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((i >= ammo2) ? '1 1 1' : '0 0 0'), 0.75, DRAWFLAG_NORMAL);
-        }
-    }
-    pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
-    if(ammo2 == 9)
-        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-       if (scoreboard_showscores)
-               HUD_DrawScoreboard();
-    else
-    {
-        switch(weapon2mode)
-        {
-            case SBRM_VOLLY:
-                spider_xhair = "gfx/vehicles/axh-bracket.tga";
-                break;
-            case SBRM_GUIDE:
-                spider_xhair = "gfx/vehicles/axh-cross.tga";
-                break;
-            case SBRM_ARTILLERY:
-                spider_xhair = "gfx/vehicles/axh-tag.tga";
-                break;
-            default:
-                spider_xhair= "gfx/vehicles/axh-tag.tga";
-        }
-
-        picsize = draw_getimagesize(spider_xhair);
-        picsize.x *= autocvar_cl_vehicle_spiderbot_cross_size;
-        picsize.y *= autocvar_cl_vehicle_spiderbot_cross_size;
-
-        drawpic('0.5 0 0' * (vid_conwidth - picsize.x) + '0 0.5 0' * (vid_conheight - picsize.y), spider_xhair, picsize, '1 1 1', autocvar_cl_vehicle_spiderbot_cross_alpha, DRAWFLAG_ADDITIVE);
-    }
-}
-
-void CSQC_RAPTOR_HUD()
-{
-       if(autocvar_r_letterbox)
-        return;
-
-    vector picsize, hudloc = '0 0 0', pic2size, picloc;
-
-    // Fetch health & ammo stats
-       HUD_GETSTATS
-
-    picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc.y = vid_conheight - picsize.y;
-    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
-
-    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
-
-    ammo1   *= 0.01;
-    ammo2   *= 0.01;
-    shield  *= 0.01;
-    vh_health  *= 0.01;
-    energy  *= 0.01;
-    reload1 = reload2 * 0.01;
-    //reload2 *= 0.01;
-
-    pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
-    picloc = picsize * 0.5 - pic2size * 0.5;
-    if(vh_health < 0.25)
-        drawpic(hudloc + picloc, raptor_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, raptor_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, raptor_bomb, pic2size,  '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, raptor_gun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
-
-// Health bar
-    picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
-    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
-    if(vh_health < 0.25)
-    {
-        if(alarm1time < time)
-        {
-            alarm1time = time + 2;
-            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm1time)
-        {
-            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm1time = 0;
-        }
-    }
-
-// Shield bar
-    picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
-    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
-    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
-    if(shield < 0.25)
-    {
-        if(alarm2time < time)
-        {
-            alarm2time = time + 1;
-            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm2time)
-        {
-            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm2time = 0;
-        }
-    }
-
-// Gun bar
-    picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
-    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
-    if(energy < 0.2)
-        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-// Bomb bar
-    picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight);
-    drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
-    if(reload1 != 1)
-        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-    if(weapon2mode == RSM_FLARE)
-    {
-        raptor_xhair =  "gfx/vehicles/axh-bracket.tga";
-    }
-    else
-    {
-        raptor_xhair =  "gfx/vehicles/axh-ring.tga";
-
-        // Bombing crosshair
-        if(!dropmark)
-        {
-            dropmark = spawn();
-            dropmark.owner = self;
-            dropmark.gravity = 1;
-        }
-
-        if(reload2 == 100)
-        {
-            vector where;
-
-            setorigin(dropmark, pmove_org);
-            dropmark.velocity = pmove_vel;
-            tracetoss(dropmark, self);
-
-            where = project_3d_to_2d(trace_endpos);
-
-            setorigin(dropmark, trace_endpos);
-            picsize = draw_getimagesize(raptor_drop) * 0.2;
-
-            if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
-            {
-                where.x -= picsize.x * 0.5;
-                where.y -= picsize.y * 0.5;
-                where.z = 0;
-                drawpic(where, raptor_drop, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
-            }
-            dropmark.cnt = time + 5;
-        }
-        else
-        {
-            vector where;
-            if(dropmark.cnt > time)
-            {
-                where = project_3d_to_2d(dropmark.origin);
-                picsize = draw_getimagesize(raptor_drop) * 0.25;
-
-                if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
-                {
-                    where.x -= picsize.x * 0.5;
-                    where.y -= picsize.y * 0.5;
-                    where.z = 0;
-                    drawpic(where, raptor_drop, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
-                }
-            }
-        }
-    }
-
-       if (scoreboard_showscores)
-               HUD_DrawScoreboard();
-    else
-    {
-        picsize = draw_getimagesize(raptor_xhair);
-        picsize.x *= 0.5;
-        picsize.y *= 0.5;
-
-        drawpic('0.5 0 0' * (vid_conwidth - picsize.x) + '0 0.5 0' * (vid_conheight - picsize.y), raptor_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    }
-}
-
-void CSQC_WAKIZASHI_HUD()
-{
-/*
-    drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0'  * (1 - health), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0'  * (1 - energy), 1, DRAWFLAG_NORMAL);
-*/
-       if(autocvar_r_letterbox)
-        return;
-
-    vector picsize, hudloc = '0 0 0', pic2size, picloc;
-
-    // Fetch health & ammo stats
-       HUD_GETSTATS
-
-    picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc.y = vid_conheight - picsize.y;
-    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
-
-    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
-
-    shield  *= 0.01;
-    vh_health  *= 0.01;
-    energy  *= 0.01;
-    reload1 *= 0.01;
-
-    pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
-    picloc = picsize * 0.5 - pic2size * 0.5;
-    if(vh_health < 0.25)
-        drawpic(hudloc + picloc, waki_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, waki_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, waki_eng, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, waki_gun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, waki_rkt, pic2size,  '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
-
-// Health bar
-    picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
-    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
-    if(vh_health < 0.25)
-    {
-        if(alarm1time < time)
-        {
-            alarm1time = time + 2;
-            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm1time)
-        {
-            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm1time = 0;
-        }
-    }
-
-
-// Shield bar
-    picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
-    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
-    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
-    if(shield < 0.25)
-    {
-        if(alarm2time < time)
-        {
-            alarm2time = time + 1;
-            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm2time)
-        {
-            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm2time = 0;
-        }
-    }
-
-// Gun bar
-    picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
-    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
-    if(energy < 0.2)
-        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-// Bomb bar
-    picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
-    picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight);
-    drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
-    if(reload1 != 1)
-        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-       if (scoreboard_showscores)
-               HUD_DrawScoreboard();
-    else
-    {
-        picsize = draw_getimagesize(waki_xhair);
-        picsize.x *= 0.5;
-        picsize.y *= 0.5;
-
-
-        drawpic('0.5 0 0' * (vid_conwidth - picsize.x) + '0 0.5 0' * (vid_conheight - picsize.y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    }
-}
-
-void Vehicles_Precache()
-{
-       precache_model("models/vehicles/bomblet.md3");
-       precache_model("models/vehicles/clusterbomb.md3");
-       precache_model("models/vehicles/clusterbomb_fragment.md3");
-       precache_model("models/vehicles/rocket01.md3");
-       precache_model("models/vehicles/rocket02.md3");
-
-       precache_sound ("vehicles/alarm.wav");
-       precache_sound ("vehicles/alarm_shield.wav");
-}
-
-void RaptorCBShellfragDraw()
-{
-       if(wasfreed(self))
-               return;
-
-       Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
-       self.move_avelocity += randomvec() * 15;
-       self.renderflags = 0;
-
-       if(self.cnt < time)
-               self.alpha = bound(0, self.nextthink - time, 1);
-
-       if(self.alpha < ALPHA_MIN_VISIBLE)
-        remove(self);
-}
-
-void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
-{
-    entity sfrag;
-
-    sfrag = spawn();
-    setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
-    setorigin(sfrag, _org);
-
-       sfrag.move_movetype = MOVETYPE_BOUNCE;
-       sfrag.gravity = 0.15;
-       sfrag.solid = SOLID_CORPSE;
-
-       sfrag.draw = RaptorCBShellfragDraw;
-
-       sfrag.move_origin = sfrag.origin = _org;
-       sfrag.move_velocity = _vel;
-       sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
-       sfrag.angles = self.move_angles = _ang;
-
-       sfrag.move_time = time;
-       sfrag.damageforcescale = 4;
-
-       sfrag.nextthink = time + 3;
-       sfrag.cnt = time + 2;
-       sfrag.alpha = 1;
-    sfrag.drawmask = MASK_NORMAL;
-}
diff --git a/qcsrc/server/tturrets/system/system_main.qc b/qcsrc/server/tturrets/system/system_main.qc
deleted file mode 100644 (file)
index 4c3a523..0000000
+++ /dev/null
@@ -1,1380 +0,0 @@
-#include "../../../common/triggers/subs.qh"
-
-#define cvar_base "g_turrets_unit_"
-.float clientframe;
-void turrets_setframe(float _frame, float client_only)
-{
-    if((client_only ? self.clientframe : self.frame ) != _frame)
-    {
-        self.SendFlags |= TNSF_ANIM;
-        self.anim_start_time = time;
-    }
-
-     if(client_only)
-        self.clientframe = _frame;
-    else
-        self.frame = _frame;
-
-}
-
-float turret_send(entity to, float sf)
-{
-
-       WriteByte(MSG_ENTITY, ENT_CLIENT_TURRET);
-       WriteByte(MSG_ENTITY, sf);
-       if(sf & TNSF_SETUP)
-       {
-           WriteByte(MSG_ENTITY, self.turret_type);
-
-           WriteCoord(MSG_ENTITY, self.origin.x);
-           WriteCoord(MSG_ENTITY, self.origin.y);
-           WriteCoord(MSG_ENTITY, self.origin.z);
-
-           WriteAngle(MSG_ENTITY, self.angles.x);
-           WriteAngle(MSG_ENTITY, self.angles.y);
-    }
-
-    if(sf & TNSF_ANG)
-    {
-        WriteShort(MSG_ENTITY, rint(self.tur_head.angles.x));
-        WriteShort(MSG_ENTITY, rint(self.tur_head.angles.y));
-    }
-
-    if(sf & TNSF_AVEL)
-    {
-        WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity.x));
-        WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity.y));
-    }
-
-    if(sf & TNSF_MOVE)
-    {
-        WriteShort(MSG_ENTITY, rint(self.origin.x));
-        WriteShort(MSG_ENTITY, rint(self.origin.y));
-        WriteShort(MSG_ENTITY, rint(self.origin.z));
-
-        WriteShort(MSG_ENTITY, rint(self.velocity.x));
-        WriteShort(MSG_ENTITY, rint(self.velocity.y));
-        WriteShort(MSG_ENTITY, rint(self.velocity.z));
-
-        WriteShort(MSG_ENTITY, rint(self.angles.y));
-    }
-
-    if(sf & TNSF_ANIM)
-    {
-        WriteCoord(MSG_ENTITY, self.anim_start_time);
-        WriteByte(MSG_ENTITY, self.frame);
-    }
-
-    if(sf & TNSF_STATUS)
-    {
-        WriteByte(MSG_ENTITY, self.team);
-
-        if(self.health <= 0)
-            WriteByte(MSG_ENTITY, 0);
-        else
-            WriteByte(MSG_ENTITY, ceil((self.health / self.tur_health) * 255));
-    }
-
-       return true;
-}
-
-void load_unit_settings(entity ent, string unitname, float is_reload)
-{
-    string sbase;
-
-    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;
-
-    sbase = strcat(cvar_base,unitname);
-    if (is_reload)
-    {
-        ent.enemy = world;
-        ent.tur_head.avelocity = '0 0 0';
-
-        ent.tur_head.angles = '0 0 0';
-    }
-
-    ent.health      = cvar(strcat(sbase,"_health")) * ent.turret_scale_health;
-    ent.respawntime = cvar(strcat(sbase,"_respawntime")) * ent.turret_scale_respawn;
-
-    ent.shot_dmg          = cvar(strcat(sbase,"_shot_dmg")) * ent.turret_scale_damage;
-    ent.shot_refire       = cvar(strcat(sbase,"_shot_refire")) * ent.turret_scale_refire;
-    ent.shot_radius       = cvar(strcat(sbase,"_shot_radius")) * ent.turret_scale_damage;
-    ent.shot_speed        = cvar(strcat(sbase,"_shot_speed"));
-    ent.shot_spread       = cvar(strcat(sbase,"_shot_spread"));
-    ent.shot_force        = cvar(strcat(sbase,"_shot_force")) * ent.turret_scale_damage;
-    ent.shot_volly        = cvar(strcat(sbase,"_shot_volly"));
-    ent.shot_volly_refire = cvar(strcat(sbase,"_shot_volly_refire")) * ent.turret_scale_refire;
-
-    ent.target_range         = cvar(strcat(sbase,"_target_range")) * ent.turret_scale_range;
-    ent.target_range_min     = cvar(strcat(sbase,"_target_range_min")) * ent.turret_scale_range;
-    ent.target_range_optimal = cvar(strcat(sbase,"_target_range_optimal")) * ent.turret_scale_range;
-    //ent.target_range_fire    = cvar(strcat(sbase,"_target_range_fire")) * ent.turret_scale_range;
-
-    ent.target_select_rangebias  = cvar(strcat(sbase,"_target_select_rangebias"));
-    ent.target_select_samebias   = cvar(strcat(sbase,"_target_select_samebias"));
-    ent.target_select_anglebias  = cvar(strcat(sbase,"_target_select_anglebias"));
-    ent.target_select_playerbias = cvar(strcat(sbase,"_target_select_playerbias"));
-    //ent.target_select_fov = cvar(cvar_gets(sbase,"_target_select_fov"));
-
-    ent.ammo_max      = cvar(strcat(sbase,"_ammo_max")) * ent.turret_scale_ammo;
-    ent.ammo_recharge = cvar(strcat(sbase,"_ammo_recharge")) * ent.turret_scale_ammo;
-
-    ent.aim_firetolerance_dist = cvar(strcat(sbase,"_aim_firetolerance_dist"));
-    ent.aim_speed    = cvar(strcat(sbase,"_aim_speed")) * ent.turret_scale_aim;
-    ent.aim_maxrot   = cvar(strcat(sbase,"_aim_maxrot"));
-    ent.aim_maxpitch = cvar(strcat(sbase,"_aim_maxpitch"));
-
-    ent.track_type        = cvar(strcat(sbase,"_track_type"));
-    ent.track_accel_pitch = cvar(strcat(sbase,"_track_accel_pitch"));
-    ent.track_accel_rot   = cvar(strcat(sbase,"_track_accel_rot"));
-    ent.track_blendrate   = cvar(strcat(sbase,"_track_blendrate"));
-
-    if(is_reload)
-        if(ent.turret_respawnhook)
-            ent.turret_respawnhook();
-}
-
-void turret_projectile_explode()
-{
-
-    self.takedamage = DAMAGE_NO;
-    self.event_damage = func_null;
-#ifdef TURRET_DEBUG
-    float d;
-    d = RadiusDamage (self, self.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
-    self.owner.tur_dbg_dmg_t_h = self.owner.tur_dbg_dmg_t_h + d;
-    self.owner.tur_dbg_dmg_t_f = self.owner.tur_dbg_dmg_t_f + self.owner.shot_dmg;
-#else
-    RadiusDamage (self, self.realowner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
-#endif
-    remove(self);
-}
-
-void turret_projectile_touch()
-{
-    PROJECTILE_TOUCH;
-    turret_projectile_explode();
-}
-
-void turret_projectile_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
-{
-    self.velocity  += vforce;
-    self.health    -= damage;
-    //self.realowner  = attacker; // Dont change realowner, it does not make much sense for turrets
-    if(self.health <= 0)
-        W_PrepareExplosionByDamage(self.owner, turret_projectile_explode);
-}
-
-entity turret_projectile(string _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
-{
-    entity proj;
-
-    sound (self, CH_WEAPON_A, _snd, VOL_BASE, ATTEN_NORM);
-    proj                 = spawn ();
-    setorigin(proj, self.tur_shotorg);
-    setsize(proj, '-0.5 -0.5 -0.5' * _size, '0.5 0.5 0.5' * _size);
-    proj.owner           = self;
-    proj.realowner       = self;
-    proj.bot_dodge       = true;
-    proj.bot_dodgerating = self.shot_dmg;
-    proj.think           = turret_projectile_explode;
-    proj.touch           = turret_projectile_touch;
-    proj.nextthink       = time + 9;
-    proj.movetype        = MOVETYPE_FLYMISSILE;
-    proj.velocity        = normalize(self.tur_shotdir_updated + randomvec() * self.shot_spread) * self.shot_speed;
-    proj.flags           = FL_PROJECTILE;
-    proj.enemy           = self.enemy;
-    proj.totalfrags      = _death;
-    PROJECTILE_MAKETRIGGER(proj);
-    if(_health)
-    {
-        proj.health         = _health;
-        proj.takedamage     = DAMAGE_YES;
-        proj.event_damage   = turret_projectile_damage;
-    }
-    else
-        proj.flags |= FL_NOTARGET;
-
-    CSQCProjectile(proj, _cli_anim, _proj_type, _cull);
-
-    return proj;
-}
-
-/**
-** updates enemy distances, predicted impact point/time
-** and updated aim<->predict impact distance.
-**/
-void turret_do_updates(entity t_turret)
-{
-    vector enemy_pos;
-    entity oldself;
-
-    oldself = self;
-    self = t_turret;
-
-    enemy_pos = real_origin(self.enemy);
-
-    turret_tag_fire_update();
-
-    self.tur_shotdir_updated = v_forward;
-    self.tur_dist_enemy  = vlen(self.tur_shotorg - enemy_pos);
-    self.tur_dist_aimpos = vlen(self.tur_shotorg - self.tur_aimpos);
-
-    /*if((self.firecheck_flags & TFL_FIRECHECK_VERIFIED) && (self.enemy))
-    {
-        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);
-
-        if(trace_ent == self.enemy)
-            self.tur_dist_impact_to_aimpos = 0;
-        else
-            self.tur_dist_impact_to_aimpos = vlen(trace_endpos - self.tur_aimpos);
-    }
-    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);
-
-       self.tur_dist_impact_to_aimpos = vlen(trace_endpos - self.tur_aimpos) - (vlen(self.enemy.maxs - self.enemy.mins) * 0.5);
-       self.tur_impactent             = trace_ent;
-       self.tur_impacttime            = vlen(self.tur_shotorg - trace_endpos) / self.shot_speed;
-
-    self = oldself;
-}
-
-/*
-vector turret_fovsearch_pingpong()
-{
-    vector wish_angle;
-    if(self.phase < time)
-    {
-        if( self.tur_head.phase )
-            self.tur_head.phase = 0;
-        else
-            self.tur_head.phase = 1;
-        self.phase = time + 5;
-    }
-
-    if( self.tur_head.phase)
-        wish_angle = self.idle_aim + '0 1 0' * (self.aim_maxrot * (self.target_select_fov / 360));
-    else
-        wish_angle = self.idle_aim - '0 1 0' * (self.aim_maxrot * (self.target_select_fov / 360));
-
-    return wish_angle;
-}
-
-vector turret_fovsearch_steprot()
-{
-    vector wish_angle;
-    //float rot_add;
-
-    wish_angle   = self.tur_head.angles;
-    wish_angle_x = self.idle_aim_x;
-
-    if (self.phase < time)
-    {
-        //rot_add = self.aim_maxrot / self.target_select_fov;
-        wish_angle_y += (self.target_select_fov * 2);
-
-        if(wish_angle_y > 360)
-            wish_angle_y = wish_angle_y - 360;
-
-         self.phase = time + 1.5;
-    }
-
-    return wish_angle;
-}
-
-vector turret_fovsearch_random()
-{
-    vector wish_angle;
-
-    if (self.phase < time)
-    {
-        wish_angle_y = random() * self.aim_maxrot;
-        if(random() < 0.5)
-            wish_angle_y *= -1;
-
-        wish_angle_x = random() * self.aim_maxpitch;
-        if(random() < 0.5)
-            wish_angle_x *= -1;
-
-        self.phase = time + 5;
-
-        self.tur_aimpos = wish_angle;
-    }
-
-    return self.idle_aim + self.tur_aimpos;
-}
-*/
-
-/**
-** Handles head rotation according to
-** the units .track_type and .track_flags
-**/
-.float turret_framecounter;
-void turret_stdproc_track()
-{
-    vector target_angle; // This is where we want to aim
-    vector move_angle;   // This is where we can aim
-    float f_tmp;
-    vector v1, v2;
-    v1 = self.tur_head.angles;
-    v2 = self.tur_head.avelocity;
-
-    if (self.track_flags == TFL_TRACK_NO)
-        return;
-
-    if (!self.active)
-        target_angle = self.idle_aim - ('1 0 0' * self.aim_maxpitch);
-    else if (self.enemy == world)
-    {
-        if(time > self.lip)
-            target_angle = self.idle_aim + self.angles;
-        else
-            target_angle = vectoangles(normalize(self.tur_aimpos - self.tur_shotorg));
-    }
-    else
-    {
-        target_angle = vectoangles(normalize(self.tur_aimpos - self.tur_shotorg));
-    }
-
-    self.tur_head.angles_x = anglemods(self.tur_head.angles.x);
-    self.tur_head.angles_y = anglemods(self.tur_head.angles.y);
-
-    // Find the diffrence between where we currently aim and where we want to aim
-    //move_angle = target_angle - (self.angles + self.tur_head.angles);
-    //move_angle = shortangle_vxy(move_angle,(self.angles + self.tur_head.angles));
-
-    move_angle = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(self.angles), AnglesTransform_FromAngles(target_angle))) - self.tur_head.angles;
-    move_angle = shortangle_vxy(move_angle, self.tur_head.angles);
-
-    switch(self.track_type)
-    {
-        case TFL_TRACKTYPE_STEPMOTOR:
-            f_tmp = self.aim_speed * self.ticrate; // dgr/sec -> dgr/tic
-            if (self.track_flags & TFL_TRACK_PITCH)
-            {
-                self.tur_head.angles_x += bound(-f_tmp,move_angle.x, f_tmp);
-                if(self.tur_head.angles.x > self.aim_maxpitch)
-                    self.tur_head.angles_x = self.aim_maxpitch;
-
-                if(self.tur_head.angles.x  < -self.aim_maxpitch)
-                    self.tur_head.angles_x = self.aim_maxpitch;
-            }
-
-            if (self.track_flags & TFL_TRACK_ROT)
-            {
-                self.tur_head.angles_y += bound(-f_tmp, move_angle.y, f_tmp);
-                if(self.tur_head.angles.y > self.aim_maxrot)
-                    self.tur_head.angles_y = self.aim_maxrot;
-
-                if(self.tur_head.angles.y  < -self.aim_maxrot)
-                    self.tur_head.angles_y = self.aim_maxrot;
-            }
-
-            // CSQC
-            self.SendFlags  |= TNSF_ANG;
-
-            return;
-
-        case TFL_TRACKTYPE_FLUIDINERTIA:
-            f_tmp = self.aim_speed * self.ticrate; // dgr/sec -> dgr/tic
-            move_angle.x = bound(-self.aim_speed, move_angle.x * self.track_accel_pitch * f_tmp, self.aim_speed);
-            move_angle.y = bound(-self.aim_speed, move_angle.y * self.track_accel_rot * f_tmp, self.aim_speed);
-            move_angle = (self.tur_head.avelocity * self.track_blendrate) + (move_angle * (1 - self.track_blendrate));
-            break;
-
-        case TFL_TRACKTYPE_FLUIDPRECISE:
-
-            move_angle.y = bound(-self.aim_speed, move_angle.y, self.aim_speed);
-            move_angle.x = bound(-self.aim_speed, move_angle.x, self.aim_speed);
-
-            break;
-    }
-
-    //  pitch
-    if (self.track_flags & TFL_TRACK_PITCH)
-    {
-        self.tur_head.avelocity_x = move_angle.x;
-        if((self.tur_head.angles.x + self.tur_head.avelocity.x * self.ticrate) > self.aim_maxpitch)
-        {
-            self.tur_head.avelocity_x = 0;
-            self.tur_head.angles_x = self.aim_maxpitch;
-
-            self.SendFlags  |= TNSF_ANG;
-        }
-
-        if((self.tur_head.angles.x + self.tur_head.avelocity.x * self.ticrate) < -self.aim_maxpitch)
-        {
-            self.tur_head.avelocity_x = 0;
-            self.tur_head.angles_x = -self.aim_maxpitch;
-
-            self.SendFlags  |= TNSF_ANG;
-        }
-    }
-
-    //  rot
-    if (self.track_flags & TFL_TRACK_ROT)
-    {
-        self.tur_head.avelocity_y = move_angle.y;
-
-        if((self.tur_head.angles.y + self.tur_head.avelocity.y * self.ticrate) > self.aim_maxrot)
-        {
-            self.tur_head.avelocity_y = 0;
-            self.tur_head.angles_y = self.aim_maxrot;
-
-            self.SendFlags  |= TNSF_ANG;
-        }
-
-        if((self.tur_head.angles.y + self.tur_head.avelocity.y * self.ticrate) < -self.aim_maxrot)
-        {
-            self.tur_head.avelocity_y = 0;
-            self.tur_head.angles_y = -self.aim_maxrot;
-
-            self.SendFlags  |= TNSF_ANG;
-        }
-    }
-
-    self.SendFlags  |= TNSF_AVEL;
-
-    // Force a angle update every 10'th frame
-    self.turret_framecounter += 1;
-    if(self.turret_framecounter >= 10)
-    {
-        self.SendFlags |= TNSF_ANG;
-        self.turret_framecounter = 0;
-    }
-}
-
-
-/*
- + = implemented
- - = not implemented
-
- + TFL_FIRECHECK_NO
- + TFL_FIRECHECK_WORLD
- + TFL_FIRECHECK_DEAD
- + TFL_FIRECHECK_DISTANCES
- - TFL_FIRECHECK_LOS
- + TFL_FIRECHECK_AIMDIST
- + TFL_FIRECHECK_REALDIST
- - TFL_FIRECHECK_ANGLEDIST
- - TFL_FIRECHECK_TEAMCECK
- + TFL_FIRECHECK_AFF
- + TFL_FIRECHECK_OWM_AMMO
- + TFL_FIRECHECK_OTHER_AMMO
- + TFL_FIRECHECK_REFIRE
-*/
-
-/**
-** Preforms pre-fire checks based on the uints firecheck_flags
-**/
-float turret_stdproc_firecheck()
-{
-    // This one just dont care =)
-    if (self.firecheck_flags & TFL_FIRECHECK_NO)
-        return 1;
-
-    if (self.enemy == world)
-        return 0;
-
-    // Ready?
-    if (self.firecheck_flags & TFL_FIRECHECK_REFIRE)
-        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)
-        if (self.volly_counter != self.shot_volly)
-                       if(self.ammo >= self.shot_dmg)
-                               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;
-
-    // Own ammo?
-    if (self.firecheck_flags & TFL_FIRECHECK_OWM_AMMO)
-        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;
-
-       // Target of opertunity?
-       if(turret_validate_target(self, self.tur_impactent, self.target_validate_flags) > 0)
-       {
-               self.enemy = self.tur_impactent;
-               return 1;
-       }
-
-    if (self.firecheck_flags & TFL_FIRECHECK_DISTANCES)
-    {
-        // To close?
-        if (self.tur_dist_aimpos < self.target_range_min)
-                       if(turret_validate_target(self, self.tur_impactent, self.target_validate_flags) > 0)
-                               return 1; // Target of opertunity?
-                       else
-                               return 0;
-    }
-
-    // Try to avoid FF?
-    if (self.firecheck_flags & TFL_FIRECHECK_AFF)
-        if (self.tur_impactent.team == self.team)
-            return 0;
-
-    // aim<->predicted impact
-    if (self.firecheck_flags & TFL_FIRECHECK_AIMDIST)
-        if (self.tur_dist_impact_to_aimpos > self.aim_firetolerance_dist)
-            return 0;
-
-    // Volly status
-    if (self.shot_volly > 1)
-        if (self.volly_counter == self.shot_volly)
-            if (self.ammo < (self.shot_dmg * self.shot_volly))
-                return 0;
-
-    /*if(self.firecheck_flags & TFL_FIRECHECK_VERIFIED)
-        if(self.tur_impactent != self.enemy)
-            return 0;*/
-
-    return 1;
-}
-
-/*
- + TFL_TARGETSELECT_NO
- + TFL_TARGETSELECT_LOS
- + TFL_TARGETSELECT_PLAYERS
- + TFL_TARGETSELECT_MISSILES
- - TFL_TARGETSELECT_TRIGGERTARGET
- + TFL_TARGETSELECT_ANGLELIMITS
- + TFL_TARGETSELECT_RANGELIMTS
- + TFL_TARGETSELECT_TEAMCHECK
- - TFL_TARGETSELECT_NOBUILTIN
- + TFL_TARGETSELECT_OWNTEAM
-*/
-
-/**
-** 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)
-{
-    vector v_tmp;
-
-    //if(!validate_flags & TFL_TARGETSELECT_NOBUILTIN)
-    //    return -0.5;
-
-    if(e_target.owner == e_turret)
-        return -0.5;
-
-    if (!checkpvs(e_target.origin, e_turret))
-        return -1;
-
-    if (!e_target)
-        return -2;
-
-       if(g_onslaught)
-               if (substring(e_target.classname, 0, 10) == "onslaught_") // don't attack onslaught targets, that's the player's job!
-                       return - 3;
-
-    if (validate_flags & TFL_TARGETSELECT_NO)
-        return -4;
-
-    // If only this was used more..
-    if (e_target.flags & FL_NOTARGET)
-        return -5;
-
-    // Cant touch this
-    if(e_target.vehicle_flags & VHF_ISVEHICLE)
-    {
-        if (e_target.vehicle_health <= 0)
-            return -6;
-    }
-    else if (e_target.health <= 0)
-        return -6;
-
-    // player
-    if (IS_CLIENT(e_target))
-    {
-        if (!(validate_flags & TFL_TARGETSELECT_PLAYERS))
-            return -7;
-
-        if (e_target.deadflag != DEAD_NO)
-            return -8;
-    }
-
-       // enemy turrets
-       if (validate_flags & TFL_TARGETSELECT_NOTURRETS)
-        if (e_target.turret_firefunc || e_target.owner.tur_head == e_target)
-            if(e_target.team != e_turret.team) // Dont break support units.
-                return -9;
-
-    // Missile
-    if (e_target.flags & FL_PROJECTILE)
-        if (!(validate_flags & TFL_TARGETSELECT_MISSILES))
-            return -10;
-
-    if (validate_flags & TFL_TARGETSELECT_MISSILESONLY)
-        if (!(e_target.flags & FL_PROJECTILE))
-            return -10.5;
-
-    // Team check
-    if (validate_flags & TFL_TARGETSELECT_TEAMCHECK)
-    {
-        if (validate_flags & TFL_TARGETSELECT_OWNTEAM)
-        {
-            if (e_target.team != e_turret.team)
-                return -11;
-
-            if (e_turret.team != e_target.owner.team)
-                return -12;
-        }
-        else
-        {
-            if (e_target.team == e_turret.team)
-                return -13;
-
-            if (e_turret.team == e_target.owner.team)
-                return -14;
-        }
-    }
-
-    // Range limits?
-    tvt_dist = vlen(e_turret.origin - real_origin(e_target));
-    if (validate_flags & TFL_TARGETSELECT_RANGELIMTS)
-    {
-        if (tvt_dist < e_turret.target_range_min)
-            return -15;
-
-        if (tvt_dist > e_turret.target_range)
-            return -16;
-    }
-
-    // Can we even aim this thing?
-    tvt_thadv = angleofs3(e_turret.tur_head.origin, e_turret.angles + e_turret.tur_head.angles, e_target);
-    tvt_tadv  = shortangle_vxy(angleofs(e_turret, e_target), e_turret.angles);
-    tvt_thadf = vlen(tvt_thadv);
-    tvt_tadf  = vlen(tvt_tadv);
-
-    /*
-    if(validate_flags & TFL_TARGETSELECT_FOV)
-    {
-        if(e_turret.target_select_fov < tvt_thadf)
-            return -21;
-    }
-    */
-
-    if (validate_flags & TFL_TARGETSELECT_ANGLELIMITS)
-    {
-        if (fabs(tvt_tadv.x) > e_turret.aim_maxpitch)
-            return -17;
-
-        if (fabs(tvt_tadv.y) > e_turret.aim_maxrot)
-            return -18;
-    }
-
-    // Line of sight?
-    if (validate_flags & TFL_TARGETSELECT_LOS)
-    {
-        v_tmp = real_origin(e_target) + ((e_target.mins + e_target.maxs) * 0.5);
-
-        traceline(e_turret.origin + '0 0 16', v_tmp, 0, e_turret);
-
-        if (e_turret.aim_firetolerance_dist < vlen(v_tmp - trace_endpos))
-            return -19;
-    }
-
-    if (e_target.classname == "grapplinghook")
-        return -20;
-
-    /*
-    if (e_target.classname == "func_button")
-        return -21;
-    */
-
-#ifdef TURRET_DEBUG_TARGETSELECT
-    dprint("Target:",e_target.netname," is a valid target for ",e_turret.netname,"\n");
-#endif
-
-    return 1;
-}
-
-entity turret_select_target()
-{
-    entity e;        // target looper entity
-    float  score;    // target looper entity score
-    entity e_enemy;  // currently best scoreing target
-    float  m_score;  // currently best scoreing target's score
-
-    m_score = 0;
-    if(self.enemy && self.enemy.takedamage && turret_validate_target(self,self.enemy,self.target_validate_flags) > 0)
-    {
-        e_enemy = self.enemy;
-        m_score = self.turret_score_target(self,e_enemy) * self.target_select_samebias;
-    }
-    else
-        e_enemy = self.enemy = world;
-
-    e = findradius(self.origin, self.target_range);
-
-    // Nothing to aim at?
-    if (!e)
-               return world;
-
-    while (e)
-    {
-               if(e.takedamage)
-               {
-                   float f = turret_validate_target(self, e, self.target_select_flags);
-                   //dprint("F is: ", ftos(f), "\n");
-                       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;
-    }
-
-    return e_enemy;
-}
-
-void turret_think()
-{
-    entity e;
-
-    self.nextthink = time + self.ticrate;
-
-    // ONS uses somewhat backwards linking.
-    if (teamplay)
-    {
-        if (g_onslaught)
-            if (self.target)
-            {
-                e = find(world, targetname,self.target);
-                if (e != world)
-                    self.team = e.team;
-            }
-
-        if (self.team != self.tur_head.team)
-            turret_stdproc_respawn();
-    }
-
-#ifdef TURRET_DEBUG
-    if (self.tur_dbg_tmr1 < time)
-    {
-        if (self.enemy) paint_target (self.enemy,128,self.tur_dbg_rvec,0.9);
-        paint_target(self,256,self.tur_dbg_rvec,0.9);
-        self.tur_dbg_tmr1 = time + 1;
-    }
-#endif
-
-    // Handle ammo
-    if (!(self.spawnflags & TSF_NO_AMMO_REGEN))
-    if (self.ammo < self.ammo_max)
-        self.ammo = min(self.ammo + self.ammo_recharge, self.ammo_max);
-
-    // Inactive turrets needs to run the think loop,
-    // So they can handle animation and wake up if need be.
-    if (!self.active)
-    {
-        turret_stdproc_track();
-        return;
-    }
-
-    // This is typicaly used for zaping every target in range
-    // 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(e.takedamage)
-                       {
-                               if (turret_validate_target(self,e,self.target_validate_flags))
-                               {
-                                       self.enemy = e;
-
-                                       turret_do_updates(self);
-
-                                       if (self.turret_firecheckfunc())
-                                               turret_fire();
-                               }
-                       }
-
-            e = e.chain;
-        }
-        self.enemy = world;
-    }
-    else if(self.shoot_flags & TFL_SHOOT_CUSTOM)
-    {
-        // This one is doing something.. oddball. assume its handles what needs to be handled.
-
-        // Predict?
-        if (!(self.aim_flags & TFL_AIM_NO))
-            self.tur_aimpos = turret_stdproc_aim_generic();
-
-        // Turn & pitch?
-        if (!(self.track_flags & TFL_TRACK_NO))
-            turret_stdproc_track();
-
-        turret_do_updates(self);
-
-        // Fire?
-        if (self.turret_firecheckfunc())
-            turret_fire();
-    }
-    else
-    {
-        // Special case for volly always. if it fired once it must compleate the volly.
-        if(self.shoot_flags & TFL_SHOOT_VOLLYALWAYS)
-            if(self.volly_counter != self.shot_volly)
-            {
-                // Predict or whatnot
-                if (!(self.aim_flags & TFL_AIM_NO))
-                    self.tur_aimpos = turret_stdproc_aim_generic();
-
-                // Turn & pitch
-                if (!(self.track_flags & TFL_TRACK_NO))
-                    turret_stdproc_track();
-
-                turret_do_updates(self);
-
-                // Fire!
-                if (self.turret_firecheckfunc() != 0)
-                    turret_fire();
-
-                if(self.turret_postthink)
-                    self.turret_postthink();
-
-                return;
-            }
-
-        // Check if we have a vailid enemy, and try to find one if we dont.
-
-        // g_turrets_targetscan_maxdelay forces a target re-scan at least this often
-        float do_target_scan = 0;
-        if((self.target_select_time + autocvar_g_turrets_targetscan_maxdelay) < time)
-            do_target_scan = 1;
-
-        // Old target (if any) invalid?
-        if(self.target_validate_time < time)
-        if (turret_validate_target(self, self.enemy, self.target_validate_flags) <= 0)
-        {
-               self.enemy = world;
-               self.target_validate_time = time + 0.5;
-               do_target_scan = 1;
-        }
-
-        // But never more often then g_turrets_targetscan_mindelay!
-        if (self.target_select_time + autocvar_g_turrets_targetscan_mindelay > time)
-            do_target_scan = 0;
-
-        if(do_target_scan)
-        {
-            self.enemy = turret_select_target();
-            self.target_select_time = time;
-        }
-
-        // No target, just go to idle, do any custom stuff and bail.
-        if (self.enemy == world)
-        {
-            // Turn & pitch
-            if (!(self.track_flags & TFL_TRACK_NO))
-                turret_stdproc_track();
-
-            // do any per-turret stuff
-            if(self.turret_postthink)
-                self.turret_postthink();
-
-            // And bail.
-            return;
-        }
-        else
-            self.lip = time + autocvar_g_turrets_aimidle_delay; // Keep track of the last time we had a target.
-
-        // Predict?
-        if (!(self.aim_flags & TFL_AIM_NO))
-            self.tur_aimpos = turret_stdproc_aim_generic();
-
-        // Turn & pitch?
-        if (!(self.track_flags & TFL_TRACK_NO))
-            turret_stdproc_track();
-
-        turret_do_updates(self);
-
-        // Fire?
-        if (self.turret_firecheckfunc())
-            turret_fire();
-    }
-
-    // do any custom per-turret stuff
-    if(self.turret_postthink)
-        self.turret_postthink();
-}
-
-void turret_fire()
-{
-    if (autocvar_g_turrets_nofire != 0)
-        return;
-
-    self.turret_firefunc();
-
-    self.attack_finished_single = time + self.shot_refire;
-    self.ammo -= self.shot_dmg;
-    self.volly_counter = self.volly_counter - 1;
-
-    if (self.volly_counter <= 0)
-    {
-        self.volly_counter = self.shot_volly;
-
-        if (self.shoot_flags & TFL_SHOOT_CLEARTARGET)
-            self.enemy = world;
-
-        if (self.shot_volly > 1)
-            self.attack_finished_single = time + self.shot_volly_refire;
-    }
-
-#ifdef TURRET_DEBUG
-    if (self.enemy) paint_target3(self.tur_aimpos, 64, self.tur_dbg_rvec, self.tur_impacttime + 0.25);
-#endif
-}
-
-void turret_stdproc_fire()
-{
-    dprint("^1Bang, ^3your dead^7 ",self.enemy.netname,"! ^1(turret with no real firefunc)\n");
-}
-
-/*
-    When .used a turret switch team to activator.team.
-    If activator is world, the turret go inactive.
-*/
-void turret_stdproc_use()
-{
-    dprint("Turret ",self.netname, " used by ", activator.classname, "\n");
-
-    self.team = activator.team;
-
-    if(self.team == 0)
-        self.active = ACTIVE_NOT;
-    else
-        self.active = ACTIVE_ACTIVE;
-
-}
-
-void turret_link()
-{
-    Net_LinkEntity(self, true, 0, turret_send);
-    self.think      = turret_think;
-    self.nextthink  = time;
-    self.tur_head.effects = EF_NODRAW;
-}
-
-void turrets_manager_think()
-{
-    self.nextthink = time + 1;
-
-    entity e;
-    if (autocvar_g_turrets_reloadcvars == 1)
-    {
-        e = nextent(world);
-        while (e)
-        {
-            if (e.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
-            {
-                load_unit_settings(e,e.cvar_basename,1);
-                if(e.turret_postthink)
-                    e.turret_postthink();
-            }
-
-            e = nextent(e);
-        }
-        cvar_set("g_turrets_reloadcvars","0");
-    }
-}
-
-/*
-* Standard turret initialization. use this!
-* (unless you have a very good reason not to)
-* if the return value is 0, the turret should be removed.
-*/
-float turret_stdproc_init (string cvar_base_name, string base, string head, float _turret_type)
-{
-       entity e, ee = world;
-
-    // Are turrets allowed?
-    if (autocvar_g_turrets == 0)
-        return 0;
-
-    if(_turret_type < 1 || _turret_type > TID_LAST)
-    {
-        dprint("Invalid / Unkown turret type\"", ftos(_turret_type), "\", aborting!\n");
-        return 0;
-    }
-    self.turret_type = _turret_type;
-
-    e = find(world, classname, "turret_manager");
-    if (!e)
-    {
-        e = spawn();
-        e.classname = "turret_manager";
-        e.think = turrets_manager_think;
-        e.nextthink = time + 2;
-    }
-
-    if (!(self.spawnflags & TSF_SUSPENDED))
-        builtin_droptofloor(); // why can't we use regular droptofloor here?
-
-    // Terrainbase spawnflag. This puts a enlongated model
-    // under the turret, so it looks ok on uneaven surfaces.
-    /*  TODO: Handle this with CSQC
-    if (self.spawnflags & TSF_TERRAINBASE)
-    {
-        entity tb;
-        tb = spawn();
-        setmodel(tb,"models/turrets/terrainbase.md3");
-        setorigin(tb,self.origin);
-        tb.solid = SOLID_BBOX;
-    }
-    */
-
-    self.cvar_basename = cvar_base_name;
-    load_unit_settings(self, self.cvar_basename, 0);
-
-    self.effects = EF_NODRAW;
-
-    // Handle turret teams.
-    if (!teamplay)
-               self.team = MAX_SHOT_DISTANCE; // Group all turrets into the same team, so they dont kill eachother.
-       else if(g_onslaught && self.targetname)
-       {
-               e = find(world,target,self.targetname);
-               if(e != world)
-               {
-                       self.team = e.team;
-                       ee = e;
-               }
-       }
-       else if(!self.team)
-               self.team = MAX_SHOT_DISTANCE; // Group all turrets into the same team, so they dont kill eachother.
-
-    /*
-    * Try to guess some reasonaly defaults
-    * for missing params and do sanety checks
-    * thise checks could produce some "interesting" results
-    * if it hits a glitch in my logic :P so try to set as mutch
-    * as possible beforehand.
-    */
-    if (!self.ticrate)
-    {
-        if (self.turrcaps_flags & TFL_TURRCAPS_SUPPORT)
-            self.ticrate = 0.2;     // Support units generaly dont need to have a high speed ai-loop
-        else
-            self.ticrate = 0.1;     // 10 fps for normal turrets
-    }
-
-    self.ticrate = bound(sys_frametime, self.ticrate, 60);  // keep it sane
-
-// General stuff
-    if (self.netname == "")
-        self.netname = self.classname;
-
-    if (!self.respawntime)
-        self.respawntime = 60;
-    self.respawntime = max(-1, self.respawntime);
-
-    if (!self.health)
-        self.health = 1000;
-    self.tur_health = max(1, self.health);
-    self.bot_attack = true;
-    self.monster_attack = true;
-
-    if (!self.turrcaps_flags)
-        self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_MEDPROJ | TFL_TURRCAPS_PLAYERKILL;
-
-    if (!self.damage_flags)
-        self.damage_flags = TFL_DMG_YES | TFL_DMG_RETALIATE | TFL_DMG_AIMSHAKE;
-
-// Shot stuff.
-    if (!self.shot_refire)
-        self.shot_refire = 1;
-    self.shot_refire = bound(0.01, self.shot_refire, 9999);
-
-    if (!self.shot_dmg)
-        self.shot_dmg  = self.shot_refire * 50;
-    self.shot_dmg = max(1, self.shot_dmg);
-
-    if (!self.shot_radius)
-        self.shot_radius = self.shot_dmg * 0.5;
-    self.shot_radius = max(1, self.shot_radius);
-
-    if (!self.shot_speed)
-        self.shot_speed = 2500;
-    self.shot_speed = max(1, self.shot_speed);
-
-    if (!self.shot_spread)
-        self.shot_spread = 0.0125;
-    self.shot_spread = bound(0.0001, self.shot_spread, 500);
-
-    if (!self.shot_force)
-        self.shot_force = self.shot_dmg * 0.5 + self.shot_radius * 0.5;
-    self.shot_force = bound(0.001, self.shot_force, 5000);
-
-    if (!self.shot_volly)
-        self.shot_volly = 1;
-    self.shot_volly = bound(1, self.shot_volly, floor(self.ammo_max / self.shot_dmg));
-
-    if (!self.shot_volly_refire)
-        self.shot_volly_refire = self.shot_refire * self.shot_volly;
-    self.shot_volly_refire = bound(self.shot_refire, self.shot_volly_refire, 60);
-
-    if (!self.firecheck_flags)
-        self.firecheck_flags = TFL_FIRECHECK_DEAD | TFL_FIRECHECK_DISTANCES |
-                               TFL_FIRECHECK_LOS | TFL_FIRECHECK_AIMDIST | TFL_FIRECHECK_TEAMCECK |
-                               TFL_FIRECHECK_OWM_AMMO | TFL_FIRECHECK_REFIRE;
-
-// Range stuff.
-    if (!self.target_range)
-        self.target_range = self.shot_speed * 0.5;
-    self.target_range = bound(0, self.target_range, MAX_SHOT_DISTANCE);
-
-    if (!self.target_range_min)
-        self.target_range_min = self.shot_radius * 2;
-    self.target_range_min = bound(0, self.target_range_min, MAX_SHOT_DISTANCE);
-
-    if (!self.target_range_optimal)
-        self.target_range_optimal = self.target_range * 0.5;
-    self.target_range_optimal = bound(0, self.target_range_optimal, MAX_SHOT_DISTANCE);
-
-
-// Aim stuff.
-    if (!self.aim_maxrot)
-        self.aim_maxrot = 90;
-    self.aim_maxrot = bound(0, self.aim_maxrot, 360);
-
-    if (!self.aim_maxpitch)
-        self.aim_maxpitch = 20;
-    self.aim_maxpitch = bound(0, self.aim_maxpitch, 90);
-
-    if (!self.aim_speed)
-        self.aim_speed = 36;
-    self.aim_speed  = bound(0.1, self.aim_speed, 1000);
-
-    if (!self.aim_firetolerance_dist)
-        self.aim_firetolerance_dist  = 5 + (self.shot_radius * 2);
-    self.aim_firetolerance_dist = bound(0.1, self.aim_firetolerance_dist, MAX_SHOT_DISTANCE);
-
-    if (!self.aim_flags)
-    {
-        self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
-        if(self.turrcaps_flags & TFL_TURRCAPS_RADIUSDMG)
-            self.aim_flags |= TFL_AIM_GROUNDGROUND;
-    }
-
-    if (!self.track_type)
-        self.track_type = TFL_TRACKTYPE_STEPMOTOR;
-
-    if (self.track_type != TFL_TRACKTYPE_STEPMOTOR)
-    {
-        // Fluid / Ineria mode. Looks mutch nicer.
-        // Can reduce aim preformance alot, needs a bit diffrent aimspeed
-
-        if (!self.aim_speed)
-            self.aim_speed = 180;
-        self.aim_speed = bound(0.1, self.aim_speed, 1000);
-
-        if (!self.track_accel_pitch)
-            self.track_accel_pitch = 0.5;
-
-        if (!self.track_accel_rot)
-            self.track_accel_rot   = 0.5;
-
-        if (!self.track_blendrate)
-            self.track_blendrate   = 0.35;
-    }
-
-    if (!self.track_flags)
-        self.track_flags = TFL_TRACK_PITCH | TFL_TRACK_ROT;
-
-
-// Target selection stuff.
-    if (!self.target_select_rangebias)
-        self.target_select_rangebias = 1;
-    self.target_select_rangebias = bound(-10, self.target_select_rangebias, 10);
-
-    if (!self.target_select_samebias)
-        self.target_select_samebias = 1;
-    self.target_select_samebias = bound(-10, self.target_select_samebias, 10);
-
-    if (!self.target_select_anglebias)
-        self.target_select_anglebias = 1;
-    self.target_select_anglebias = bound(-10, self.target_select_anglebias, 10);
-
-    if (!self.target_select_missilebias)
-        self.target_select_missilebias = -10;
-
-    self.target_select_missilebias = bound(-10, self.target_select_missilebias, 10);
-    self.target_select_playerbias = bound(-10, self.target_select_playerbias, 10);
-
-    if (!self.target_select_flags)
-    {
-            self.target_select_flags = TFL_TARGETSELECT_LOS | TFL_TARGETSELECT_TEAMCHECK
-                                     | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_ANGLELIMITS;
-
-        if (self.turrcaps_flags & TFL_TURRCAPS_MISSILEKILL)
-            self.target_select_flags |= TFL_TARGETSELECT_MISSILES;
-
-        if (self.turrcaps_flags & TFL_TURRCAPS_PLAYERKILL)
-            self.target_select_flags |= TFL_TARGETSELECT_PLAYERS;
-        //else
-        //    self.target_select_flags = TFL_TARGETSELECT_NO;
-    }
-
-    self.target_validate_flags = self.target_select_flags;
-
-// Ammo stuff
-    if (!self.ammo_max)
-        self.ammo_max = self.shot_dmg * 10;
-    self.ammo_max = max(self.shot_dmg, self.ammo_max);
-
-    if (!self.ammo)
-        self.ammo = self.shot_dmg * 5;
-    self.ammo = bound(0,self.ammo, self.ammo_max);
-
-    if (!self.ammo_recharge)
-        self.ammo_recharge = self.shot_dmg * 0.5;
-    self.ammo_recharge = max(0 ,self.ammo_recharge);
-
-    // Convert the recharge from X per sec to X per ticrate
-    self.ammo_recharge = self.ammo_recharge * self.ticrate;
-
-    if (!self.ammo_flags)
-        self.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE;
-
-// Damage stuff
-    if(self.spawnflags & TSL_NO_RESPAWN)
-        if (!(self.damage_flags & TFL_DMG_DEATH_NORESPAWN))
-            self.damage_flags |= TFL_DMG_DEATH_NORESPAWN;
-
-// Offsets & origins
-    if (!self.tur_shotorg)   self.tur_shotorg = '50 0 50';
-
-    if (!self.health)
-        self.health = 150;
-
-// Game hooks
-       if(MUTATOR_CALLHOOK(TurretSpawn))
-               return 0;
-
-// End of default & sanety checks, start building the turret.
-
-// Spawn extra bits
-    self.tur_head         = spawn();
-    self.tur_head.netname = self.tur_head.classname = "turret_head";
-    self.tur_head.team    = self.team;
-    self.tur_head.owner   = self;
-
-    setmodel(self, base);
-    setmodel(self.tur_head, head);
-
-    setsize(self, '-32 -32 0', '32 32 64');
-    setsize(self.tur_head, '0 0 0', '0 0 0');
-
-    setorigin(self.tur_head, '0 0 0');
-    setattachment(self.tur_head, self, "tag_head");
-
-    self.tur_health          = self.health;
-    self.solid               = SOLID_BBOX;
-    self.tur_head.solid      = SOLID_NOT;
-    self.takedamage          = DAMAGE_AIM;
-    self.tur_head.takedamage = DAMAGE_NO;
-    self.movetype            = MOVETYPE_NOCLIP;
-    self.tur_head.movetype   = MOVETYPE_NOCLIP;
-
-    // Defend mode?
-    if (!self.tur_defend)
-    if (self.target != "")
-    {
-        self.tur_defend = find(world, targetname, self.target);
-        if (self.tur_defend == world)
-        {
-            self.target = "";
-            dprint("Turret has invalid defendpoint!\n");
-        }
-    }
-
-    // In target defend mode, aim on the spot to defend when idle.
-    if (self.tur_defend)
-        self.idle_aim  = self.tur_head.angles + angleofs(self.tur_head, self.tur_defend);
-    else
-        self.idle_aim  = '0 0 0';
-
-    // Attach stdprocs. override when and what needed
-    self.turret_firecheckfunc   = turret_stdproc_firecheck;
-    self.turret_firefunc        = turret_stdproc_fire;
-    self.event_damage           = turret_stdproc_damage;
-
-    if (self.turrcaps_flags & TFL_TURRCAPS_SUPPORT)
-        self.turret_score_target    = turret_stdproc_targetscore_support;
-    else
-        self.turret_score_target    = turret_stdproc_targetscore_generic;
-
-    self.use = turret_stdproc_use;
-
-    ++turret_count;
-    self.nextthink = time + 1;
-    self.nextthink +=  turret_count * sys_frametime;
-
-    self.tur_head.team = self.team;
-    self.view_ofs = '0 0 0';
-
-#ifdef TURRET_DEBUG
-    self.tur_dbg_start = self.nextthink;
-    while (vlen(self.tur_dbg_rvec) < 2)
-        self.tur_dbg_rvec  = randomvec() * 4;
-
-    self.tur_dbg_rvec_x = fabs(self.tur_dbg_rvec.x);
-    self.tur_dbg_rvec_y = fabs(self.tur_dbg_rvec.y);
-    self.tur_dbg_rvec_z = fabs(self.tur_dbg_rvec.z);
-#endif
-
-    // Its all good.
-    self.turrcaps_flags |= TFL_TURRCAPS_ISTURRET;
-
-    self.classname = "turret_main";
-
-    self.active = ACTIVE_ACTIVE;
-
-    // In ONS mode, and linked to a ONS ent. need to call the use to set team.
-    if (g_onslaught && ee)
-    {
-        activator = ee;
-        self.use();
-    }
-
-       turret_link();
-       turret_stdproc_respawn();
-    turret_tag_fire_update();
-
-    return 1;
-}
-
-
diff --git a/qcsrc/server/tturrets/system/system_misc.qc b/qcsrc/server/tturrets/system/system_misc.qc
deleted file mode 100644 (file)
index eab1e1a..0000000
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
-* Return a angle within +/- 360.
-*/
-float anglemods(float v)
-{
-       v = v - 360 * floor(v / 360);
-
-       if(v >= 180)
-               return v - 360;
-       else if(v <= -180)
-               return v + 360;
-       else
-               return v;
-}
-
-/*
-* Return the short angle
-*/
-float shortangle_f(float ang1, float ang2)
-{
-    if(ang1 > ang2)
-    {
-        if(ang1 > 180)
-            return ang1 - 360;
-    }
-    else
-    {
-        if(ang1 < -180)
-            return ang1 + 360;
-    }
-
-    return ang1;
-}
-
-vector shortangle_v(vector ang1, vector ang2)
-{
-    vector vtmp;
-
-    vtmp.x = shortangle_f(ang1_x,ang2_x);
-    vtmp.y = shortangle_f(ang1_y,ang2_y);
-    vtmp.z = shortangle_f(ang1_z,ang2_z);
-
-    return vtmp;
-}
-
-vector shortangle_vxy(vector ang1, vector ang2)
-{
-    vector vtmp = '0 0 0';
-
-    vtmp.x = shortangle_f(ang1_x,ang2_x);
-    vtmp.y = shortangle_f(ang1_y,ang2_y);
-
-    return vtmp;
-}
-
-
-/*
-* Get "real" origin, in worldspace, even if ent is attached to something else.
-*/
-vector real_origin(entity ent)
-{
-    entity e;
-    vector v = ((ent.absmin + ent.absmax) * 0.5);
-
-    e = ent.tag_entity;
-    while(e)
-    {
-        v = v + ((e.absmin + e.absmax) * 0.5);
-        e = e.tag_entity;
-    }
-
-    return v;
-}
-
-/*
-* Return the angle between two enteties
-*/
-vector angleofs(entity from, entity to)
-{
-    vector v_res;
-
-    v_res = normalize(to.origin - from.origin);
-    v_res = vectoangles(v_res);
-    v_res = v_res - from.angles;
-
-    if (v_res.x < 0)   v_res.x += 360;
-    if (v_res.x > 180)         v_res.x -= 360;
-
-    if (v_res.y < 0)   v_res.y += 360;
-    if (v_res.y > 180)         v_res.y -= 360;
-
-    return v_res;
-}
-
-vector angleofs3(vector from, vector from_a, entity to)
-{
-    vector v_res;
-
-    v_res = normalize(to.origin - from);
-    v_res = vectoangles(v_res);
-    v_res = v_res - from_a;
-
-    if (v_res.x < 0)   v_res.x += 360;
-    if (v_res.x > 180)         v_res.x -= 360;
-
-    if (v_res.y < 0)   v_res.y += 360;
-    if (v_res.y > 180)         v_res.y -= 360;
-
-    return v_res;
-}
-
-/*
-* Update self.tur_shotorg by getting up2date bone info
-* NOTICE this func overwrites the global v_forward, v_right and v_up vectors.
-*/
-#define turret_tag_fire_update() self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire"));v_forward = normalize(v_forward)
-float turret_tag_fire_update_s()
-{
-    if(!self.tur_head)
-    {
-        error("Call to turret_tag_fire_update with self.tur_head missing!\n");
-        self.tur_shotorg = '0 0 0';
-        return false;
-    }
-
-    self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire"));
-    v_forward = normalize(v_forward);
-
-    return true;
-}
-
-/*
-* Railgun-like beam, but has thickness and suppots slowing of target
-*/
-void FireImoBeam (vector start, vector end, vector smin, vector smax,
-                  float bforce, float f_dmg, float f_velfactor, float deathtype)
-
-{
-    vector hitloc, force, endpoint, dir;
-    entity ent;
-
-    dir = normalize(end - start);
-    force = dir * bforce;
-
-    // go a little bit into the wall because we need to hit this wall later
-    end = end + dir;
-
-    // trace multiple times until we hit a wall, each obstacle will be made unsolid.
-    // note down which entities were hit so we can damage them later
-    while (1)
-    {
-        tracebox(start, smin, smax, end, false, self);
-
-        // if it is world we can't hurt it so stop now
-        if (trace_ent == world || trace_fraction == 1)
-            break;
-
-        if (trace_ent.solid == SOLID_BSP)
-            break;
-
-        // make the entity non-solid so we can hit the next one
-        trace_ent.railgunhit = true;
-        trace_ent.railgunhitloc = end;
-        trace_ent.railgunhitsolidbackup = trace_ent.solid;
-
-        // stop if this is a wall
-
-        // make the entity non-solid
-        trace_ent.solid = SOLID_NOT;
-    }
-
-    endpoint = trace_endpos;
-
-    // find all the entities the railgun hit and restore their solid state
-    ent = findfloat(world, railgunhit, true);
-    while (ent)
-    {
-        // restore their solid type
-        ent.solid = ent.railgunhitsolidbackup;
-        ent = findfloat(ent, railgunhit, true);
-    }
-
-    // find all the entities the railgun hit and hurt them
-    ent = findfloat(world, railgunhit, true);
-    while (ent)
-    {
-        // get the details we need to call the damage function
-        hitloc = ent.railgunhitloc;
-        ent.railgunhitloc = '0 0 0';
-        ent.railgunhitsolidbackup = SOLID_NOT;
-        ent.railgunhit = false;
-
-        // apply the damage
-        if (ent.takedamage)
-        {
-            Damage (ent, self, self, f_dmg, deathtype, hitloc, force);
-            ent.velocity = ent.velocity * f_velfactor;
-            //ent.alpha = 0.25 + random() * 0.75;
-        }
-
-        // advance to the next entity
-        ent = findfloat(ent, railgunhit, true);
-    }
-    trace_endpos = endpoint;
-}
-
-// Plug this into wherever precache is done.
-void g_turrets_common_precash()
-{
-    precache_model ("models/turrets/c512.md3");
-    precache_model ("models/marker.md3");
-}
-
-void turrets_precache_debug_models()
-{
-    precache_model ("models/turrets/c512.md3");
-    precache_model ("models/pathlib/goodsquare.md3");
-    precache_model ("models/pathlib/badsquare.md3");
-    precache_model ("models/pathlib/square.md3");
-    precache_model ("models/pathlib/edge.md3");
-}
-
-void turrets_precash()
-{
-    #ifdef TURRET_DEBUG
-       turrets_precache_debug_models();
-       #endif
-}
-
-
-#ifdef TURRET_DEBUG
-void marker_think()
-{
-    if(self.cnt)
-    if(self.cnt < time)
-    {
-        self.think = SUB_Remove;
-        self.nextthink = time;
-        return;
-    }
-
-    self.frame += 1;
-    if(self.frame > 29)
-        self.frame = 0;
-
-    self.nextthink = time;
-}
-
-void mark_error(vector where,float lifetime)
-{
-    entity err;
-
-    err = spawn();
-    err.classname = "error_marker";
-    setmodel(err,"models/marker.md3");
-    setorigin(err,where);
-    err.movetype = MOVETYPE_NONE;
-    err.think = marker_think;
-    err.nextthink = time;
-    err.skin = 0;
-    if(lifetime)
-        err.cnt = lifetime + time;
-}
-
-void mark_info(vector where,float lifetime)
-{
-    entity err;
-
-    err = spawn();
-    err.classname = "info_marker";
-    setmodel(err,"models/marker.md3");
-    setorigin(err,where);
-    err.movetype = MOVETYPE_NONE;
-    err.think = marker_think;
-    err.nextthink = time;
-    err.skin = 1;
-    if(lifetime)
-        err.cnt = lifetime + time;
-}
-
-entity mark_misc(vector where,float lifetime)
-{
-    entity err;
-
-    err = spawn();
-    err.classname = "mark_misc";
-    setmodel(err,"models/marker.md3");
-    setorigin(err,where);
-    err.movetype = MOVETYPE_NONE;
-    err.think = marker_think;
-    err.nextthink = time;
-    err.skin = 3;
-    if(lifetime)
-        err.cnt = lifetime + time;
-    return err;
-}
-
-/*
-* Paint a v_color colord circle on target onwho
-* that fades away over f_time
-*/
-void paint_target(entity onwho, float f_size, vector v_color, float f_time)
-{
-    entity e;
-
-    e = spawn();
-    setmodel(e, "models/turrets/c512.md3"); // precision set above
-    e.scale = (f_size/512);
-    //setsize(e, '0 0 0', '0 0 0');
-    //setattachment(e,onwho,"");
-    setorigin(e,onwho.origin + '0 0 1');
-    e.alpha = 0.15;
-    e.movetype = MOVETYPE_FLY;
-
-    e.velocity = (v_color * 32); // + '0 0 1' * 64;
-
-    e.colormod = v_color;
-    SUB_SetFade(e,time,f_time);
-}
-
-void paint_target2(entity onwho, float f_size, vector v_color, float f_time)
-{
-    entity e;
-
-    e = spawn();
-    setmodel(e, "models/turrets/c512.md3"); // precision set above
-    e.scale = (f_size/512);
-    setsize(e, '0 0 0', '0 0 0');
-
-    setorigin(e,onwho.origin + '0 0 1');
-    e.alpha = 0.15;
-    e.movetype = MOVETYPE_FLY;
-
-    e.velocity = (v_color * 32); // + '0 0 1' * 64;
-    e.avelocity_x = -128;
-
-    e.colormod = v_color;
-    SUB_SetFade(e,time,f_time);
-}
-
-void paint_target3(vector where, float f_size, vector v_color, float f_time)
-{
-    entity e;
-    e = spawn();
-    setmodel(e, "models/turrets/c512.md3"); // precision set above
-    e.scale = (f_size/512);
-    setsize(e, '0 0 0', '0 0 0');
-    setorigin(e,where+ '0 0 1');
-    e.movetype = MOVETYPE_NONE;
-    e.velocity = '0 0 0';
-    e.colormod = v_color;
-    SUB_SetFade(e,time,f_time);
-}
-#endif
diff --git a/qcsrc/server/vehicles/racer.qc b/qcsrc/server/vehicles/racer.qc
deleted file mode 100644 (file)
index 06760b0..0000000
+++ /dev/null
@@ -1,685 +0,0 @@
-const vector RACER_MIN = '-120 -120 -40';
-const vector RACER_MAX = '120 120 40';
-
-#ifdef SVQC
-#include "../../common/triggers/trigger/impulse.qh"
-
-void racer_exit(float eject);
-void racer_enter();
-
-// Auto cvars
-float autocvar_g_vehicle_racer;
-
-float autocvar_g_vehicle_racer_speed_afterburn;
-float autocvar_g_vehicle_racer_afterburn_cost;
-
-float autocvar_g_vehicle_racer_anglestabilizer;
-float autocvar_g_vehicle_racer_downforce;
-
-float autocvar_g_vehicle_racer_speed_forward;
-float autocvar_g_vehicle_racer_speed_strafe;
-float autocvar_g_vehicle_racer_springlength;
-float autocvar_g_vehicle_racer_upforcedamper;
-float autocvar_g_vehicle_racer_friction;
-
-float autocvar_g_vehicle_racer_hovertype;
-float autocvar_g_vehicle_racer_hoverpower;
-
-float autocvar_g_vehicle_racer_turnroll;
-float autocvar_g_vehicle_racer_turnspeed;
-float autocvar_g_vehicle_racer_pitchspeed;
-
-float autocvar_g_vehicle_racer_energy;
-float autocvar_g_vehicle_racer_energy_regen;
-float autocvar_g_vehicle_racer_energy_regen_pause;
-
-float autocvar_g_vehicle_racer_health;
-float autocvar_g_vehicle_racer_health_regen;
-float autocvar_g_vehicle_racer_health_regen_pause;
-
-float autocvar_g_vehicle_racer_shield;
-float autocvar_g_vehicle_racer_shield_regen;
-float autocvar_g_vehicle_racer_shield_regen_pause;
-
-float autocvar_g_vehicle_racer_cannon_cost;
-float autocvar_g_vehicle_racer_cannon_damage;
-float autocvar_g_vehicle_racer_cannon_radius;
-float autocvar_g_vehicle_racer_cannon_refire;
-float autocvar_g_vehicle_racer_cannon_speed;
-float autocvar_g_vehicle_racer_cannon_spread;
-float autocvar_g_vehicle_racer_cannon_force;
-
-float autocvar_g_vehicle_racer_rocket_accel;
-float autocvar_g_vehicle_racer_rocket_damage;
-float autocvar_g_vehicle_racer_rocket_radius;
-float autocvar_g_vehicle_racer_rocket_force;
-float autocvar_g_vehicle_racer_rocket_refire;
-float autocvar_g_vehicle_racer_rocket_speed;
-float autocvar_g_vehicle_racer_rocket_turnrate;
-
-float autocvar_g_vehicle_racer_rocket_locktarget;
-float autocvar_g_vehicle_racer_rocket_locking_time;
-float autocvar_g_vehicle_racer_rocket_locking_releasetime;
-float autocvar_g_vehicle_racer_rocket_locked_time;
-float autocvar_g_vehicle_racer_rocket_locked_maxangle;
-float autocvar_g_vehicle_racer_rocket_climbspeed;
-
-float autocvar_g_vehicle_racer_respawntime;
-
-float autocvar_g_vehicle_racer_blowup_radius;
-float autocvar_g_vehicle_racer_blowup_coredamage;
-float autocvar_g_vehicle_racer_blowup_edgedamage;
-float autocvar_g_vehicle_racer_blowup_forceintensity;
-
-float autocvar_g_vehicle_racer_bouncefactor;
-float autocvar_g_vehicle_racer_bouncestop;
-vector autocvar_g_vehicle_racer_bouncepain;
-
-var vector racer_force_from_tag(string tag_name, float spring_length, float max_power);
-
-void racer_align4point(float _delta)
-{
-    vector push_vector;
-    float fl_push, fr_push, bl_push, br_push;
-
-    push_vector  = racer_force_from_tag("tag_engine_fr", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
-    fr_push      = force_fromtag_normpower;
-    //vehicles_sweap_collision(force_fromtag_origin, self.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
-
-    push_vector += racer_force_from_tag("tag_engine_fl", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
-    fl_push      = force_fromtag_normpower;
-    //vehicles_sweap_collision(force_fromtag_origin, self.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
-
-    push_vector += racer_force_from_tag("tag_engine_br", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
-    br_push      = force_fromtag_normpower;
-    //vehicles_sweap_collision(force_fromtag_origin, self.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
-
-    push_vector += racer_force_from_tag("tag_engine_bl", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
-    bl_push      = force_fromtag_normpower;
-    //vehicles_sweap_collision(force_fromtag_origin, self.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
-
-   self.velocity += push_vector * _delta;
-
-    // Anti ocilation
-    if(self.velocity.z > 0)
-        self.velocity_z *= 1 - autocvar_g_vehicle_racer_upforcedamper * _delta;
-
-    push_vector.x =  (fl_push - bl_push);
-    push_vector_x += (fr_push - br_push);
-    push_vector_x *= 360;
-
-    push_vector.z = (fr_push - fl_push);
-    push_vector_z += (br_push - bl_push);
-    push_vector_z *= 360;
-
-    // Apply angle diffrance
-    self.angles_z += push_vector.z * _delta;
-    self.angles_x += push_vector.x * _delta;
-
-    // Apply stabilizer
-    self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * _delta);
-    self.angles_z *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * _delta);
-}
-
-void racer_fire_cannon(string tagname)
-{
-    vector v;
-    entity bolt;
-
-    v = gettaginfo(self, gettagindex(self, tagname));
-    bolt = vehicles_projectile("wakizashi_gun_muzzleflash", "weapons/lasergun_fire.wav",
-                           v, normalize(v_forward + randomvec() * autocvar_g_vehicle_racer_cannon_spread) * autocvar_g_vehicle_racer_cannon_speed,
-                           autocvar_g_vehicle_racer_cannon_damage, autocvar_g_vehicle_racer_cannon_radius, autocvar_g_vehicle_racer_cannon_force,  0,
-                           DEATH_VH_WAKI_GUN, PROJECTILE_WAKICANNON, 0, true, true, self.owner);
-
-       // Fix z-aim (for chase mode)
-    v = normalize(trace_endpos - bolt.origin);
-    v_forward.z = v.z * 0.5;
-    bolt.velocity = v_forward * autocvar_g_vehicle_racer_cannon_speed;
-}
-
-void racer_rocket_groundhugger()
-{
-    vector olddir, newdir;
-    float oldvel, newvel;
-
-    self.nextthink  = time;
-
-    if(self.owner.deadflag != DEAD_NO || self.cnt < time)
-    {
-        self.use();
-        return;
-    }
-
-    if (!self.realowner.vehicle)
-    {
-        UpdateCSQCProjectile(self);
-        return;
-    }
-
-    olddir = normalize(self.velocity);
-    oldvel = vlen(self.velocity);
-    newvel = oldvel + self.lip;
-
-    tracebox(self.origin, self.mins, self.maxs, self.origin + olddir * 64, MOVE_WORLDONLY,self);
-    if(trace_fraction <= 0.5)
-    {
-        // Hitting somethign soon, just speed ahead
-        self.velocity = olddir * newvel;
-        UpdateCSQCProjectile(self);
-        return;
-    }
-
-    traceline(trace_endpos, trace_endpos - '0 0 64', MOVE_NORMAL, self);
-    if(trace_fraction != 1.0)
-    {
-        newdir = normalize(trace_endpos + '0 0 64' - self.origin) * autocvar_g_vehicle_racer_rocket_turnrate;
-        self.velocity = normalize(olddir + newdir) * newvel;
-    }
-    else
-    {
-        self.velocity = olddir * newvel;
-        self.velocity_z -= 1600 * sys_frametime; // 2x grav looks better for this one
-    }
-
-    UpdateCSQCProjectile(self);
-    return;
-}
-
-void racer_rocket_tracker()
-{
-    vector olddir, newdir;
-    float oldvel, newvel;
-
-    self.nextthink  = time;
-
-    if (self.owner.deadflag != DEAD_NO || self.cnt < time)
-    {
-        self.use();
-        return;
-    }
-
-    if (!self.realowner.vehicle)
-    {
-        UpdateCSQCProjectile(self);
-        return;
-    }
-
-    olddir = normalize(self.velocity);
-    oldvel = vlen(self.velocity);
-    newvel = oldvel + self.lip;
-    makevectors(vectoangles(olddir));
-
-       float time_to_impact = min(vlen(self.enemy.origin - self.origin) / vlen(self.velocity), 1);
-       vector predicted_origin = self.enemy.origin + self.enemy.velocity * time_to_impact;
-
-    traceline(self.origin, self.origin + v_forward * 64 - '0 0 32', MOVE_NORMAL, self);
-    newdir = normalize(predicted_origin - self.origin);
-
-    //vector
-       float height_diff = predicted_origin.z - self.origin.z;
-
-    if(vlen(newdir - v_forward) > autocvar_g_vehicle_racer_rocket_locked_maxangle)
-    {
-        //bprint("Target lost!\n");
-        //dprint("OF:", ftos(vlen(newdir - v_forward)), "\n");
-        self.think = racer_rocket_groundhugger;
-        return;
-    }
-
-    if(trace_fraction != 1.0 && trace_ent != self.enemy)
-        newdir.z += 16 * sys_frametime;
-
-    self.velocity = normalize(olddir + newdir * autocvar_g_vehicle_racer_rocket_turnrate) * newvel;
-    self.velocity_z -= 800 * sys_frametime;
-    self.velocity_z += max(height_diff, autocvar_g_vehicle_racer_rocket_climbspeed) * sys_frametime ;
-
-    UpdateCSQCProjectile(self);
-    return;
-}
-
-void racer_fire_rocket(string tagname, entity trg)
-{
-    vector v = gettaginfo(self, gettagindex(self, tagname));
-    entity rocket = rocket = vehicles_projectile("wakizashi_rocket_launch", "weapons/rocket_fire.wav",
-                           v, v_forward * autocvar_g_vehicle_racer_rocket_speed,
-                           autocvar_g_vehicle_racer_rocket_damage, autocvar_g_vehicle_racer_rocket_radius, autocvar_g_vehicle_racer_rocket_force, 3,
-                           DEATH_VH_WAKI_ROCKET, PROJECTILE_WAKIROCKET, 20, false, false, self.owner);
-
-    rocket.lip              = autocvar_g_vehicle_racer_rocket_accel * sys_frametime;
-    rocket.wait             = autocvar_g_vehicle_racer_rocket_turnrate;
-    rocket.nextthink        = time;
-    rocket.enemy            = trg;
-    rocket.cnt              = time + 15;
-
-    if(trg)
-        rocket.think            = racer_rocket_tracker;
-    else
-        rocket.think            = racer_rocket_groundhugger;
-}
-
-float racer_frame()
-{
-    entity player, racer;
-    vector df;
-    float ftmp;
-
-       if(intermission_running)
-               return 1;
-
-    player  = self;
-    racer   = self.vehicle;
-    self    = racer;
-
-    player.BUTTON_ZOOM = player.BUTTON_CROUCH = 0;
-
-    vehicles_painframe();
-
-    if(racer.deadflag != DEAD_NO)
-    {
-        self = player;
-        player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0;
-        return 1;
-    }
-
-    racer_align4point(frametime);
-
-    crosshair_trace(player);
-
-    racer.angles_x *= -1;
-
-    // Yaw
-    ftmp = autocvar_g_vehicle_racer_turnspeed * frametime;
-    ftmp = bound(-ftmp, shortangle_f(player.v_angle.y - racer.angles.y, racer.angles.y), ftmp);
-    racer.angles_y = anglemods(racer.angles.y + ftmp);
-
-    // Roll
-    racer.angles_z += -ftmp * autocvar_g_vehicle_racer_turnroll * frametime;
-
-    // Pitch
-    ftmp = autocvar_g_vehicle_racer_pitchspeed  * frametime;
-    ftmp = bound(-ftmp, shortangle_f(player.v_angle.x - racer.angles.x, racer.angles.x), ftmp);
-    racer.angles_x = bound(-30, anglemods(racer.angles.x + ftmp), 30);
-
-    makevectors(racer.angles);
-    racer.angles_x *= -1;
-
-    //ftmp = racer.velocity_z;
-    df = racer.velocity * -autocvar_g_vehicle_racer_friction;
-    //racer.velocity_z = ftmp;
-
-    if(vlen(player.movement) != 0)
-    {
-        if(player.movement_x)
-            df += v_forward * ((player.movement.x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward);
-
-        if(player.movement_y)
-            df += v_right * ((player.movement.y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe);
-
-        if(self.sound_nexttime < time || self.sounds != 1)
-        {
-            self.sounds = 1;
-            self.sound_nexttime = time + 10.922667; //soundlength("vehicles/racer_move.wav");
-            sound (self, CH_TRIGGER_SINGLE, "vehicles/racer_move.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
-        }
-    }
-    else
-    {
-        if(self.sound_nexttime < time || self.sounds != 0)
-        {
-            self.sounds = 0;
-            self.sound_nexttime = time + 11.888604; //soundlength("vehicles/racer_idle.wav");
-            sound (self, CH_TRIGGER_SINGLE, "vehicles/racer_idle.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
-        }
-    }
-
-    // Afterburn
-    if (player.BUTTON_JUMP && racer.vehicle_energy >= (autocvar_g_vehicle_racer_afterburn_cost * frametime))
-    {
-        if(time - racer.wait > 0.2)
-            pointparticles(particleeffectnum("wakizashi_booster_smoke"), self.origin - v_forward * 32, v_forward  * vlen(self.velocity), 1);
-
-        racer.wait = time;
-        racer.vehicle_energy -= autocvar_g_vehicle_racer_afterburn_cost * frametime;
-        df += (v_forward * autocvar_g_vehicle_racer_speed_afterburn);
-
-        if(racer.invincible_finished < time)
-        {
-            traceline(racer.origin, racer.origin - '0 0 256', MOVE_NORMAL, self);
-            if(trace_fraction != 1.0)
-                pointparticles(particleeffectnum("smoke_small"), trace_endpos, '0 0 0', 1);
-
-            racer.invincible_finished = time + 0.1 + (random() * 0.1);
-        }
-
-        if(racer.strength_finished < time)
-        {
-            racer.strength_finished = time + 10.922667; //soundlength("vehicles/racer_boost.wav");
-            sound (racer.tur_head, CH_TRIGGER_SINGLE, "vehicles/racer_boost.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
-        }
-    }
-    else
-    {
-        racer.strength_finished = 0;
-        sound (racer.tur_head, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
-    }
-
-       df -= v_up * (vlen(racer.velocity) * autocvar_g_vehicle_racer_downforce);
-    player.movement = racer.velocity += df * frametime;
-
-    if(player.BUTTON_ATCK)
-    if(time > racer.attack_finished_single)
-    if(racer.vehicle_energy >= autocvar_g_vehicle_racer_cannon_cost)
-    {
-        racer.vehicle_energy -= autocvar_g_vehicle_racer_cannon_cost;
-        racer.wait = time;
-
-        crosshair_trace(player);
-        if(racer.cnt)
-        {
-            racer_fire_cannon("tag_fire1");
-            racer.cnt = 0;
-        }
-        else
-        {
-            racer_fire_cannon("tag_fire2");
-            racer.cnt = 1;
-        }
-        racer.attack_finished_single = time + autocvar_g_vehicle_racer_cannon_refire;
-    }
-
-    if(autocvar_g_vehicle_racer_rocket_locktarget)
-    {
-        vehicles_locktarget((1 / autocvar_g_vehicle_racer_rocket_locking_time) * frametime,
-                         (1 / autocvar_g_vehicle_racer_rocket_locking_releasetime) * frametime,
-                         autocvar_g_vehicle_racer_rocket_locked_time);
-
-        if(self.lock_target)
-        {
-            if(racer.lock_strength == 1)
-                UpdateAuxiliaryXhair(player, real_origin(self.lock_target), '1 0 0', 0);
-            else if(self.lock_strength > 0.5)
-                UpdateAuxiliaryXhair(player, real_origin(self.lock_target), '0 1 0', 0);
-            else if(self.lock_strength < 0.5)
-                UpdateAuxiliaryXhair(player, real_origin(self.lock_target), '0 0 1', 0);
-        }
-    }
-
-    if(time > racer.delay)
-    if(player.BUTTON_ATCK2)
-    {
-        racer.misc_bulletcounter += 1;
-        racer.delay = time + 0.3;
-
-        if(racer.misc_bulletcounter == 1)
-            racer_fire_rocket("tag_rocket_r", (racer.lock_strength == 1 && racer.lock_target) ? racer.lock_target : world);
-        else if(racer.misc_bulletcounter == 2)
-        {
-            racer_fire_rocket("tag_rocket_l", (racer.lock_strength == 1 && racer.lock_target) ? racer.lock_target : world);
-            racer.lock_strength  = 0;
-            racer.lock_target    = world;
-            racer.misc_bulletcounter = 0;
-
-            racer.delay = time + autocvar_g_vehicle_racer_rocket_refire;
-            racer.lip = time;
-        }
-    }
-    player.vehicle_reload1 = bound(0, 100 * ((time - racer.lip) / (racer.delay - racer.lip)), 100);
-
-    if(racer.vehicle_flags  & VHF_SHIELDREGEN)
-        vehicles_regen(racer.dmg_time, vehicle_shield, autocvar_g_vehicle_racer_shield, autocvar_g_vehicle_racer_shield_regen_pause, autocvar_g_vehicle_racer_shield_regen, frametime, true);
-
-    if(racer.vehicle_flags  & VHF_HEALTHREGEN)
-        vehicles_regen(racer.dmg_time, vehicle_health, autocvar_g_vehicle_racer_health, autocvar_g_vehicle_racer_health_regen_pause, autocvar_g_vehicle_racer_health_regen, frametime, false);
-
-    if(racer.vehicle_flags  & VHF_ENERGYREGEN)
-        vehicles_regen(racer.wait, vehicle_energy, autocvar_g_vehicle_racer_energy, autocvar_g_vehicle_racer_energy_regen_pause, autocvar_g_vehicle_racer_energy_regen, frametime, false);
-
-
-    VEHICLE_UPDATE_PLAYER(player, health, racer);
-    VEHICLE_UPDATE_PLAYER(player, energy, racer);
-
-    if(racer.vehicle_flags & VHF_HASSHIELD)
-        VEHICLE_UPDATE_PLAYER(player, shield, racer);
-
-    player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0;
-    setorigin(player,racer.origin + '0 0 32');
-    player.velocity = racer.velocity;
-
-    self = player;
-    return 1;
-}
-
-void racer_think()
-{
-    self.nextthink = time;
-
-    float pushdeltatime = time - self.lastpushtime;
-    if (pushdeltatime > 0.15) pushdeltatime = 0;
-    self.lastpushtime = time;
-    if(!pushdeltatime) return;
-
-    tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * autocvar_g_vehicle_racer_springlength), MOVE_NORMAL, self);
-
-    vector df = self.velocity * -autocvar_g_vehicle_racer_friction;
-       df.z += (1 - trace_fraction) * autocvar_g_vehicle_racer_hoverpower + sin(time * 2) * (autocvar_g_vehicle_racer_springlength * 2);
-
-       self.velocity += df * pushdeltatime;
-    if(self.velocity.z > 0)
-        self.velocity_z *= 1 - autocvar_g_vehicle_racer_upforcedamper * pushdeltatime;
-
-    self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime);
-    self.angles_z *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime);
-}
-
-void racer_enter()
-{
-    self.movetype = MOVETYPE_BOUNCE;
-    self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_racer_health)  * 100;
-    self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_racer_shield)  * 100;
-
-    if(self.owner.flagcarried)
-       setorigin(self.owner.flagcarried, '-190 0 96');
-
-       //targetdrone_spawn(self.origin + '0 0 512' + randomvec() * 256, 1);
-}
-
-void racer_exit(float eject)
-{
-    vector spot;
-
-    self.think      = racer_think;
-    self.nextthink  = time;
-    self.movetype   = MOVETYPE_BOUNCE;
-    sound (self.tur_head, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
-
-    if (!self.owner)
-        return;
-
-       makevectors(self.angles);
-       if(eject)
-       {
-           spot = self.origin + v_forward * 100 + '0 0 64';
-           spot = vehicles_findgoodexit(spot);
-           setorigin(self.owner , spot);
-           self.owner.velocity = (v_up + v_forward * 0.25) * 750;
-           self.owner.oldvelocity = self.owner.velocity;
-       }
-       else
-       {
-               if(vlen(self.velocity) > 2 * autocvar_sv_maxairspeed)
-               {
-                       self.owner.velocity = normalize(self.velocity) * autocvar_sv_maxairspeed * 2;
-                       self.owner.velocity_z += 200;
-                       spot = self.origin + v_forward * 32 + '0 0 32';
-                       spot = vehicles_findgoodexit(spot);
-               }
-               else
-               {
-                       self.owner.velocity = self.velocity * 0.5;
-                       self.owner.velocity_z += 10;
-                       spot = self.origin - v_forward * 200 + '0 0 32';
-                       spot = vehicles_findgoodexit(spot);
-               }
-           self.owner.oldvelocity = self.owner.velocity;
-           setorigin(self.owner , spot);
-       }
-       antilag_clear(self.owner);
-    self.owner = world;
-}
-
-void racer_impact()
-{
-       if(autocvar_g_vehicle_racer_bouncepain.x)
-               vehicles_impact(autocvar_g_vehicle_racer_bouncepain.x, autocvar_g_vehicle_racer_bouncepain.y, autocvar_g_vehicle_racer_bouncepain.z);
-}
-
-void racer_blowup()
-{
-    self.deadflag    = DEAD_DEAD;
-    self.vehicle_exit(VHEF_NORMAL);
-
-    RadiusDamage (self, self.enemy, autocvar_g_vehicle_racer_blowup_coredamage,
-                                       autocvar_g_vehicle_racer_blowup_edgedamage,
-                                       autocvar_g_vehicle_racer_blowup_radius, world, world,
-                                       autocvar_g_vehicle_racer_blowup_forceintensity,
-                                       DEATH_VH_WAKI_DEATH, world);
-
-       self.alpha      = -1;
-    self.movetype   = MOVETYPE_NONE;
-    self.effects    = EF_NODRAW;
-    self.colormod  = '0 0 0';
-    self.avelocity = '0 0 0';
-    self.velocity  = '0 0 0';
-
-    setorigin(self, self.pos1);
-       self.touch = func_null;
-       self.nextthink = 0;
-}
-
-void racer_deadtouch()
-{
-    self.avelocity_x *= 0.7;
-    self.cnt -= 1;
-    if(self.cnt <= 0)
-        racer_blowup();
-}
-
-void racer_die()
-{
-    self.health       = 0;
-    self.event_damage = func_null;
-    self.solid        = SOLID_CORPSE;
-    self.takedamage   = DAMAGE_NO;
-    self.deadflag     = DEAD_DYING;
-    self.movetype     = MOVETYPE_BOUNCE;
-    self.wait         = time;
-    self.cnt          = 1 + random() * 2;
-    self.touch        = racer_deadtouch;
-
-    pointparticles(particleeffectnum("explosion_medium"), self.origin, '0 0 0', 1);
-
-    if(random() < 0.5)
-        self.avelocity_z = 32;
-    else
-        self.avelocity_z = -32;
-
-    self.avelocity_x = -vlen(self.velocity) * 0.2;
-    self.velocity   += '0 0 700';
-    self.colormod    = '-0.5 -0.5 -0.5';
-
-       self.think     = racer_blowup;
-       self.nextthink = 2 + time + random() * 3;
-}
-void racer_spawn(float _spawnflag)
-{
-    if(self.scale != 0.5)
-    {
-        if(autocvar_g_vehicle_racer_hovertype != 0)
-            racer_force_from_tag = vehicles_force_fromtag_maglev;
-        else
-            racer_force_from_tag = vehicles_force_fromtag_hover;
-
-        // FIXME: this be hakkz, fix the models insted (scale body, add tag_viewport to the hudmodel).
-        self.scale = 0.5;
-        setattachment(self.vehicle_hudmodel, self, "");
-        setattachment(self.vehicle_viewport, self, "tag_viewport");
-
-        self.mass               = 900;
-    }
-
-    self.think          = racer_think;
-    self.nextthink      = time;
-    self.vehicle_health = autocvar_g_vehicle_racer_health;
-    self.vehicle_shield = autocvar_g_vehicle_racer_shield;
-
-    self.movetype       = MOVETYPE_TOSS;
-    self.solid          = SOLID_SLIDEBOX;
-    self.delay          = time;
-    self.scale          = 0.5;
-
-    setsize(self, RACER_MIN * 0.5, RACER_MAX * 0.5);
-    self.bouncefactor = autocvar_g_vehicle_racer_bouncefactor;
-    self.bouncestop = autocvar_g_vehicle_racer_bouncestop;
-    self.vehicle_impact = racer_impact;
-    self.damageforcescale = 0.5;
-    //self.destvec = autocvar_g_vehicle_racer_bouncepain;
-}
-
-void spawnfunc_vehicle_racer()
-{
-    if(!autocvar_g_vehicle_racer)
-    {
-        remove(self);
-        return;
-    }
-
-    self.vehicle_flags |= VHF_DMGSHAKE;
-    self.vehicle_flags |= VHF_DMGROLL;
-
-    precache_sound ("weapons/lasergun_fire.wav");
-    precache_sound ("weapons/rocket_fire.wav");
-
-    precache_sound ("vehicles/racer_idle.wav");
-    precache_sound ("vehicles/racer_move.wav");
-    precache_sound ("vehicles/racer_boost.wav");
-
-    precache_model ("models/vhshield.md3");
-    precache_model ("models/vehicles/wakizashi.dpm");
-    precache_model ("models/vehicles/wakizashi_cockpit.dpm");
-
-    if(autocvar_g_vehicle_racer_energy)
-        if(autocvar_g_vehicle_racer_energy_regen)
-            self.vehicle_flags |= VHF_ENERGYREGEN;
-
-    if(autocvar_g_vehicle_racer_shield)
-        self.vehicle_flags |= VHF_HASSHIELD;
-
-    if(autocvar_g_vehicle_racer_shield_regen)
-        self.vehicle_flags |= VHF_SHIELDREGEN;
-
-    if(autocvar_g_vehicle_racer_health_regen)
-        self.vehicle_flags |= VHF_HEALTHREGEN;
-
-    if(!vehicle_initialize(
-             "Wakizashi",
-             "models/vehicles/wakizashi.dpm",
-             "null", // we need this so tur_head is networked and usable for sounds
-             "models/vehicles/wakizashi_cockpit.dpm",
-             "", "", "tag_viewport",
-             HUD_WAKIZASHI,
-             0.5 * RACER_MIN, 0.5 * RACER_MAX,
-             false,
-             racer_spawn, autocvar_g_vehicle_racer_respawntime,
-             racer_frame,
-             racer_enter, racer_exit,
-             racer_die,   racer_think,
-             true,
-             autocvar_g_vehicle_racer_health,
-             autocvar_g_vehicle_racer_shield))
-    {
-        remove(self);
-        return;
-    }
-}
-#endif // SVQC
diff --git a/qcsrc/server/vehicles/vehicles.qc b/qcsrc/server/vehicles/vehicles.qc
deleted file mode 100644 (file)
index 5f639a8..0000000
+++ /dev/null
@@ -1,1448 +0,0 @@
-#include "../../common/triggers/subs.qh"
-
-float autocvar_g_vehicles_crush_dmg;
-float autocvar_g_vehicles_crush_force;
-float autocvar_g_vehicles_delayspawn;
-float autocvar_g_vehicles_delayspawn_jitter;
-
-float autocvar_g_vehicles_vortex_damagerate = 0.5;
-float autocvar_g_vehicles_machinegun_damagerate = 0.5;
-float autocvar_g_vehicles_rifle_damagerate = 0.75;
-float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
-float autocvar_g_vehicles_tag_damagerate = 5;
-
-float autocvar_g_vehicles;
-
-void vehicles_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force);
-void vehicles_return();
-void vehicles_enter();
-void vehicles_touch();
-void vehicles_reset_colors();
-void vehicles_clearreturn();
-void vehicles_setreturn();
-
-
-/** AuxiliaryXhair*
-    Send additional points of interest to be drawn, to vehicle owner
-**/
-const float MAX_AXH = 4;
-.entity AuxiliaryXhair[MAX_AXH];
-
-float SendAuxiliaryXhair(entity to, float sf)
-{
-
-       WriteByte(MSG_ENTITY, ENT_CLIENT_AUXILIARYXHAIR);
-
-       WriteByte(MSG_ENTITY, self.cnt);
-
-       WriteCoord(MSG_ENTITY, self.origin.x);
-       WriteCoord(MSG_ENTITY, self.origin.y);
-       WriteCoord(MSG_ENTITY, self.origin.z);
-
-    WriteByte(MSG_ENTITY, rint(self.colormod.x * 255));
-    WriteByte(MSG_ENTITY, rint(self.colormod.y * 255));
-    WriteByte(MSG_ENTITY, rint(self.colormod.z * 255));
-
-    return true;
-}
-
-void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, float axh_id)
-{
-    if (!IS_REAL_CLIENT(own))
-        return;
-
-    entity axh;
-
-    axh_id = bound(0, axh_id, MAX_AXH);
-    axh = own.(AuxiliaryXhair[axh_id]);
-
-    if(axh == world || wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
-    {
-        axh                     = spawn();
-        axh.cnt                 = axh_id;
-        axh.drawonlytoclient    = own;
-        axh.owner               = own;
-        Net_LinkEntity(axh, false, 0, SendAuxiliaryXhair);
-    }
-
-    setorigin(axh, loc);
-    axh.colormod            = clr;
-    axh.SendFlags           = 0x01;
-    own.(AuxiliaryXhair[axh_id]) = axh;
-}
-
-/*
-// SVC_TEMPENTITY based, horrible with even 50 ping. hm.
-// WriteByte(MSG_ONE, SVC_TEMPENTITY) uses reliable messagess, never use for thinsg that need continous updates.
-void SendAuxiliaryXhair2(entity own, vector loc, vector clr, float axh_id)
-{
-       msgexntity = own;
-
-       WriteByte(MSG_ONE, SVC_TEMPENTITY);
-       WriteByte(MSG_ONE, TE_CSQC_AUXILIARYXHAIR);
-
-       WriteByte(MSG_ONE, axh_id);
-
-       WriteCoord(MSG_ONE, loc_x);
-       WriteCoord(MSG_ONE, loc_y);
-       WriteCoord(MSG_ONE, loc_z);
-
-    WriteByte(MSG_ONE, rint(clr_x * 255));
-    WriteByte(MSG_ONE, rint(clr_y * 255));
-    WriteByte(MSG_ONE, rint(clr_z * 255));
-
-}
-*/
-// End AuxiliaryXhair
-
-/**
-    Notifies the client that he enterd a vehicle, and sends
-    realavent data.
-
-    only sends vehicle_id atm (wich is a HUD_* constant, ex. HUD_SPIDERBOT)
-**/
-void CSQCVehicleSetup(entity own, float vehicle_id)
-{
-    if (!IS_REAL_CLIENT(own))
-        return;
-
-       msg_entity = own;
-
-       WriteByte(MSG_ONE, SVC_TEMPENTITY);
-       WriteByte(MSG_ONE, TE_CSQC_VEHICLESETUP);
-       if(vehicle_id != 0)
-           WriteByte(MSG_ONE, vehicle_id);
-       else
-        WriteByte(MSG_ONE, 1 + own.vehicle.vehicle_weapon2mode + HUD_VEHICLE_LAST);
-}
-
-/** vehicles_locktarget
-
-    Generic target locking.
-
-    Figure out if what target is "locked" (if any), for missile tracking as such.
-
-    after calling, "if(self.lock_target != world && self.lock_strength == 1)" mean
-    you have a locked in target.
-
-    Exspects a crosshair_trace() or equivalent to be
-    dont before calling.
-
-**/
-.entity lock_target;
-.float  lock_strength;
-.float  lock_time;
-.float  lock_soundtime;
-const float    DAMAGE_TARGETDRONE = 10;
-
-vector targetdrone_getnewspot()
-{
-
-       vector spot;
-       float i;
-       for(i = 0; i < 100; ++i)
-       {
-               spot = self.origin + randomvec() * 1024;
-               tracebox(spot, self.mins, self.maxs, spot, MOVE_NORMAL, self);
-               if(trace_fraction == 1.0 && trace_startsolid == 0 && trace_allsolid == 0)
-                       return spot;
-       }
-       return self.origin;
-}
-
-#if 0
-void targetdrone_think();
-void targetdrone_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force);
-void targetdrone_renwe()
-{
-       self.think = targetdrone_think;
-       self.nextthink = time + 0.1;
-       setorigin(self, targetdrone_getnewspot());
-       self.health = 200;
-       self.takedamage = DAMAGE_TARGETDRONE;
-       self.event_damage = targetdrone_damage;
-       self.solid = SOLID_BBOX;
-       setmodel(self, "models/runematch/rune.mdl");
-       self.effects = EF_LOWPRECISION;
-       self.scale = 10;
-       self.movetype = MOVETYPE_BOUNCEMISSILE;
-       setsize(self, '-100 -100 -100', '100 100 100');
-
-}
-void targetdrone_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
-{
-       self.health -= damage;
-       if(self.health <= 0)
-       {
-               pointparticles(particleeffectnum("explosion_medium"), self.origin, '0 0 0', 1);
-
-               if(!self.cnt)
-                       remove(self);
-               else
-               {
-                       self.think = targetdrone_renwe;
-                       self.nextthink = time + 1 + random() * 2;
-                       self.solid = SOLID_NOT;
-                       setmodel(self, "");
-               }
-       }
-}
-entity targetdrone_getfear()
-{
-       entity fear;
-       float i;
-
-       for(i = 64; i <= 1024; i += 64)
-       {
-               fear = findradius(self.origin, i);
-               while(fear)
-               {
-                       if(fear.bot_dodge)
-                               return fear;
-
-                       fear = fear.chain;
-               }
-       }
-
-       return world;
-}
-void targetdrone_think()
-{
-       self.nextthink = time + 0.1;
-
-       if(self.wp00)
-       if(self.wp00.deadflag != DEAD_NO)
-               self.wp00 = targetdrone_getfear();
-
-       if(!self.wp00)
-               self.wp00 = targetdrone_getfear();
-
-       vector newdir;
-
-       if(self.wp00)
-               newdir = steerlib_push(self.wp00.origin) + randomvec() * 0.75;
-       else
-               newdir = randomvec() * 0.75;
-
-       newdir = newdir * 0.5 + normalize(self.velocity) * 0.5;
-
-       if(self.wp00)
-               self.velocity = normalize(newdir) * (500 + (1024 / min(vlen(self.wp00.origin - self.origin), 1024)) * 700);
-       else
-               self.velocity = normalize(newdir) * 750;
-
-       tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 2, MOVE_NORMAL, self);
-       if(trace_fraction != 1.0)
-               self.velocity = self.velocity * -1;
-
-       //normalize((normalize(self.velocity) * 0.5 + newdir * 0.5)) * 750;
-}
-
-void targetdrone_spawn(vector _where, float _autorenew)
-{
-       entity drone = spawn();
-       setorigin(drone, _where);
-       drone.think = targetdrone_renwe;
-       drone.nextthink = time + 0.1;
-       drone.cnt = _autorenew;
-}
-#endif
-
-void vehicles_locktarget(float incr, float decr, float _lock_time)
-{
-    if(self.lock_target && self.lock_target.deadflag != DEAD_NO)
-    {
-        self.lock_target    = world;
-        self.lock_strength  = 0;
-        self.lock_time      = 0;
-    }
-
-    if(self.lock_time > time)
-    {
-        if(self.lock_target)
-        if(self.lock_soundtime < time)
-        {
-            self.lock_soundtime = time + 0.5;
-            play2(self.owner, "vehicles/locked.wav");
-        }
-
-        return;
-    }
-
-    if(trace_ent != world)
-    {
-        if(teamplay && trace_ent.team == self.team)
-            trace_ent = world;
-
-        if(trace_ent.deadflag != DEAD_NO)
-            trace_ent = world;
-
-        if(!trace_ent.vehicle_flags & VHF_ISVEHICLE ||
-                               trace_ent.turrcaps_flags & TFL_TURRCAPS_ISTURRET ||
-                               trace_ent.takedamage == DAMAGE_TARGETDRONE)
-            trace_ent = world;
-    }
-
-    if(self.lock_target == world && trace_ent != world)
-        self.lock_target = trace_ent;
-
-    if(self.lock_target && trace_ent == self.lock_target)
-    {
-        if(self.lock_strength != 1 && self.lock_strength + incr >= 1)
-        {
-            play2(self.owner, "vehicles/lock.wav");
-            self.lock_soundtime = time + 0.8;
-        }
-        else if (self.lock_strength != 1 && self.lock_soundtime < time)
-        {
-            play2(self.owner, "vehicles/locking.wav");
-            self.lock_soundtime = time + 0.3;
-        }
-
-    }
-
-    // Have a locking target
-    // Trace hit current target
-    if(trace_ent == self.lock_target && trace_ent != world)
-    {
-        self.lock_strength = min(self.lock_strength + incr, 1);
-        if(self.lock_strength == 1)
-            self.lock_time = time + _lock_time;
-    }
-    else
-    {
-        if(trace_ent)
-            self.lock_strength = max(self.lock_strength - decr * 2, 0);
-        else
-            self.lock_strength = max(self.lock_strength - decr, 0);
-
-        if(self.lock_strength == 0)
-            self.lock_target = world;
-    }
-}
-
-#define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
-ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
-
-#define vehicles_sweap_collision(orig,vel,dt,acm,mult) \
-traceline(orig, orig + vel * dt, MOVE_NORMAL, self); \
-if(trace_fraction != 1) \
-    acm += normalize(self.origin - trace_endpos) * (vlen(vel) * mult)
-
-// Hover movement support
-float  force_fromtag_power;
-float  force_fromtag_normpower;
-vector force_fromtag_origin;
-vector vehicles_force_fromtag_hover(string tag_name, float spring_length, float max_power)
-{
-    force_fromtag_origin = gettaginfo(self, gettagindex(self, tag_name));
-    v_forward  = normalize(v_forward) * -1;
-    traceline(force_fromtag_origin, force_fromtag_origin - (v_forward  * spring_length), MOVE_NORMAL, self);
-
-    force_fromtag_power = (1 - trace_fraction) * max_power;
-    force_fromtag_normpower = force_fromtag_power / max_power;
-
-    return v_forward  * force_fromtag_power;
-}
-
-// Experimental hovermode wich uses attraction/repulstion from surface insted of gravity/repulsion
-// Can possibly be use to move abt any surface (inclusing walls/celings)
-vector vehicles_force_fromtag_maglev(string tag_name, float spring_length, float max_power)
-{
-
-    force_fromtag_origin = gettaginfo(self, gettagindex(self, tag_name));
-    v_forward  = normalize(v_forward) * -1;
-    traceline(force_fromtag_origin, force_fromtag_origin - (v_forward  * spring_length), MOVE_NORMAL, self);
-
-    // TODO - this may NOT be compatible with wall/celing movement, unhardcode 0.25 (engine count multiplier)
-    if(trace_fraction == 1.0)
-    {
-        force_fromtag_normpower = -0.25;
-        return '0 0 -200';
-    }
-
-    force_fromtag_power = ((1 - trace_fraction) - trace_fraction) * max_power;
-    force_fromtag_normpower = force_fromtag_power / max_power;
-
-    return v_forward  * force_fromtag_power;
-}
-
-// Generic vehile projectile system
-void vehicles_projectile_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
-{
-    // Ignore damage from oterh projectiles from my owner (dont mess up volly's)
-    if(inflictor.owner == self.owner)
-        return;
-
-    self.health -= damage;
-    self.velocity += force;
-    if(self.health < 1)
-    {
-        self.takedamage = DAMAGE_NO;
-        self.event_damage = func_null;
-        self.think = self.use;
-        self.nextthink = time;
-    }
-}
-
-void vehicles_projectile_explode()
-{
-    if(self.owner && other != world)
-    {
-        if(other == self.owner.vehicle)
-            return;
-
-        if(other == self.owner.vehicle.tur_head)
-            return;
-    }
-
-       PROJECTILE_TOUCH;
-
-       self.event_damage = func_null;
-    RadiusDamage (self, self.realowner, self.shot_dmg, 0, self.shot_radius, self, world, self.shot_force, self.totalfrags, other);
-
-    remove (self);
-}
-
-entity vehicles_projectile(string _mzlfx, string _mzlsound,
-                           vector _org, vector _vel,
-                           float _dmg, float _radi, float _force,  float _size,
-                           float _deahtype, float _projtype, float _health,
-                           float _cull, float _clianim, entity _owner)
-{
-    entity proj;
-
-    proj = spawn();
-
-    PROJECTILE_MAKETRIGGER(proj);
-    setorigin(proj, _org);
-
-    proj.shot_dmg         = _dmg;
-    proj.shot_radius      = _radi;
-    proj.shot_force       = _force;
-    proj.totalfrags       = _deahtype;
-    proj.solid            = SOLID_BBOX;
-    proj.movetype         = MOVETYPE_FLYMISSILE;
-    proj.flags            = FL_PROJECTILE;
-    proj.bot_dodge        = true;
-    proj.bot_dodgerating  = _dmg;
-    proj.velocity         = _vel;
-    proj.touch            = vehicles_projectile_explode;
-    proj.use              = vehicles_projectile_explode;
-    proj.owner            = self;
-    proj.realowner        = _owner;
-    proj.think            = SUB_Remove;
-    proj.nextthink        = time + 30;
-
-    if(_health)
-    {
-        proj.takedamage       = DAMAGE_AIM;
-        proj.event_damage     = vehicles_projectile_damage;
-        proj.health           = _health;
-    }
-    else
-        proj.flags           = FL_PROJECTILE | FL_NOTARGET;
-
-    if(_mzlsound)
-        sound (self, CH_WEAPON_A, _mzlsound, VOL_BASE, ATTEN_NORM);
-
-    if(_mzlfx)
-        pointparticles(particleeffectnum(_mzlfx), proj.origin, proj.velocity, 1);
-
-
-    setsize (proj, '-1 -1 -1' * _size, '1 1 1' * _size);
-
-    CSQCProjectile(proj, _clianim, _projtype, _cull);
-
-    return proj;
-}
-// End generic vehile projectile system
-
-void vehicles_reset()
-{
-       if(self.owner)
-       {
-               entity oldself = self;
-               self = self.owner;
-               vehicles_exit(VHEF_RELESE);
-               self = oldself;
-       }
-       self.alpha      = -1;
-       self.movetype   = MOVETYPE_NONE;
-       self.effects    = EF_NODRAW;
-       self.colormod  = '0 0 0';
-       self.avelocity = '0 0 0';
-       self.velocity  = '0 0 0';
-       self.event_damage = func_null;
-       self.solid = SOLID_NOT;
-       self.deadflag = DEAD_NO;
-
-       self.touch = func_null;
-       self.nextthink = 0;
-       vehicles_setreturn();
-}
-
-/** vehicles_spawn
-    Exetuted for all vehicles on (re)spawn.
-    Sets defaults for newly spawned units.
-**/
-void vehicles_spawn()
-{
-    dprint("Spawning vehicle: ", self.netname, "\n");
-
-    // De-own & reset
-    self.vehicle_hudmodel.viewmodelforclient = self;
-
-    self.owner              = world;
-    self.touch              = vehicles_touch;
-    self.event_damage       = vehicles_damage;
-    self.reset              = vehicles_reset;
-    self.iscreature         = true;
-    self.teleportable       = false; // no teleporting for vehicles, too buggy
-    self.damagedbycontents     = true;
-    self.movetype           = MOVETYPE_WALK;
-    self.solid              = SOLID_SLIDEBOX;
-    self.takedamage         = DAMAGE_AIM;
-       self.deadflag           = DEAD_NO;
-    self.bot_attack         = true;
-    self.flags              = FL_NOTARGET;
-    self.avelocity          = '0 0 0';
-    self.velocity           = '0 0 0';
-
-    // Reset locking
-    self.lock_strength      = 0;
-    self.lock_target        = world;
-    self.misc_bulletcounter = 0;
-
-    // Return to spawn
-    self.angles             = self.pos2;
-    setorigin(self, self.pos1 + '0 0 0');
-    // Show it
-    pointparticles(particleeffectnum("teleport"), self.origin + '0 0 64', '0 0 0', 1);
-
-    if(self.vehicle_controller)
-        self.team = self.vehicle_controller.team;
-
-    vehicles_reset_colors();
-    self.vehicle_spawn(VHSF_NORMAL);
-}
-
-// Better way of determening whats crushable needed! (fl_crushable?)
-float vehicles_crushable(entity e)
-{
-    if(IS_PLAYER(e))
-        return true;
-
-    if(e.flags & FL_MONSTER)
-        return true;
-
-    return false;
-}
-
-void vehicles_impact(float _minspeed, float _speedfac, float _maxpain)
-{
-    if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
-        return;
-
-    if(self.play_time < time)
-    {
-        float wc = vlen(self.velocity - self.oldvelocity);
-        //dprint("oldvel: ", vtos(self.oldvelocity), "\n");
-        //dprint("vel: ", vtos(self.velocity), "\n");
-        if(_minspeed < wc)
-        {
-            float take = min(_speedfac * wc, _maxpain);
-            Damage (self, world, world, take, DEATH_FALL, self.origin, '0 0 0');
-            self.play_time = time + 0.25;
-
-            //dprint("wc: ", ftos(wc), "\n");
-            //dprint("take: ", ftos(take), "\n");
-        }
-    }
-}
-
-.void() vehicle_impact;
-void vehicles_touch()
-{
-       if(MUTATOR_CALLHOOK(VehicleTouch))
-               return;
-
-    // Vehicle currently in use
-    if(self.owner)
-    {
-        if(other != world)
-        if(vehicles_crushable(other))
-        {
-            if(vlen(self.velocity) != 0)
-                Damage(other, self, self.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH, '0 0 0', normalize(other.origin - self.origin) * autocvar_g_vehicles_crush_force);
-
-            return; // Dont do selfdamage when hitting "soft targets".
-        }
-
-        if(self.play_time < time)
-        if(self.vehicle_impact)
-            self.vehicle_impact();
-
-        return;
-    }
-
-    if (!IS_PLAYER(other))
-        return;
-
-    if(other.deadflag != DEAD_NO)
-        return;
-
-    if(other.vehicle != world)
-        return;
-
-    vehicles_enter();
-}
-float autocvar_g_vehicles_allow_bots = 0;
-void vehicles_enter()
-{
-   // Remove this when bots know how to use vehicles
-
-    if (IS_BOT_CLIENT(other))
-        if (autocvar_g_vehicles_allow_bots)
-            dprint("Bot enters vehicle\n"); // This is where we need to disconnect (some, all?) normal bot AI and hand over to vehicle's _aiframe()
-        else
-            return;
-
-    if(self.phase > time)
-        return;
-    if(other.frozen)
-        return;
-    if(other.vehicle)
-        return;
-    if(other.deadflag != DEAD_NO)
-        return;
-
-    if(teamplay)
-    if(self.team)
-    if(self.team != other.team)
-        return;
-
-    RemoveGrapplingHook(other);
-
-    self.vehicle_ammo1   = 0;
-    self.vehicle_ammo2   = 0;
-    self.vehicle_reload1 = 0;
-    self.vehicle_reload2 = 0;
-    self.vehicle_energy  = 0;
-
-    self.owner          = other;
-    self.switchweapon   = other.switchweapon;
-
-    // .viewmodelforclient works better.
-    //self.vehicle_hudmodel.drawonlytoclient = self.owner;
-
-    self.vehicle_hudmodel.viewmodelforclient = self.owner;
-
-    self.event_damage         = vehicles_damage;
-    self.nextthink            = 0;
-    self.owner.angles         = self.angles;
-    self.owner.takedamage     = DAMAGE_NO;
-    self.owner.solid          = SOLID_NOT;
-    self.owner.movetype       = MOVETYPE_NOCLIP;
-    self.owner.alpha          = -1;
-    self.owner.vehicle        = self;
-    self.owner.event_damage   = func_null;
-    self.owner.view_ofs       = '0 0 0';
-    self.colormap             = self.owner.colormap;
-    if(self.tur_head)
-        self.tur_head.colormap    = self.owner.colormap;
-
-    self.owner.hud            = self.hud;
-    self.owner.PlayerPhysplug = self.PlayerPhysplug;
-
-    self.owner.vehicle_ammo1    = self.vehicle_ammo1;
-    self.owner.vehicle_ammo2    = self.vehicle_ammo2;
-    self.owner.vehicle_reload1  = self.vehicle_reload1;
-    self.owner.vehicle_reload2  = self.vehicle_reload2;
-
-    // Cant do this, hides attached objects too.
-    //self.exteriormodeltoclient = self.owner;
-    //self.tur_head.exteriormodeltoclient = self.owner;
-
-    other.flags &= ~FL_ONGROUND;
-    self.flags  &= ~FL_ONGROUND;
-
-    self.team                 = self.owner.team;
-    self.flags               -= FL_NOTARGET;
-    self.monster_attack       = true;
-
-    if (IS_REAL_CLIENT(other))
-    {
-        msg_entity = other;
-        WriteByte (MSG_ONE, SVC_SETVIEWPORT);
-        WriteEntity(MSG_ONE, self.vehicle_viewport);
-
-        WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
-        if(self.tur_head)
-        {
-            WriteAngle(MSG_ONE, self.tur_head.angles.x + self.angles.x); // tilt
-            WriteAngle(MSG_ONE, self.tur_head.angles.y + self.angles.y); // yaw
-            WriteAngle(MSG_ONE, 0);                                      // roll
-        }
-        else
-        {
-            WriteAngle(MSG_ONE,  self.angles.x * -1); // tilt
-            WriteAngle(MSG_ONE,  self.angles.y);      // yaw
-            WriteAngle(MSG_ONE,  0);                  // roll
-        }
-    }
-
-    vehicles_clearreturn();
-
-    CSQCVehicleSetup(self.owner, self.hud);
-
-    vh_player = other;
-    vh_vehicle = self;
-    MUTATOR_CALLHOOK(VehicleEnter);
-    other = vh_player;
-    self = vh_vehicle;
-
-    self.vehicle_enter();
-    antilag_clear(other);
-}
-
-/** vehicles_findgoodexit
-    Locates a valid location for the player to exit the vehicle.
-    Will first try prefer_spot, then up 100 random spots arround the vehicle
-    wich are in direct line of sight and empty enougth to hold a players bbox
-**/
-vector vehicles_findgoodexit(vector prefer_spot)
-{
-    //vector exitspot;
-    float mysize;
-
-    tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, prefer_spot, MOVE_NORMAL, self.owner);
-    if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
-        return prefer_spot;
-
-    mysize = 1.5 * vlen(self.maxs - self.mins);
-    float i;
-    vector v, v2;
-    v2 = 0.5 * (self.absmin + self.absmax);
-    for(i = 0; i < 100; ++i)
-    {
-        v = randomvec();
-        v.z = 0;
-        v = v2 + normalize(v) * mysize;
-        tracebox(v2, PL_MIN, PL_MAX, v, MOVE_NORMAL, self.owner);
-        if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
-            return v;
-    }
-
-    /*
-    exitspot = (self.origin + '0 0 48') + v_forward * mysize;
-    tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, self.owner);
-    if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
-        return exitspot;
-
-    exitspot = (self.origin + '0 0 48') - v_forward * mysize;
-    tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, self.owner);
-    if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
-        return exitspot;
-
-    exitspot = (self.origin + '0 0 48') + v_right * mysize;
-    tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, self.owner);
-    if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
-        return exitspot;
-
-    exitspot = (self.origin + '0 0 48') - v_right * mysize;
-    tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, self.owner);
-    if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
-        return exitspot;
-    */
-
-    return self.origin;
-}
-
-/** vehicles_exit
-    Standarrd vehicle release fucntion.
-    custom code goes in self.vehicle_exit
-**/
-float vehicles_exit_running;
-void vehicles_exit(float eject)
-{
-    entity _vehicle;
-    entity _player;
-    entity _oldself = self;
-
-    if(vehicles_exit_running)
-    {
-        dprint("^1vehicles_exit allready running! this is not good..\n");
-        return;
-    }
-
-    vehicles_exit_running = true;
-    if(IS_CLIENT(self))
-    {
-        _vehicle = self.vehicle;
-
-        if (_vehicle.vehicle_flags & VHF_PLAYERSLOT)
-        {
-            _vehicle.vehicle_exit(eject);
-            self = _oldself;
-            vehicles_exit_running = false;
-            return;
-        }
-    }
-    else
-        _vehicle = self;
-
-    _player = _vehicle.owner;
-
-    self = _vehicle;
-
-    if (_player)
-    {
-        if (IS_REAL_CLIENT(_player))
-        {
-            msg_entity = _player;
-            WriteByte (MSG_ONE, SVC_SETVIEWPORT);
-            WriteEntity( MSG_ONE, _player);
-
-            WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
-            WriteAngle(MSG_ONE, 0);
-            WriteAngle(MSG_ONE, _vehicle.angles.y);
-            WriteAngle(MSG_ONE, 0);
-        }
-
-        setsize(_player, PL_MIN,PL_MAX);
-
-        _player.takedamage     = DAMAGE_AIM;
-        _player.solid          = SOLID_SLIDEBOX;
-        _player.movetype       = MOVETYPE_WALK;
-        _player.effects        &= ~EF_NODRAW;
-        _player.alpha          = 1;
-        _player.PlayerPhysplug = func_null;
-        _player.vehicle        = world;
-        _player.view_ofs       = PL_VIEW_OFS;
-        _player.event_damage   = PlayerDamage;
-        _player.hud            = HUD_NORMAL;
-        _player.switchweapon   = _vehicle.switchweapon;
-
-        CSQCVehicleSetup(_player, HUD_NORMAL);
-    }
-    _vehicle.flags |= FL_NOTARGET;
-
-    if(_vehicle.deadflag == DEAD_NO)
-        _vehicle.avelocity          = '0 0 0';
-
-    _vehicle.tur_head.nodrawtoclient             = world;
-
-    if(!teamplay)
-        _vehicle.team = 0;
-
-    vh_player = _player;
-    vh_vehicle = _vehicle;
-    MUTATOR_CALLHOOK(VehicleExit);
-    _player = vh_player;
-    _vehicle = vh_vehicle;
-
-    _vehicle.team = _vehicle.tur_head.team;
-
-    sound (_vehicle, CH_TRIGGER_SINGLE, "misc/null.wav", 1, ATTEN_NORM);
-    _vehicle.vehicle_hudmodel.viewmodelforclient = _vehicle;
-    _vehicle.phase = time + 1;
-    _vehicle.monster_attack = false;
-
-    _vehicle.vehicle_exit(eject);
-
-    vehicles_setreturn();
-    vehicles_reset_colors();
-    _vehicle.owner = world;
-    self = _oldself;
-
-    vehicles_exit_running = false;
-}
-
-
-void vehicles_regen(float timer, .float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
-{
-    if(self.regen_field < field_max)
-    if(timer + rpause < time)
-    {
-        if(_healthscale)
-            regen = regen * (self.vehicle_health / self.tur_health);
-
-        self.regen_field = min(self.regen_field + regen * delta_time, field_max);
-
-        if(self.owner)
-            self.owner.regen_field = (self.regen_field / field_max) * 100;
-    }
-}
-
-void shieldhit_think()
-{
-    self.alpha -= 0.1;
-    if (self.alpha <= 0)
-    {
-        //setmodel(self, "");
-        self.alpha = -1;
-        self.effects |= EF_NODRAW;
-    }
-    else
-    {
-        self.nextthink = time + 0.1;
-    }
-}
-
-void vehicles_painframe()
-{
-    if(self.owner.vehicle_health <= 50)
-    if(self.pain_frame < time)
-    {
-        float _ftmp;
-        _ftmp = self.owner.vehicle_health / 50;
-        self.pain_frame = time + 0.1 + (random() * 0.5 * _ftmp);
-        pointparticles(particleeffectnum("smoke_small"), (self.origin + (randomvec() * 80)), '0 0 0', 1);
-
-        if(self.vehicle_flags & VHF_DMGSHAKE)
-            self.velocity += randomvec() * 30;
-
-        if(self.vehicle_flags & VHF_DMGROLL)
-            if(self.vehicle_flags & VHF_DMGHEADROLL)
-                self.tur_head.angles += randomvec();
-            else
-                self.angles += randomvec();
-
-    }
-}
-
-void vehicles_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
-{
-    self.dmg_time = time;
-
-       // WEAPONTODO
-    if(DEATH_ISWEAPON(deathtype, WEP_VORTEX))
-        damage *= autocvar_g_vehicles_vortex_damagerate;
-
-    if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN))
-        damage *= autocvar_g_vehicles_machinegun_damagerate;
-
-    if(DEATH_ISWEAPON(deathtype, WEP_RIFLE))
-        damage *= autocvar_g_vehicles_rifle_damagerate;
-
-    if(DEATH_ISWEAPON(deathtype, WEP_VAPORIZER))
-        damage *= autocvar_g_vehicles_vaporizer_damagerate;
-
-    if(DEATH_ISWEAPON(deathtype, WEP_SEEKER))
-        damage *= autocvar_g_vehicles_tag_damagerate;
-
-    self.enemy = attacker;
-
-    if((self.vehicle_flags & VHF_HASSHIELD) && (self.vehicle_shield > 0))
-    {
-        if (wasfreed(self.vehicle_shieldent) || self.vehicle_shieldent == world)
-        {
-            self.vehicle_shieldent = spawn();
-            self.vehicle_shieldent.effects = EF_LOWPRECISION;
-
-            setmodel(self.vehicle_shieldent, "models/vhshield.md3");
-            setattachment(self.vehicle_shieldent, self, "");
-            setorigin(self.vehicle_shieldent, real_origin(self) - self.origin);
-            self.vehicle_shieldent.scale       = 256 / vlen(self.maxs - self.mins);
-            self.vehicle_shieldent.think       = shieldhit_think;
-        }
-
-        self.vehicle_shieldent.colormod    = '1 1 1';
-        self.vehicle_shieldent.alpha       = 0.45;
-        self.vehicle_shieldent.angles      = vectoangles(normalize(hitloc - (self.origin + self.vehicle_shieldent.origin))) - self.angles;
-        self.vehicle_shieldent.nextthink   = time;
-        self.vehicle_shieldent.effects &= ~EF_NODRAW;
-
-        self.vehicle_shield -= damage;
-
-        if(self.vehicle_shield < 0)
-        {
-            self.vehicle_health            -= fabs(self.vehicle_shield);
-            self.vehicle_shieldent.colormod = '2 0 0';
-            self.vehicle_shield             = 0;
-            self.vehicle_shieldent.alpha    = 0.75;
-
-               if(sound_allowed(MSG_BROADCAST, attacker))
-                spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM);   // FIXME: PLACEHOLDER
-        }
-        else
-               if(sound_allowed(MSG_BROADCAST, attacker))
-                spamsound (self, CH_PAIN, "onslaught/electricity_explode.wav", VOL_BASE, ATTEN_NORM);  // FIXME: PLACEHOLDER
-
-    }
-    else
-    {
-        self.vehicle_health -= damage;
-
-        if(sound_allowed(MSG_BROADCAST, attacker))
-            spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM);  // FIXME: PLACEHOLDER
-    }
-
-       if(self.damageforcescale < 1 && self.damageforcescale > 0)
-               self.velocity += force * self.damageforcescale;
-       else
-               self.velocity += force;
-
-    if(self.vehicle_health <= 0)
-    {
-        if(self.owner)
-            if(self.vehicle_flags & VHF_DEATHEJECT)
-                vehicles_exit(VHEF_EJECT);
-            else
-                vehicles_exit(VHEF_RELESE);
-
-
-        antilag_clear(self);
-
-        self.vehicle_die();
-        vehicles_setreturn();
-    }
-}
-
-void vehicles_clearreturn()
-{
-    entity ret;
-    // Remove "return helper", if any.
-    ret = findchain(classname, "vehicle_return");
-    while(ret)
-    {
-        if(ret.wp00 == self)
-        {
-            ret.classname   = "";
-            ret.think       = SUB_Remove;
-            ret.nextthink   = time + 0.1;
-
-            if(ret.waypointsprite_attached)
-                WaypointSprite_Kill(ret.waypointsprite_attached);
-
-            return;
-        }
-        ret = ret.chain;
-    }
-}
-
-void vehicles_return()
-{
-    pointparticles(particleeffectnum("teleport"), self.wp00.origin + '0 0 64', '0 0 0', 1);
-
-    self.wp00.think     = vehicles_spawn;
-    self.wp00.nextthink = time;
-
-    if(self.waypointsprite_attached)
-        WaypointSprite_Kill(self.waypointsprite_attached);
-
-    remove(self);
-}
-
-void vehicles_showwp_goaway()
-{
-    if(self.waypointsprite_attached)
-        WaypointSprite_Kill(self.waypointsprite_attached);
-
-    remove(self);
-
-}
-
-void vehicles_showwp()
-{
-    entity oldself = world;
-    vector rgb;
-
-    if(self.cnt)
-    {
-        self.think      = vehicles_return;
-        self.nextthink  = self.cnt;
-    }
-    else
-    {
-        self.think      = vehicles_return;
-        self.nextthink  = time +1;
-
-        oldself = self;
-        self = spawn();
-        setmodel(self, "null");
-        self.team = oldself.wp00.team;
-        self.wp00 = oldself.wp00;
-        setorigin(self, oldself.wp00.pos1);
-
-        self.nextthink = time + 5;
-        self.think = vehicles_showwp_goaway;
-    }
-
-    if(teamplay && self.team)
-           rgb = Team_ColorRGB(self.team);
-    else
-           rgb = '1 1 1';
-    WaypointSprite_Spawn("vehicle", 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_POWERUP, rgb);
-    if(self.waypointsprite_attached)
-    {
-        WaypointSprite_UpdateRule(self.waypointsprite_attached, self.wp00.team, SPRITERULE_DEFAULT);
-        if(oldself == world)
-            WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, self.nextthink);
-        WaypointSprite_Ping(self.waypointsprite_attached);
-    }
-
-    if(oldself != world)
-        self = oldself;
-}
-
-void vehicles_setreturn()
-{
-    entity ret;
-
-    vehicles_clearreturn();
-
-    ret = spawn();
-    ret.classname   = "vehicle_return";
-    ret.wp00       = self;
-    ret.team        = self.team;
-    ret.think       = vehicles_showwp;
-
-       if(self.deadflag != DEAD_NO)
-       {
-               ret.cnt = max(game_starttime, time) + self.vehicle_respawntime;
-               ret.nextthink = max(game_starttime, time) + max(0, self.vehicle_respawntime - 5);
-       }
-       else
-               ret.nextthink = max(game_starttime, time) + max(0, self.vehicle_respawntime - 1);
-
-    setmodel(ret, "null");
-    setorigin(ret, self.pos1 + '0 0 96');
-}
-
-void vehicles_reset_colors()
-{
-    entity e;
-    float _effects = 0, _colormap;
-    vector _glowmod, _colormod;
-
-    if(autocvar_g_nodepthtestplayers)
-        _effects |= EF_NODEPTHTEST;
-
-    if(autocvar_g_fullbrightplayers)
-        _effects |= EF_FULLBRIGHT;
-
-    if(self.team)
-        _colormap = 1024 + (self.team - 1) * 17;
-    else
-        _colormap = 1024;
-
-    _glowmod  = '0 0 0';
-    _colormod = '0 0 0';
-
-    // Find all ents attacked to main model and setup effects, colormod etc.
-    e = findchainentity(tag_entity, self);
-    while(e)
-    {
-        if(e != self.vehicle_shieldent)
-        {
-            e.effects   = _effects; //  | EF_LOWPRECISION;
-            e.colormod  = _colormod;
-            e.colormap  = _colormap;
-            e.alpha     = 1;
-        }
-        e = e.chain;
-    }
-
-    self.vehicle_hudmodel.effects  = self.effects  = _effects; // | EF_LOWPRECISION;
-    self.vehicle_hudmodel.colormod = self.colormod = _colormod;
-    self.vehicle_hudmodel.colormap = self.colormap = _colormap;
-    self.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
-
-    self.alpha     = 1;
-    self.avelocity = '0 0 0';
-    self.velocity  = '0 0 0';
-    self.effects   = _effects;
-}
-
-void vehicle_use()
-{
-    dprint("vehicle ",self.netname, " used by ", activator.classname, "\n");
-
-    self.tur_head.team = activator.team;
-
-    if(self.tur_head.team == 0)
-        self.active = ACTIVE_NOT;
-    else
-        self.active = ACTIVE_ACTIVE;
-
-    if(self.active == ACTIVE_ACTIVE && self.deadflag == DEAD_NO)
-    {
-        dprint("^3Eat shit yall!\n");
-        vehicles_setreturn();
-        vehicles_reset_colors();
-    }
-    else if(self.active == ACTIVE_NOT && self.deadflag != DEAD_NO)
-    {
-
-    }
-}
-
-float vehicle_addplayerslot(    entity _owner,
-                                entity _slot,
-                                float _hud,
-                                string _hud_model,
-                                float() _framefunc,
-                                void(float) _exitfunc)
-{
-    if (!(_owner.vehicle_flags & VHF_MULTISLOT))
-        _owner.vehicle_flags |= VHF_MULTISLOT;
-
-    _slot.PlayerPhysplug = _framefunc;
-    _slot.vehicle_exit = _exitfunc;
-    _slot.hud = _hud;
-    _slot.vehicle_flags = VHF_PLAYERSLOT;
-    _slot.vehicle_viewport = spawn();
-    _slot.vehicle_hudmodel = spawn();
-    _slot.vehicle_hudmodel.viewmodelforclient = _slot;
-    _slot.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
-
-    setmodel(_slot.vehicle_hudmodel, _hud_model);
-    setmodel(_slot.vehicle_viewport, "null");
-
-    setattachment(_slot.vehicle_hudmodel, _slot, "");
-    setattachment(_slot.vehicle_viewport, _slot.vehicle_hudmodel, "");
-
-    return true;
-}
-
-float vehicle_initialize(string  net_name,
-                         string  bodymodel,
-                         string  topmodel,
-                         string  hudmodel,
-                         string  toptag,
-                         string  hudtag,
-                         string  viewtag,
-                         float   vhud,
-                         vector  min_s,
-                         vector  max_s,
-                         float   nodrop,
-                         void(float _spawnflag)  spawnproc,
-                         float   _respawntime,
-                         float() physproc,
-                         void()  enterproc,
-                         void(float extflag) exitfunc,
-                         void() dieproc,
-                         void() thinkproc,
-                         float  use_csqc,
-                         float _max_health,
-                         float _max_shield)
-{
-       if(!autocvar_g_vehicles)
-               return false;
-
-    if(self.targetname)
-    {
-        self.vehicle_controller = find(world, target, self.targetname);
-        if(!self.vehicle_controller)
-        {
-            bprint("^1WARNING: ^7Vehicle with invalid .targetname\n");
-        }
-        else
-        {
-            self.team = self.vehicle_controller.team;
-            self.use = vehicle_use;
-
-            if(teamplay)
-            {
-                if(self.vehicle_controller.team == 0)
-                    self.active = ACTIVE_NOT;
-                else
-                    self.active = ACTIVE_ACTIVE;
-            }
-        }
-    }
-
-    precache_sound("onslaught/ons_hit2.wav");
-    precache_sound("onslaught/electricity_explode.wav");
-
-
-    addstat(STAT_HUD, AS_INT,  hud);
-       addstat(STAT_VEHICLESTAT_HEALTH,  AS_INT, vehicle_health);
-       addstat(STAT_VEHICLESTAT_SHIELD,  AS_INT, vehicle_shield);
-       addstat(STAT_VEHICLESTAT_ENERGY,  AS_INT, vehicle_energy);
-
-       addstat(STAT_VEHICLESTAT_AMMO1,   AS_INT, vehicle_ammo1);
-       addstat(STAT_VEHICLESTAT_RELOAD1, AS_INT, vehicle_reload1);
-
-       addstat(STAT_VEHICLESTAT_AMMO2,   AS_INT, vehicle_ammo2);
-       addstat(STAT_VEHICLESTAT_RELOAD2, AS_INT, vehicle_reload2);
-
-    if(bodymodel == "")
-        error("vehicles: missing bodymodel!");
-
-    if(hudmodel == "")
-        error("vehicles: missing hudmodel!");
-
-    if(net_name == "")
-        self.netname = self.classname;
-    else
-        self.netname = net_name;
-
-    if(self.team && !teamplay)
-        self.team = 0;
-
-    self.vehicle_flags |= VHF_ISVEHICLE;
-
-    setmodel(self, bodymodel);
-
-    self.vehicle_viewport   = spawn();
-    self.vehicle_hudmodel   = spawn();
-    self.tur_head           = spawn();
-    self.tur_head.owner     = self;
-    self.takedamage         = DAMAGE_AIM;
-    self.bot_attack         = true;
-    self.iscreature         = true;
-    self.teleportable       = false; // no teleporting for vehicles, too buggy
-    self.damagedbycontents     = true;
-    self.hud                = vhud;
-    self.tur_health          = _max_health;
-    self.tur_head.tur_health = _max_shield;
-    self.vehicle_die         = dieproc;
-    self.vehicle_exit        = exitfunc;
-    self.vehicle_enter       = enterproc;
-    self.PlayerPhysplug      = physproc;
-    self.event_damage        = func_null;
-    self.touch               = vehicles_touch;
-    self.think               = vehicles_spawn;
-    self.vehicle_spawn       = spawnproc;
-       self.vehicle_respawntime = max(0, _respawntime);
-    self.effects             = EF_NODRAW;
-       self.dphitcontentsmask   = DPCONTENTS_BODY | DPCONTENTS_SOLID;
-       if(!autocvar_g_vehicles_delayspawn || !self.vehicle_respawntime)
-               self.nextthink = time;
-       else
-               self.nextthink = max(time, game_starttime) + max(0, self.vehicle_respawntime + ((random() * 2 - 1) * autocvar_g_vehicles_delayspawn_jitter));
-
-       if(autocvar_g_playerclip_collisions)
-               self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
-
-    if(autocvar_g_nodepthtestplayers)
-        self.effects = self.effects | EF_NODEPTHTEST;
-
-    if(autocvar_g_fullbrightplayers)
-        self.effects = self.effects | EF_FULLBRIGHT;
-
-    setmodel(self.vehicle_hudmodel, hudmodel);
-    setmodel(self.vehicle_viewport, "null");
-
-    if(topmodel != "")
-    {
-        setmodel(self.tur_head, topmodel);
-        setattachment(self.tur_head, self, toptag);
-        setattachment(self.vehicle_hudmodel, self.tur_head, hudtag);
-        setattachment(self.vehicle_viewport, self.vehicle_hudmodel, viewtag);
-    }
-    else
-    {
-        setattachment(self.tur_head, self, "");
-        setattachment(self.vehicle_hudmodel, self, hudtag);
-        setattachment(self.vehicle_viewport, self.vehicle_hudmodel, viewtag);
-    }
-
-    setsize(self, min_s, max_s);
-    if (!nodrop)
-    {
-        setorigin(self, self.origin);
-        tracebox(self.origin + '0 0 100', min_s, max_s, self.origin - '0 0 10000', MOVE_WORLDONLY, self);
-        setorigin(self, trace_endpos);
-    }
-
-    self.pos1 = self.origin;
-    self.pos2 = self.angles;
-    self.tur_head.team = self.team;
-
-       if(MUTATOR_CALLHOOK(VehicleSpawn))
-               return false;
-
-    return true;
-}
-
-vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string _tagname,
-                         float _pichlimit_min, float _pichlimit_max,
-                         float _rotlimit_min, float _rotlimit_max, float _aimspeed)
-{
-    vector vtmp, vtag;
-    float ftmp;
-    vtag = gettaginfo(_turrret, gettagindex(_turrret, _tagname));
-    vtmp = vectoangles(normalize(_target - vtag));
-    vtmp = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(_vehic.angles), AnglesTransform_FromAngles(vtmp))) - _turrret.angles;
-    vtmp = AnglesTransform_Normalize(vtmp, true);
-    ftmp = _aimspeed * frametime;
-    vtmp.y = bound(-ftmp, vtmp.y, ftmp);
-    vtmp.x = bound(-ftmp, vtmp.x, ftmp);
-    _turrret.angles_y = bound(_rotlimit_min, _turrret.angles.y + vtmp.y, _rotlimit_max);
-    _turrret.angles_x = bound(_pichlimit_min, _turrret.angles.x + vtmp.x, _pichlimit_max);
-    return vtag;
-}
-
-void vehicles_gib_explode()
-{
-       sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
-       pointparticles(particleeffectnum("explosion_small"), randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
-       remove(self);
-}
-
-void vehicles_gib_think()
-{
-       self.alpha -= 0.1;
-       if(self.cnt >= time)
-               remove(self);
-       else
-               self.nextthink = time + 0.1;
-}
-
-entity vehicle_tossgib(entity _template, vector _vel, string _tag, float _burn, float _explode, float _maxtime, vector _rot)
-{
-       entity _gib = spawn();
-       setmodel(_gib, _template.model);
-       setorigin(_gib, gettaginfo(self, gettagindex(self, _tag)));
-       _gib.velocity = _vel;
-       _gib.movetype = MOVETYPE_TOSS;
-       _gib.solid = SOLID_CORPSE;
-       _gib.colormod = '-0.5 -0.5 -0.5';
-       _gib.effects = EF_LOWPRECISION;
-       _gib.avelocity = _rot;
-
-       if(_burn)
-               _gib.effects |= EF_FLAME;
-
-       if(_explode)
-       {
-               _gib.think = vehicles_gib_explode;
-               _gib.nextthink = time + random() * _explode;
-               _gib.touch = vehicles_gib_explode;
-       }
-       else
-       {
-               _gib.cnt = time + _maxtime;
-               _gib.think = vehicles_gib_think;
-               _gib.nextthink = time + _maxtime - 1;
-               _gib.alpha = 1;
-       }
-       return _gib;
-}
-
-/*
-vector predict_target(entity _targ, vector _from, float _shot_speed)
-{
-    float i;                // loop
-    float _distance;        // How far to target
-    float _impact_time;     // How long untill projectile impacts
-    vector _predict_pos;    // Predicted enemy location
-    vector _original_origin;// Where target is before predicted
-
-     _original_origin = real_origin(_targ); // Typicaly center of target BBOX
-
-    _predict_pos = _original_origin;
-    for(i = 0; i < 4; ++i)  // Loop a few times to increase prediction accuracy (increase loop count if accuracy is to low)
-    {
-        _distance = vlen(_predict_pos - _from); // Get distance to previos predicted location
-        _impact_time = _distance / _shot_speed; // Calculate impact time
-        _predict_pos = _original_origin + _targ.velocity * _impact_time; // Calculate new predicted location
-    }
-
-    return _predict_pos;
-}
-*/