seta hud_shownames 1 "draw names and health/armor of nearby players"
seta hud_shownames_enemies 1 "also draw names of enemies"
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"
-seta hud_shownames_height 10 "height in pixels"
-seta hud_shownames_aspect 6 "aspect ratio"
+seta hud_shownames_height 15 "height of icons"
+seta hud_shownames_aspect 8 "aspect ratio"
+seta hud_shownames_fontsize 8 "aspect ratio"
// scoreboard
seta scoreboard_columns default
float autocvar_hud_shownames_status;
float autocvar_hud_shownames_height;
float autocvar_hud_shownames_aspect;
+float autocvar_hud_shownames_fontsize;
string autocvar_hud_skin;
float autocvar_loddebug;
float autocvar_menu_mouse_speed;
myPos = o - '0.5 0 0' * mySize_x - '0 1 0' * mySize_y;
vector iconpos, iconsize;
- vector namepos, namesize;
+ vector namepos;
+ float namesize;
iconpos = myPos;
}
}
- namepos = myPos + eX * 2 * iconsize_y;
- namesize = eX * mySize_x - eX * 2 * iconsize_y + eY * mySize_y;
+ namepos = myPos + eX * 2 * iconsize_y + eY * 0.5 * (autocvar_hud_shownames_height - autocvar_hud_shownames_fontsize);
+ namesize = mySize_x - 2 * iconsize_y;
- drawcolorcodedstring_aspect(namepos, GetPlayerName(self.the_entnum-1), namesize, a, DRAWFLAG_NORMAL);
+ string s;
+ s = GetPlayerName(self.the_entnum-1);
+ s = textShortenToWidth(s, namesize, '1 1 0' * autocvar_hud_shownames_fontsize, stringwidth_colors);
+ drawcolorcodedstring(namepos, s, '1 1 0' * autocvar_hud_shownames_fontsize, a, DRAWFLAG_NORMAL);
/* Or maybe a health bar instead?
*
return TRUE;
}
+const vector SHOWNAMES_ORIGIN_OFFSET = '0 0 48';
void shownames_think()
{
- if(self.origin != self.owner.origin)
+ if(self.origin - SHOWNAMES_ORIGIN_OFFSET != self.owner.origin)
{
- setorigin(self, self.owner.origin);
+ setorigin(self, self.owner.origin + SHOWNAMES_ORIGIN_OFFSET);
self.SendFlags |= 1;
}
if(self.health != floor(self.owner.health) || self.armorvalue != floor(self.owner.armorvalue))