]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Allow multiple gfx/hud/ subfolders and a cvar to choose which is in use
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 3 Feb 2013 00:04:12 +0000 (02:04 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 3 Feb 2013 00:04:12 +0000 (02:04 +0200)
data/hudVT.cfg
data/qcsrc/client/Main.qc
data/qcsrc/client/hud.qc
data/qcsrc/client/radar.qc

index de8d9bfdc1f2abd6768fdbaed626dffd4b586bec..4d3267e0aac26762798e172ff2d1ce3930d4aa83 100644 (file)
@@ -1,6 +1,8 @@
 // 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_style default // which subfolder to use for HUD images in gfx/hud/\r
+\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
index b3aeb438617715a115e8a98ca6539804d230f692..b1ae0350a9ad380178e563b96f6ebedfb3bc6c8e 100644 (file)
@@ -176,9 +176,10 @@ void CSQC_Init(void)
                else\r
                        get_mi_min_max_texcoords(0); // load new texcoords\r
        }\r
-       precache_pic("gfx/hud/bg_radar.tga");\r
-       precache_pic("gfx/hud/fg_radar.tga");\r
-       precache_pic("gfx/hud/fg_radar_team.tga");\r
+\r
+       precache_pic(strcat("gfx/hud/", cvar_string("hud_style"), "/bg_radar.tga"));\r
+       precache_pic(strcat("gfx/hud/", cvar_string("hud_style"), "/fg_radar.tga"));\r
+       precache_pic(strcat("gfx/hud/", cvar_string("hud_style"), "/fg_radar_team.tga"));\r
 \r
        mi_center = (mi_min + mi_max) * 0.5;\r
        mi_scale = mi_max - mi_min;\r
index f0f8b116ace17e6061e7867cf4a8a1eda7e2bb92..04a51543c3df0dba2938c831043f4ff6542b026b 100644 (file)
@@ -801,6 +801,12 @@ vector Sbar_ColorFade(vector target_color)
        return colorfade_current;\r
 }\r
 \r
+string Sbar_GetTexture(string img)\r
+{\r
+       string path = cvar_string("hud_style");\r
+       return strcat("gfx/hud/", path, "/", img);\r
+}\r
+\r
 float xmin, xmax, ymin, ymax, sbwidth;\r
 float sbar_fixscoreboardcolumnwidth_len;\r
 float sbar_fixscoreboardcolumnwidth_iconlen;\r
@@ -1058,7 +1064,7 @@ void Sbar_PrintStomachboardItem(entity pl, vector position, vector dimensions)
                                drawcolorcodedstring(pos, textShortenToWidth("self", sz_x, font_sz, stringwidth_colors), font_sz, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                        else\r
                        {\r
-                               drawpic(pos, "gfx/hud/sb_health", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                               drawpic(pos, Sbar_GetTexture("sb_health"), sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 \r
                                pos_x = position_x + dimensions_x * cvar("hud_item_preylist_health_text_location");\r
                                sz_x = dimensions_x * cvar("hud_item_preylist_health_text_length");\r
@@ -1134,7 +1140,7 @@ vector Sbar_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_si
        tmp_y = 1.25 * sbar_fontsize_y;\r
 \r
        // rounded header\r
-       drawpic(pos, "gfx/hud/sb_scoreboard_tableheader", tmp, (rgb * sbar_color_bg_team) + '0.5 0.5 0.5', sbar_scoreboard_alpha_bg, DRAWFLAG_NORMAL);\r
+       drawpic(pos, Sbar_GetTexture("sb_scoreboard_tableheader"), tmp, (rgb * sbar_color_bg_team) + '0.5 0.5 0.5', sbar_scoreboard_alpha_bg, DRAWFLAG_NORMAL);\r
 \r
        // table border\r
        tmp_y += sbar_border_thickness;\r
@@ -1150,7 +1156,7 @@ vector Sbar_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_si
 \r
        // table background\r
        tmp_y = body_table_height;\r
-       drawpic_tiled(pos, "gfx/hud/sb_scoreboard_bg", bg_size, tmp, rgb * sbar_color_bg_team, sbar_scoreboard_alpha_bg, DRAWFLAG_NORMAL);\r
+       drawpic_tiled(pos, Sbar_GetTexture("sb_scoreboard_bg"), bg_size, tmp, rgb * sbar_color_bg_team, sbar_scoreboard_alpha_bg, DRAWFLAG_NORMAL);\r
 \r
        // anyway, apply some color\r
        //drawfill(pos, tmp + '2 0 0', rgb, 0.1, DRAWFLAG_NORMAL);\r
@@ -1285,7 +1291,7 @@ vector Sbar_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        tmp_x = sbwidth;\r
        tmp_y = height * rows;\r
 \r
-       drawpic_tiled(pos, "gfx/hud/sb_scoreboard_bg", bg_size, tmp, rgb * sbar_color_bg_team, sbar_scoreboard_alpha_bg, DRAWFLAG_NORMAL);\r
+       drawpic_tiled(pos, Sbar_GetTexture("sb_scoreboard_bg"), bg_size, tmp, rgb * sbar_color_bg_team, sbar_scoreboard_alpha_bg, DRAWFLAG_NORMAL);\r
        drawborderlines(sbar_accuracy_border_thickness, pos, tmp, '0 0 0', sbar_scoreboard_alpha_bg * 0.75, DRAWFLAG_NORMAL);\r
 \r
        // column highlighting\r
@@ -1335,7 +1341,7 @@ vector Sbar_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
                        weapon_alpha = 0.2 * sbar_scoreboard_alpha_fg;\r
 \r
                // weapon icon\r
-               drawpic(pos, strcat("gfx/hud/inv_weapon", self.netname), '1 0 0' * sbwidth * (1/weapon_cnt) + '0 1 0' * height * (2/3), '1 1 1', weapon_alpha, DRAWFLAG_NORMAL);\r
+               drawpic(pos,  Sbar_GetTexture(strcat("inv_weapon", self.netname)), '1 0 0' * sbwidth * (1/weapon_cnt) + '0 1 0' * height * (2/3), '1 1 1', weapon_alpha, DRAWFLAG_NORMAL);\r
                // the accuracy\r
                if(weapon_damage) {\r
                        weapons_with_stats += 1;\r
@@ -1400,7 +1406,7 @@ vector Sbar_DrawScoreboardRankings(vector pos, entity pl,  vector rgb, vector bg
        tmp_x = sbwidth;\r
        tmp_y = sbar_fontsize_y * RANKINGS_RECEIVED_CNT;\r
 \r
-       drawpic_tiled(pos, "gfx/hud/sb_scoreboard_bg", bg_size, tmp, rgb * sbar_color_bg_team, sbar_scoreboard_alpha_bg, DRAWFLAG_NORMAL);\r
+       drawpic_tiled(pos, Sbar_GetTexture("sb_scoreboard_bg"), bg_size, tmp, rgb * sbar_color_bg_team, sbar_scoreboard_alpha_bg, DRAWFLAG_NORMAL);\r
        drawborderlines(sbar_border_thickness, pos, tmp, '0 0 0', sbar_scoreboard_alpha_bg * 0.75, DRAWFLAG_NORMAL);\r
 \r
        // row highlighting\r
@@ -1494,7 +1500,7 @@ void Sbar_DrawScoreboard()
 \r
        // Draw the scoreboard\r
        vector bg_size;\r
-       bg_size = drawgetimagesize("gfx/hud/sb_scoreboard_bg");\r
+       bg_size = drawgetimagesize(Sbar_GetTexture("sb_scoreboard_bg"));\r
 \r
        if(teamplay)\r
        {\r
@@ -1758,9 +1764,9 @@ string GetAmmoPicture(float i)
        {\r
                case 0:\r
                        if(getstati(STAT_ITEMS) & IT_FUEL_REGEN)\r
-                               return "gfx/hud/sb_fuel_regen";\r
+                               return Sbar_GetTexture("sb_fuel_regen");\r
                        else\r
-                               return "gfx/hud/sb_fuel";\r
+                               return Sbar_GetTexture("sb_fuel");\r
                default:\r
                        return "";\r
        }\r
@@ -1830,20 +1836,20 @@ void Sbar_DrawRaceStatus(vector pos)
        rankname = race_PlaceName(rank);\r
 \r
        if(race_status == 0)\r
-               drawpic(pos, "gfx/hud/race/newfail", '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
+               drawpic(pos, Sbar_GetTexture("race/newfail"), '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
        else if(race_status == 1) {\r
-               drawpic(pos, "gfx/hud/race/newtime", '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);   \r
+               drawpic(pos, Sbar_GetTexture("race/newtime"), '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);  \r
                drawcolorcodedstring(pos + '40 80 0' - '1 0 0' * stringwidth(s, TRUE, '5 0 0'), s, '10 10 0', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
                drawstring(pos + '40 20 0' - '1 0 0' * stringwidth(rankname, TRUE, '7 0 0'), rankname, '14 14 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
        } else if(race_status == 2) {\r
                if(race_status_name == GetPlayerName(player_localentnum -1) || !race_myrank || race_myrank < rank)\r
-                       drawpic(pos, "gfx/hud/race/newrankgreen", '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
+                       drawpic(pos, Sbar_GetTexture("race/newrankgreen"), '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
                else\r
-                       drawpic(pos, "gfx/hud/race/newrankyellow", '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
+                       drawpic(pos, Sbar_GetTexture("race/newrankyellow"), '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
                drawcolorcodedstring(pos + '40 80 0' - '1 0 0' * stringwidth(s, TRUE, '5 0 0'), s, '10 10 0', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
                drawstring(pos + '40 20 0' - '1 0 0' * stringwidth(rankname, TRUE, '7 0 0'), rankname, '14 14 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
        } else if(race_status == 3) {\r
-               drawpic(pos, "gfx/hud/race/newrecordserver", '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
+               drawpic(pos, Sbar_GetTexture("race/newrecordserver"), '80 80 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
                drawcolorcodedstring(pos + '40 80 0' - '1 0 0' * stringwidth(s, TRUE, '5 0 0'), s, '10 10 0', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
                drawstring(pos + '40 20 0' - '1 0 0' * stringwidth(rankname, TRUE, '7 0 0'), rankname, '14 14 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);\r
        }\r
@@ -2160,13 +2166,13 @@ void Sbar_Status()
        x = armor;\r
        if (x > 0)\r
        {\r
-               Sbar_DrawPic("gfx/hud/sb_armor", stov(cvar_string("hud_item_armor_icon_position")), stov(cvar_string("hud_item_armor_icon_scale")), FALSE);\r
+               Sbar_DrawPic(Sbar_GetTexture("sb_armor"), stov(cvar_string("hud_item_armor_icon_position")), stov(cvar_string("hud_item_armor_icon_scale")), FALSE);\r
                Sbar_DrawXNum(stov(cvar_string("hud_item_armor_text_position")), x, 3, 0, cvar("hud_item_armor_text_scale"), Sbar_NumColor(x), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
        }\r
 \r
        // health\r
        x = health;\r
-       Sbar_DrawPic("gfx/hud/sb_health", stov(cvar_string("hud_item_health_icon_position")), stov(cvar_string("hud_item_health_icon_scale")), FALSE);\r
+       Sbar_DrawPic(Sbar_GetTexture("sb_health"), stov(cvar_string("hud_item_health_icon_position")), stov(cvar_string("hud_item_health_icon_scale")), FALSE);\r
        Sbar_DrawXNum(stov(cvar_string("hud_item_health_text_position")), x, 3, 0, cvar("hud_item_health_text_scale"), Sbar_NumColor(x), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 \r
        // if we are dead, we can skip the HUD from here\r
@@ -2218,7 +2224,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/sb_activeweapon_", e.netname), stov(cvar_string("hud_item_weapon_position")), stov(cvar_string("hud_item_weapon_scale")), FALSE);\r
+               Sbar_DrawPic(Sbar_GetTexture(strcat("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
@@ -2260,7 +2266,7 @@ void Sbar_Timer()
                seconds = secondsLeft;\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
+       Sbar_DrawPic(Sbar_GetTexture("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
        if(seconds < 10)\r
@@ -2335,14 +2341,14 @@ void Sbar_Ring()
 \r
        if(text1_msg != "" && cvar("sbar_ring1"))\r
        {\r
-               DrawCircleClippedPic(ring_pos, ring1_size, "gfx/hud/sb_ring.tga", ring1_clip, ring1_color, ring1_alpha, DRAWFLAG_ADDITIVE);\r
+               DrawCircleClippedPic(ring_pos, ring1_size, Sbar_GetTexture("sb_ring.tga"), ring1_clip, ring1_color, ring1_alpha, DRAWFLAG_ADDITIVE);\r
                text_pos_x = ring_pos_x - stringwidth(text1_msg, FALSE, text1_size) / 2;\r
                text_pos_y = ring_pos_y - ring1_size / 2;\r
                drawstring(text_pos, text1_msg, text1_size, ring1_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
        }\r
        if(text2_msg != "" && cvar("sbar_ring2"))\r
        {\r
-               DrawCircleClippedPic(ring_pos, ring2_size, "gfx/hud/sb_ring.tga", ring2_clip, ring2_color, ring2_alpha, DRAWFLAG_ADDITIVE);\r
+               DrawCircleClippedPic(ring_pos, ring2_size, Sbar_GetTexture("sb_ring.tga"), ring2_clip, ring2_color, ring2_alpha, DRAWFLAG_ADDITIVE);\r
                text_pos_x = ring_pos_x - stringwidth(text2_msg, FALSE, text2_size) / 2;\r
                text_pos_y = ring_pos_y + ring1_size / 2;\r
                drawstring(text_pos, text2_msg, text2_size, ring2_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
@@ -2374,18 +2380,18 @@ void CSQC_Strength_Timer() {
                {\r
                        if(dt < 5)\r
                        {\r
-                               drawpic_expanding_two(pos, "gfx/hud/sb_str", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE,\r
+                               drawpic_expanding_two(pos, Sbar_GetTexture("sb_str"), sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE,\r
                                        bound(0, (ceil(dt) - dt) / 0.5, 1));\r
                        }\r
                        else\r
                        {\r
-                               drawpic(pos, "gfx/hud/sb_str", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE);\r
+                               drawpic(pos, Sbar_GetTexture("sb_str"), sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE);\r
                        }\r
                        Sbar_DrawXNum(stov(cvar_string("hud_item_strength_text_position")), ceil(dt), 2, 0, cvar("hud_item_strength_text_scale"), '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                }\r
                else if(dt > -1)\r
                {\r
-                       drawpic_expanding(pos, "gfx/hud/sb_str", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE,\r
+                       drawpic_expanding(pos, Sbar_GetTexture("sb_str"), sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE,\r
                                bound(0, -dt / 0.5, 1));\r
                }\r
        }\r
@@ -2400,18 +2406,18 @@ void CSQC_Strength_Timer() {
                {\r
                        if(dt < 5)\r
                        {\r
-                               drawpic_expanding_two(pos, "gfx/hud/sb_invinc", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE,\r
+                               drawpic_expanding_two(pos, Sbar_GetTexture("sb_invinc"), sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE,\r
                                        bound(0, (ceil(dt) - dt) / 0.5, 1));\r
                        }\r
                        else\r
                        {\r
-                               drawpic(pos, "gfx/hud/sb_invinc", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE);\r
+                               drawpic(pos, Sbar_GetTexture("sb_invinc"), sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE);\r
                        }\r
                        Sbar_DrawXNum(stov(cvar_string("hud_item_invincible_text_position")), ceil(dt), 2, 0, cvar("hud_item_invincible_text_scale"), '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                }\r
                else if(dt > -1)\r
                {\r
-                       drawpic_expanding(pos, "gfx/hud/sb_invinc", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE,\r
+                       drawpic_expanding(pos, Sbar_GetTexture("sb_invinc"), sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE,\r
                                bound(0, -dt / 0.5, 1));\r
                }\r
        }\r
@@ -2625,13 +2631,13 @@ void Sbar_DrawPressedKeys(void)
        pos -= '-15 -6 0'; // adjust to the origin of these numbers\r
 \r
        pressedkeys = getstatf(STAT_PRESSED_KEYS);\r
-       drawpic(pos + '-15   -6   0', "gfx/hud/keys/key_bg.tga",           bgsize, '1 1 1', 0.1 * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-       drawpic(pos + ' 83.5  9   0', ((pressedkeys & KEY_CROUCH) ? "gfx/hud/keys/key_crouch_inv.tga" : "gfx/hud/keys/key_crouch.tga"), ' 24 24 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-       drawpic(pos + ' 32   -1.5 0', ((pressedkeys & KEY_FORWARD) ? "gfx/hud/keys/key_forward_inv.tga" : "gfx/hud/keys/key_forward.tga"),  ' 32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-       drawpic(pos + '-11.5  9   0', ((pressedkeys & KEY_JUMP) ? "gfx/hud/keys/key_jump_inv.tga" : "gfx/hud/keys/key_jump.tga"),     ' 24 24 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-       drawpic(pos + ' -1   32   0', ((pressedkeys & KEY_LEFT) ? "gfx/hud/keys/key_left_inv.tga" : "gfx/hud/keys/key_left.tga"),     ' 32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-       drawpic(pos + ' 32   32   0', ((pressedkeys & KEY_BACKWARD) ? "gfx/hud/keys/key_backward_inv.tga" : "gfx/hud/keys/key_backward.tga"), ' 32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-       drawpic(pos + ' 65   32   0', ((pressedkeys & KEY_RIGHT) ? "gfx/hud/keys/key_right_inv.tga" : "gfx/hud/keys/key_right.tga"),    ' 32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+       drawpic(pos + '-15   -6   0', Sbar_GetTexture("keys/key_bg.tga"),           bgsize, '1 1 1', 0.1 * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+       drawpic(pos + ' 83.5  9   0', Sbar_GetTexture((pressedkeys & KEY_CROUCH) ? "keys/key_crouch_inv.tga" : "keys/key_crouch.tga"), ' 24 24 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+       drawpic(pos + ' 32   -1.5 0', Sbar_GetTexture((pressedkeys & KEY_FORWARD) ? "keys/key_forward_inv.tga" : "keys/key_forward.tga"),  ' 32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+       drawpic(pos + '-11.5  9   0', Sbar_GetTexture((pressedkeys & KEY_JUMP) ? "keys/key_jump_inv.tga" : "keys/key_jump.tga"),     ' 24 24 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+       drawpic(pos + ' -1   32   0', Sbar_GetTexture((pressedkeys & KEY_LEFT) ? "keys/key_left_inv.tga" : "keys/key_left.tga"),     ' 32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+       drawpic(pos + ' 32   32   0', Sbar_GetTexture((pressedkeys & KEY_BACKWARD) ? "keys/key_backward_inv.tga" : "keys/key_backward.tga"), ' 32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+       drawpic(pos + ' 65   32   0', Sbar_GetTexture((pressedkeys & KEY_RIGHT) ? "keys/key_right_inv.tga" : "keys/key_right.tga"),    ' 32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 }\r
 \r
 void Sbar_ShowSpeed(void)\r
@@ -2725,9 +2731,9 @@ void Sbar_ShowAcceleration(void)
        }\r
                \r
        if (acceleration > 0)\r
-               drawpic(pos, "gfx/hud/accelerometer_gradient", acceleration * scale * '40 0 0' + sz * '0 1 0', rgb, alpha * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+               drawpic(pos, Sbar_GetTexture("accelerometer_gradient"), acceleration * scale * '40 0 0' + sz * '0 1 0', rgb, alpha * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
        else if (acceleration < 0)\r
-               drawpic(pos + acceleration * scale * '40 0 0', "gfx/hud/accelerometer_gradient", -acceleration * scale * '40 0 0' + sz * '0 1 0', rgb, alpha * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+               drawpic(pos + acceleration * scale * '40 0 0', Sbar_GetTexture("accelerometer_gradient"), -acceleration * scale * '40 0 0' + sz * '0 1 0', rgb, alpha * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 }\r
 \r
 void Sbar_DrawAccuracyStats_Description_Hitscan(vector position)\r
@@ -2836,11 +2842,11 @@ void Sbar_DrawAccuracyStats()
                                pos_y = top_border_splash + row_splash * (fill_size_y + row_margin);\r
 \r
                                // background\r
-                               drawpic(pos, "gfx/hud/sb_accuracy", fill_size , fill_colour, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
+                               drawpic(pos, Sbar_GetTexture("sb_accuracy"), fill_size , fill_colour, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
                                drawborderlines(sbar_border_thickness, pos, fill_size, border_colour, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
 \r
                                // the weapon\r
-                               drawpic(pos, strcat("gfx/hud/inv_weapon", self.netname), '1 0.5 0' * fill_size_x , '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                               drawpic(pos, Sbar_GetTexture("inv_weapon"), self.netname), '1 0.5 0' * fill_size_x , '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 \r
                                // the amount of shots fired or max damage\r
                                drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 3 0' * sbar_fontsize_y, ftos(weapon_damage), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
@@ -2888,11 +2894,11 @@ void Sbar_DrawAccuracyStats()
                                pos_y = top_border_hitscan + row_hitscan * (fill_size_y + row_margin);\r
 \r
                                // background\r
-                               drawpic(pos, "gfx/hud/sb_accuracy", fill_size , fill_colour, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
+                               drawpic(pos, Sbar_GetTexture("sb_accuracy"), fill_size , fill_colour, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
                                drawborderlines(sbar_border_thickness, pos, fill_size, border_colour, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
 \r
                                // the weapon\r
-                               drawpic(pos, strcat("gfx/hud/inv_weapon", self.netname), '1 0.5 0' * fill_size_x , '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                               drawpic(pos, Sbar_GetTexture(strcat("inv_weapon", self.netname)), '1 0.5 0' * fill_size_x , '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 \r
                                // the amount of shots fired or max damage\r
                                drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 3 0' * sbar_fontsize_y, ftos(weapon_damage), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
@@ -3144,7 +3150,7 @@ void Sbar_Draw (void)
 \r
                vector voteorigin = bottomright - '290 135 0';\r
                vector votesize = '280 70 0';\r
-               drawpic(voteorigin, "gfx/hud/voteprogress_back", votesize, color, a * sbar_alpha_bg, DRAWFLAG_NORMAL);\r
+               drawpic(voteorigin, Sbar_GetTexture("voteprogress_back"), votesize, color, a * sbar_alpha_bg, DRAWFLAG_NORMAL);\r
 \r
                s = "A vote has been called for: ";\r
                drawstring(voteorigin + '0.5 0 0' * votesize_x + '0 0.1 0' * votesize_y - '1 0 0' * stringwidth(s, FALSE, '6 0 0'), s, '12 12 0', '1 1 1', a * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
@@ -3159,19 +3165,19 @@ void Sbar_Draw (void)
 \r
                // draw the progress bars\r
                drawsetcliparea(voteorigin_x, voteorigin_y, votesize_x * 0.5 * (vote_yescount/vote_needed), votesize_y);\r
-               drawpic(voteorigin, "gfx/hud/voteprogress_prog", votesize, '0 1 0', a * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+               drawpic(voteorigin, Sbar_GetTexture("voteprogress_prog"), votesize, '0 1 0', a * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 \r
                drawsetcliparea(voteorigin_x + votesize_x - votesize_x * 0.5 * (vote_nocount/vote_needed), voteorigin_y, votesize_x * 0.5, votesize_y);\r
-               drawpic(voteorigin, "gfx/hud/voteprogress_prog", votesize, '1 0 0', a * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+               drawpic(voteorigin, Sbar_GetTexture("voteprogress_prog"), votesize, '1 0 0', a * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
 \r
                // draw the highlights\r
                if(vote_highlighted == 1) {\r
                        drawsetcliparea(voteorigin_x, voteorigin_y, votesize_x * 0.5, votesize_y);\r
-                       drawpic(voteorigin, "gfx/hud/voteprogress_voted", votesize, '0 1 0', a * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                       drawpic(voteorigin, Sbar_GetTexture("voteprogress_voted"), votesize, '0 1 0', a * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                }\r
                else if(vote_highlighted == 2) {\r
                        drawsetcliparea(voteorigin_x + 0.5 * votesize_x, voteorigin_y, votesize_x * 0.5, votesize_y);\r
-                       drawpic(voteorigin, "gfx/hud/voteprogress_voted", votesize, '1 0 0', a * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                       drawpic(voteorigin, Sbar_GetTexture("voteprogress_voted"), votesize, '1 0 0', a * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                }\r
 \r
                drawresetcliparea();\r
@@ -3223,8 +3229,8 @@ void Sbar_Draw (void)
                        if(getstati(STAT_ARMOR) < g_power)\r
                        {\r
                                // subsystems are down\r
-                               drawpic(warn_pos - '128 0 0', "gfx/hud/sb_power_fail", '256 256 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-                               drawpic(warn_pos - '16 0 0' + '0 150 0', "gfx/hud/sb_power_fail_icon", '32 32 0', '1 1 1', sbar_alpha_fg * (0.5 + sin(time * 5) / 2), DRAWFLAG_NORMAL);\r
+                               drawpic(warn_pos - '128 0 0', Sbar_GetTexture("sb_power_fail"), '256 256 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                               drawpic(warn_pos - '16 0 0' + '0 150 0', Sbar_GetTexture("sb_power_fail_icon"), '32 32 0', '1 1 1', sbar_alpha_fg * (0.5 + sin(time * 5) / 2), DRAWFLAG_NORMAL);\r
                                power_boot = time + g_power_reboot;\r
                                Sbar_Portrait(); // draw the portrait still\r
                                return; // skip drawing the HUD\r
@@ -3232,8 +3238,8 @@ void Sbar_Draw (void)
                        else if(time <= power_boot)\r
                        {\r
                                // subsystems are rebooting\r
-                               drawpic(warn_pos - '128 0 0', "gfx/hud/sb_power_reboot", '256 256 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-                               drawpic(warn_pos - '16 0 0' + '0 150 0', "gfx/hud/sb_power_reboot_icon", '32 32 0', '1 1 1', sbar_alpha_fg * (0.5 + sin(time * 5) / 2), DRAWFLAG_NORMAL);\r
+                               drawpic(warn_pos - '128 0 0', Sbar_GetTexture("sb_power_reboot"), '256 256 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                               drawpic(warn_pos - '16 0 0' + '0 150 0', Sbar_GetTexture("sb_power_reboot_icon"), '32 32 0', '1 1 1', sbar_alpha_fg * (0.5 + sin(time * 5) / 2), DRAWFLAG_NORMAL);\r
                                Sbar_Portrait(); // draw the portrait still\r
                                return; // skip drawing the HUD\r
                        }\r
@@ -3268,11 +3274,11 @@ void Sbar_Draw (void)
                        Sbar_DrawString(status_text, status_pos, status_size);\r
 \r
                        if(getstati(STAT_VORE_DIGESTING)) // we are currently digesting\r
-                               Sbar_DrawPic("gfx/hud/sb_digestion_active", stov(cvar_string("hud_item_digestion_icon_position")), stov(cvar_string("hud_item_digestion_icon_scale")), FALSE);\r
+                               Sbar_DrawPic(Sbar_GetTexture("sb_digestion_active"), stov(cvar_string("hud_item_digestion_icon_position")), stov(cvar_string("hud_item_digestion_icon_scale")), FALSE);\r
                        else if(stomach_load) // we can digest at this time\r
-                               Sbar_DrawPic("gfx/hud/sb_digestion_possible", stov(cvar_string("hud_item_digestion_icon_position")), stov(cvar_string("hud_item_digestion_icon_scale")), FALSE);\r
+                               Sbar_DrawPic(Sbar_GetTexture("sb_digestion_possible"), stov(cvar_string("hud_item_digestion_icon_position")), stov(cvar_string("hud_item_digestion_icon_scale")), FALSE);\r
                        else // we cannot digest at this time\r
-                               Sbar_DrawPic("gfx/hud/sb_digestion_impossible", stov(cvar_string("hud_item_digestion_icon_position")), stov(cvar_string("hud_item_digestion_icon_scale")), FALSE);\r
+                               Sbar_DrawPic(Sbar_GetTexture("sb_digestion_impossible"), stov(cvar_string("hud_item_digestion_icon_position")), stov(cvar_string("hud_item_digestion_icon_scale")), FALSE);\r
 \r
                        // draw the stomach board player list\r
                        entity pl, pred;\r
@@ -3413,25 +3419,25 @@ void CSQC_ctf_hud(void)
        float red_alpha, red_alpha_prevstatus;\r
        red_alpha = red_alpha_prevstatus = 1;\r
        switch(redflag) {\r
-               case 1: red_icon = "gfx/hud/sb_flag_red_taken"; break;\r
-               case 2: red_icon = "gfx/hud/sb_flag_red_lost"; break;\r
-               case 3: red_icon = "gfx/hud/sb_flag_red_carrying"; red_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;\r
+               case 1: red_icon = Sbar_GetTexture("sb_flag_red_taken"); break;\r
+               case 2: red_icon = Sbar_GetTexture("sb_flag_red_lost"); break;\r
+               case 3: red_icon = Sbar_GetTexture("sb_flag_red_carrying"); red_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;\r
                default:\r
                        if((stat_items & IT_CTF_SHIELDED) && (myteam == COLOR_TEAM2))\r
-                               red_icon = "gfx/hud/sb_flag_red_shielded";\r
+                               red_icon = Sbar_GetTexture("sb_flag_red_shielded");\r
                        else\r
                                red_icon = string_null;\r
                        break;\r
        }\r
        switch(redflag_prevstatus) {\r
-               case 1: red_icon_prevstatus = "gfx/hud/sb_flag_red_taken"; break;\r
-               case 2: red_icon_prevstatus = "gfx/hud/sb_flag_red_lost"; break;\r
-               case 3: red_icon_prevstatus = "gfx/hud/sb_flag_red_carrying"; red_alpha_prevstatus = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;\r
+               case 1: red_icon_prevstatus = Sbar_GetTexture("sb_flag_red_taken"); break;\r
+               case 2: red_icon_prevstatus = Sbar_GetTexture("sb_flag_red_lost"); break;\r
+               case 3: red_icon_prevstatus = Sbar_GetTexture("sb_flag_red_carrying"); red_alpha_prevstatus = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;\r
                default:\r
                        if(redflag == 3)\r
-                               red_icon_prevstatus = "gfx/hud/sb_flag_red_carrying"; // make it more visible\r
+                               red_icon_prevstatus = Sbar_GetTexture("sb_flag_red_carrying"); // make it more visible\r
                        else if((stat_items & IT_CTF_SHIELDED) && (myteam == COLOR_TEAM2))\r
-                               red_icon_prevstatus = "gfx/hud/sb_flag_red_shielded";\r
+                               red_icon_prevstatus = Sbar_GetTexture("sb_flag_red_shielded");\r
                        else\r
                                red_icon_prevstatus = string_null;\r
                        break;\r
@@ -3441,25 +3447,25 @@ void CSQC_ctf_hud(void)
        float blue_alpha, blue_alpha_prevstatus;\r
        blue_alpha = blue_alpha_prevstatus = 1;\r
        switch(blueflag) {\r
-               case 1: blue_icon = "gfx/hud/sb_flag_blue_taken"; break;\r
-               case 2: blue_icon = "gfx/hud/sb_flag_blue_lost"; break;\r
-               case 3: blue_icon = "gfx/hud/sb_flag_blue_carrying"; blue_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;\r
+               case 1: blue_icon = Sbar_GetTexture("sb_flag_blue_taken"); break;\r
+               case 2: blue_icon = Sbar_GetTexture("sb_flag_blue_lost"); break;\r
+               case 3: blue_icon = Sbar_GetTexture("sb_flag_blue_carrying"); blue_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;\r
                default:\r
                        if((stat_items & IT_CTF_SHIELDED) && (myteam == COLOR_TEAM1))\r
-                               blue_icon = "gfx/hud/sb_flag_blue_shielded";\r
+                               blue_icon = Sbar_GetTexture("sb_flag_blue_shielded");\r
                        else\r
                                blue_icon = string_null;\r
                        break;\r
        }\r
        switch(blueflag_prevstatus) {\r
-               case 1: blue_icon_prevstatus = "gfx/hud/sb_flag_blue_taken"; break;\r
-               case 2: blue_icon_prevstatus = "gfx/hud/sb_flag_blue_lost"; break;\r
-               case 3: blue_icon_prevstatus = "gfx/hud/sb_flag_blue_carrying"; blue_alpha_prevstatus = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;\r
+               case 1: blue_icon_prevstatus = Sbar_GetTexture("sb_flag_blue_taken"); break;\r
+               case 2: blue_icon_prevstatus = Sbar_GetTexture("sb_flag_blue_lost"); break;\r
+               case 3: blue_icon_prevstatus = Sbar_GetTexture("sb_flag_blue_carrying"); blue_alpha_prevstatus = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break;\r
                default:\r
                        if(blueflag == 3)\r
-                               blue_icon_prevstatus = "gfx/hud/sb_flag_blue_carrying"; // make it more visible\r
+                               blue_icon_prevstatus = Sbar_GetTexture("sb_flag_blue_carrying"); // make it more visible\r
                        else if((stat_items & IT_CTF_SHIELDED) && (myteam == COLOR_TEAM1))\r
-                               blue_icon_prevstatus = "gfx/hud/sb_flag_blue_shielded";\r
+                               blue_icon_prevstatus = Sbar_GetTexture("sb_flag_blue_shielded");\r
                        else\r
                                blue_icon_prevstatus = string_null;\r
                        break;\r
@@ -3567,16 +3573,16 @@ void CSQC_kh_hud(void)
                        switch(keyteam)\r
                        {\r
                                case COLOR_TEAM1:\r
-                                       drawpic (pa, "gfx/hud/sb_kh_redarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% alpha key\r
+                                       drawpic (pa, Sbar_GetTexture("sb_kh_redarrow"), kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% alpha key\r
                                        break;\r
                                case COLOR_TEAM2:\r
-                                       drawpic (pa, "gfx/hud/sb_kh_bluearrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% alpha key\r
+                                       drawpic (pa, Sbar_GetTexture("sb_kh_bluearrow"), kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% alpha key\r
                                        break;\r
                                case COLOR_TEAM3:\r
-                                       drawpic (pa, "gfx/hud/sb_kh_yellowarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% alpha key\r
+                                       drawpic (pa, Sbar_GetTexture("sb_kh_yellowarrow"), kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% alpha key\r
                                        break;\r
                                case COLOR_TEAM4:\r
-                                       drawpic (pa, "gfx/hud/sb_kh_pinkarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% alpha key\r
+                                       drawpic (pa, Sbar_GetTexture("sb_kh_pinkarrow"), kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% alpha key\r
                                        break;\r
                                default:\r
                                        break;\r
@@ -3584,16 +3590,16 @@ void CSQC_kh_hud(void)
                        switch(i) // YAY! switch(i) inside a for loop for i. DailyWTF, here we come!\r
                        {\r
                                case 0:\r
-                                       drawpic (p, "gfx/hud/sb_kh_red", kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% alpha key\r
+                                       drawpic (p, Sbar_GetTexture("sb_kh_red"), kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% alpha key\r
                                        break;\r
                                case 1:\r
-                                       drawpic (p, "gfx/hud/sb_kh_blue", kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% alpha key\r
+                                       drawpic (p, Sbar_GetTexture("sb_kh_blue"), kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% alpha key\r
                                        break;\r
                                case 2:\r
-                                       drawpic (p, "gfx/hud/sb_kh_yellow", kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% alpha key\r
+                                       drawpic (p, Sbar_GetTexture("sb_kh_yellow"), kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% alpha key\r
                                        break;\r
                                case 3:\r
-                                       drawpic (p, "gfx/hud/sb_kh_pink", kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% alpha key\r
+                                       drawpic (p, Sbar_GetTexture("sb_kh_pink"), kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% alpha key\r
                                        break;\r
                        }\r
                }\r
index 4350b0cb83c2c67f7d83ac42b3d980a25f6178ab..b9cdab9be65273ca0f5f84bef13f50f783c58327 100644 (file)
@@ -64,7 +64,7 @@ void draw_radar_background(float ca, float bg)
 \r
        if(bg > 0)\r
        {\r
-               R_BeginPolygon("gfx/hud/bg_radar.tga", 0);\r
+               R_BeginPolygon(strcat("gfx/hud/", cvar_string("hud_style"), "/bg_radar.tga"), 0);\r
                R_PolygonVertex(pos1, yinvert('0 1 0'), '1 1 1', bg);\r
                R_PolygonVertex(pos2, yinvert('1 1 0'), '1 1 1', bg);\r
                R_PolygonVertex(pos3, yinvert('1 0 0'), '1 1 1', bg);\r
@@ -106,14 +106,14 @@ void draw_radar_foreground(float fg)
 \r
        if(fg > 0)\r
        {\r
-               R_BeginPolygon("gfx/hud/fg_radar.tga", 0);\r
+               R_BeginPolygon(strcat("gfx/hud/", cvar_string("hud_style"), "/fg_radar.tga"), 0);\r
                R_PolygonVertex(pos1, yinvert('0 1 0'), '1 1 1', fg);\r
                R_PolygonVertex(pos2, yinvert('1 1 0'), '1 1 1', fg);\r
                R_PolygonVertex(pos3, yinvert('1 0 0'), '1 1 1', fg);\r
                R_PolygonVertex(pos4, yinvert('0 0 0'), '1 1 1', fg);\r
                R_EndPolygon();\r
 \r
-               R_BeginPolygon("gfx/hud/fg_radar_team.tga", 0);\r
+               R_BeginPolygon(strcat("gfx/hud/", cvar_string("hud_style"), "/fg_radar_team.tga"), 0);\r
                R_PolygonVertex(pos1, yinvert('0 1 0'), rgb, fg);\r
                R_PolygonVertex(pos2, yinvert('1 1 0'), rgb, fg);\r
                R_PolygonVertex(pos3, yinvert('1 0 0'), rgb, fg);\r