]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Adapt Sbar_DrawXNum to the new system
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 16 May 2012 20:03:14 +0000 (23:03 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 16 May 2012 20:03:14 +0000 (23:03 +0300)
data/hudVT.cfg
data/qcsrc/client/hud.qc

index 8a7123ee38ea231082d5d0892577b0445a41f709..b562491b1d35d162f697fbe88fac99acfde43f27 100644 (file)
@@ -7,12 +7,12 @@ set hud_panel_status_item_weapon_scale "0.5 0.5 0"
 set hud_panel_status_item_health_icon_position "0.5 0.5 0"\r
 set hud_panel_status_item_health_icon_scale "0.5 0.5 0"\r
 set hud_panel_status_item_health_text_position "0.5 0.5 0"\r
-set hud_panel_status_item_health_text_scale 0.5\r
+set hud_panel_status_item_health_text_scale 16\r
 \r
 set hud_panel_status_item_armor_icon_position "0.5 0.5 0"\r
 set hud_panel_status_item_armor_icon_scale "0.5 0.5 0"\r
 set hud_panel_status_item_armor_text_position "0.5 0.5 0"\r
-set hud_panel_status_item_armor_text_scale 0.5\r
+set hud_panel_status_item_armor_text_scale 16\r
 \r
 set hud_panel_status_item_ammo_icon_position "-0.5 0.5 0"\r
 set hud_panel_status_item_ammo_icon_scale "0.5 0.5 0"\r
index ed39de4ceb9678d1429e669e582b981efb78b9c3..8f4fa174349e5eb92b8a0f223d978ad9bc72ec2b 100644 (file)
@@ -33,27 +33,6 @@ float ts_primary, ts_secondary;
 \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
@@ -93,15 +72,32 @@ vector Sbar_AccuracyColor(float accuracy)
        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
@@ -141,9 +137,16 @@ void Sbar_DrawXNum (vector pos, float num, float digits, float showminusplus, fl
                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
@@ -2006,18 +2009,15 @@ void Sbar_Status()
        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