From: terencehill Date: Wed, 15 Jul 2015 13:33:59 +0000 (+0200) Subject: Make map voting screen more compact when possible (hard size limit is now applied... X-Git-Tag: xonotic-v0.8.1~22^2~9 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c5566d7092e4719f8fb729d25cbc04055ddd1d6f;p=xonotic%2Fxonotic-data.pk3dir.git Make map voting screen more compact when possible (hard size limit is now applied to the table cell rather than to the items within the cell) Signed-off-by: terencehill --- diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index 35c250882..1350b154e 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -87,13 +87,6 @@ void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string g else alpha = 1; // Normal, full alpha - float maxheight = vid_conheight / 5; - if(maxh > maxheight) - { - pos.y += (maxh - maxheight) / 2; - maxh = maxheight; - } - // Bounding box details float rect_margin = hud_fontsize.y / 2; @@ -211,7 +204,6 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin float img_ar = 4/3; img_size.x = min(tsize, isize * img_ar); - img_size.x = min(img_size.x, vid_conwidth / 6); img_size.y = img_size.x / img_ar; img_size.y -= hud_fontsize.y - autocvar_scoreboard_border_thickness * 2; img_size.x = img_size.y * img_ar; @@ -391,6 +383,35 @@ void MapVote_Draw() dist.x = (xmax - xmin) / mv_columns; dist.y = (ymax - pos.y) / rows; + // reduce size of too wide items + tmp = vid_conwidth / 3; // max width + if(dist.x > tmp) + { + dist.x = tmp; + dist.y = min(dist.y, dist.x / item_aspect); + } + tmp = vid_conheight / 3; // max height + if(dist.y > tmp) + { + dist.y = tmp; + dist.x = min(dist.x, dist.y * item_aspect); + } + + // reduce size to fix aspect ratio + if(dist.x / dist.y > item_aspect) + dist.x = dist.y * item_aspect; + else + dist.y = dist.x / item_aspect; + + // adjust table pos and size according to the new size + float offset; + offset = ((xmax - pos.x) - dist.x * mv_columns) / 2; + xmin = pos.x += offset; + xmax -= offset; + offset = ((ymax - pos.y) - dist.y * rows) / 2; + ymin = pos.y += offset; + ymax -= offset; + tsize = dist.x; isize = dist.y;