]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Remove the code for each HUD background image, and create a system which allows defin...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 2 Feb 2013 23:20:22 +0000 (01:20 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 2 Feb 2013 23:20:22 +0000 (01:20 +0200)
data/gfx/hud/bg_status_activeweapon_grabber.tga [deleted file]
data/gfx/hud/sb_activeweapon_grabber.tga [new file with mode: 0644]
data/hudVT.cfg
data/qcsrc/client/hud.qc
docs/TODO.txt

diff --git a/data/gfx/hud/bg_status_activeweapon_grabber.tga b/data/gfx/hud/bg_status_activeweapon_grabber.tga
deleted file mode 100644 (file)
index e7ad60a..0000000
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 (file)
index 0000000..e7ad60a
Binary files /dev/null and b/data/gfx/hud/sb_activeweapon_grabber.tga differ
index ce3b606a896a82889a1876234f99a1cc5cd2fff2..de8d9bfdc1f2abd6768fdbaed626dffd4b586bec 100644 (file)
@@ -1,8 +1,23 @@
 // Only some HUD components can be customized here at the time.\r
 // Components left to do: Portrait, Sbar ring, "HUD disabled" warnings, some race timers, some spectator messages.\r
 \r
-set hud_panel_status_background_position "0 -0.85 0"\r
-set hud_panel_status_background_scale "0.2 0.15 0"\r
+set hud_backgrounds 4 // total number of backgrounds defined\r
+set hud_background_1_texture "gfx/hud/bg_status"\r
+set hud_background_1_position "0 -0.85 0"\r
+set hud_background_1_scale "0.2 0.15 0"\r
+set hud_background_1_colortype 1 // 0 = white, 1 = HUD / team color, 2 = vore color\r
+set hud_background_2_texture "gfx/hud/bg_stomach"\r
+set hud_background_2_position "-0.68 -0.58 0"\r
+set hud_background_2_scale "0.325 0.475 0"\r
+set hud_background_2_colortype 1 // 0 = white, 1 = HUD / team color, 2 = vore color\r
+set hud_background_3_texture "gfx/hud/bg_stomach_status"\r
+set hud_background_3_position "-0.68 -0.58 0"\r
+set hud_background_3_scale "0.325 0.475 0"\r
+set hud_background_3_colortype 2 // 0 = white, 1 = HUD / team color, 2 = vore color\r
+set hud_background_4_texture "gfx/hud/bg_timer"\r
+set hud_background_4_position "0.875 0.95 0"\r
+set hud_background_4_scale "0.125 0.05 0"\r
+set hud_background_4_colortype 1 // 0 = white, 1 = HUD / team color, 2 = vore color\r
 \r
 set hud_item_timer_text_position "0.875 0.96 0"\r
 set hud_item_timer_text_scale 16\r
@@ -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"\r
 set hud_item_ammo_load_clip_text_scale 16\r
 \r
-set hud_item_digestion_icon_position "-0.89 -0.53 0"\r
+set hud_item_digestion_icon_position "-0.895 -0.53 0"\r
 set hud_item_digestion_icon_scale "0.02 0.03 0"\r
 \r
-set hud_item_stomach_load_single_text_position "-0.89 -0.47 0"\r
+set hud_item_stomach_load_single_text_position "-0.895 -0.46 0"\r
 set hud_item_stomach_load_single_text_scale 20\r
-set hud_item_stomach_load_double_text_position "-0.89 -0.47 0"\r
+set hud_item_stomach_load_double_text_position "-0.895 -0.46 0"\r
 set hud_item_stomach_load_double_text_scale 16\r
 \r
 set hud_item_predator_position "-0.64 -0.525 0"\r
index 5e9b0717ea3c4284844ede607023df37f8d81591..f0f8b116ace17e6061e7867cf4a8a1eda7e2bb92 100644 (file)
@@ -1766,6 +1766,44 @@ string GetAmmoPicture(float i)
        }\r
 }\r
 \r
+void Sbar_DrawBackgrounds()\r
+{\r
+       // Draw all backgrounds defined by our HUD setup\r
+       if (cvar("viewsize") > 100 || !sbar_hudselector)\r
+               return;\r
+\r
+       float total = cvar("hud_backgrounds");\r
+       float i;\r
+       for(i = 1; i <= total; i++)\r
+       {\r
+               string img = cvar_string(strcat("hud_background_", ftos(i), "_texture"));\r
+               vector pos = stov(cvar_string(strcat("hud_background_", ftos(i), "_position")));\r
+               vector sz = stov(cvar_string(strcat("hud_background_", ftos(i), "_scale")));\r
+\r
+               pos = Sbar_ConvertToScreen_PicPosition(pos, sz);\r
+               sz = Sbar_ConvertToScreen_PicScale(sz);\r
+\r
+               vector col;\r
+               switch(cvar(strcat("hud_background_", ftos(i), "_colortype")))\r
+               {\r
+                       case 1:\r
+                               if(teamplay)\r
+                                       col = GetTeamRGB(myteam) * sbar_color_bg_team;\r
+                               else\r
+                                       col = stov(cvar_string("sbar_color_bg"));\r
+                               break;\r
+                       case 2:\r
+                               col = Sbar_ColorFade(Sbar_GetVoreColor());\r
+                               break;\r
+                       default:\r
+                               col = '1 1 1';\r
+                               break;\r
+               }\r
+\r
+               drawpic(pos, img, sz, col, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
+       }\r
+}\r
+\r
 float race_status_time;\r
 float race_status_prev;\r
 string race_status_name_prev;\r
@@ -2118,9 +2156,6 @@ void Sbar_Status()
        float stat_items;\r
        stat_items = getstati(STAT_ITEMS);\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
        // armor\r
        x = armor;\r
        if (x > 0)\r
@@ -2183,7 +2218,7 @@ void Sbar_Status()
        entity e;\r
        e = get_weaponinfo(activeweapon);\r
        if (e && e.netname != "" && e.netname != "N/A")\r
-               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);\r
+               Sbar_DrawPic(strcat("gfx/hud/sb_activeweapon_", e.netname), stov(cvar_string("hud_item_weapon_position")), stov(cvar_string("hud_item_weapon_scale")), FALSE);\r
 }\r
 \r
 void Sbar_Timer()\r
@@ -2225,16 +2260,6 @@ void Sbar_Timer()
                seconds = secondsLeft;\r
        }\r
 \r
-       if (cvar("viewsize") <= 100 && sbar_hudselector) { // draw timer background when viewsize <= 100\r
-               if (teamplay)\r
-                       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\r
-               else {\r
-                       color = stov(cvar_string("sbar_color_bg"));\r
-\r
-                       drawpic('1 0 0' * (vid_conwidth - (70 + 17 + 12)), "gfx/hud/bg_timer", '120 30 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
-               }\r
-       }\r
-\r
        Sbar_DrawPic("gfx/hud/sb_time", stov(cvar_string("hud_item_timer_icon_position")), stov(cvar_string("hud_item_timer_icon_scale")), FALSE);\r
 \r
        finaltime = strcat(ftos(minutes), ":");\r
@@ -3214,21 +3239,11 @@ void Sbar_Draw (void)
                        }\r
                }\r
 \r
+               Sbar_DrawBackgrounds();\r
+\r
                if(g_vore) // only when the vore system is active\r
                {\r
                        // draw the stomach board\r
-                       if (cvar("viewsize") <= 100 && sbar_hudselector) {\r
-                               if (teamplay)\r
-                                       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\r
-                               else {\r
-                                       // allow for custom HUD colors in non-teamgames\r
-                                       color = stov(cvar_string("sbar_color_bg"));\r
-\r
-                                       drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach", '256 256 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
-                               }\r
-                       }\r
-\r
-                       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);\r
 \r
                        float stomach_load, stomach_maxload; // shows the predator's stomach load when we are eaten, and ours otherwise\r
                        stomach_load = getstati(STAT_VORE_LOAD);\r
index 6595fcf289968dffb7698518f2b9f075b0a61c2c..cc4c5d80c30df8f2750833aa706c6874840f3341 100644 (file)
 - 0.8: Smart hint system detecting gameplay errors client-side\r
 \r
 - 0.8: Make acceleration / deceleration play a role in swallow speed\r
+\r
+- 0.8: Does the "viewsize" cvar still need to be used for the HUD?\r