X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fhud%2Fpanel%2Fscoreboard.qc;h=99dbfece70e019f905a0f8d6fd02513abbff8aaa;hp=6dadc75ed0be8da95fe54346b700d4e28b36b79f;hb=54baffb62bc1c17091399dfa8c3b8ddb03ffc33b;hpb=2f8bbef379dd3b686a158b07db07ff62a4bbf7d3 diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 6dadc75ed..99dbfece7 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -80,7 +80,6 @@ float autocvar_hud_panel_scoreboard_table_highlight_alpha = 0.2; float autocvar_hud_panel_scoreboard_table_highlight_alpha_self = 0.4; float autocvar_hud_panel_scoreboard_table_highlight_alpha_eliminated = 0.6; float autocvar_hud_panel_scoreboard_bg_teams_color_team = 0; -float autocvar_hud_panel_scoreboard_namesize = 15; float autocvar_hud_panel_scoreboard_team_size_position = 0; float autocvar_hud_panel_scoreboard_spectators_position = 1; @@ -209,6 +208,11 @@ void Scoreboard_InitScores() //float lastpnum; void Scoreboard_UpdatePlayerTeams() { + static float update_time; + if (time <= update_time) + return; + update_time = time; + entity pl, tmp; //int num = 0; for(pl = players.sort_next; pl; pl = pl.sort_next) @@ -1241,9 +1245,10 @@ vector Scoreboard_AccuracyStats_Draw(vector pos, vector rgb, vector bg_size) int rows = 1; if (autocvar_hud_panel_scoreboard_accuracy_doublerows && weapon_cnt >= floor((REGISTRY_COUNT(Weapons) - nHidden - 1) * 0.5)) rows = 2; - int columnns = ceil(weapon_cnt / rows); + int columns = ceil(weapon_cnt / rows); - float weapon_height = hud_fontsize.y * 2.3; + float aspect = max(0.001, autocvar_hud_panel_weapons_aspect); + float weapon_height = hud_fontsize.y * 2.3 / aspect; float height = weapon_height + hud_fontsize.y; drawstring(pos + eX * panel_bg_padding, sprintf(_("Accuracy stats (average %d%%)"), average_accuracy), hud_fontsize, '1 1 1', panel_fg_alpha * scoreboard_acc_fade_alpha, DRAWFLAG_NORMAL); @@ -1273,7 +1278,7 @@ vector Scoreboard_AccuracyStats_Draw(vector pos, vector rgb, vector bg_size) pos = panel_pos; vector tmp = panel_size; - float weapon_width = tmp.x / columnns / rows; + float weapon_width = tmp.x / columns / rows; if (sbt_bg_alpha) drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb, sbt_bg_alpha * scoreboard_acc_fade_alpha, DRAWFLAG_NORMAL); @@ -1281,7 +1286,7 @@ vector Scoreboard_AccuracyStats_Draw(vector pos, vector rgb, vector bg_size) if(sbt_highlight) { // column highlighting - for (int i = 0; i < columnns; ++i) + for (int i = 0; i < columns; ++i) if ((i % 2) == 0) drawfill(pos + eX * weapon_width * rows * i, vec2(weapon_width * rows, height * rows), '0 0 0', sbt_highlight_alpha * scoreboard_acc_fade_alpha, DRAWFLAG_NORMAL); @@ -1326,11 +1331,8 @@ vector Scoreboard_AccuracyStats_Draw(vector pos, vector rgb, vector bg_size) weapons_with_stats += 1; average_accuracy += weapon_stats; // store sum of all accuracies in average_accuracy - string s; - s = sprintf("%d%%", weapon_stats * 100); - - float padding; - padding = (weapon_width - stringwidth(s, false, hud_fontsize)) / 2; // center the accuracy value + string s = sprintf("%d%%", weapon_stats * 100); + float padding = (weapon_width - stringwidth(s, false, hud_fontsize)) / 2; if(!autocvar_hud_panel_scoreboard_accuracy_nocolors) rgb = Accuracy_GetColor(weapon_stats); @@ -1339,7 +1341,7 @@ vector Scoreboard_AccuracyStats_Draw(vector pos, vector rgb, vector bg_size) } tmpos.x += weapon_width * rows; pos.x += weapon_width * rows; - if (rows == 2 && column == columnns - 1) { + if (rows == 2 && column == columns - 1) { tmpos.x = oldposx; tmpos.y += height; pos.y += height; @@ -1401,7 +1403,7 @@ vector Scoreboard_ItemStats_Draw(vector pos, vector rgb, vector bg_size) if (n <= 0) return pos; int rows = (autocvar_hud_panel_scoreboard_itemstats_doublerows && n >= floor(REGISTRY_COUNT(Items) / 2)) ? 2 : 1; - int columnns = max(6, ceil(n / rows)); + int columns = max(6, ceil(n / rows)); float item_height = hud_fontsize.y * 2.3; float height = item_height + hud_fontsize.y; @@ -1433,7 +1435,7 @@ vector Scoreboard_ItemStats_Draw(vector pos, vector rgb, vector bg_size) pos = panel_pos; vector tmp = panel_size; - float item_width = tmp.x / columnns / rows; + float item_width = tmp.x / columns / rows; if (sbt_bg_alpha) drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb, sbt_bg_alpha * scoreboard_itemstats_fade_alpha, DRAWFLAG_NORMAL); @@ -1441,7 +1443,7 @@ vector Scoreboard_ItemStats_Draw(vector pos, vector rgb, vector bg_size) if(sbt_highlight) { // column highlighting - for (int i = 0; i < columnns; ++i) + for (int i = 0; i < columns; ++i) if ((i % 2) == 0) drawfill(pos + eX * item_width * rows * i, vec2(item_width * rows, height * rows), '0 0 0', sbt_highlight_alpha * scoreboard_itemstats_fade_alpha, DRAWFLAG_NORMAL); @@ -1467,7 +1469,7 @@ vector Scoreboard_ItemStats_Draw(vector pos, vector rgb, vector bg_size) drawstring(tmpos + vec2(padding, item_height), s, hud_fontsize, '1 1 1', panel_fg_alpha * scoreboard_itemstats_fade_alpha, DRAWFLAG_NORMAL); tmpos.x += item_width * rows; pos.x += item_width * rows; - if (rows == 2 && column == columnns - 1) { + if (rows == 2 && column == columns - 1) { tmpos.x = oldposx; tmpos.y += height; pos.y += height; @@ -1652,7 +1654,7 @@ vector Scoreboard_Rankings_Draw(vector pos, string ranktitle, entity pl, vector str = count_ordinal(i+1); drawstring(pos + text_ofs, str, hud_fontsize, '1 1 1', sbt_fg_alpha, DRAWFLAG_NORMAL); - drawstring(pos + text_ofs + eX * ranksize, TIME_ENCODED_TOSTRING(t), hud_fontsize, '1 1 1', sbt_fg_alpha, DRAWFLAG_NORMAL); + drawstring(pos + text_ofs + eX * ranksize, TIME_ENCODED_TOSTRING(t, true), hud_fontsize, '1 1 1', sbt_fg_alpha, DRAWFLAG_NORMAL); str = ColorTranslateRGB(grecordholder[i]); if(cut) str = textShortenToWidth(str, namesize, hud_fontsize, stringwidth_colors); @@ -2107,8 +2109,7 @@ void Scoreboard_Draw() // print information about respawn status float respawn_time = STAT(RESPAWN_TIME); - if(!intermission) - if(respawn_time) + if(!intermission && respawn_time) { if(respawn_time < 0) {