]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix some issues with texture compression default
authorRudolf Polzer <divverent@alientrap.org>
Sat, 18 Dec 2010 11:44:25 +0000 (12:44 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 18 Dec 2010 11:44:25 +0000 (12:44 +0100)
qcsrc/menu/gamecommand.qc
qcsrc/menu/xonotic/dialog_settings_effects.c
qcsrc/menu/xonotic/util.qc

index 104c8840e58cda121daecb6afd36c6b68f2083cf..439a1b5c96b4428ac82623384dc208d73ea9bf54 100644 (file)
@@ -75,6 +75,7 @@ void GameCommand(string theCommand)
        if(argv(0) == "sync")
        {
                loadAllCvars(main);
+               updateCompression();
                return;
        }
 
index 19b232f8ca504f2abffc9e454be90f6b72292e0f..cd108f0be99679bac91121dcb170f5f430f127fd 100644 (file)
@@ -30,34 +30,6 @@ float someShadowCvarIsEnabled(entity box)
        return FALSE;
 }
 
-float updateCompression()
-{
-       float fh;
-       float have_dds, have_jpg, have_tga;
-       if((have_dds = ((fh = fopen("dds/particles/particlefont.dds", FILE_READ)) >= 0)))
-               fclose(fh);
-       if((have_jpg = ((fh = fopen("particles/particlefont.jpg", FILE_READ)) >= 0)))
-               fclose(fh);
-       if((have_tga = ((fh = fopen("particles/particlefont.tga", FILE_READ)) >= 0)))
-               fclose(fh);
-       if(have_dds && (have_jpg || have_tga))
-       {
-               cvar_set("gl_texturecompression", "0");
-               return 1;
-       }
-       else if(have_dds)
-       {
-               cvar_set("gl_texturecompression", "0");
-               cvar_set("r_texture_dds_load", "1");
-               return 0;
-       }
-       else
-       {
-               cvar_set("gl_texturecompression", cvar_string("r_texture_dds_load"));
-               return 2;
-       }
-}
-
 void XonoticEffectsSettingsTab_fill(entity me)
 {
        entity e, s;
index 1cb4cf50db979f0d7db77ef9c203a348f97bfa46..c968c60acc10154223c31c57bbb00d2d34137914 100644 (file)
@@ -454,3 +454,34 @@ string HUD_Panel_GetSettingName(float theSetting)
                default: return "";
        }
 }
+
+float updateCompression()
+{
+       float fh;
+       float have_dds, have_jpg, have_tga;
+       if((have_dds = ((fh = fopen("dds/particles/particlefont.dds", FILE_READ)) >= 0)))
+               fclose(fh);
+       if((have_jpg = ((fh = fopen("particles/particlefont.jpg", FILE_READ)) >= 0)))
+               fclose(fh);
+       if((have_tga = ((fh = fopen("particles/particlefont.tga", FILE_READ)) >= 0)))
+               fclose(fh);
+       if(have_dds && (have_jpg || have_tga))
+       {
+               // both? Let's only use good quality precompressed files
+               cvar_set("gl_texturecompression", "0");
+               return 1;
+       }
+       else if(have_dds)
+       {
+               // DDS only? We probably always want texture compression
+               cvar_set("gl_texturecompression", "1");
+               cvar_set("r_texture_dds_load", "1");
+               return 0;
+       }
+       else
+       {
+               // TGA only? Allow runtime compression
+               cvar_set("gl_texturecompression", cvar_string("r_texture_dds_load"));
+               return 2;
+       }
+}