From: MirceaKitsune Date: Sat, 2 Feb 2013 23:20:22 +0000 (+0200) Subject: Remove the code for each HUD background image, and create a system which allows defin... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d1c07c24a54f177c6783f8bbf3f21bf676781f5c;p=voretournament%2Fvoretournament.git Remove the code for each HUD background image, and create a system which allows definind any number of background components. Old HUD will still look how it used to of course. --- diff --git a/data/gfx/hud/bg_status_activeweapon_grabber.tga b/data/gfx/hud/bg_status_activeweapon_grabber.tga deleted file mode 100644 index e7ad60a7..00000000 Binary files a/data/gfx/hud/bg_status_activeweapon_grabber.tga and /dev/null differ diff --git a/data/gfx/hud/sb_activeweapon_grabber.tga b/data/gfx/hud/sb_activeweapon_grabber.tga new file mode 100644 index 00000000..e7ad60a7 Binary files /dev/null and b/data/gfx/hud/sb_activeweapon_grabber.tga differ diff --git a/data/hudVT.cfg b/data/hudVT.cfg index ce3b606a..de8d9bfd 100644 --- a/data/hudVT.cfg +++ b/data/hudVT.cfg @@ -1,8 +1,23 @@ // Only some HUD components can be customized here at the time. // Components left to do: Portrait, Sbar ring, "HUD disabled" warnings, some race timers, some spectator messages. -set hud_panel_status_background_position "0 -0.85 0" -set hud_panel_status_background_scale "0.2 0.15 0" +set hud_backgrounds 4 // total number of backgrounds defined +set hud_background_1_texture "gfx/hud/bg_status" +set hud_background_1_position "0 -0.85 0" +set hud_background_1_scale "0.2 0.15 0" +set hud_background_1_colortype 1 // 0 = white, 1 = HUD / team color, 2 = vore color +set hud_background_2_texture "gfx/hud/bg_stomach" +set hud_background_2_position "-0.68 -0.58 0" +set hud_background_2_scale "0.325 0.475 0" +set hud_background_2_colortype 1 // 0 = white, 1 = HUD / team color, 2 = vore color +set hud_background_3_texture "gfx/hud/bg_stomach_status" +set hud_background_3_position "-0.68 -0.58 0" +set hud_background_3_scale "0.325 0.475 0" +set hud_background_3_colortype 2 // 0 = white, 1 = HUD / team color, 2 = vore color +set hud_background_4_texture "gfx/hud/bg_timer" +set hud_background_4_position "0.875 0.95 0" +set hud_background_4_scale "0.125 0.05 0" +set hud_background_4_colortype 1 // 0 = white, 1 = HUD / team color, 2 = vore color set hud_item_timer_text_position "0.875 0.96 0" set hud_item_timer_text_scale 16 @@ -55,12 +70,12 @@ set hud_item_ammo_load_text_scale 12 set hud_item_ammo_load_clip_text_position "0.03 -0.89 0" set hud_item_ammo_load_clip_text_scale 16 -set hud_item_digestion_icon_position "-0.89 -0.53 0" +set hud_item_digestion_icon_position "-0.895 -0.53 0" set hud_item_digestion_icon_scale "0.02 0.03 0" -set hud_item_stomach_load_single_text_position "-0.89 -0.47 0" +set hud_item_stomach_load_single_text_position "-0.895 -0.46 0" set hud_item_stomach_load_single_text_scale 20 -set hud_item_stomach_load_double_text_position "-0.89 -0.47 0" +set hud_item_stomach_load_double_text_position "-0.895 -0.46 0" set hud_item_stomach_load_double_text_scale 16 set hud_item_predator_position "-0.64 -0.525 0" diff --git a/data/qcsrc/client/hud.qc b/data/qcsrc/client/hud.qc index 5e9b0717..f0f8b116 100644 --- a/data/qcsrc/client/hud.qc +++ b/data/qcsrc/client/hud.qc @@ -1766,6 +1766,44 @@ string GetAmmoPicture(float i) } } +void Sbar_DrawBackgrounds() +{ + // Draw all backgrounds defined by our HUD setup + if (cvar("viewsize") > 100 || !sbar_hudselector) + return; + + float total = cvar("hud_backgrounds"); + float i; + for(i = 1; i <= total; i++) + { + string img = cvar_string(strcat("hud_background_", ftos(i), "_texture")); + vector pos = stov(cvar_string(strcat("hud_background_", ftos(i), "_position"))); + vector sz = stov(cvar_string(strcat("hud_background_", ftos(i), "_scale"))); + + pos = Sbar_ConvertToScreen_PicPosition(pos, sz); + sz = Sbar_ConvertToScreen_PicScale(sz); + + vector col; + switch(cvar(strcat("hud_background_", ftos(i), "_colortype"))) + { + case 1: + if(teamplay) + col = GetTeamRGB(myteam) * sbar_color_bg_team; + else + col = stov(cvar_string("sbar_color_bg")); + break; + case 2: + col = Sbar_ColorFade(Sbar_GetVoreColor()); + break; + default: + col = '1 1 1'; + break; + } + + drawpic(pos, img, sz, col, sbar_alpha_bg, DRAWFLAG_NORMAL); + } +} + float race_status_time; float race_status_prev; string race_status_name_prev; @@ -2118,9 +2156,6 @@ void Sbar_Status() float stat_items; stat_items = getstati(STAT_ITEMS); - 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 x = armor; if (x > 0) @@ -2183,7 +2218,7 @@ void Sbar_Status() entity e; e = get_weaponinfo(activeweapon); if (e && e.netname != "" && e.netname != "N/A") - Sbar_DrawPic(strcat("gfx/hud/bg_status_activeweapon_", e.netname), stov(cvar_string("hud_item_weapon_position")), stov(cvar_string("hud_item_weapon_scale")), FALSE); + Sbar_DrawPic(strcat("gfx/hud/sb_activeweapon_", e.netname), stov(cvar_string("hud_item_weapon_position")), stov(cvar_string("hud_item_weapon_scale")), FALSE); } void Sbar_Timer() @@ -2225,16 +2260,6 @@ void Sbar_Timer() seconds = secondsLeft; } - if (cvar("viewsize") <= 100 && sbar_hudselector) { // draw timer background when viewsize <= 100 - if (teamplay) - drawpic('1 0 0' * (vid_conwidth - (70 + 17 + 12)), "gfx/hud/bg_timer", '120 30 0', GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // timer bg color = myteam color - else { - color = stov(cvar_string("sbar_color_bg")); - - drawpic('1 0 0' * (vid_conwidth - (70 + 17 + 12)), "gfx/hud/bg_timer", '120 30 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL); - } - } - Sbar_DrawPic("gfx/hud/sb_time", stov(cvar_string("hud_item_timer_icon_position")), stov(cvar_string("hud_item_timer_icon_scale")), FALSE); finaltime = strcat(ftos(minutes), ":"); @@ -3214,21 +3239,11 @@ void Sbar_Draw (void) } } + Sbar_DrawBackgrounds(); + if(g_vore) // only when the vore system is active { // draw the stomach board - if (cvar("viewsize") <= 100 && sbar_hudselector) { - if (teamplay) - drawpic(bottomleft- '0 256 0', "gfx/hud/bg_stomach", '256 256 0', 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(bottomleft - '0 256 0', "gfx/hud/bg_stomach", '256 256 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL); - } - } - - drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', Sbar_ColorFade(Sbar_GetVoreColor()), cvar("sbar_stomachboard_status_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL); float stomach_load, stomach_maxload; // shows the predator's stomach load when we are eaten, and ours otherwise stomach_load = getstati(STAT_VORE_LOAD); diff --git a/docs/TODO.txt b/docs/TODO.txt index 6595fcf2..cc4c5d80 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -269,3 +269,5 @@ - 0.8: Smart hint system detecting gameplay errors client-side - 0.8: Make acceleration / deceleration play a role in swallow speed + +- 0.8: Does the "viewsize" cvar still need to be used for the HUD?