float sbt_highlight_alpha;
float sbt_highlight_alpha_self;
+// provide basic panel cvars to old clients
+// TODO remove them after a future release (0.8.2+)
+string autocvar_hud_panel_scoreboard_pos = "0.150000 0.150000";
+string autocvar_hud_panel_scoreboard_size = "0.700000 0.700000";
+string autocvar_hud_panel_scoreboard_bg = "border_default";
+string autocvar_hud_panel_scoreboard_bg_color = "0 0.3 0.5";
+string autocvar_hud_panel_scoreboard_bg_color_team = "";
+string autocvar_hud_panel_scoreboard_bg_alpha = "0.7";
+string autocvar_hud_panel_scoreboard_bg_border = "";
+string autocvar_hud_panel_scoreboard_bg_padding = "";
+
float autocvar_hud_panel_scoreboard_fadeinspeed = 10;
float autocvar_hud_panel_scoreboard_fadeoutspeed = 5;
float autocvar_hud_panel_scoreboard_respawntime_decimals = 1;
-float autocvar_hud_panel_scoreboard_table_bg_alpha = 0.7;
+float autocvar_hud_panel_scoreboard_table_bg_alpha = 0;
float autocvar_hud_panel_scoreboard_table_bg_scale = 0.25;
float autocvar_hud_panel_scoreboard_table_fg_alpha = 0.9;
float autocvar_hud_panel_scoreboard_table_fg_alpha_self = 1;
bool autocvar_hud_panel_scoreboard_table_highlight = true;
float autocvar_hud_panel_scoreboard_table_highlight_alpha = 0.2;
-float autocvar_hud_panel_scoreboard_table_highlight_alpha_self = 0.5;
+float autocvar_hud_panel_scoreboard_table_highlight_alpha_self = 0.4;
float autocvar_hud_panel_scoreboard_bg_teams_color_team = 0;
bool autocvar_hud_panel_scoreboard_accuracy = true;
case "rank": return CTX(_("SCO^rank"));
case "returns": return CTX(_("SCO^returns"));
case "revivals": return CTX(_("SCO^revivals"));
+ case "rounds": return CTX(_("SCO^rounds won"));
case "score": return CTX(_("SCO^score"));
case "suicides": return CTX(_("SCO^suicides"));
case "takes": return CTX(_("SCO^takes"));
// no layout can be properly set up until score_info data haven't been received
argc = tokenizebyseparator("0 1 ping pl name | score", " ");
ps_primary = SP_SCORE;
+ ps_secondary = SP_SCORE;
scores_label(ps_primary) = strzone("score");
scores_flags(ps_primary) = SFL_ALLOW_HIDE;
}
if (sbt_highlight)
if (!(i % 2))
{
- if (i == sbt_num_fields-1)
- column_dim.x = sbt_field_size[i] + hud_fontsize.x * 0.5;
- else
- column_dim.x = sbt_field_size[i] + hud_fontsize.x;
+ column_dim.x = sbt_field_size[i] + hud_fontsize.x;
drawfill(pos - eX * hud_fontsize.x * 0.5, column_dim, '0 0 0', sbt_highlight_alpha, DRAWFLAG_NORMAL);
}
TC(bool, is_self); TC(int, pl_number);
string str;
bool is_spec = (entcs_GetTeam(pl.sv_entnum) == NUM_SPECTATOR);
- if(is_spec && !is_self)
- rgb = '0 0 0';
vector h_pos = item_pos;
vector h_size = eX * panel_size.x + eY * hud_fontsize.y * 1.25;
panel_size.y += panel_bg_padding * 2;
HUD_Panel_DrawBg(scoreboard_fade_alpha);
- vector end_pos = panel_pos + eY * (panel_size.y + panel_bg_border * 2 + hud_fontsize.y);
+ vector end_pos = panel_pos + eY * (panel_size.y + hud_fontsize.y);
+ if(panel.current_panel_bg != "0")
+ end_pos.y += panel_bg_border * 2;
if(panel_bg_padding)
{
drawstring(pos + eX * panel_bg_padding, sprintf(_("Accuracy stats (average %d%%)"), average_accuracy), hud_fontsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
pos.y += 1.25 * hud_fontsize.y;
- pos.y += panel_bg_border;
+ if(panel.current_panel_bg != "0")
+ pos.y += panel_bg_border;
panel_pos = pos;
panel_size.y = height * rows;
panel_size.y += panel_bg_padding * 2;
HUD_Panel_DrawBg(scoreboard_fade_alpha);
- vector end_pos = panel_pos + eY * (panel_size.y + panel_bg_border * 2 + hud_fontsize.y);
+ vector end_pos = panel_pos + eY * (panel_size.y + hud_fontsize.y);
+ if(panel.current_panel_bg != "0")
+ end_pos.y += panel_bg_border * 2;
if(panel_bg_padding)
{
// row highlighting
for (int i = 0; i < rows; ++i)
- drawfill(pos + eY * weapon_height + eY * height * i, eX * tmp.x + eY * fontsize, '1 1 1', sbt_highlight_alpha, DRAWFLAG_NORMAL);
+ drawfill(pos + eY * weapon_height + eY * height * i, eX * tmp.x + eY * fontsize, rgb, sbt_highlight_alpha, DRAWFLAG_NORMAL);
}
average_accuracy = 0;
// get monster stats
stat_monsters_killed = STAT(MONSTERS_KILLED);
stat_monsters_total = STAT(MONSTERS_TOTAL);
- stat_monsters_killed = 14;
- stat_monsters_total = 22;
// get secrets stats
stat_secrets_found = STAT(SECRETS_FOUND);
stat_secrets_total = STAT(SECRETS_TOTAL);
- stat_secrets_found = 5;
- stat_secrets_total = 7;
// get number of rows
if(stat_secrets_total)
// draw table header
drawstring(pos + eX * panel_bg_padding, _("Map stats:"), hud_fontsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
pos.y += 1.25 * hud_fontsize.y;
- pos.y += panel_bg_border;
+ if(panel.current_panel_bg != "0")
+ pos.y += panel_bg_border;
panel_pos = pos;
panel_size.y = hud_fontsize.y * rows;
panel_size.y += panel_bg_padding * 2;
HUD_Panel_DrawBg(scoreboard_fade_alpha);
- vector end_pos = panel_pos + eY * (panel_size.y + panel_bg_border * 2 + hud_fontsize.y);
+ vector end_pos = panel_pos + eY * (panel_size.y + hud_fontsize.y);
+ if(panel.current_panel_bg != "0")
+ end_pos.y += panel_bg_border * 2;
if(panel_bg_padding)
{
pos.y += hud_fontsize.y;
drawstring(pos + eX * panel_bg_padding, _("Rankings"), hud_fontsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
pos.y += 1.25 * hud_fontsize.y;
- pos.y += panel_bg_border;
+ if(panel.current_panel_bg != "0")
+ pos.y += panel_bg_border;
panel_pos = pos;
panel_size.y = 1.25 * hud_fontsize.y * RANKINGS_RECEIVED_CNT;
panel_size.y += panel_bg_padding * 2;
HUD_Panel_DrawBg(scoreboard_fade_alpha);
- vector end_pos = panel_pos + eY * (panel_size.y + panel_bg_border * 2 + hud_fontsize.y);
+ vector end_pos = panel_pos + eY * (panel_size.y + hud_fontsize.y);
+ if(panel.current_panel_bg != "0")
+ end_pos.y += panel_bg_border * 2;
if(panel_bg_padding)
{
{
// frametime checks allow to toggle the scoreboard even when the game is paused
if(scoreboard_active) {
- if(menu_enabled == 1)
+ if(hud_configure_menu_open == 1)
scoreboard_fade_alpha = 1;
float scoreboard_fadeinspeed = autocvar_hud_panel_scoreboard_fadeinspeed;
if (scoreboard_fadeinspeed && frametime)
HUD_Scale_Disable();
float hud_fade_alpha_save = hud_fade_alpha;
- if(menu_enabled == 1)
+ if(hud_configure_menu_open == 1)
hud_fade_alpha = 1;
else
hud_fade_alpha = scoreboard_fade_alpha * (1 - autocvar__menu_alpha);
draw_endBoldFont();
pos.y += sb_heading_fontsize.y;
- pos.y += panel_bg_border;
+ if(panel.current_panel_bg != "0")
+ pos.y += panel_bg_border;
// Draw the scoreboard
float scale = autocvar_hud_panel_scoreboard_table_bg_scale;
if(teamplay)
{
vector panel_bg_color_save = panel_bg_color;
- vector team_score_baseoffset = eY * hud_fontsize.y - eX * (panel_bg_border + hud_fontsize.x * 0.5);
+ vector team_score_baseoffset = eY * hud_fontsize.y - eX * hud_fontsize.x * 0.5;
+ if(panel.current_panel_bg != "0")
+ team_score_baseoffset.x -= panel_bg_border;
for(tm = teams.sort_next; tm; tm = tm.sort_next)
{
if(tm.team == NUM_SPECTATOR)
continue;
- if(!tm.team && teamplay)
+ if(!tm.team)
continue;
draw_beginBoldFont();
{
if(tm.team == NUM_SPECTATOR)
continue;
- if(!tm.team && teamplay)
- continue;
pos = Scoreboard_MakeTable(pos, tm, panel_bg_color, bg_size);
}
if(pl.team != NUM_SPECTATOR)
continue;
pos.y += 1.25 * hud_fontsize.y;
- Scoreboard_DrawItem(pos, panel_bg_color, pl, (pl.sv_entnum == player_localnum), specs);
+ Scoreboard_DrawItem(pos, '0 0 0', pl, (pl.sv_entnum == player_localnum), specs);
++specs;
}
{
// a negative number means we are awaiting respawn, time value is still the same
respawn_time *= -1; // remove mark now that we checked it
- respawn_time = max(time, respawn_time); // don't show a negative value while the server is respawning the player (lag)
- str = sprintf(_("^1Respawning in ^3%s^1..."),
- (autocvar_hud_panel_scoreboard_respawntime_decimals ?
- count_seconds_decs(respawn_time - time, autocvar_hud_panel_scoreboard_respawntime_decimals)
- :
- count_seconds(respawn_time - time)
- )
- );
+ if(respawn_time < time) // it happens for a few frames when server is respawning the player
+ str = ""; // draw an empty string to not change suddenly scoreboard_bottom
+ else
+ str = sprintf(_("^1Respawning in ^3%s^1..."),
+ (autocvar_hud_panel_scoreboard_respawntime_decimals ?
+ count_seconds_decs(respawn_time - time, autocvar_hud_panel_scoreboard_respawntime_decimals)
+ :
+ count_seconds(ceil(respawn_time - time))
+ )
+ );
}
else if(time < respawn_time)
{
(autocvar_hud_panel_scoreboard_respawntime_decimals ?
count_seconds_decs(respawn_time - time, autocvar_hud_panel_scoreboard_respawntime_decimals)
:
- count_seconds(respawn_time - time)
+ count_seconds(ceil(respawn_time - time))
)
);
}