#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';
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)
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;
}
}
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;
}
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)
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)
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
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;
}
}
-// 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;
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;
}
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;