From fb50d2373a4f636c5d85dace52140ea7610c8c5a Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 18 Dec 2010 12:44:25 +0100 Subject: [PATCH] fix some issues with texture compression default --- qcsrc/menu/gamecommand.qc | 1 + qcsrc/menu/xonotic/dialog_settings_effects.c | 28 ------------------ qcsrc/menu/xonotic/util.qc | 31 ++++++++++++++++++++ 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/qcsrc/menu/gamecommand.qc b/qcsrc/menu/gamecommand.qc index 104c8840e..439a1b5c9 100644 --- a/qcsrc/menu/gamecommand.qc +++ b/qcsrc/menu/gamecommand.qc @@ -75,6 +75,7 @@ void GameCommand(string theCommand) if(argv(0) == "sync") { loadAllCvars(main); + updateCompression(); return; } diff --git a/qcsrc/menu/xonotic/dialog_settings_effects.c b/qcsrc/menu/xonotic/dialog_settings_effects.c index 19b232f8c..cd108f0be 100644 --- a/qcsrc/menu/xonotic/dialog_settings_effects.c +++ b/qcsrc/menu/xonotic/dialog_settings_effects.c @@ -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; diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index 1cb4cf50d..c968c60ac 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -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; + } +} -- 2.39.2