From: terencehill Date: Thu, 19 May 2011 17:07:27 +0000 (+0200) Subject: Merge branch 'master' into terencehill/infinite_ammo X-Git-Tag: xonotic-v0.5.0~95^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4aabbcbfcb5d689c7553db92012b7db84b867afa;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into terencehill/infinite_ammo Conflicts: qcsrc/client/hud.qc --- 4aabbcbfcb5d689c7553db92012b7db84b867afa diff --cc qcsrc/client/hud.qc index 451a996ad,91256b9c5..0707d717d --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@@ -2004,28 -1088,67 +1093,69 @@@ void HUD_Ammo(void return; } } - return; // nothing to display - } + return; // nothing to display + } + + stat_items = getstati(STAT_ITEMS); ++ if (stat_items & IT_UNLIMITED_WEAPON_AMMO) ++ infinite_ammo = TRUE; + for (i = 0; i < AMMO_COUNT; ++i) { + currently_selected = stat_items & GetAmmoItemCode(i); - DrawAmmoItem(pos + eX * column * (ammo_size_x + offset_x) + eY * row * (ammo_size_y + offset_y), ammo_size, i, currently_selected); ++ DrawAmmoItem(pos + eX * column * (ammo_size_x + offset_x) + eY * row * (ammo_size_y + offset_y), ammo_size, i, currently_selected, infinite_ammo); + ++row; + if(row >= rows) + { + row = 0; + column = column + 1; + } + } + } + + void DrawNumIcon(vector myPos, vector mySize, float x, string icon, float vertical, float icon_right_align, vector color, float alpha) + { + vector newPos, newSize; + vector picpos, numpos; + + if (vertical) + { + if(mySize_y/mySize_x > 2) + { + newSize_y = 2 * mySize_x; + newSize_x = mySize_x; + + newPos_y = myPos_y + (mySize_y - newSize_y) / 2; + newPos_x = myPos_x; + } + else + { + newSize_x = 1/2 * mySize_y; + newSize_y = mySize_y; + + newPos_x = myPos_x + (mySize_x - newSize_x) / 2; + newPos_y = myPos_y; + } - stat_items = getstati(STAT_ITEMS); - if (stat_items & IT_UNLIMITED_WEAPON_AMMO) - infinite_ammo = TRUE; - for (i = 0; i < AMMO_COUNT; ++i) { - currently_selected = stat_items & GetAmmoItemCode(i); - DrawAmmoItem(pos + eX * column * (ammo_size_x + offset_x) + eY * row * (ammo_size_y + offset_y), ammo_size, i, currently_selected, infinite_ammo); - ++row; - if(row >= rows) + if(icon_right_align) { - row = 0; - column = column + 1; + numpos = newPos; + picpos = newPos + eY * newSize_x; + } + else + { + picpos = newPos; + numpos = newPos + eY * newSize_x; } + + newSize_y /= 2; + drawpic_aspect_skin(picpos, icon, newSize, '1 1 1', panel_fg_alpha * alpha, DRAWFLAG_NORMAL); + // make number smaller than icon, it looks better + // reduce only y to draw numbers with different number of digits with the same y size + numpos_y += newSize_y * ((1 - 0.7) / 2); + newSize_y *= 0.7; + drawstring_aspect(numpos, ftos(x), newSize, color, panel_fg_alpha * alpha, DRAWFLAG_NORMAL); + return; } - } - void DrawNumIcon(float iconalign, vector myPos, vector mySize, float x, string icon, float left, vector color, float alpha) - { - vector newPos; - float newSize_x, newSize_y; if(mySize_x/mySize_y > 3) { newSize_x = 3 * mySize_y;