From: terencehill Date: Fri, 23 Dec 2011 23:22:14 +0000 (+0100) Subject: Entry aspect ratio is now customizable in the itemstime panel for a nicer layout... X-Git-Tag: xonotic-v0.8.1~12^2~58 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=04db5714407a65399363cc44d82e721f90afa0b6;p=xonotic%2Fxonotic-data.pk3dir.git Entry aspect ratio is now customizable in the itemstime panel for a nicer layout when progressbars are enabled, see example in hud_luminos_old.cfg --- diff --git a/_hud_descriptions.cfg b/_hud_descriptions.cfg index 2f2ea597e..b48639a4d 100644 --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@ -303,4 +303,5 @@ seta hud_panel_itemstime_progressbar_name "" "name of progressbar to use behind seta hud_panel_itemstime_progressbar_xoffset "" "percentage of item width to offset progressbar with" seta hud_panel_itemstime_showspawned "0" "show icons of already spawned items" seta hud_panel_itemstime_text "" "show text/icons" +seta hud_panel_itemstime_ratio "2" "ratio between space reserved for text and icon width of each item entry (min value is 2)" diff --git a/hud_luminos.cfg b/hud_luminos.cfg index 723d77efa..c80001557 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -297,5 +297,6 @@ seta hud_panel_itemstime_progressbar_name "progressbar" seta hud_panel_itemstime_progressbar_reduced "0" seta hud_panel_itemstime_showspawned "0" seta hud_panel_itemstime_text "1" +seta hud_panel_itemstime_ratio "2" menu_sync diff --git a/hud_luminos_minimal.cfg b/hud_luminos_minimal.cfg index 802231d7b..c0c5ea871 100644 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@ -297,5 +297,6 @@ seta hud_panel_itemstime_progressbar_name "progressbar" seta hud_panel_itemstime_progressbar_reduced "0" seta hud_panel_itemstime_showspawned "0" seta hud_panel_itemstime_text "1" +seta hud_panel_itemstime_ratio "2" menu_sync diff --git a/hud_luminos_minimal_xhair.cfg b/hud_luminos_minimal_xhair.cfg index df62eb38d..17bc72cd9 100644 --- a/hud_luminos_minimal_xhair.cfg +++ b/hud_luminos_minimal_xhair.cfg @@ -297,5 +297,6 @@ seta hud_panel_itemstime_progressbar_name "progressbar" seta hud_panel_itemstime_progressbar_reduced "0" seta hud_panel_itemstime_showspawned "0" seta hud_panel_itemstime_text "1" +seta hud_panel_itemstime_ratio "2" menu_sync diff --git a/hud_luminos_old.cfg b/hud_luminos_old.cfg index 07e0147a6..4fc14af05 100644 --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@ -283,19 +283,20 @@ seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75" seta hud_panel_centerprint_fade_minfontsize "0" seta hud_panel_itemstime 1 -seta hud_panel_itemstime_pos "0.020000 0.500000" -seta hud_panel_itemstime_size "0.150000 0.120000" -seta hud_panel_itemstime_bg "" +seta hud_panel_itemstime_pos "0.020000 0.490000" +seta hud_panel_itemstime_size "0.150000 0.140000" +seta hud_panel_itemstime_bg "0" seta hud_panel_itemstime_bg_color "" seta hud_panel_itemstime_bg_color_team "" seta hud_panel_itemstime_bg_alpha "" seta hud_panel_itemstime_bg_border "" seta hud_panel_itemstime_bg_padding "" seta hud_panel_itemstime_iconalign "0" -seta hud_panel_itemstime_progressbar "0" +seta hud_panel_itemstime_progressbar "1" seta hud_panel_itemstime_progressbar_name "progressbar" -seta hud_panel_itemstime_progressbar_reduced "0" +seta hud_panel_itemstime_progressbar_reduced "1" seta hud_panel_itemstime_showspawned "0" seta hud_panel_itemstime_text "1" +seta hud_panel_itemstime_ratio "3.5" menu_sync diff --git a/hud_nexuiz.cfg b/hud_nexuiz.cfg index 5fbfb9d4e..3617db57e 100644 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@ -297,5 +297,6 @@ seta hud_panel_itemstime_progressbar_name "progressbar" seta hud_panel_itemstime_progressbar_reduced "0" seta hud_panel_itemstime_showspawned "0" seta hud_panel_itemstime_text "1" +seta hud_panel_itemstime_ratio "2" menu_sync diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index e9b088a9d..319a9d664 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -243,6 +243,7 @@ float autocvar_hud_panel_healtharmor_text; float autocvar_hud_panel_infomessages; float autocvar_hud_panel_infomessages_flip; float autocvar_hud_panel_itemstime; +float autocvar_hud_panel_itemstime_ratio; float autocvar_hud_panel_itemstime_iconalign; float autocvar_hud_panel_itemstime_progressbar; float autocvar_hud_panel_itemstime_progressbar_maxtime; diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 76daff588..7b45966cd 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -4800,7 +4800,7 @@ string GetItemsTimePicture(float i) } } -void DrawItemsTimeItem(vector myPos, vector mySize, float itemcode) +void DrawItemsTimeItem(vector myPos, vector mySize, float ar, float itemcode) { float t; vector color; @@ -4828,7 +4828,7 @@ void DrawItemsTimeItem(vector myPos, vector mySize, float itemcode) if(autocvar_hud_panel_itemstime_iconalign) { numpos = myPos; - picpos = myPos + eX * 2 * mySize_y; + picpos = myPos + eX * (ar - 1) * mySize_y; } else { @@ -4842,7 +4842,7 @@ void DrawItemsTimeItem(vector myPos, vector mySize, float itemcode) if(autocvar_hud_panel_itemstime_progressbar_reduced) { p_pos = numpos; - p_size = eX * (2/3) * mySize_x + eY * mySize_y; + p_size = eX * ((ar - 1)/ar) * mySize_x + eY * mySize_y; } else { @@ -4853,7 +4853,7 @@ void DrawItemsTimeItem(vector myPos, vector mySize, float itemcode) } if(t > 0 && autocvar_hud_panel_itemstime_text) - drawstring_aspect(numpos, ftos(t), eX * (2/3) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(numpos, ftos(t), eX * ((ar - 1)/ar) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL); drawpic_aspect_skin(picpos, GetItemsTimePicture(itemcode), '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * picalpha, DRAWFLAG_NORMAL); } @@ -4915,9 +4915,9 @@ void HUD_ItemsTime(void) } float rows, columns, row, column; - const float ASPECT_RATIO = 3; + float ar = max(2, autocvar_hud_panel_itemstime_ratio) + 1; rows = mySize_y/mySize_x; - rows = bound(1, floor((sqrt(4 * ASPECT_RATIO * rows * count + rows * rows) + rows + 0.5) / 2), count); + rows = bound(1, floor((sqrt(4 * ar * rows * count + rows * rows) + rows + 0.5) / 2), count); columns = ceil(count/rows); @@ -4926,16 +4926,16 @@ void HUD_ItemsTime(void) local noref vector offset; // fteqcc sucks float newSize; - if(itemstime_size_x/itemstime_size_y > ASPECT_RATIO) + if(itemstime_size_x/itemstime_size_y > ar) { - newSize = ASPECT_RATIO * itemstime_size_y; + newSize = ar * itemstime_size_y; offset_x = itemstime_size_x - newSize; pos_x += offset_x/2; itemstime_size_x = newSize; } else { - newSize = 1/ASPECT_RATIO * itemstime_size_x; + newSize = 1/ar * itemstime_size_x; offset_y = itemstime_size_y - newSize; pos_y += offset_y/2; itemstime_size_y = newSize; @@ -4947,7 +4947,7 @@ void HUD_ItemsTime(void) if (!autocvar_hud_panel_itemstime_showspawned) if (ItemsTime_time[i] <= time) continue; - DrawItemsTimeItem(pos + eX * column * (itemstime_size_x + offset_x) + eY * row * (itemstime_size_y + offset_y), itemstime_size, i); + DrawItemsTimeItem(pos + eX * column * (itemstime_size_x + offset_x) + eY * row * (itemstime_size_y + offset_y), itemstime_size, ar, i); ++row; if(row >= rows) { diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index c9c78d481..61cddaa1c 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -184,6 +184,7 @@ void HUD_Panel_ExportCfg(string cfgname) HUD_Write_PanelCvar_q("_progressbar_xoffset"); HUD_Write_PanelCvar_q("_showspawned"); HUD_Write_PanelCvar_q("_text"); + HUD_Write_PanelCvar_q("_ratio"); break; } HUD_Write("\n");