From a7495fa306b865b96903f7230bbe932ce7e3117b Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Mon, 10 May 2010 16:09:35 +0200 Subject: [PATCH] replace odd formula by a funny one ;) --- qcsrc/client/hud.qc | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index be5e92ba4..5e951744b 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -1040,32 +1040,11 @@ void HUD_WeaponIcons() HUD_WeaponIcons_Clear(); float rows, columns; - //TODO: yuck. there must be a better way :) - //rows = ceil(4 * mySize_y/mySize_x); - if(mySize_y/mySize_x < 0.08) - rows = 1; - else if(mySize_y/mySize_x < 0.25) - rows = 2; - else if(mySize_y/mySize_x < 0.5) - rows = 3; - else if(mySize_y/mySize_x < 0.7) - rows = 4; - else if(mySize_y/mySize_x < 0.9) - rows = 5; - else if(mySize_y/mySize_x < 1.25) - rows = 6; - else if(mySize_y/mySize_x < 1.7) - rows = 7; - else if(mySize_y/mySize_x < 2.5) - rows = 8; - else if(mySize_y/mySize_x < 4) - rows = 12; - else if(mySize_y/mySize_x < 6) - rows = 14; - else - rows = 16; + rows = mySize_y/mySize_x; + rows = bound(1, floor((sqrt(4 * (2/1) * rows * WEP_COUNT + rows * rows) + rows + 0.5) / 2), WEP_COUNT); + // ^^^ weapon icon aspect goes here - columns = ceil(16/rows); + columns = ceil(WEP_COUNT/rows); float row, column; for(i = WEP_FIRST; i <= WEP_LAST; ++i) { -- 2.39.2