From 1f37f0d11398001be1cce92434beb40885857c40 Mon Sep 17 00:00:00 2001 From: FruitieX Date: Wed, 13 Apr 2011 13:58:38 +0300 Subject: [PATCH] some more tweaks, remaining issues: why does it project the names also behind the player? also need to fix the customizeentityforclient (currently is disabled) --- defaultXonotic.cfg | 5 +++-- qcsrc/client/autocvars.qh | 1 + qcsrc/client/shownames.qc | 12 ++++++++---- qcsrc/server/cl_player.qc | 5 +++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index ae05e4b8d..e71c8c2a2 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1489,8 +1489,9 @@ 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 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 diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 11c1ff96e..0fdea2961 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -277,6 +277,7 @@ float autocvar_hud_shownames_enemies; 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; diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index d5a35c487..3b88b329c 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -27,7 +27,8 @@ void Draw_ShowNames() 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; @@ -55,10 +56,13 @@ void Draw_ShowNames() } } - 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? * diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 131d0a69b..85c7b0741 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -758,11 +758,12 @@ float SendEntity_ShowNames(entity to, float sendflags) 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)) -- 2.39.2