From: Jakob MG Date: Wed, 23 May 2012 20:49:51 +0000 (+0200) Subject: Simple tactical hud overlay for turrets when in a vehicle X-Git-Tag: xonotic-v0.7.0~314^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f1640e9882a14d88d3b2ad0c673dacfed8fecfa0;p=xonotic%2Fxonotic-data.pk3dir.git Simple tactical hud overlay for turrets when in a vehicle --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 0c5f1819c..ae552dd16 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -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 index 000000000..d831896ff 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 index 000000000..31703bcfe Binary files /dev/null and b/gfx/vehicles/vth-stationary.tga differ diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 344c3731c..1e938c26a 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -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; diff --git a/qcsrc/client/tturrets.qc b/qcsrc/client/tturrets.qc index 3ef3eb9d6..d7abeb091 100644 --- a/qcsrc/client/tturrets.qc +++ b/qcsrc/client/tturrets.qc @@ -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