From 5e7f1520415d3e3efecba41b8e3fb466b7aa3ee0 Mon Sep 17 00:00:00 2001 From: Severin Meyer Date: Mon, 22 Sep 2014 10:47:59 +0200 Subject: [PATCH] Add new cvar hud_panel_notify_icon_aspect, to choose the aspect ratio of the total drawing area per icon --- _hud_descriptions.cfg | 1 + hud_luminos.cfg | 1 + hud_luminos_minimal.cfg | 1 + hud_luminos_minimal_xhair.cfg | 1 + hud_luminos_old.cfg | 1 + hud_nexuiz.cfg | 1 + qcsrc/client/autocvars.qh | 1 + qcsrc/client/hud.qc | 11 ++++++----- qcsrc/client/hud.qh | 1 - qcsrc/client/hud_config.qc | 1 + 10 files changed, 14 insertions(+), 6 deletions(-) diff --git a/_hud_descriptions.cfg b/_hud_descriptions.cfg index 5f21867d35..c9a0861556 100644 --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@ -128,6 +128,7 @@ seta hud_panel_notify_flip "" "order the list top to bottom instead of bottom to seta hud_panel_notify_fontsize "" "multiplier for the font size used for player names in the panel" seta hud_panel_notify_fadetime "" "fade out time" seta hud_panel_notify_time "" "time that a new entry stays until it fades out" +seta hud_panel_notify_icon_aspect "" "aspect ratio of total drawing area per icon" seta hud_panel_timer "" "enable/disable this panel" seta hud_panel_timer_pos "" "position of this base of the panel" diff --git a/hud_luminos.cfg b/hud_luminos.cfg index f2b4fa4bd8..2736524c64 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -126,6 +126,7 @@ seta hud_panel_notify_flip "0" seta hud_panel_notify_fontsize "0.8" seta hud_panel_notify_time "10" seta hud_panel_notify_fadetime "3" +seta hud_panel_notify_icon_aspect "2" seta hud_panel_timer 1 seta hud_panel_timer_pos "0.800000 0.040000" diff --git a/hud_luminos_minimal.cfg b/hud_luminos_minimal.cfg index c401132ac3..fdb57a37ee 100644 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@ -126,6 +126,7 @@ seta hud_panel_notify_flip "1" seta hud_panel_notify_fontsize "0.8" seta hud_panel_notify_time "10" seta hud_panel_notify_fadetime "3" +seta hud_panel_notify_icon_aspect "2" seta hud_panel_timer 1 seta hud_panel_timer_pos "0.435000 0" diff --git a/hud_luminos_minimal_xhair.cfg b/hud_luminos_minimal_xhair.cfg index 518492ed4a..e0345f822e 100644 --- a/hud_luminos_minimal_xhair.cfg +++ b/hud_luminos_minimal_xhair.cfg @@ -126,6 +126,7 @@ seta hud_panel_notify_flip "1" seta hud_panel_notify_fontsize "0.8" seta hud_panel_notify_time "10" seta hud_panel_notify_fadetime "3" +seta hud_panel_notify_icon_aspect "2" seta hud_panel_timer 1 seta hud_panel_timer_pos "0.435000 0" diff --git a/hud_luminos_old.cfg b/hud_luminos_old.cfg index 0a5f05955e..6a94d2b3ee 100644 --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@ -126,6 +126,7 @@ seta hud_panel_notify_flip "0" seta hud_panel_notify_fontsize "0.8" seta hud_panel_notify_time "10" seta hud_panel_notify_fadetime "3" +seta hud_panel_notify_icon_aspect "2" seta hud_panel_timer 1 seta hud_panel_timer_pos "0.870000 0" diff --git a/hud_nexuiz.cfg b/hud_nexuiz.cfg index acf3ad921e..5d8ee1fb96 100644 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@ -126,6 +126,7 @@ seta hud_panel_notify_flip "0" seta hud_panel_notify_fontsize "1" seta hud_panel_notify_time "10" seta hud_panel_notify_fadetime "3" +seta hud_panel_notify_icon_aspect "2" seta hud_panel_timer 1 seta hud_panel_timer_pos "0.850000 0" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 67a0325938..678b5f49fe 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -268,6 +268,7 @@ float autocvar_hud_panel_notify_fadetime; float autocvar_hud_panel_notify_flip; float autocvar_hud_panel_notify_fontsize; float autocvar_hud_panel_notify_time; +float autocvar_hud_panel_notify_icon_aspect; float autocvar_hud_panel_physics; float autocvar_hud_panel_physics_acceleration_progressbar_mode; float autocvar_hud_panel_physics_acceleration_progressbar_scale; diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 0f43461ced..9faf594451 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -1662,18 +1662,19 @@ void HUD_Notify(void) size -= '2 2 0' * panel_bg_padding; } - float entry_count = bound(1, floor(NOTIFY_MAX_ENTRIES * size_y / size_x), NOTIFY_MAX_ENTRIES); - float entry_height = size_y / entry_count; - float fade_start = max(0, autocvar_hud_panel_notify_time); float fade_time = max(0, autocvar_hud_panel_notify_fadetime); + float icon_aspect = max(1, autocvar_hud_panel_notify_icon_aspect); + + float entry_count = bound(1, floor(NOTIFY_MAX_ENTRIES * size_y / size_x), NOTIFY_MAX_ENTRIES); + float entry_height = size_y / entry_count; float panel_width_half = size_x * 0.5; - float icon_width_half = entry_height * NOTIFY_ICON_ASPECT / 2; + float icon_width_half = entry_height * icon_aspect / 2; float name_maxwidth = panel_width_half - icon_width_half - size_x * NOTIFY_ICON_MARGIN; vector font_size = '0.5 0.5 0' * entry_height * autocvar_hud_panel_notify_fontsize; - vector icon_size = (eX * NOTIFY_ICON_ASPECT + eY) * entry_height; + vector icon_size = (eX * icon_aspect + eY) * entry_height; vector icon_left = eX * (panel_width_half - icon_width_half); vector attacker_right = eX * name_maxwidth; vector victim_left = eX * (size_x - name_maxwidth); diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index 26e9480ca9..dcaa81a871 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -338,7 +338,6 @@ HUD_Panel_GetBorder() \ } ENDS_WITH_CURLY_BRACE #define NOTIFY_MAX_ENTRIES 10 -#define NOTIFY_ICON_ASPECT 1.78 #define NOTIFY_ICON_MARGIN 0.02 float notify_index; diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index 98dbdefd18..8ecc326b1e 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -119,6 +119,7 @@ void HUD_Panel_ExportCfg(string cfgname) HUD_Write_PanelCvar_q("_fontsize"); HUD_Write_PanelCvar_q("_time"); HUD_Write_PanelCvar_q("_fadetime"); + HUD_Write_PanelCvar_q("_icon_aspect"); break; case HUD_PANEL_TIMER: HUD_Write_PanelCvar_q("_increment"); -- 2.39.2