]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/master' into fruitiex/panelhud
authorFruitieX <fruitiex@gmail.com>
Sat, 14 May 2011 18:12:54 +0000 (21:12 +0300)
committerFruitieX <fruitiex@gmail.com>
Sat, 14 May 2011 18:12:54 +0000 (21:12 +0300)
defaultXonotic.cfg
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/shownames.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/domination.qc

index 37878c63df1cdf04e5032c570e7c04c51312aba3..803fdc0a90c3562d57752af4f16bcdf9fafdef8b 100644 (file)
@@ -1508,6 +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"
 
 // scoreboard
 seta scoreboard_columns default
index f03c2b33d0bd8f87d0a3fbe8708bd124764039db..fc7657b721a2d1190249dc2d084264b8da1c9784 100644 (file)
@@ -898,24 +898,19 @@ void Ent_ShowNames()
     // entity init, TODO can this be done only once somehow?
     self.the_entnum = ReadByte(); // TODO: fixme to only send once somehow
     self.draw2d = Draw_ShowNames;
+
     //self.movetype = MOVETYPE_FLY; // movetype needed so we can traceline?
-    self.mins = '-20 -20 -24';
-    self.maxs = '20 20 45';
+    //self.mins = '-20 -20 -24';
+    //self.maxs = '20 20 45';
     self.classname = "shownames_tag";
 
     sf = ReadByte();
 
     if(sf & 1)
-    {
-        self.origin_x = ReadShort();
-        self.origin_y = ReadShort();
-        self.origin_z = ReadShort();
-    }
-    if(sf & 2)
     {
         self.healthvalue = ReadByte();
     }
-    if(sf & 4)
+    if(sf & 2)
     {
         self.armorvalue = ReadByte();
     }
index f1ba9abfde0f30860099e4e41237845b8040e580..f582f33a3ab9fec0be98673778d3d17fd8f7f9f8 100644 (file)
@@ -903,7 +903,7 @@ void CSQC_UpdateView(float w, float h)
                                CSQC_common_hud();
 
                // crosshair goes VERY LAST
-               if(!scoreboard_active && !camera_active && intermission != 2) {
+               if(!scoreboard_active && !camera_active && intermission != 2 && spectatee_status != -1) {
                        string wcross_style;
                        float wcross_alpha, wcross_resolution;
                        wcross_style = autocvar_crosshair;
index 1e48eed9de3e68e53a636a1fcbeb3a1c277d9ec9..5324d56ab84c3e471c3d5e85746172f07eaef9bd 100644 (file)
@@ -291,6 +291,7 @@ float autocvar_hud_shownames_mindistance;
 float autocvar_hud_shownames_maxdistance;
 float autocvar_hud_shownames_antioverlap;
 float autocvar_hud_shownames_antioverlap_distance;
+float autocvar_hud_shownames_offset;
 string autocvar_hud_skin;
 float autocvar_loddebug;
 float autocvar_menu_mouse_speed;
index c224fcd7ccb386855fe0e96bc35d350bf41d5ce8..91256b9c5d566bb9d1d900368ceb53688992766e 100644 (file)
@@ -2586,9 +2586,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
 #define SCOREPANEL_MAX_ENTRIES 6
 #define SCOREPANEL_ASPECTRATIO 2
        const float entries = bound(1, floor(SCOREPANEL_MAX_ENTRIES * mySize_y/mySize_x * SCOREPANEL_ASPECTRATIO), SCOREPANEL_MAX_ENTRIES);
-       const float height = mySize_y/entries;
-       const vector fontsize = '0.9 0.9 0' * height;
-       pos_y += height * (1 - 0.9) / 2;
+       const vector fontsize = '1 1 0' * (mySize_y/entries);
 
        vector rgb, score_color;
        rgb = '1 1 1';
@@ -2602,20 +2600,19 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
        i, first_pl = 0;
        if (autocvar__hud_configure)
        {
+               float players_per_team;
                if (team_count)
                {
                        // show team scores in the first line
                        float score_size = mySize_x / team_count;
-                       for(tm = teams.sort_next; tm; tm = tm.sort_next) {
-                               if(tm.team == COLOR_SPECTATOR)
-                                       continue;
-                               if (tm.team == myteam)
-                                       HUD_Panel_DrawHighlight(pos - eY * (height * (1 - 0.9) / 2) + eX * score_size * i, eX * score_size + eY * height, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-                               drawstring_aspect(pos + eX * score_size * i, ftos(123), eX * score_size + eY * fontsize_y, GetTeamRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
-                               ++i;
+                       players_per_team = max(2, ceil((entries - 1) / team_count));
+                       for(i=0; i<team_count; ++i) {
+                               if (i == floor((entries - 2) / players_per_team) || (entries == 1 && i == 0))
+                                       HUD_Panel_DrawHighlight(pos + eX * score_size * i, eX * score_size + eY * fontsize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawstring_aspect(pos + eX * score_size * i, ftos(175 - 23*i), eX * score_size + eY * fontsize_y, GetTeamRGB(ColorByTeam(i)) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
                        first_pl = 1;
-                       pos_y += height;
+                       pos_y += fontsize_y;
                }
                score = 10 + SCOREPANEL_MAX_ENTRIES * 3;
                for (i=first_pl; i<entries; ++i)
@@ -2626,7 +2623,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
                        if (i == entries-1 && autocvar_hud_panel_score_rankings == 1)
                        {
                                rgb = '1 1 0';
-                               drawfill(pos - eY * (height * (1 - 0.9) / 2), eX * mySize_x + eY * height, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawfill(pos, eX * mySize_x + eY * fontsize_y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                                s = GetPlayerName(pl.sv_entnum);
                                score = 7;
                        }
@@ -2637,11 +2634,11 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
                        }
 
                        if (team_count)
-                               score_color = GetTeamRGB(ColorByTeam(mod(i + 2, team_count))) * 0.8;
+                               score_color = GetTeamRGB(ColorByTeam(floor((i - first_pl) / players_per_team))) * 0.8;
                        s = textShortenToWidth(s, name_size, fontsize, stringwidth_colors);
                        drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, TRUE, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
                        drawstring(pos + eX * (name_size + spacing_size), ftos(score), fontsize, score_color, panel_fg_alpha, DRAWFLAG_NORMAL);
-                       pos_y += height;
+                       pos_y += fontsize_y;
                }
                return;
        }
@@ -2656,17 +2653,20 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
                        if(tm.team == COLOR_SPECTATOR)
                                continue;
                        if (tm.team == myteam)
-                               drawfill(pos - eY * (height * (1 - 0.9) / 2) + eX * score_size * i, eX * score_size + eY * height, '1 1 1', highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawfill(pos + eX * score_size * i, eX * score_size + eY * fontsize_y, '1 1 1', highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        drawstring_aspect(pos + eX * score_size * i, ftos(tm.(teamscores[ts_primary])), eX * score_size + eY * fontsize_y, GetTeamRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
                        ++i;
                }
                first_pl = 1;
-               pos_y += height;
+               pos_y += fontsize_y;
+               tm = teams.sort_next;
        }
        i = first_pl;
-       for (pl = players.sort_next; pl && i<entries; pl = pl.sort_next, ++i)
+
+       do
+       for (pl = players.sort_next; pl && i<entries; pl = pl.sort_next)
        {
-               if (pl.team == COLOR_SPECTATOR)
+               if ((team_count && pl.team != tm.team) || pl.team == COLOR_SPECTATOR)
                        continue;
 
                if (i == entries-1 && !me_printed && pl != me)
@@ -2688,15 +2688,17 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count)
                        if (i == first_pl)
                                rgb = '0 1 0'; //first: green
                        me_printed = 1;
-                       drawfill(pos - eY * (height * (1 - 0.9) / 2), eX * mySize_x + eY * height, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawfill(pos, eX * mySize_x + eY * fontsize_y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                }
                if (team_count)
                        score_color = GetTeamRGB(pl.team) * 0.8;
                s = textShortenToWidth(GetPlayerName(pl.sv_entnum), name_size, fontsize, stringwidth_colors);
                drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, TRUE, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
                drawstring(pos + eX * (name_size + spacing_size), ftos(pl.(scores[ps_primary])), fontsize, score_color, panel_fg_alpha, DRAWFLAG_NORMAL);
-               pos_y += height;
+               pos_y += fontsize_y;
+               ++i;
        }
+       while (i<entries && team_count && (tm = tm.sort_next) && (tm.team != COLOR_SPECTATOR || (tm = tm.sort_next)));
 }
 
 void HUD_Score(void)
@@ -4136,16 +4138,14 @@ void HUD_InfoMessages(void)
        fontsize = '0.20 0.20 0' * mySize_y;
        
        float a;
-       if(spectatee_status != 0)
-               a = 1;
-       else
-               a = panel_fg_alpha;
+       a = panel_fg_alpha;
 
        string s;
        if(!autocvar__hud_configure)
        {
                if(spectatee_status && !intermission)
                {
+                       a = 1;
                        if(spectatee_status == -1)
                                s = _("^1Observing");
                        else
@@ -4560,7 +4560,18 @@ void HUD_Main (void)
                hud_fade_alpha = (1 - scoreboard_fade_alpha);
 
        if(intermission == 2) // no hud during mapvote
+       {
+               if (autocvar__hud_configure) //force exit from hud config
+               {
+                       if (menu_enabled)
+                       {
+                               menu_enabled = 0;
+                               localcmd("togglemenu\n");
+                       }
+                       cvar_set("_hud_configure", "0");
+               }
                hud_fade_alpha = 0;
+       }
        else if(autocvar__menu_alpha == 0 && scoreboard_fade_alpha == 0)
                hud_fade_alpha = 1;
 
index f69c495fb0fa493b87867469b47f4c5f826e59ba..92b071ea18cb7444a94e5a6b63edcc6ec9069865 100644 (file)
@@ -12,12 +12,15 @@ void Draw_ShowNames()
 
     if(self.sameteam || (!self.sameteam && autocvar_hud_shownames_enemies))
     {
-        InterpolateOrigin_Do();
+        string temporigin;
+        temporigin = getplayerkey(self.the_entnum-1, "TEMPHACK_origin");
+        if(temporigin == "")
+            return;
+        self.origin = stov(temporigin);
+        self.origin_z += autocvar_hud_shownames_offset;
 
         if(!self.sameteam)
         {
-            traceline(self.origin, view_origin, 1, self);
-
             /* WIP, why does trace_ent != self not work as intended here?
             if(autocvar_hud_shownames_enemies != 2) // player has to point at enemy if so
             {
@@ -26,6 +29,8 @@ void Draw_ShowNames()
                 if(trace_ent != self)
                     return;
             }*/
+
+            traceline(self.origin, view_origin, 1, self);
         }
 
         vector o, eo;
index a655b0199f6af4e21cc46f741bf761f69f0bbac9..329a0f9b822f2ae342491351abcc238fd2c53217 100644 (file)
@@ -1778,7 +1778,7 @@ void ClientConnect (void)
     self.shownames.owner = self;
     self.shownames.think = shownames_think;
     self.shownames.nextthink = time;
-       self.shownames.customizeentityforclient = shownames_customize;
+    self.shownames.customizeentityforclient = shownames_customize;
     Net_LinkEntity(self.shownames, FALSE, 0, SendEntity_ShowNames);
 }
 
index 3e507f4ab644b2bb25f1d2eced3a7a3363e4b178..7bb1d6851d4ad637ee64fef59b2a4d54df186c0a 100644 (file)
@@ -735,7 +735,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
        }
 }
 
-// sendflags use: 1 = origin, 2 = health (0 or 1 for dead/alive on enemies), 4 = armor, 0x80 = same team (includes health)
+// sendflags use: 1 = health (value is 0 or 1 for dead/alive on enemies), 2 = armor, 0x80 = same team (includes health)
 float SendEntity_ShowNames(entity to, float sendflags)
 {
     float the_health;
@@ -752,40 +752,29 @@ float SendEntity_ShowNames(entity to, float sendflags)
 
     WriteByte(MSG_ENTITY, sendflags);
     if(sendflags & 1)
-    {
-        WriteShort(MSG_ENTITY, rint(self.origin_x));
-        WriteShort(MSG_ENTITY, rint(self.origin_y));
-        WriteShort(MSG_ENTITY, rint(self.origin_z));
-    }
-    if(sendflags & 2)
     {
         WriteByte(MSG_ENTITY, the_health);
     }
-    if(sendflags & 4)
+    if(sendflags & 2)
     {
         WriteByte(MSG_ENTITY, self.armorvalue);
     }
     return TRUE;
 }
 
-const vector SHOWNAMES_ORIGIN_OFFSET = '0 0 48';
 void shownames_think()
 {
-    if(self.origin - SHOWNAMES_ORIGIN_OFFSET != self.owner.origin)
-    {
-        setorigin(self, self.owner.origin + SHOWNAMES_ORIGIN_OFFSET);
-        self.SendFlags |= 1;
-    }
+    self.origin = self.owner.origin + '0 0 1' * 48;
     if(self.health != max(0, floor(self.owner.health)) || self.armorvalue != max(0, floor(self.owner.armorvalue)))
     {
         self.health = max(0, floor(self.owner.health));
         self.armorvalue = max(0, floor(self.owner.armorvalue));
-        self.SendFlags |= 2;
+        self.SendFlags |= 1;
     }
     if(self.armorvalue != max(0, floor(self.owner.armorvalue)))
     {
         self.armorvalue = max(0, floor(self.owner.armorvalue));
-        self.SendFlags |= 4;
+        self.SendFlags |= 2;
     }
     self.nextthink = time;
 }
@@ -793,9 +782,9 @@ void shownames_think()
 float shownames_customize()
 {
     if(self.owner.classname == "player") // only send players, no spectators!
-    if(self.owner != other) // no need to spam own coordinates
+    if(self.owner != other) // no need to spam own info
     if(vlen(other.origin - self.origin) < autocvar_sv_shownames_cull_distance) // distance cull
-    if(self.owner.team == other.team || (self.owner.team != other.team && checkpvs(self.origin, other)))
+    if((teams_matter && self.owner.team == other.team) || checkpvs(self.origin, other))
         return TRUE;
 
     return FALSE;
index 281a0b4a4548df2f5583c43266be37cd6c619e36..b58c0f074fd052ba8824c007d89293247d5ea686 100644 (file)
@@ -179,7 +179,7 @@ void dompoint_captured ()
 
        self.captime = time;
 
-       FOR_EACH_PLAYER(head)
+       FOR_EACH_REALCLIENT(head)
                set_dom_state(head);
 };