\r
vector color;\r
\r
-void Sbar_DrawPic(string pic, vector position, vector size, float background)\r
-{\r
- vector pos, sz;\r
- sz_x = vid_conwidth * size_x;\r
- sz_y = vid_conheight * size_y;\r
- pos_x = (vid_conwidth / 2) * bound(0, 1 + position_x, 2);\r
- pos_x -= sz_x / 2;\r
- pos_y = (vid_conheight / 2) * bound(0, 1 + position_y, 2);\r
- pos_y -= sz_y / 2;\r
-\r
- if(background)\r
- {\r
- if(teamplay)\r
- drawpic(pos, "gfx/hud/bg_status", sz, GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // hud color = myteam color\r
- else\r
- drawpic(pos, "gfx/hud/bg_status", sz, stov(cvar_string("sbar_color_bg")), sbar_alpha_bg, DRAWFLAG_NORMAL);\r
- }\r
- else\r
- drawpic(pos, "gfx/hud/bg_status", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-}\r
-\r
void CSQC_kh_hudreset();\r
void CSQC_kh_hud();\r
void CSQC_ctf_hudreset();\r
return rgb;\r
}\r
\r
-void Sbar_DrawXNum (vector pos, float num, float digits, float showminusplus, float lettersize, vector rgb, float alpha, float dflags)\r
+void Sbar_DrawPic(string pic, vector position, vector size, float background)\r
+{\r
+ vector pos, sz;\r
+ sz_x = vid_conwidth * size_x;\r
+ sz_y = vid_conheight * size_y;\r
+ pos_x = (vid_conwidth / 2) * bound(0, 1 + position_x, 2);\r
+ pos_x -= sz_x / 2;\r
+ pos_y = (vid_conheight / 2) * bound(0, 1 + position_y, 2);\r
+ pos_y -= sz_y / 2;\r
+\r
+ if(background)\r
+ {\r
+ if(teamplay)\r
+ drawpic(pos, pic, sz, GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // hud color = myteam color\r
+ else\r
+ drawpic(pos, pic, sz, stov(cvar_string("sbar_color_bg")), sbar_alpha_bg, DRAWFLAG_NORMAL);\r
+ }\r
+ else\r
+ drawpic(pos, pic, sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+}\r
+\r
+void Sbar_DrawXNum (vector position, float num, float digits, float showminusplus, float lettersize, vector rgb, float alpha, float dflags)\r
{\r
float l;\r
string str, tmp, l_length, final_num;\r
float minus, plus;\r
- vector vsize;\r
-\r
- vsize_x = vsize_y = lettersize;\r
- vsize_z = 0;\r
\r
// showminusplus 1: always prefix with minus sign (useful in race distribution display)\r
// showminusplus 2: always prefix with plus sign (useful in race distribution display)\r
final_num = "-";\r
else if(plus)\r
final_num = "+";\r
-\r
final_num = strcat(final_num, str);\r
- drawstring(pos, final_num, vsize, rgb, alpha, dflags);\r
+\r
+ vector pos, sz;\r
+ sz_x = sz_y = lettersize;\r
+ pos_x = (vid_conwidth / 2) * bound(0, 1 + position_x, 2);\r
+ pos_x -= stringwidth(final_num, FALSE, sz) * 0.5;\r
+ pos_y = (vid_conheight / 2) * bound(0, 1 + position_y, 2);\r
+ pos_y -= sz_y / 2;\r
+\r
+ drawstring(pos, final_num, sz, rgb, alpha, dflags);\r
}\r
\r
vector Sbar_NumColor (float x)\r
if (cvar("viewsize") <= 100 && sbar_hudselector)\r
Sbar_DrawPic("gfx/hud/bg_status", stov(cvar_string("hud_panel_status_background_position")), stov(cvar_string("hud_panel_status_background_scale")), TRUE);\r
\r
-/*\r
// armor\r
- pos = edge - stov(cvar_string("hud_panel_status_item_armor_text_position"));\r
- pos2 = edge - stov(cvar_string("hud_panel_status_item_armor_icon_position"));\r
x = armor;\r
if (x > 0)\r
{\r
- drawpic(pos2, "gfx/hud/sb_armor", stov(cvar_string("hud_panel_status_item_armor_icon_scale")), '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- pos -= '1 0 0' * stringwidth(ftos(x), FALSE, '1 1 0' * cvar("hud_panel_status_item_armor_text_scale")) * 0.5;\r
- Sbar_DrawXNum(pos, x, 3, 0, cvar("hud_panel_status_item_armor_text_scale"), Sbar_NumColor(x), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ Sbar_DrawPic("gfx/hud/sb_armor", stov(cvar_string("hud_panel_status_item_armor_icon_position")), stov(cvar_string("hud_panel_status_item_armor_icon_scale")), FALSE);\r
+ Sbar_DrawXNum(stov(cvar_string("hud_panel_status_item_armor_icon_position")), x, 3, 0, cvar("hud_panel_status_item_armor_text_scale"), Sbar_NumColor(x), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
}\r
\r
+/*\r
// health\r
pos = edge - stov(cvar_string("hud_panel_status_item_health_text_position"));\r
pos2 = edge - stov(cvar_string("hud_panel_status_item_health_icon_position"));\r