From fba964fe04707b38b9ca28f304fc38d6e1889cfe Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 5 Feb 2013 11:09:39 +0100 Subject: [PATCH] Don't draw weapons panel content if it moved off the screen leaving visible only the border --- qcsrc/client/hud.qc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index abc43ce3a..b1d96028a 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -438,7 +438,7 @@ void HUD_Weapons(void) WEPSET_DECLARE_A(weapons_stat); WEPSET_COPY_AS(weapons_stat); float i, f, a, j, factor; - float screen_ar, center_x, center_y; + float screen_ar, center_x = 0, center_y; float weapon_count, weapon_id; float row, column, rows, columns; float aspect = autocvar_hud_panel_weapons_aspect; @@ -599,6 +599,8 @@ void HUD_Weapons(void) else //top panel_pos_y -= f * (panel_pos_y + panel_size_y); } + if(f == 1) + center_x = -1; // mark the panel as off screen } weaponprevtime = time - (1 - f) * timein_effect_length; } @@ -646,6 +648,10 @@ void HUD_Weapons(void) // draw the background, then change the virtual size of it to better fit other items inside HUD_Panel_DrawBg(1); + + if(center_x == -1) + return; + if(panel_bg_padding) { panel_pos += '1 1 0' * panel_bg_padding; -- 2.39.2