Allow users to enable high res textures, even if their default

value stats that they should be disabled.
This commit is contained in:
hiker 2015-01-22 09:18:22 +11:00
parent aab8066611
commit e17add7bc8
5 changed files with 21 additions and 10 deletions

View File

@ -443,9 +443,14 @@ namespace UserConfigParams
PARAM_PREFIX BoolUserConfigParam m_texture_compression
PARAM_DEFAULT(BoolUserConfigParam(true, "enable_texture_compression",
&m_video_group, "Enable Texture Compression"));
PARAM_PREFIX BoolUserConfigParam m_high_definition_textures
PARAM_DEFAULT(BoolUserConfigParam(true, "enable_high_definition_textures",
&m_video_group, "Enable high definition textures"));
/** This is a bit flag: bit 0: enabled (1) or disabled(0).
* Bit 1: setting done by default(0), or by user choice (2). This allows
* to e.g. disable h.d. textures on hd3000 as default, but still allow the
* user to enable it. */
PARAM_PREFIX IntUserConfigParam m_high_definition_textures
PARAM_DEFAULT(IntUserConfigParam(1, "enable_high_definition_textures",
&m_video_group, "Enable high definition textures. Bit flag: "
"bit 0 = enabled/disabled; bit 1 = set by user/set as default"));
PARAM_PREFIX BoolUserConfigParam m_glow
PARAM_DEFAULT(BoolUserConfigParam(false, "enable_glow",
&m_video_group, "Enable Glow"));

View File

@ -132,9 +132,12 @@ void CentralVideoSettings::init()
Log::info("GLDriver", "ARB Geometry Shader 4 Present");
}
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_HIGHDEFINITION_TEXTURES))
// Only unset the high def textures if they are set as default. If the
// user has enabled them (bit 1 set), then leave them enabled.
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_HIGHDEFINITION_TEXTURES) &&
(UserConfigParams::m_high_definition_textures & 0x02) == 0)
{
UserConfigParams::m_high_definition_textures = false;
UserConfigParams::m_high_definition_textures = 0x00;
}
// Specific disablement

View File

@ -1089,7 +1089,7 @@ std::string FileManager::getTextureCacheLocation(const std::string& filename)
parent_dir = parent_dir.substr(0, parent_dir.size() - 1);
parent_dir = StringUtils::getBasename(parent_dir);
std::string cache_subdir = UserConfigParams::m_high_definition_textures
std::string cache_subdir = (UserConfigParams::m_high_definition_textures & 0x01) == 0x01
? "hd/"
: "resized/";
std::string cached_file =

View File

@ -55,7 +55,8 @@ void CustomVideoSettingsDialog::beforeAddingWidgets()
getWidget<CheckBoxWidget>("anim_gfx")->setState(UserConfigParams::m_graphical_effects);
getWidget<CheckBoxWidget>("weather_gfx")->setState(UserConfigParams::m_weather_effects);
getWidget<CheckBoxWidget>("dof")->setState(UserConfigParams::m_dof);
getWidget<CheckBoxWidget>("hd-textures")->setState(UserConfigParams::m_high_definition_textures);
getWidget<CheckBoxWidget>("hd-textures")
->setState((UserConfigParams::m_high_definition_textures & 0x01)==0x01);
SpinnerWidget* kart_anim = getWidget<SpinnerWidget>("steering_animations");
kart_anim->addLabel(_("Disabled")); // 0
@ -168,8 +169,10 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s
UserConfigParams::m_weather_effects =
getWidget<CheckBoxWidget>("weather_gfx")->getState();
// Set bit 0 for enabled/disabled, and set bit 1 to indicate that this
// is now a user's choice and should not be overwritten by any default
UserConfigParams::m_high_definition_textures =
getWidget<CheckBoxWidget>("hd-textures")->getState();
getWidget<CheckBoxWidget>("hd-textures")->getState() ? 0x03 : 0x02;
UserConfigParams::m_show_steering_animations =
getWidget<SpinnerWidget>("steering_animations")->getValue();

View File

@ -961,7 +961,7 @@ bool Track::loadMainTrack(const XMLNode &root)
scene::IMesh *mesh;
// If the hd texture option is disabled, we generate smaller textures
// and configure the path to them before loading the mesh.
if (!UserConfigParams::m_high_definition_textures)
if ( (UserConfigParams::m_high_definition_textures & 0x01) == 0x00)
{
std::string cached_textures_dir =
irr_driver->generateSmallerTextures(m_root);
@ -1639,7 +1639,7 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
// If the hd texture option is disabled, we generate smaller textures
// and we also add the cache directory to the texture search path
if (!UserConfigParams::m_high_definition_textures)
if ( (UserConfigParams::m_high_definition_textures & 0x01) == 0x00)
{
std::string cached_textures_dir =
irr_driver->generateSmallerTextures(m_root);