}
// draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
+// TODO: make a default skin, and fallback to these!
void drawpic_skin(vector pos, string pic, vector sz, vector color, float alpha, float drawflag) {
drawpic_aspect(pos, strcat("gfx/hud/", cvar_string("hud_skin"), "/", pic), sz, color, alpha, drawflag);
}
// TODO: aspect!
void drawpic_skin_expanding(vector pos, string pic, vector sz, vector rgb, float alpha, float flag, float fadelerp) {
- drawpic_expanding(pos, strcat("gfx/hud/", cvar_string("hud_skin"), "/", pic), sz, rgb, alpha, flag, fadelerp);
+ return;
+ //drawpic_aspect_expanding(pos, strcat("gfx/hud/", cvar_string("hud_skin"), "/", pic), sz, rgb, alpha, flag, fadelerp);
}
void drawpic_skin_expanding_two(vector pos, string pic, vector sz, vector rgb, float alpha, float flag, float fadelerp) {
- drawpic_expanding_two(pos, strcat("gfx/hud/", cvar_string("hud_skin"), "/", pic), sz, rgb, alpha, flag, fadelerp);
+ return;
+ //drawpic_aspect_expanding_two(pos, strcat("gfx/hud/", cvar_string("hud_skin"), "/", pic), sz, rgb, alpha, flag, fadelerp);
}
// return HUD background color
return rgb;
}
-// draw number in the XSCALE font
-void HUD_DrawXNum (vector pos, float num, float digits, float showsign, float lettersize, vector rgb, float highlighted, float stroke, float alpha, float dflags)
-{
- float l, i;
- string str, tmp, l_length;
- float minus, plus;
- vector vsize, num_color;
-
- vsize_x = vsize_y = lettersize;
- vsize_z = 0;
-
- // showsign 1: always prefix with minus sign (useful in race distribution display)
- // showsign 2: always prefix with plus sign (useful in race distribution display)
- // showsign 3: prefix with minus sign if negative, plus sign if positive (useful in score distribution display)
-
- if((showsign == 2 && num >= 0) || (num > 0 && showsign == 3))
- {
- plus = true;
- pos_x -= lettersize;
- } else
- plus = false;
-
- if(num < 0 || (num < 0 && showsign == 3) || (showsign == 1 && num <= 0))
- {
- minus = true;
- num = -num;
- pos_x -= lettersize;
- } else
- minus = false;
-
- if(digits < 0)
- {
- tmp = ftos(num);
- digits = -digits;
- str = strcat(substring("0000000000", 0, digits - strlen(tmp)), tmp);
- } else
- str = ftos(num);
-
- l = strlen(str);
- l_length = ftos(l);
-
- if(l > digits)
- {
- str = substring(str, l-digits, 999);
- l = strlen(str);
- } else if(l < digits)
- pos_x += (digits-l) * lettersize;
-
- if (highlighted == 1) {
- vector hl_size;
- hl_size_x = vsize_x * l + vsize_x * 0.2;
- hl_size_y = vsize_y * 1.1;
- hl_size_z = 0;
- if(minus)
- hl_size_x = hl_size_x + vsize_x;
-
- vector hl_pos;
- hl_pos_x = pos_x - lettersize/10;
- hl_pos_y = pos_y - lettersize/20;
- hl_pos_z = 0;
-
- drawpic_skin(hl_pos, strcat("num_leading_", l_length), hl_size, '1 1 1', alpha, dflags);
- }
-
- if (stroke == 1)
- num_color = '1 1 1';
- else
- num_color = rgb;
-
- if(minus)
- {
- if (stroke == 1)
- drawpic_skin(pos, "num_minus_stroke", vsize, rgb, alpha, dflags);
- drawpic_skin(pos, "num_minus", vsize, num_color, alpha, dflags);
- pos_x += lettersize;
- } else if(plus)
- {
- if (stroke == 1)
- drawpic_skin(pos, "num_plus_stroke", vsize, rgb, alpha, dflags);
- drawpic_skin(pos, "num_plus", vsize, num_color, alpha, dflags);
- pos_x += lettersize;
- }
-
- for(i = 0; i < l; ++i)
- {
- tmp = substring(str, i, 1);
- if (stroke == 1)
- drawpic_skin(pos, strcat("num_", tmp, "_stroke"), vsize, rgb, alpha, dflags);
- drawpic_skin(pos, strcat("num_", tmp), vsize, num_color, alpha, dflags);
- pos_x += lettersize;
- }
-}
-
vector HUD_Get_Num_Color (float x, float maxvalue)
{
vector color;
}
return color;
}
-// color the number differently based on how big it is (used in the health/armor panel)
-void HUD_DrawXNum_Colored (vector pos, float x, float digits, float lettersize, float alpha)
-{
- vector color;
- color = HUD_Get_Num_Color (x, 200);
- HUD_DrawXNum(pos, x, digits, 0, lettersize, color, 0, 0, alpha, DRAWFLAG_NORMAL);
-}
float stringwidth_colors(string s, vector theSize)
{
void HUD_Panel_DrawProgressBar(vector pos, float vertical, vector mySize, vector color, float alpha, float drawflag)
{
-//float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #328;
+ if(!alpha)
+ return;
+
string pic;
pic = strcat("gfx/hud/", cvar_string("hud_skin"), "/");
if(vertical) {
if(cvar_or("hud_weaponicons_number", 1))
drawstring(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), ftos(weapid), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
+ // draw a "ghost weapon icon" if you don't have the weapon
else
{
drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), strcat("weapon", self.netname), eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '0 0 0', HUD_Panel_GetFgAlpha(id) * 0.5, DRAWFLAG_NORMAL);
}
}
+void DrawAmmoItem(vector myPos, vector mySize, float itemcode, float currently_selected)
+{
+ float a;
+ a = getstati(GetAmmoStat(itemcode)); // how much ammo do we have of type itemcode?
+ if(hud_configure)
+ a = 100;
+
+ vector color;
+ if(a < 10)
+ color = '0.7 0 0';
+ else
+ color = '1 1 1';
+
+ float alpha;
+ if(currently_selected)
+ alpha = 1;
+ else
+ alpha = 0.7;
+
+ vector newSize, newPos;
+ if(mySize_x/mySize_y > 3)
+ {
+ newSize_x = 3 * mySize_y;
+ newSize_y = mySize_y;
+
+ newPos_x = myPos_x + (mySize_x - newSize_x) / 2;
+ newPos_y = myPos_y;
+ }
+ else
+ {
+ newSize_y = 1/3 * mySize_x;
+ newSize_x = mySize_x;
+
+ newPos_y = myPos_y + (mySize_y - newSize_y) / 2;
+ newPos_x = myPos_x;
+ }
+
+ vector picpos, numpos;
+ if(cvar("hud_inventory_iconalign"))
+ {
+ numpos = newPos;
+ picpos = newPos + eX * 2 * newSize_y;
+ }
+ else
+ {
+ numpos = newPos + eX * newSize_y;
+ picpos = newPos;
+ }
+
+ if (currently_selected)
+ drawpic_skin(newPos, "ammo_current_bg", newSize, '1 1 1', HUD_Panel_GetFgAlpha(HUD_PANEL_INVENTORY), DRAWFLAG_NORMAL);
+
+ drawstring_aspect(numpos, ftos(a), eX * (2/3) * newSize_x + eY * newSize_y, newSize_y, color, HUD_Panel_GetFgAlpha(HUD_PANEL_INVENTORY) * alpha, DRAWFLAG_NORMAL);
+ drawpic_skin(picpos, GetAmmoPicture(itemcode), '1 1 0' * newSize_y, '1 1 1', HUD_Panel_GetFgAlpha(HUD_PANEL_INVENTORY) * alpha, DRAWFLAG_NORMAL);
+}
+
void HUD_Inventory(void)
{
float id = HUD_PANEL_INVENTORY;
- float i;
- float stat_items;
+ float i, currently_selected;
- vector pos, mySize, mysize, mypos;
+ vector pos, mySize;
pos = HUD_Panel_GetPos(id);
mySize = HUD_Panel_GetSize(id);
mySize -= '2 2 0' * padding;
}
- // ammo
- stat_items = getstati(STAT_ITEMS);
- for (i = 0; i < 4; ++i) {
- float a;
- a = getstati(GetAmmoStat(i)); // how much ammo do we have of type i?
- if(hud_configure)
- a = 100;
+ float rows, columns;
+ rows = mySize_y/mySize_x;
+ rows = bound(1, floor((sqrt(4 * (3/1) * rows * AMMO_COUNT + rows * rows) + rows + 0.5) / 2), AMMO_COUNT);
+ // ^^^ ammo item aspect goes here
+
+ columns = ceil(AMMO_COUNT/rows);
+ float row, column;
+ // ammo
+ for (i = 0; i < AMMO_COUNT; ++i) {
+ currently_selected = getstati(STAT_ITEMS) & GetAmmoItemCode(i);
if(cvar("hud_inventory_onlycurrent")) {
if(hud_configure)
i = 2;
- if (stat_items & GetAmmoItemCode(i) || hud_configure) {
- drawpic_skin(pos, GetAmmoPicture(i), '1 1 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- if(a < 10)
- HUD_DrawXNum(pos + eX * mySize_y + eY * 0.25 * mySize_y, a, strlen(ftos(a)), 0, 0.5 * mySize_y, '0.7 0 0', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- else
- HUD_DrawXNum(pos + eX * mySize_y + eY * 0.25 * mySize_y, a, strlen(ftos(a)), 0, 0.5 * mySize_y, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- }
- if(hud_configure)
- break;
+ if (currently_selected || hud_configure)
+ DrawAmmoItem(pos, mySize, i, currently_selected);
+ break;
} else {
- if (a > 0) {
- if(mySize_x/mySize_y >= 10) { // arrange horizontally
- switch (i) {
- case 0: mypos_x = pos_x; mypos_y = pos_y; break; // shells
- case 1: mypos_x = pos_x + 0.25 * mySize_x; mypos_y = pos_y; break; // bullets
- case 2: mypos_x = pos_x + 0.5 * mySize_x; mypos_y = pos_y; break; // rockets
- case 3: mypos_x = pos_x + 0.75 * mySize_x; mypos_y = pos_y; break; // cells
- }
- mysize_x = 0.25 * mySize_x;
- mysize_y = mySize_y;
- } else if(mySize_x/mySize_y >= 2.5) { // arrange in a 2x2 grid
- switch (i) {
- case 0: mypos_x = pos_x + 0.5 * mySize_x; mypos_y = pos_y + 0.5 * mySize_y; break; // shells
- case 1: mypos_x = pos_x + 0.5 * mySize_x; mypos_y = pos_y; break; // bullets
- case 2: mypos_x = pos_x; mypos_y = pos_y + 0.5 * mySize_y; break; // rockets
- case 3: mypos_x = pos_x; mypos_y = pos_y; break; // cells
- }
- mysize_x = 0.5 * mySize_x;
- mysize_y = 0.5 * mySize_y;
- } else { // arrange vertically
- switch (i) {
- case 0: mypos_x = pos_x; mypos_y = pos_y; break; // shells
- case 1: mypos_x = pos_x; mypos_y = pos_y + 0.25 * mySize_y; break; // bullets
- case 2: mypos_x = pos_x; mypos_y = pos_y + 0.5 * mySize_y; break; // rockets
- case 3: mypos_x = pos_x; mypos_y = pos_y + 0.75 * mySize_y; break; // cells
- }
- mysize_x = mySize_x;
- mysize_y = 0.25 * mySize_y;
- }
-
- if (stat_items & GetAmmoItemCode(i))
- drawpic_skin(mypos, "ammo_current_bg", mysize, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- drawpic_skin(mypos + eY * 0.05 * mysize_y, GetAmmoPicture(i), '1 1 0' * 0.8 * mysize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- if (a < 10) {
- if(stat_items & GetAmmoItemCode(i))
- HUD_DrawXNum(mypos + eX * 0.8 * mysize_y + eY * 0.25 * mysize_y, a, strlen(ftos(a)), 0, 0.5 * mysize_y, '0.7 0 0', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- else
- HUD_DrawXNum(mypos + eX * 0.8 * mysize_y + eY * 0.25 * mysize_y, a, strlen(ftos(a)), 0, 0.5 * mysize_y, '0.7 0 0', 0, 0, HUD_Panel_GetFgAlpha(id) * 0.7, DRAWFLAG_NORMAL);
- } else {
- if(stat_items & GetAmmoItemCode(i))
- HUD_DrawXNum(mypos + eX * 0.8 * mysize_y + eY * 0.25 * mysize_y, a, strlen(ftos(a)), 0, 0.5 * mysize_y, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- else
- HUD_DrawXNum(mypos + eX * 0.8 * mysize_y + eY * 0.25 * mysize_y, a, strlen(ftos(a)), 0, 0.5 * mysize_y, '0.7 0.7 0.7', 0, 0, HUD_Panel_GetFgAlpha(id) * 0.7, DRAWFLAG_NORMAL);
- }
+ DrawAmmoItem(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), i, currently_selected);
+ ++row;
+ if(row >= rows)
+ {
+ row = 0;
+ column = column + 1;
}
}
}
}
-
// Powerups (#2)
//
void HUD_Powerups(void) {
shield_time = 27;
}
- float len;
-
vector barpos, barsize;
vector picpos;
vector numpos;
leftalpha = bound(0, leftexact, 1);
rightalpha = bound(0, rightexact, 1);
+ float baralign, iconalign;
+ baralign = cvar(strcat("hud_", HUD_Panel_GetName(id), "_baralign"));
+ iconalign = cvar(strcat("hud_", HUD_Panel_GetName(id), "_iconalign"));
+
if (mySize_x/mySize_y > 4)
{
if(leftcnt)
{
- len = strlen(ftos(leftcnt));
-
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+ if(baralign == 1 || baralign == 3) { // right align
barpos = pos + eX * 0.5 * mySize_x - eX * 0.5 * mySize_x * min(1, leftcnt/30);
barsize = eX * 0.5 * mySize_x * min(1, leftcnt/30) + eY * mySize_y;
- picpos = pos + eX * 0.5 * mySize_x - eX * mySize_y;
- numpos = picpos - eX * 2 * 0.5 * mySize_y + eX * (2-len) * 0.5 * mySize_y + eY * 0.25 * mySize_y;
- } else {
+ } else { // left align
barpos = pos;
barsize = eX * 0.5 * mySize_x * min(1, leftcnt/30) + eY * mySize_y;
+ }
+
+ if(iconalign == 1 || iconalign == 3) { // right align
+ picpos = pos + eX * (2/6) * mySize_x;
+ numpos = pos;
+ } else { // left align
picpos = pos;
- numpos = picpos + eX * mySize_y - eX * (2-len) * 0.5 * mySize_y + eY * 0.25 * mySize_y;
+ numpos = pos + eX * (1/6) * mySize_x;
}
HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
if(leftcnt <= 5)
drawpic_skin_expanding_two(picpos, leftname, '1 1 0' * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE, bound(0, (leftcnt - leftexact) / 0.5, 1));
else
- drawpic_skin(picpos, leftname, '1 1 0' * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum(numpos, leftcnt, 2, 0, 0.5 * mySize_y, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawpic_skin(picpos, leftname, eX * (1/6) * mySize_x + eY * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(leftcnt), eX * (2/6) * mySize_x + eY * mySize_y, mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
if(rightcnt)
{
- len = strlen(ftos(rightcnt));
-
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+ if(baralign == 0 || baralign == 3) { // left align
barpos = pos + eX * 0.5 * mySize_x;
barsize = eX * 0.5 * mySize_x * min(1, rightcnt/30) + eY * mySize_y;
- picpos = pos + eX * 0.5 * mySize_x;
- numpos = picpos + eX * mySize_y - eX * (2-len) * 0.5 * mySize_y + eY * 0.25 * mySize_y;
- } else {
+ } else { // right align
barpos = pos + eX * mySize_x - eX * 0.5 * mySize_x * min(1, rightcnt/30);
barsize = eX * 0.5 * mySize_x * min(1, rightcnt/30) + eY * mySize_y;
- picpos = pos + eX * mySize_x - eX * mySize_y;
- numpos = picpos - eX * mySize_y + eY * 0.25 * mySize_y;
+ }
+
+ if(iconalign == 0 || iconalign == 3) { // left align
+ picpos = pos + eX * (3/6) * mySize_x;
+ numpos = pos + eX * (4/6) * mySize_x;
+ } else { // right align
+ picpos = pos + eX * (5/6) * mySize_x;
+ numpos = pos + eX * (3/6) * mySize_x;
}
HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
if(rightcnt <= 5)
drawpic_skin_expanding_two(picpos, rightname, '1 1 0' * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE, bound(0, (rightcnt - rightexact) / 0.5, 1));
else
- drawpic_skin(picpos, rightname, '1 1 0' * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum(numpos, rightcnt, 2, 0, 0.5 * mySize_y, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawpic_skin(picpos, rightname, eX * (1/6) * mySize_x + eY * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(rightcnt), eX * (2/6) * mySize_x + eY * mySize_y, mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
}
else if (mySize_x/mySize_y > 1.5)
{
if(leftcnt)
{
- len = strlen(ftos(leftcnt));
-
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+ if(baralign == 1 || baralign == 3) { // right align
barpos = pos + eX * mySize_x - eX * mySize_x * min(1, leftcnt/30);
barsize = eX * mySize_x * min(1, leftcnt/30) + eY * 0.5 * mySize_y;
- picpos = pos + eX * mySize_x - eX * 0.5 * mySize_y;
- numpos = picpos - eX * len * 0.5 * mySize_y;
- } else {
+ } else { // left align
barpos = pos;
barsize = eX * mySize_x * min(1, leftcnt/30) + eY * 0.5 * mySize_y;
+ }
+
+ if(iconalign == 1 || iconalign == 3) { // right align
+ picpos = pos + eX * (2/3) * mySize_x;
+ numpos = pos;
+ } else { // left align
picpos = pos;
- numpos = picpos + eX * 0.5 * mySize_y;
+ numpos = pos + eX * (1/3) * mySize_x;
}
HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
if(leftcnt <= 5)
drawpic_skin_expanding_two(picpos, leftname, '0.5 0.5 0' * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE, bound(0, (leftcnt - leftexact) / 0.5, 1));
else
- drawpic_skin(picpos, leftname, '0.5 0.5 0' * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum(numpos, leftcnt, len, 0, 0.5 * mySize_y, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawpic_skin(picpos, leftname, eX * (1/3) * mySize_x + eY * 0.5 * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(leftcnt), eX * (2/3) * mySize_x + eY * 0.5 * mySize_y, mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
if(rightcnt)
{
- len = strlen(ftos(rightcnt));
-
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
- barpos = pos + eX * mySize_x - eX * mySize_x * min(1, rightcnt/30) + eY * 0.5 * mySize_y;
- barsize = eX * mySize_x * min(1, rightcnt/30) + eY * 0.5 * mySize_y;
- picpos = pos + eX * mySize_x - eX * 0.5 * mySize_y + eY * 0.5 * mySize_y;
- numpos = picpos - eX * len * 0.5 * mySize_y;
- } else {
+ if(baralign == 0 || baralign == 3) { // left align
barpos = pos + eY * 0.5 * mySize_y;
barsize = eX * mySize_x * min(1, rightcnt/30) + eY * 0.5 * mySize_y;
+ } else { // right align
+ barpos = pos + eX * mySize_x - eX * mySize_x * min(1, rightcnt/30) + eY * 0.5 * mySize_y;
+ barsize = eX * mySize_x * min(1, rightcnt/30) + eY * 0.5 * mySize_y;
+ }
+
+ if(iconalign == 0 || iconalign == 3) { // left align
picpos = pos + eY * 0.5 * mySize_y;
- numpos = picpos + eX * 0.5 * mySize_y;
+ numpos = pos + eX * (1/3) * mySize_x + eY * 0.5 * mySize_y;
+ } else { // right align
+ picpos = pos + eX * (2/3) * mySize_x + eY * 0.5 * mySize_y;
+ numpos = pos + eY * 0.5 * mySize_y;
}
HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
if(rightcnt <= 5)
drawpic_skin_expanding_two(picpos, rightname, '0.5 0.5 0' * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE, bound(0, (rightcnt - rightexact) / 0.5, 1));
else
- drawpic_skin(picpos, rightname, '0.5 0.5 0' * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum(numpos, rightcnt, len, 0, 0.5 * mySize_y, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawpic_skin(picpos, rightname, eX * (1/3) * mySize_x + eY * 0.5 * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(rightcnt), eX * (2/3) * mySize_x + eY * 0.5 * mySize_y, mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
}
else
{
if(leftcnt)
{
- len = strlen(ftos(leftcnt));
-
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+ if(baralign == 1 || baralign == 3) { // down align
+ barpos = pos + eY * mySize_y - eY * mySize_y * min(1, leftcnt/30);
+ barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/30);
+ } else { // up align
barpos = pos;
barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/30);
+ }
+
+ if(iconalign == 1 || iconalign == 3) { // down align
+ picpos = pos + eX * 0.05 * mySize_x + eY * (mySize_y - 0.65 * mySize_x);
+ numpos = pos + eY * mySize_y - eY * 0.25 * mySize_x;
+ } else { // up align
picpos = pos + eX * 0.05 * mySize_x;
- numpos = pos + eX * ((2-len)/2) * 0.25 * mySize_x + eY * 0.4 * mySize_x;
- } else {
- barpos = pos + eY * mySize_y - eY * mySize_y * min(1, leftcnt/30);
- barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/30);
- picpos = pos + eX * 0.05 * mySize_x + eY * mySize_y - eY * 0.65 * mySize_x;
- numpos = pos + eX * ((2-len)/2) * 0.25 * mySize_x + eY * mySize_y - eY * 0.25 * mySize_x;
+ numpos = pos + eY * 0.4 * mySize_x;
}
HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
drawpic_skin_expanding_two(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE, bound(0, (leftcnt - leftexact) / 0.5, 1));
else
drawpic_skin(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum(numpos, leftcnt, len, 0, 0.25 * mySize_x, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(leftcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, 0.25 * mySize_x, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
if(rightcnt)
{
- len = strlen(ftos(rightcnt));
-
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+ if(baralign == 0 || baralign == 3) { // up align
barpos = pos + eX * 0.5 * mySize_x;
barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/30);
- picpos = pos + eX * 0.05 * mySize_x + eX * 0.5 * mySize_x;
- numpos = pos + eX * ((2-len)/2) * 0.25 * mySize_x + eY * 0.4 * mySize_x + eX * 0.5 * mySize_x;
- } else {
+ } else { // down align
barpos = pos + eY * mySize_y - eY * mySize_y * min(1, rightcnt/30) + eX * 0.5 * mySize_x;
barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/30);
- picpos = pos + eX * 0.05 * mySize_x + eY * mySize_y - eY * 0.65 * mySize_x + eX * 0.5 * mySize_x;
- numpos = pos + eX * ((2-len)/2) * 0.25 * mySize_x + eY * mySize_y - eY * 0.25 * mySize_x + eX * 0.5 * mySize_x;
+ }
+
+ if(iconalign == 0 || iconalign == 3) { // up align
+ picpos = pos + eX * 0.05 * mySize_x + eX * 0.5 * mySize_x;
+ numpos = pos + eY * 0.4 * mySize_x + eX * 0.5 * mySize_x;
+ } else { // down align
+ picpos = pos + eX * 0.05 * mySize_x + eY * (mySize_y - 0.65 * mySize_x) + eX * 0.5 * mySize_x;
+ numpos = pos + eY * mySize_y - eY * 0.25 * mySize_x + eX * 0.5 * mySize_x;
}
HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
drawpic_skin_expanding_two(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE, bound(0, (rightcnt - rightexact) / 0.5, 1));
else
drawpic_skin(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum(numpos, rightcnt, len, 0, 0.25 * mySize_x, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(rightcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, 0.25 * mySize_x, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
}
}
if(health <= 0)
return;
- float len;
vector barpos, barsize;
vector picpos;
vector numpos;
if(armor)
drawpic_skin(picpos, "armor", '1 1 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
- HUD_DrawXNum_Colored(numpos, x, 3, mySize_y, HUD_Panel_GetFgAlpha(id)); // draw the combined health and armor
+ //HUD_DrawXNum_Colored(numpos, x, 3, mySize_y, HUD_Panel_GetFgAlpha(id)); // draw the combined health and armor
// fuel
if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
if(fuel)
HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("fuel"), HUD_Panel_GetFgAlpha(id) * 0.8, DRAWFLAG_NORMAL);
}
-
else
{
string leftname, rightname;
rightalpha = min((armor+10)/55, 1);
}
+ float baralign, iconalign;
+ baralign = cvar(strcat("hud_", HUD_Panel_GetName(id), "_baralign"));
+ iconalign = cvar(strcat("hud_", HUD_Panel_GetName(id), "_iconalign"));
+
if (mySize_x/mySize_y > 5)
{
if(leftactive)
{
- len = strlen(ftos(leftcnt));
-
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+ if(baralign == 1 || baralign == 3) { // right align
barpos = pos + eX * 0.5 * mySize_x - eX * 0.5 * mySize_x * min(1, leftcnt/200);
barsize = eX * 0.5 * mySize_x * min(1, leftcnt/200) + eY * mySize_y;
- picpos = pos + eX * 0.5 * mySize_x - eX * mySize_y;
- numpos = picpos - eX * 3 * 0.5 * mySize_y + eX * (3-len) * 0.5 * mySize_y + eY * 0.25 * mySize_y;
- } else {
+ } else { // left align
barpos = pos;
barsize = eX * 0.5 * mySize_x * min(1, leftcnt/200) + eY * mySize_y;
+ }
+
+ if(iconalign == 1 || iconalign == 3) { // right align
+ picpos = pos + eX * (2/6) * mySize_x;
+ numpos = pos;
+ } else { // left align
picpos = pos;
- numpos = picpos + eX * mySize_y + eY * 0.25 * mySize_y;
+ numpos = pos + eX * (1/6) * mySize_x;
}
HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- drawpic_skin(picpos, leftname, '1 1 0' * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum_Colored(numpos, leftcnt, len, 0.5 * mySize_y, HUD_Panel_GetFgAlpha(id));
+ drawpic_skin(picpos, leftname, eX * (1/6) * mySize_x + eY * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(leftcnt), eX * (2/6) * mySize_x + eY * mySize_y, mySize_y, HUD_Get_Num_Color(leftcnt, 200), HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
if(rightactive)
{
- len = strlen(ftos(rightcnt));
-
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+ if(baralign == 0 || baralign == 3) { // left align
barpos = pos + eX * 0.5 * mySize_x;
barsize = eX * 0.5 * mySize_x * min(1, rightcnt/200) + eY * mySize_y;
- picpos = pos + eX * 0.5 * mySize_x;
- numpos = picpos + eX * mySize_y - eX * (3-len) * 0.5 * mySize_y + eY * 0.25 * mySize_y;
- } else {
+ } else { // right align
barpos = pos + eX * mySize_x - eX * 0.5 * mySize_x * min(1, rightcnt/200);
barsize = eX * 0.5 * mySize_x * min(1, rightcnt/200) + eY * mySize_y;
- picpos = pos + eX * mySize_x - eX * mySize_y;
- numpos = picpos - eX * 1.5 * mySize_y + eY * 0.25 * mySize_y;
+ }
+
+ if(iconalign == 0 || iconalign == 3) { // left align
+ picpos = pos + eX * (3/6) * mySize_x;
+ numpos = pos + eX * (4/6) * mySize_x;
+ } else { // right align
+ picpos = pos + eX * (5/6) * mySize_x;
+ numpos = pos + eX * (3/6) * mySize_x;
}
HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- drawpic_skin(picpos, rightname, '1 1 0' * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum_Colored(numpos, rightcnt, 3, 0.5 * mySize_y, HUD_Panel_GetFgAlpha(id));
+ drawpic_skin(picpos, rightname, eX * (1/6) * mySize_x + eY * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(rightcnt), eX * (2/6) * mySize_x + eY * mySize_y, mySize_y, HUD_Get_Num_Color(rightcnt, 200), HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
- barpos = pos + eX * mySize_x - eX * mySize_x * min(1, fuel/100);
- barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
- } else {
- barpos = pos;
- barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
- }
if(fuel)
+ {
+ if(baralign == 0 || baralign == 3) { // left align
+ barpos = pos + eX * mySize_x - eX * mySize_x * min(1, fuel/100);
+ barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
+ } else {
+ barpos = pos;
+ barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
+ }
HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("fuel"), HUD_Panel_GetFgAlpha(id) * 0.8, DRAWFLAG_NORMAL);
+ }
}
else if (mySize_x/mySize_y > 2)
{
if(leftactive)
{
- len = strlen(ftos(leftcnt));
-
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+ if(baralign == 1 || baralign == 3) { // right align
barpos = pos + eX * mySize_x - eX * mySize_x * min(1, leftcnt/200);
- barsize = eX * mySize_x * min(1, leftcnt/200) + eY * 0.5 * mySize_y;
- picpos = pos + eX * mySize_x - eX * 0.5 * mySize_y;
- numpos = picpos - eX * len * 0.5 * mySize_y;
- } else {
+ barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
+ } else { // left align
barpos = pos;
- barsize = eX * mySize_x * min(1, leftcnt/200) + eY * 0.5 * mySize_y;
+ barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
+ }
+
+ if(iconalign == 1 || iconalign == 3) { // right align
+ picpos = pos + eX * (2/3) * mySize_x;
+ numpos = pos;
+ } else { // left align
picpos = pos;
- numpos = picpos + eX * 0.5 * mySize_y;
+ numpos = pos + eX * (1/3) * mySize_x;
}
HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- drawpic_skin(picpos, leftname, '0.5 0.5 0' * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum_Colored(numpos, leftcnt, len, 0.5 * mySize_y, HUD_Panel_GetFgAlpha(id));
+ drawpic_skin(picpos, leftname, eX * (1/3) * mySize_x + eY * 0.5 * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(leftcnt), eX * (2/3) * mySize_x + eY * 0.5 * mySize_y, mySize_y, HUD_Get_Num_Color(leftcnt, 200), HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
if(rightactive)
{
- len = strlen(ftos(rightcnt));
-
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
- barpos = pos + eX * mySize_x - eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
- barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
- picpos = pos + eX * mySize_x - eX * 0.5 * mySize_y + eY * 0.5 * mySize_y;
- numpos = picpos - eX * len * 0.5 * mySize_y;
- } else {
+ if(baralign == 0 || baralign == 3) { // left align
barpos = pos + eY * 0.5 * mySize_y;
barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
+ } else { // right align
+ barpos = pos + eX * mySize_x - eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
+ barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
+ }
+
+ if(iconalign == 0 || iconalign == 3) { // left align
picpos = pos + eY * 0.5 * mySize_y;
- numpos = picpos + eX * 0.5 * mySize_y;
+ numpos = pos + eX * (1/3) * mySize_x + eY * 0.5 * mySize_y;
+ } else { // right align
+ picpos = pos + eX * (2/3) * mySize_x + eY * 0.5 * mySize_y;
+ numpos = pos + eY * 0.5 * mySize_y;
}
HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- drawpic_skin(picpos, rightname, '0.5 0.5 0' * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum_Colored(numpos, rightcnt, len, 0.5 * mySize_y, HUD_Panel_GetFgAlpha(id));
+ drawpic_skin(picpos, rightname, eX * (1/3) * mySize_x + eY * 0.5 * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawstring_aspect(numpos, ftos(rightcnt), eX * (2/3) * mySize_x + eY * 0.5 * mySize_y, mySize_y, HUD_Get_Num_Color(rightcnt, 200), HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
- barpos = pos + eX * mySize_x - eX * mySize_x * min(1, fuel/100);
- barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.1 * mySize_y;
- } else {
- barpos = pos;
- barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.1 * mySize_y;
- }
if(fuel)
+ {
+ if(baralign == 0 || baralign == 3) { // left align
+ barpos = pos + eX * mySize_x - eX * mySize_x * min(1, fuel/100);
+ barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.1 * mySize_y;
+ } else {
+ barpos = pos;
+ barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.1 * mySize_y;
+ }
HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("fuel"), HUD_Panel_GetFgAlpha(id) * 0.8, DRAWFLAG_NORMAL);
+ }
}
else
{
if(leftactive)
{
- len = strlen(ftos(leftcnt));
-
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+ if(baralign == 1 || baralign == 3) { // down align
+ barpos = pos + eY * mySize_y - eY * mySize_y * min(1, leftcnt/200);
+ barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/200);
+ } else { // up align
barpos = pos;
barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/200);
+ }
+
+ if(iconalign == 1 || iconalign == 3) { // down align
+ picpos = pos + eX * 0.05 * mySize_x + eY * (mySize_y - 0.65 * mySize_x);
+ numpos = pos + eY * mySize_y - eY * 0.25 * mySize_x;
+ } else { // up align
picpos = pos + eX * 0.05 * mySize_x;
- numpos = pos + eX * ((3-len)/2) * 0.25 * mySize_x + eY * 0.4 * mySize_x;
- } else {
- barpos = pos + eY * mySize_y - eY * mySize_y * min(1, leftcnt/200);
- barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/200);
- picpos = pos + eX * 0.05 * mySize_x + eY * mySize_y - eY * 0.566 * mySize_x;
- numpos = pos + eX * ((3-len)/2) * 0.25 * mySize_x + eY * mySize_y - eY * 0.166 * mySize_x;
+ numpos = pos + eY * 0.4 * mySize_x;
}
HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
drawpic_skin(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum_Colored(numpos, leftcnt, len, 0.166 * mySize_x, HUD_Panel_GetFgAlpha(id));
+ drawstring_aspect(numpos, ftos(leftcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, 0.25 * mySize_x, HUD_Get_Num_Color(leftcnt, 200), HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
if(rightactive)
{
- len = strlen(ftos(rightcnt));
-
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+ if(baralign == 0 || baralign == 3) { // up align
barpos = pos + eX * 0.5 * mySize_x;
barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/200);
- picpos = pos + eX * 0.05 * mySize_x + eX * 0.5 * mySize_x;
- numpos = pos + eX * ((3-len)/2) * 0.25 * mySize_x + eY * 0.4 * mySize_x + eX * 0.5 * mySize_x;
- } else {
+ } else { // down align
barpos = pos + eY * mySize_y - eY * mySize_y * min(1, rightcnt/200) + eX * 0.5 * mySize_x;
barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/200);
- picpos = pos + eX * 0.05 * mySize_x + eY * mySize_y - eY * 0.566 * mySize_x + eX * 0.5 * mySize_x;
- numpos = pos + eX * ((3-len)/2) * 0.25 * mySize_x + eY * mySize_y - eY * 0.166 * mySize_x + eX * 0.5 * mySize_x;
+ }
+
+ if(iconalign == 0 || iconalign == 3) { // up align
+ picpos = pos + eX * 0.05 * mySize_x + eX * 0.5 * mySize_x;
+ numpos = pos + eY * 0.4 * mySize_x + eX * 0.5 * mySize_x;
+ } else { // down align
+ picpos = pos + eX * 0.05 * mySize_x + eY * (mySize_y - 0.65 * mySize_x) + eX * 0.5 * mySize_x;
+ numpos = pos + eY * mySize_y - eY * 0.25 * mySize_x + eX * 0.5 * mySize_x;
}
HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
drawpic_skin(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum_Colored(numpos, rightcnt, len, 0.166 * mySize_x, HUD_Panel_GetFgAlpha(id));
+ drawstring_aspect(numpos, ftos(rightcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, 0.25 * mySize_x, HUD_Get_Num_Color(rightcnt, 200), HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
}
- if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
- barpos = pos;
- barsize = eX * 0.05 * mySize_x + eY * mySize_y * min(1, fuel/100);
- } else {
- barpos = pos + eY * mySize_y - eY * mySize_y * min(1, fuel/100);
- barsize = eX * 0.05 * mySize_x + eY * mySize_y * min(1, fuel/100);
- }
if(fuel)
+ {
+ if(baralign == 0 || baralign == 3) { // left align
+ barpos = pos;
+ barsize = eX * 0.05 * mySize_x + eY * mySize_y * min(1, fuel/100);
+ } else {
+ barpos = pos + eY * mySize_y - eY * mySize_y * min(1, fuel/100);
+ barsize = eX * 0.05 * mySize_x + eY * mySize_y * min(1, fuel/100);
+ }
HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor("fuel"), HUD_Panel_GetFgAlpha(id) * 0.8, DRAWFLAG_NORMAL);
+ }
}
}
}
}
float score, distribution, leader;
- float score_len, distr_len;
+ float score_len;
vector distribution_color;
entity tm, pl, me;
me = (spectatee_status > 0) ? playerslots[spectatee_status - 1] : playerslots[player_localentnum - 1];
distribution_color = eX;
minusplus = 2; // minusplus 1: always prefix with plus sign
}
- HUD_DrawXNum(bottomright - '0 48 0' - '16 0 0' * TIME_DECIMALS, distmsec, -TIME_DECIMALS, 0, 16, distribution_color, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum(bottomright - '68 48 0' - '16 0 0' * TIME_DECIMALS, distsec, 4, minusplus, 16, distribution_color, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ //HUD_DrawXNum(bottomright - '0 48 0' - '16 0 0' * TIME_DECIMALS, distmsec, -TIME_DECIMALS, 0, 16, distribution_color, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ //HUD_DrawXNum(bottomright - '68 48 0' - '16 0 0' * TIME_DECIMALS, distsec, 4, minusplus, 16, distribution_color, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
drawpic_skin(bottomright - '10 48 0' - '16 0 0' * TIME_DECIMALS, "num_dot", '16 16 0', distribution_color, HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE);
}
// race record display
if (distribution <= 0 || distribution == score) // draw the highlight background behind the timer if we have the lead
drawpic_skin(bottomright - '0 32 0' - '32 0 0' * (4 + TIME_DECIMALS), "num_leading_4", '0 28 0' + '32 0 0' * (4 + TIME_DECIMALS), '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0', racemsec, -TIME_DECIMALS, 0, 30, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0' - '66 0 0', racesec, -2, 0, 30, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ //HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0', racemsec, -TIME_DECIMALS, 0, 30, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ //HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0' - '66 0 0', racesec, -2, 0, 30, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
drawpic_skin(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0' - '18 0 0', "num_dot", '30 30 0', '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE);
- HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0' - '132 0 0', racemin, -2, 0, 30, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ //HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0' - '132 0 0', racemin, -2, 0, 30, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
drawpic_skin(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0' - '84 0 0', "num_colon", '30 30 0', '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE);
*/
} else if (!teamplay) { // non-teamgames
distribution_color = eX;
score_len = strlen(ftos(score));
- distr_len = strlen(ftos(distribution));
- HUD_DrawXNum(pos + eX * mySize_x - eX * 3 * 0.33 * mySize_y, distribution, 3, 3, 0.33 * mySize_y, distribution_color, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + eX * 0.75 * mySize_x, ftos(distribution), eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, (1/3) * mySize_y, distribution_color, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
if (leader)
- drawpic_skin(pos + eX * mySize_x - eX * score_len * mySize_y - eX * 3 * 0.33 * mySize_y, strcat("num_leading_", ftos(score_len)), eX * score_len * mySize_y + eY * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum(pos + eX * mySize_x - eX * 3 * mySize_y - eX * 3 * 0.33 * mySize_y, score, 3, 0, mySize_y, distribution_color, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawpic_skin(pos, strcat("num_leading_", ftos(score_len)), eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawfont = hud_bigfont;
+ drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize_x + eY * mySize_y, mySize_y, distribution_color, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawfont = hud_font;
} else { // teamgames
float max_fragcount;
max_fragcount = -99;
if (max_fragcount == score)
leader = 1;
if (leader)
- drawpic_skin(pos + eX * mySize_x - eX * score_len * mySize_y - eX * 3 * 0.33 * mySize_y, strcat("num_leading_", ftos(score_len)), eX * score_len * mySize_y + eY * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum(pos + eX * mySize_x - eX * 3 * mySize_y - eX * 3 * 0.33 * mySize_y, score, 3, 0, mySize_y, GetTeamRGB(tm.team) * 0.8, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawpic_skin(pos, strcat("num_leading_", ftos(score_len)), eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawfont = hud_bigfont;
+ drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize_x + eY * mySize_y, mySize_y, GetTeamRGB(tm.team) * 0.8, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawfont = hud_font;
} else {
if (max_fragcount == score)
leader = 1;
if (leader)
- drawpic_skin(pos + eX * mySize_x - eX * 0.33 * score_len * mySize_y + eY * 0.33 * mySize_y * teamnum, strcat("num_leading_", ftos(score_len)), eX * 0.33 * score_len * mySize_y + eY * 0.33 * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
- HUD_DrawXNum(pos + eX * mySize_x - eX * 3 * 0.33 * mySize_y + eY * 0.33 * mySize_y * teamnum, score, 3, 0, 0.33 * mySize_y, GetTeamRGB(tm.team) * 0.8, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawpic_skin(pos + eX * 0.75 * mySize_x + eY * (1/3) * teamnum * mySize_y, strcat("num_leading_", ftos(score_len)), eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + eX * 0.75 * mySize_x + eY * (1/3) * teamnum * mySize_y, ftos(score), eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, (1/3) * mySize_y, GetTeamRGB(tm.team) * 0.8, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
teamnum += 1;
}
}
}
}
- if(cvar_string("hud_dock") != "")
+ if(cvar_string("hud_dock") != "" && cvar_string("hud_dock") != "0")
drawpic('0 0 0', strcat("gfx/hud/", cvar_string("hud_skin"), "/", cvar_string("hud_dock")), eX * vid_conwidth + eY * vid_conheight, HUD_Panel_Dock_GetColor(), cvar("hud_dock_alpha") * menu_fade_alpha, DRAWFLAG_NORMAL); // no aspect ratio forcing on dock...
if(HUD_Panel_CheckActive(HUD_PANEL_RADAR) || hud_configure)