#include "score.qh" #include #include #include // Score (#7) void HUD_UpdatePlayerTeams(); void HUD_Score_Rankings(vector pos, vector mySize, entity me) { float score; entity tm = world, pl; int SCOREPANEL_MAX_ENTRIES = 6; float SCOREPANEL_ASPECTRATIO = 2; int entries = bound(1, floor(SCOREPANEL_MAX_ENTRIES * mySize.y/mySize.x * SCOREPANEL_ASPECTRATIO), SCOREPANEL_MAX_ENTRIES); vector fontsize = '1 1 0' * (mySize.y/entries); vector rgb, score_color; rgb = '1 1 1'; score_color = '1 1 1'; float name_size = mySize.x*0.75; float spacing_size = mySize.x*0.04; const float highlight_alpha = 0.2; int i = 0, first_pl = 0; bool me_printed = false; string s; if (autocvar__hud_configure) { float players_per_team = 0; if (team_count) { // show team scores in the first line float score_size = mySize.x / team_count; players_per_team = max(2, ceil((entries - 1) / team_count)); for(i=0; i= 5) distribution_color = eY; else if(distribution >= 0) distribution_color = '1 1 1'; else if(distribution >= -5) distribution_color = '1 1 0'; else distribution_color = eX; string distribution_str; distribution_str = ftos(distribution); draw_beginBoldFont(); if (distribution >= 0) { if (distribution > 0) distribution_str = strcat("+", distribution_str); HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize.x + eY * mySize.y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL); drawstring_aspect(pos + eX * 0.75 * mySize.x, distribution_str, eX * 0.25 * mySize.x + eY * (1/3) * mySize.y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL); draw_endBoldFont(); } else { // teamgames float row, column, rows = 0, columns = 0; vector offset = '0 0 0'; vector score_pos, score_size; //for scores other than myteam if(autocvar_hud_panel_score_rankings) { HUD_Score_Rankings(pos, mySize, me); return; } if(spectatee_status == -1) { rows = HUD_GetRowCount(team_count, mySize, 3); columns = ceil(team_count/rows); score_size = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows); float newSize; if(score_size.x/score_size.y > 3) { newSize = 3 * score_size.y; offset.x = score_size.x - newSize; pos.x += offset.x/2; score_size.x = newSize; } else { newSize = 1/3 * score_size.x; offset.y = score_size.y - newSize; pos.y += offset.y/2; score_size.y = newSize; } } else score_size = eX * mySize.x*(1/4) + eY * mySize.y*(1/3); float max_fragcount; max_fragcount = -99; draw_beginBoldFont(); row = column = 0; for(tm = teams.sort_next; tm; tm = tm.sort_next) { if(tm.team == NUM_SPECTATOR) continue; if(!tm.team && teamplay) continue; score = tm.(teamscores[ts_primary]); if(autocvar__hud_configure) score = 123; if (score > max_fragcount) max_fragcount = score; if (spectatee_status == -1) { score_pos = pos + eX * column * (score_size.x + offset.x) + eY * row * (score_size.y + offset.y); if (max_fragcount == score) HUD_Panel_DrawHighlight(score_pos, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); drawstring_aspect(score_pos, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL); ++row; if(row >= rows) { row = 0; ++column; } } else if(tm.team == myteam) { if (max_fragcount == score) HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize.x + eY * mySize.y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL); } else { if (max_fragcount == score) HUD_Panel_DrawHighlight(pos + eX * 0.75 * mySize.x + eY * (1/3) * rows * mySize.y, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); drawstring_aspect(pos + eX * 0.75 * mySize.x + eY * (1/3) * rows * mySize.y, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL); ++rows; } } draw_endBoldFont(); } }