]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Simple tactical hud overlay for turrets when in a vehicle
authorJakob MG <jakob_mg@hotmail.com>
Wed, 23 May 2012 20:49:51 +0000 (22:49 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Wed, 23 May 2012 20:49:51 +0000 (22:49 +0200)
defaultXonotic.cfg
gfx/vehicles/vth-mover.tga [new file with mode: 0644]
gfx/vehicles/vth-stationary.tga [new file with mode: 0644]
qcsrc/client/autocvars.qh
qcsrc/client/tturrets.qc

index 0c5f1819c2971e5a26a297f29d80d6232da906a1..ae552dd16db737b10c27d4f7f64f9519e3d01fac 100644 (file)
@@ -1647,6 +1647,7 @@ seta cl_vehicle_spiderbot_cross_alpha 0.6
 seta cl_vehicle_spiderbot_cross_size 1
 seta cl_vehicles_hudscale 0.5 
 seta cl_vehicles_hudalpha 0.75
+seta cl_vehicles_hud_tactical 1
 
 //cl_gunalign calculator
 seta menu_cl_gunalign 3 "Gun alignment; 1 = center (if allowed by g_shootfromclient) or right, 2 = center (if allowed by g_shootfromclient) or left, 3 = right only, 4 = left only"
diff --git a/gfx/vehicles/vth-mover.tga b/gfx/vehicles/vth-mover.tga
new file mode 100644 (file)
index 0000000..d831896
Binary files /dev/null and b/gfx/vehicles/vth-mover.tga differ
diff --git a/gfx/vehicles/vth-stationary.tga b/gfx/vehicles/vth-stationary.tga
new file mode 100644 (file)
index 0000000..31703bc
Binary files /dev/null and b/gfx/vehicles/vth-stationary.tga differ
index 344c3731c4561f1932d123df8a2032bc9f139934..1e938c26ae3d95c12b9056b484edde0c87fbee82 100644 (file)
@@ -67,6 +67,7 @@ float autocvar_cl_reticle_stretch;
 float autocvar_cl_stripcolorcodes;
 var float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
 var float autocvar_cl_vehicle_spiderbot_cross_size = 1;
+var float autocvar_cl_vehicles_hud_tactical = 1;
 float autocvar_cl_velocityzoom;
 var float autocvar_cl_velocityzoom_type = 3;
 float autocvar_cl_velocityzoom_speed;
index 3ef3eb9d61d200b2612a25be39ce75eae058c89c..d7abeb0919de42e95d278942f363cb9009336b96 100644 (file)
@@ -235,36 +235,46 @@ void turret_draw2d()
         return; 
 
        float dist = vlen(self.origin - view_origin);
+    float t = (GetPlayerColor(player_localnum) + 1);   
+
        vector o;
-       /*
-       // TODO: Vehicle tactical hud
-       o = project_3d_to_2d(self.origin + '0 0 32');
-       if(o_z < 0 
-       || o_x < (vid_conwidth * waypointsprite_edgeoffset_left) 
-       || o_y < (vid_conheight * waypointsprite_edgeoffset_top) 
-       || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))  
-       || o_y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)))
-           return; // Dont draw wp's for turrets out of view
-    o_z = 0;
-    if(hud != HUD_NORMAL)
-    {        
-        switch(hud)
-        {
-            case HUD_SPIDERBOT:
-            case HUD_WAKIZASHI:
-            case HUD_RAPTOR:
-                vector pz = drawgetimagesize("gfx/vehicles/axh-bracket.tga") * 0.25;
-                drawpic(o - pz * 0.5 , "gfx/vehicles/axh-bracket.tga", pz , '1 1 1', 0.75, DRAWFLAG_NORMAL);
-                break;
+       string txt;
+       
+       if(autocvar_cl_vehicles_hud_tactical)
+       if(dist < 10240 && t != self.team)
+       {
+        // TODO: Vehicle tactical hud
+        o = project_3d_to_2d(self.origin + '0 0 32');
+        if(o_z < 0 
+        || o_x < (vid_conwidth * waypointsprite_edgeoffset_left) 
+        || o_y < (vid_conheight * waypointsprite_edgeoffset_top) 
+        || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))  
+        || o_y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)))
+            return; // Dont draw wp's for turrets out of view
+        o_z = 0;
+        if(hud != HUD_NORMAL)
+        {        
+            switch(hud)
+            {
+                case HUD_SPIDERBOT:
+                case HUD_WAKIZASHI:
+                case HUD_RAPTOR:
+                    if(self.turret_type == TID_EWHEEL || self.turret_type == TID_WALKER)
+                        txt = "gfx/vehicles/vth-mover.tga";
+                    else
+                        txt = "gfx/vehicles/vth-stationary.tga";
+                        
+                    vector pz = drawgetimagesize(txt) * 0.25;
+                    drawpic(o - pz * 0.5, txt, pz , '1 1 1', 0.75, DRAWFLAG_NORMAL);
+                    break;
+            }
         }
-    }
-    */
+       }
     
        if(dist > self.maxdistance)
         return;
 
        string spriteimage = self.netname;
-       float t = (GetPlayerColor(player_localnum) + 1);        
        float a = self.alpha * autocvar_hud_panel_fg_alpha;
        vector rgb = spritelookupcolor(spriteimage, self.teamradar_color);
 
@@ -280,7 +290,7 @@ void turret_draw2d()
                print(sprintf("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage)); 
        }
 
-       string txt = self.netname;
+       txt = self.netname;
        if(autocvar_g_waypointsprite_spam && waypointsprite_count >= autocvar_g_waypointsprite_spam)
                txt = _("Spam");
        else