From: MirceaKitsune Date: Wed, 16 May 2012 19:30:27 +0000 (+0300) Subject: Switch to a new system of defining HUD element positions. This will currently break... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b58155d101337dd2482a1f0c39fb105e1e9f34ce;p=voretournament%2Fvoretournament.git Switch to a new system of defining HUD element positions. This will currently break the HUD --- diff --git a/data/hudVT.cfg b/data/hudVT.cfg index 801ab01d..8a7123ee 100644 --- a/data/hudVT.cfg +++ b/data/hudVT.cfg @@ -1,26 +1,24 @@ -set hud_panel_status_edge "bottom" +set hud_panel_status_background_position "0.5 0.5 0" +set hud_panel_status_background_scale "0.5 0.5 0" -set hud_panel_status_background_position "96 96 0" -set hud_panel_status_background_scale "192 96 0" +set hud_panel_status_item_weapon_position "0.5 0.5 0" +set hud_panel_status_item_weapon_scale "0.5 0.5 0" -set hud_panel_status_item_weapon_position "96 96 0" -set hud_panel_status_item_weapon_scale "192 96 0" +set hud_panel_status_item_health_icon_position "0.5 0.5 0" +set hud_panel_status_item_health_icon_scale "0.5 0.5 0" +set hud_panel_status_item_health_text_position "0.5 0.5 0" +set hud_panel_status_item_health_text_scale 0.5 -set hud_panel_status_item_health_icon_position "53.5 42 0" -set hud_panel_status_item_health_icon_scale "32 32 0" -set hud_panel_status_item_health_text_position "43 58 0" -set hud_panel_status_item_health_text_scale 22 +set hud_panel_status_item_armor_icon_position "0.5 0.5 0" +set hud_panel_status_item_armor_icon_scale "0.5 0.5 0" +set hud_panel_status_item_armor_text_position "0.5 0.5 0" +set hud_panel_status_item_armor_text_scale 0.5 -set hud_panel_status_item_armor_icon_position "50.5 82 0" -set hud_panel_status_item_armor_icon_scale "16 16 0" -set hud_panel_status_item_armor_text_position "43 68 0" -set hud_panel_status_item_armor_text_scale 12 - -set hud_panel_status_item_ammo_icon_position "-34 39 0" -set hud_panel_status_item_ammo_icon_scale "20 20 0" -set hud_panel_status_item_noload_ammo_text_position "-17 37 0" -set hud_panel_status_item_noload_ammo_text_scale 16 -set hud_panel_status_item_load_ammo_text_position "-15 43 0" -set hud_panel_status_item_load_ammo_text_scale 12 -set hud_panel_status_item_load_clip_text_position "-10 27 0" -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" +set hud_panel_status_item_ammo_icon_scale "0.5 0.5 0" +set hud_panel_status_item_noload_ammo_text_position "-0.5 0.5 0" +set hud_panel_status_item_noload_ammo_text_scale 0.5 +set hud_panel_status_item_load_ammo_text_position "-0.5 0.5 0" +set hud_panel_status_item_load_ammo_text_scale 0.5 +set hud_panel_status_item_load_clip_text_position "-0.5 0.5 0" +set hud_panel_status_item_load_clip_text_scale 0.5 \ No newline at end of file diff --git a/data/qcsrc/client/hud.qc b/data/qcsrc/client/hud.qc index 4406129b..ed39de4c 100644 --- a/data/qcsrc/client/hud.qc +++ b/data/qcsrc/client/hud.qc @@ -33,18 +33,25 @@ float ts_primary, ts_secondary; vector color; -vector Sbar_Edge(string str) +void Sbar_DrawPic(string pic, vector position, vector size, float background) { - vector pos; - switch(str) + vector pos, sz; + sz_x = vid_conwidth * size_x; + sz_y = vid_conheight * size_y; + pos_x = (vid_conwidth / 2) * bound(0, 1 + position_x, 2); + pos_x -= sz_x / 2; + pos_y = (vid_conheight / 2) * bound(0, 1 + position_y, 2); + pos_y -= sz_y / 2; + + if(background) { - case "bottom": - pos_x = vid_conwidth / 2; - pos_y = vid_conheight; - default: - break; + if(teamplay) + drawpic(pos, "gfx/hud/bg_status", sz, GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // hud color = myteam color + else + drawpic(pos, "gfx/hud/bg_status", sz, stov(cvar_string("sbar_color_bg")), sbar_alpha_bg, DRAWFLAG_NORMAL); } - return pos; + else + drawpic(pos, "gfx/hud/bg_status", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); } void CSQC_kh_hudreset(); @@ -1994,21 +2001,12 @@ void Sbar_Status() float stat_items; stat_items = getstati(STAT_ITEMS); - vector edge, pos, pos2; - edge = Sbar_Edge(cvar_string("hud_panel_status_edge")); + vector pos, pos2; - pos = edge - stov(cvar_string("hud_panel_status_background_position")); - if (cvar("viewsize") <= 100 && sbar_hudselector) { - if (teamplay) - 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 - else { - // allow for custom HUD colors in non-teamgames - color = stov(cvar_string("sbar_color_bg")); - - drawpic(pos, "gfx/hud/bg_status", stov(cvar_string("hud_panel_status_background_scale")), color, sbar_alpha_bg, DRAWFLAG_NORMAL); - } - } + if (cvar("viewsize") <= 100 && sbar_hudselector) + Sbar_DrawPic("gfx/hud/bg_status", stov(cvar_string("hud_panel_status_background_position")), stov(cvar_string("hud_panel_status_background_scale")), TRUE); +/* // armor pos = edge - stov(cvar_string("hud_panel_status_item_armor_text_position")); pos2 = edge - stov(cvar_string("hud_panel_status_item_armor_icon_position")); @@ -2094,6 +2092,7 @@ void Sbar_Status() e = get_weaponinfo(activeweapon); if (e && e.netname != "" && e.netname != "N/A") 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); +*/ } void Sbar_Timer()