fallback to a default border bg if specified one cant be found
authorFruitieX <rasse@rasse-lappy.localdomain>
Wed, 7 Jul 2010 12:14:52 +0000 (15:14 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Wed, 7 Jul 2010 12:14:52 +0000 (15:14 +0300)
qcsrc/client/hud.qc
qcsrc/client/hud.qh

index 39470f38d4bec67bca9093b92db78463609e885b..2a5cf40e08ce648135c311fef61338e0eb0e79a7 100644 (file)
@@ -102,7 +102,6 @@ do {\
        }\
 } while(0)
 
-var string picpath;
 // draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
 #define drawpic_aspect_skin(pos,pic,sz,color,alpha,drawflag)\
 do{\
@@ -627,7 +626,7 @@ void HUD_Panel_HlBorder(float myBorder, vector color, float alpha)
 // draw the background/borders
 #define HUD_Panel_DrawBg(alpha)\
 if(panel_bg != "0")\
-       draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, strcat(hud_skin_path, "/", panel_bg), panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER));\
+       draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER));\
 if(highlightedPanel_prev == active_panel && autocvar__hud_configure)\
        HUD_Panel_HlBorder(panel_bg_border + 1.5 * hlBorderSize, '0 0.5 1', 0.25 * (1 - autocvar__menu_alpha) * alpha);
 
index 08e75273579d7e6626a92a77381e118887bdc4c6..71de37649be788746e3c0ea5a191b37e3b922557 100644 (file)
@@ -75,6 +75,8 @@ var float panel_accuracy_info_top;
 var float panel_accuracy_foreground_alpha;
 var float panel_accuracy_alreadyvoted_alpha;
 
+var string picpath;
+
 // Because calling lots of functions in QC apparently cuts fps in half on many machines:
 // ----------------------
 // MACRO HELL STARTS HERE
@@ -105,6 +107,10 @@ if(!autocvar__hud_configure && panel_bg_str == "0") {\
        } else {\
                panel_bg = panel_bg_str;\
        }\
+       panel_bg = strcat(hud_skin_path, "/", panel_bg);\
+       if(precache_pic(panel_bg) == "") {\
+               panel_bg = strcat("gfx/hud/default/", "border");\
+       }\
 }
 
 // Get value for panel_bg_color: if "" fetch default, else use panel_bg_color. Convert pants, shirt or teamcolor into a vector.