seta hud_contents_water_color "0.4 0.3 0.3"
seta hud_shownames 1 "draw names and health/armor of nearby players"
-seta hud_shownames_enemies 2 "1 = draw names of enemies you point at, 2 = draw names of all enemies in view"
-seta hud_shownames_status 2 "1 = draw health/armor status of teammates, 2 = same as 1, but draw health/armor icons with a question mark on enemies in teamgames"
-seta hud_shownames_height 15 "height of icons"
+seta hud_shownames_enemies 2 "1 = draw names of enemies you point at (TODO), 2 = draw names of all enemies in view"
+seta hud_shownames_status 1 "1 = draw health/armor status of teammates"
+seta hud_shownames_statusbar_height 4 "height of status bar"
seta hud_shownames_aspect 8 "aspect ratio of total drawing area per name"
-seta hud_shownames_fontsize 13 "font size"
+seta hud_shownames_fontsize 12 "font size"
seta hud_shownames_decolorize 1 "1 = decolorize name in team games, 2 = decolorize always"
seta hud_shownames_alpha 0.7 "alpha"
seta hud_shownames_resize 1 "enable resizing of the names, then the size cvars will correspond to the maximum size"
seta hud_shownames_maxdistance 2500 "alpha/size is 0 at this distance"
seta hud_shownames_antioverlap 1 "if two tags get too close to each other, fade out the one further away from you"
seta hud_shownames_antioverlap_distance 125 "2d distance to other tag after which to fade out"
-seta hud_shownames_offset 48 "offset (along z-axis) tag from player origin by this many units"
+seta hud_shownames_offset 52 "offset (along z-axis) tag from player origin by this many units"
// scoreboard
seta scoreboard_columns default
if(self.sameteam || (!self.sameteam && autocvar_hud_shownames_enemies))
{
- string temporigin;
- temporigin = getplayerkey(self.the_entnum-1, "TEMPHACK_origin");
- if(temporigin == "")
- return;
- self.origin = stov(temporigin);
+ self.origin = getplayerorigin(self.the_entnum-1);
self.origin_z += autocvar_hud_shownames_offset;
if(!self.sameteam)
o_z = 0;
vector myPos, mySize;
- mySize = (eX * autocvar_hud_shownames_aspect + eY) * autocvar_hud_shownames_height;
+ mySize = (eX * autocvar_hud_shownames_aspect + eY) * autocvar_hud_shownames_fontsize;
myPos = o - '0.5 0 0' * mySize_x - '0 1 0' * mySize_y;
// size scaling
myPos_x += 0.5 * (mySize_x / resize - mySize_x);
myPos_y += (mySize_y / resize - mySize_y);
- vector iconpos, iconsize; // these determine icon position/size, if any
vector namepos; // this is where the origin of the string
- float namesize; // total area where we can draw the string
+ float namewidth;
- iconpos = myPos;
+ namepos = myPos;
+ namewidth = mySize_x;
if(autocvar_hud_shownames_status && teamplay)
{
if(self.sameteam)
{
- iconsize = eX * 2 * mySize_y + eY * mySize_y;
- // "ghost" backgrounds
- drawpic_aspect_skin(iconpos, "health", '1 1 0' * iconsize_y, '0 0 0', a * 0.5, DRAWFLAG_NORMAL);
- drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor", '1 1 0' * iconsize_y, '0 0 0', a * 0.5, DRAWFLAG_NORMAL);
-
if(self.healthvalue > 0)
{
- drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, self.healthvalue/autocvar_hud_panel_healtharmor_maxhealth), vid_conwidth, myPos_y + iconsize_y);
- drawpic_aspect_skin(iconpos, "health", '1 1 0' * iconsize_y, '1 1 1', a, DRAWFLAG_NORMAL);
- }
+ HUD_Panel_DrawProgressBar(namepos + '0 1 0' * autocvar_hud_shownames_fontsize * resize, eX * mySize_x + eY * resize * autocvar_hud_shownames_statusbar_height, "nametag_statusbar", self.healthvalue, 0, 0, '1 0 0', a, DRAWFLAG_NORMAL);
- if(self.armorvalue > 0)
- {
- drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, self.armorvalue/autocvar_hud_panel_healtharmor_maxarmor), vid_conwidth, myPos_y + iconsize_y);
- drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor", '1 1 0' * iconsize_y, '1 1 1', a, DRAWFLAG_NORMAL);
+ if(self.armorvalue > 0)
+ HUD_Panel_DrawProgressBar(namepos + '0 1 0' * autocvar_hud_shownames_fontsize * resize + eY * resize * autocvar_hud_shownames_statusbar_height, eX * mySize_x + eY * resize * autocvar_hud_shownames_statusbar_height, "nametag_statusbar", self.armorvalue, 0, 0, '0 1 0', a, DRAWFLAG_NORMAL);
}
- drawresetcliparea();
- }
- else if(autocvar_hud_shownames_status == 2)
- {
- iconsize = eX * 2 * mySize_y + eY * mySize_y;
- drawpic_aspect_skin(iconpos, "health_unknown", '1 1 0' * iconsize_y, '0 0 0', a, DRAWFLAG_NORMAL);
- drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor_unknown", '1 1 0' * iconsize_y, '0 0 0', a, DRAWFLAG_NORMAL);
}
}
- namepos = myPos + eX * 2 * iconsize_y + eY * 0.5 * resize * (autocvar_hud_shownames_height - autocvar_hud_shownames_fontsize);
- namesize = mySize_x - 2 * iconsize_y;
-
string s;
s = GetPlayerName(self.the_entnum-1);
if((autocvar_hud_shownames_decolorize == 1 && teamplay) || autocvar_hud_shownames_decolorize == 2)
s = playername(s, GetPlayerColor(self.the_entnum-1));
drawfontscale = '1 1 0' * resize;
- s = textShortenToWidth(s, namesize, '1 1 0' * autocvar_hud_shownames_fontsize, stringwidth_colors);
+ s = textShortenToWidth(s, namewidth, '1 1 0' * autocvar_hud_shownames_fontsize, stringwidth_colors);
float width;
width = stringwidth(s, TRUE, '1 1 0' * autocvar_hud_shownames_fontsize);
- if (width != namesize)
- namepos_x += (namesize - width) / 2;
+ if (width != namewidth)
+ namepos_x += (namewidth - width) / 2;
drawcolorcodedstring(namepos, s, '1 1 0' * autocvar_hud_shownames_fontsize, a, DRAWFLAG_NORMAL);
drawfontscale = '1 1 0';
}