]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
some more tweaks, remaining issues: why does it project the names also behind the...
authorFruitieX <fruitiex@gmail.com>
Wed, 13 Apr 2011 10:58:38 +0000 (13:58 +0300)
committerFruitieX <fruitiex@gmail.com>
Wed, 13 Apr 2011 10:58:38 +0000 (13:58 +0300)
defaultXonotic.cfg
qcsrc/client/autocvars.qh
qcsrc/client/shownames.qc
qcsrc/server/cl_player.qc

index ae05e4b8de7dbb0f45ef99f9ce0214cb904f2059..e71c8c2a2546f7c0c14ef700aedd348a8f1de44d 100644 (file)
@@ -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
index 11c1ff96efa07f481bb2d760b30f561d65dd7a28..0fdea2961da9ee856fc1a2c1218a8ecf3a6f66d0 100644 (file)
@@ -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;
index d5a35c487ed2a275ad77150945bd48c440b37c61..3b88b329c3d46eed12830e46a81ce5c11ea2163d 100644 (file)
@@ -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?
          *
index 131d0a69bfab04d63c40e6c0bd80f778a0561120..85c7b0741ee456ed3ab9b7c94f11fa02682465eb 100644 (file)
@@ -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))