From: Rudolf Polzer Date: Mon, 10 May 2010 14:09:35 +0000 (+0200) Subject: replace odd formula by a funny one ;) X-Git-Tag: xonotic-v0.1.0preview~541^2~198 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a7495fa306b865b96903f7230bbe932ce7e3117b;p=xonotic%2Fxonotic-data.pk3dir.git replace odd formula by a funny one ;) --- 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) {