]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
bunch of updates, statusbars instead of icons
authorFruitieX <fruitiex@gmail.com>
Sat, 14 May 2011 19:33:46 +0000 (22:33 +0300)
committerFruitieX <fruitiex@gmail.com>
Sat, 14 May 2011 19:33:46 +0000 (22:33 +0300)
defaultXonotic.cfg
qcsrc/client/autocvars.qh
qcsrc/client/shownames.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc

index 803fdc0a90c3562d57752af4f16bcdf9fafdef8b..e1ebe8b7d2c9f8ebb2d57cad38ecd30cccbaf70b 100644 (file)
@@ -1496,11 +1496,11 @@ seta hud_contents_water_alpha 0.5 "alpha of the water color blend when inside it
 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"
@@ -1508,7 +1508,7 @@ seta hud_shownames_mindistance 1000 "start fading alpha/size at this distance"
 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
index 5324d56ab84c3e471c3d5e85746172f07eaef9bd..b2a1602686530db5db228200b390fb5fc1379fff 100644 (file)
@@ -281,7 +281,7 @@ float autocvar_hud_showbinds_limit;
 float autocvar_hud_shownames;
 float autocvar_hud_shownames_enemies;
 float autocvar_hud_shownames_status;
-float autocvar_hud_shownames_height;
+float autocvar_hud_shownames_statusbar_height;
 float autocvar_hud_shownames_aspect;
 float autocvar_hud_shownames_fontsize;
 float autocvar_hud_shownames_decolorize;
index 92b071ea18cb7444a94e5a6b63edcc6ec9069865..f132bfa66e1963d809fd2e227950276bc78e75ea 100644 (file)
@@ -12,11 +12,7 @@ void Draw_ShowNames()
 
     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)
@@ -97,7 +93,7 @@ void Draw_ShowNames()
             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
@@ -107,58 +103,39 @@ void Draw_ShowNames()
             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';
         }
index 329a0f9b822f2ae342491351abcc238fd2c53217..01cf67c7e09583f7edaeee3a9ae0823be2a0154f 100644 (file)
@@ -1778,7 +1778,6 @@ void ClientConnect (void)
     self.shownames.owner = self;
     self.shownames.think = shownames_think;
     self.shownames.nextthink = time;
-    self.shownames.customizeentityforclient = shownames_customize;
     Net_LinkEntity(self.shownames, FALSE, 0, SendEntity_ShowNames);
 }
 
index 7bb1d6851d4ad637ee64fef59b2a4d54df186c0a..d7e4905e475b07d4a4466e72dd19e7c46df180cf 100644 (file)
@@ -779,17 +779,6 @@ void shownames_think()
     self.nextthink = time;
 }
 
-float shownames_customize()
-{
-    if(self.owner.classname == "player") // only send players, no spectators!
-    if(self.owner != other) // no need to spam own info
-    if(vlen(other.origin - self.origin) < autocvar_sv_shownames_cull_distance) // distance cull
-    if((teams_matter && self.owner.team == other.team) || checkpvs(self.origin, other))
-        return TRUE;
-
-    return FALSE;
-}
-
 .float muted; // to be used by prvm_edictset server playernumber muted 1
 float Say(entity source, float teamsay, entity privatesay, string msgin, float floodcontrol)
 // message "": do not say, just test flood control