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