From db0321353ac4b3a662572c9b3e447ab2a55dab97 Mon Sep 17 00:00:00 2001 From: terencehill Date: Wed, 29 Jul 2015 17:23:21 +0200 Subject: [PATCH] Make the mapvote panel less horizontally stretched: reduce a bit available width and increase available height by resizing (if too high) / moving to the bottom the chat panel --- qcsrc/client/autocvars.qh | 1 - qcsrc/client/hud.qc | 10 +++++++++- qcsrc/client/hud.qh | 5 +++++ qcsrc/client/mapvoting.qc | 23 ++++++++++++++--------- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 90faef941..86e8f6273 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -94,7 +94,6 @@ bool autocvar_cl_unpress_zoom_on_death = 1; bool autocvar_cl_unpress_zoom_on_weapon_switch = 1; bool autocvar_cl_unpress_attack_on_weapon_switch = 1; bool autocvar_con_chat; -float autocvar_con_chatpos; bool autocvar_con_chatrect; float autocvar_con_chatsize; float autocvar_con_chattime; diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 2323ae588..c671a07d2 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -3593,7 +3593,6 @@ void HUD_PressedKeys(void) // void HUD_Chat(void) { - //if(intermission == 2) return; if(!autocvar__hud_configure) { if (!autocvar_hud_panel_chat) @@ -3615,6 +3614,15 @@ void HUD_Chat(void) HUD_Panel_UpdateCvars(); + if(intermission == 2) + { + // reserve some more space to the mapvote panel + // by resizing and moving chat panel to the bottom + panel_size.y = min(panel_size.y, vid_conheight * 0.2); + panel_pos.y = vid_conheight - panel_size.y - panel_bg_border * 2; + chat_posy = panel_pos.y; + chat_sizey = panel_size.y; + } if(autocvar__con_chat_maximized && !autocvar__hud_configure) // draw at full screen height if maximized { panel_pos.y = panel_bg_border; diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index 2c2a3fbc4..90032e395 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -113,6 +113,11 @@ string panel_bg_padding_str; class(HUDPanel) .void() panel_draw; +// chat panel can be reduced / moved while the mapvote is active +// let know the mapvote panel about chat pos and size +float chat_posy; +float chat_sizey; + float current_player; float GetPlayerColorForce(int i); diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index 0f54af489..77fd31a08 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -333,14 +333,15 @@ void MapVote_Draw() } center = (vid_conwidth - 1)/2; - xmin = vid_conwidth*0.05; // 5% border must suffice + xmin = vid_conwidth * 0.08; xmax = vid_conwidth - xmin; ymin = 20; - i = autocvar_con_chatpos; // *autocvar_con_chatsize; - if(i < 0) - ymax = vid_conheight + (i - autocvar_con_chat) * autocvar_con_chatsize; - if(i >= 0 || ymax < (vid_conheight*0.5)) - ymax = vid_conheight - ymin; + ymax = vid_conheight - ymin; + + if(chat_posy + chat_sizey / 2 < vid_conheight / 2) + ymin += chat_sizey; + else + ymax -= chat_sizey; hud_fontsize = HUD_GetFontsize("hud_fontsize"); @@ -374,14 +375,18 @@ void MapVote_Draw() pos.y += hud_fontsize.y * 1.5; pos.y += hud_fontsize.y * 0.5; + HUD_Panel_UpdateCvars(); + // base for multi-column stuff... pos.y += hud_fontsize.y; pos.x = xmin; ymin = pos.y; + float abstain_spacing = panel_bg_border + hud_fontsize.y; if(mv_abstain) + { mv_num_maps -= 1; - - HUD_Panel_UpdateCvars(); + ymax -= abstain_spacing; + } // higher than the image itself ratio for mapvote items to reserve space for long map names int item_aspect = (gametypevote) ? 3/1 : 5/3; @@ -466,7 +471,7 @@ void MapVote_Draw() if(mv_abstain && i < mv_num_maps) { tmp = mv_votes[i]; - pos.y = ymax + 2 * hud_fontsize.y; + pos.y = ymax + abstain_spacing; pos.x = (xmax+xmin)*0.5; MapVote_DrawAbstain(pos, dist.x, xmax - xmin, tmp, i); } -- 2.39.2