Switch to a new system of defining HUD element positions. This will currently break...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 16 May 2012 19:30:27 +0000 (22:30 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 16 May 2012 19:30:27 +0000 (22:30 +0300)
data/hudVT.cfg
data/qcsrc/client/hud.qc

index 801ab01d8ac0112423abfbdf253105a5688fd481..8a7123ee38ea231082d5d0892577b0445a41f709 100644 (file)
@@ -1,26 +1,24 @@
-set hud_panel_status_edge "bottom"\r
+set hud_panel_status_background_position "0.5 0.5 0"\r
+set hud_panel_status_background_scale "0.5 0.5 0"\r
 \r
-set hud_panel_status_background_position "96 96 0"\r
-set hud_panel_status_background_scale "192 96 0"\r
+set hud_panel_status_item_weapon_position "0.5 0.5 0"\r
+set hud_panel_status_item_weapon_scale "0.5 0.5 0"\r
 \r
-set hud_panel_status_item_weapon_position "96 96 0"\r
-set hud_panel_status_item_weapon_scale "192 96 0"\r
+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
 \r
-set hud_panel_status_item_health_icon_position "53.5 42 0"\r
-set hud_panel_status_item_health_icon_scale "32 32 0"\r
-set hud_panel_status_item_health_text_position "43 58 0"\r
-set hud_panel_status_item_health_text_scale 22\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
 \r
-set hud_panel_status_item_armor_icon_position "50.5 82 0"\r
-set hud_panel_status_item_armor_icon_scale "16 16 0"\r
-set hud_panel_status_item_armor_text_position "43 68 0"\r
-set hud_panel_status_item_armor_text_scale 12\r
-\r
-set hud_panel_status_item_ammo_icon_position "-34 39 0"\r
-set hud_panel_status_item_ammo_icon_scale "20 20 0"\r
-set hud_panel_status_item_noload_ammo_text_position "-17 37 0"\r
-set hud_panel_status_item_noload_ammo_text_scale 16\r
-set hud_panel_status_item_load_ammo_text_position "-15 43 0"\r
-set hud_panel_status_item_load_ammo_text_scale 12\r
-set hud_panel_status_item_load_clip_text_position "-10 27 0"\r
-set hud_panel_status_item_load_clip_text_scale 16
\ No newline at end of file
+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
+set hud_panel_status_item_noload_ammo_text_position "-0.5 0.5 0"\r
+set hud_panel_status_item_noload_ammo_text_scale 0.5\r
+set hud_panel_status_item_load_ammo_text_position "-0.5 0.5 0"\r
+set hud_panel_status_item_load_ammo_text_scale 0.5\r
+set hud_panel_status_item_load_clip_text_position "-0.5 0.5 0"\r
+set hud_panel_status_item_load_clip_text_scale 0.5
\ No newline at end of file
index 4406129beeb224d6cc7da4ac079d548ed01474af..ed39de4ceb9678d1429e669e582b981efb78b9c3 100644 (file)
@@ -33,18 +33,25 @@ float ts_primary, ts_secondary;
 \r
 vector color;\r
 \r
-vector Sbar_Edge(string str)\r
+void Sbar_DrawPic(string pic, vector position, vector size, float background)\r
 {\r
-       vector pos;\r
-       switch(str)\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
-               case "bottom":\r
-                       pos_x = vid_conwidth / 2;\r
-                       pos_y = vid_conheight;\r
-               default:\r
-                       break;\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
-       return pos;\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
@@ -1994,21 +2001,12 @@ void Sbar_Status()
        float stat_items;\r
        stat_items = getstati(STAT_ITEMS);\r
 \r
-       vector edge, pos, pos2;\r
-       edge = Sbar_Edge(cvar_string("hud_panel_status_edge"));\r
+       vector pos, pos2;\r
 \r
-       pos = edge - stov(cvar_string("hud_panel_status_background_position"));\r
-       if (cvar("viewsize") <= 100 && sbar_hudselector) {\r
-               if (teamplay)\r
-                       drawpic(pos, "gfx/hud/bg_status", stov(cvar_string("hud_panel_status_background_scale")), GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // hud color = myteam color\r
-               else {\r
-                       // allow for custom HUD colors in non-teamgames\r
-                       color = stov(cvar_string("sbar_color_bg"));\r
-\r
-                       drawpic(pos, "gfx/hud/bg_status", stov(cvar_string("hud_panel_status_background_scale")), color, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
-               }\r
-       }\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
@@ -2094,6 +2092,7 @@ void Sbar_Status()
        e = get_weaponinfo(activeweapon);\r
        if (e && e.netname != "" && e.netname != "N/A")\r
                drawpic(pos, strcat("gfx/hud/bg_status_activeweapon_", e.netname), stov(cvar_string("hud_panel_status_item_weapon_scale")), '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+*/\r
 }\r
 \r
 void Sbar_Timer()\r