]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
autocvar_hud_skin's turn
authorterencehill <piuntn@gmail.com>
Thu, 4 Nov 2010 23:31:17 +0000 (00:31 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 4 Nov 2010 23:31:17 +0000 (00:31 +0100)
Also initialize hud_skin_path (zoning it!) when the HUD gets drawn

qcsrc/client/autocvars.qh
qcsrc/client/hud.qc

index 945b76d5f2f86b4bee4468e0989158e379a526c9..4d9b1cd40a9650cfa55a70f64b3b4a977e88dfe5 100644 (file)
@@ -25,7 +25,6 @@ var float autocvar_hud_configure_grid_alpha;
 var float autocvar__con_chat_maximized;
 var string autocvar__hud_panelorder;
 
-var string autocvar_hud_skin;
 var string autocvar_hud_dock;
 
 var float autocvar_hud_progressbar_alpha;
index ac1065ec6f562ec070a26a10328953f41b3db506..ee6d0e63919f1b39edee0451a1d4efebed4d2fed 100644 (file)
@@ -422,7 +422,8 @@ HUD panels
 void HUD_Panel_ExportCfg(string cfgname)
 {
        float fh;
-       fh = fopen(strcat("hud_", autocvar_hud_skin, "_", cfgname, ".cfg"), FILE_WRITE);
+       string filename = strcat("hud_", cvar_string("hud_skin"), "_", cfgname, ".cfg");
+       fh = fopen(filename, FILE_WRITE);
        if(fh >= 0)
        {
                HUD_Write_Cvar_q("hud_skin");
@@ -524,11 +525,11 @@ void HUD_Panel_ExportCfg(string cfgname)
                }
                HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
 
-               print("^2Successfully exported to hud_", autocvar_hud_skin, "_", cfgname, ".cfg! (Note: It's saved in data/data/)\n");
+               print("^2Successfully exported to ", filename, "! (Note: It's saved in data/data/)\n");
                fclose(fh);
        }
        else
-               print("^1Couldn't write to hud_", autocvar_hud_skin, "_", cfgname, ".cfg\n");
+               print("^1Couldn't write to ", filename, "\n");
 }
 
 const float hlBorderSize = 4;
@@ -4982,8 +4983,6 @@ switch (id) {\
 
 void HUD_Main (void)
 {
-       hud_skin_path = strcat("gfx/hud/", autocvar_hud_skin);
-
        // global hud alpha fade
        if(menu_enabled == 1)
                hud_fade_alpha = 1;
@@ -5004,6 +5003,12 @@ void HUD_Main (void)
                return;
 
        // Drawing stuff
+       if (hud_skin_path != cvar_string("hud_skin"))
+       {
+               if (hud_skin_path)
+                       strunzone(hud_skin_path);
+               hud_skin_path = strzone(strcat("gfx/hud/", cvar_string("hud_skin")));
+       }
 
        // HUD configure visible grid
        if(autocvar__hud_configure && autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)