From 4a15868c0e12a45d9178a9779d388b59a942dfab Mon Sep 17 00:00:00 2001 From: Thunderforge Date: Tue, 18 May 2021 18:05:54 -0500 Subject: [PATCH] Moving Lighting Method from Advanced -> Visuals to Graphics -> Lighting The plan is to add additional options to this new tab, and since it's of similar status as the Shaders settings, it makes sense to put them next to them on the Graphics page. --- apps/launcher/advancedpage.cpp | 10 ------- apps/launcher/graphicspage.cpp | 17 ++++++++++++ files/ui/advancedpage.ui | 30 -------------------- files/ui/graphicspage.ui | 50 ++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 40 deletions(-) diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp index 5199be07e6..ed36634b62 100644 --- a/apps/launcher/advancedpage.cpp +++ b/apps/launcher/advancedpage.cpp @@ -136,13 +136,6 @@ bool Launcher::AdvancedPage::loadSettings() loadSettingBool(activeGridObjectPagingCheckBox, "object paging active grid", "Terrain"); viewingDistanceComboBox->setValue(convertToCells(Settings::Manager::getInt("viewing distance", "Camera"))); - - int lightingMethod = 1; - if (Settings::Manager::getString("lighting method", "Shaders") == "legacy") - lightingMethod = 0; - else if (Settings::Manager::getString("lighting method", "Shaders") == "shaders") - lightingMethod = 2; - lightingMethodComboBox->setCurrentIndex(lightingMethod); } // Audio @@ -294,9 +287,6 @@ void Launcher::AdvancedPage::saveSettings() { Settings::Manager::setInt("viewing distance", "Camera", convertToUnits(viewingDistance)); } - - static std::array lightingMethodMap = {"legacy", "shaders compatibility", "shaders"}; - Settings::Manager::setString("lighting method", "Shaders", lightingMethodMap[lightingMethodComboBox->currentIndex()]); } // Audio diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 3bfd90fdeb..ebb031e9ef 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -92,6 +92,7 @@ bool Launcher::GraphicsPage::loadSettings() if (!setupSDL()) return false; + // Visuals if (Settings::Manager::getBool("vsync", "Video")) vSyncCheckBox->setCheckState(Qt::Checked); @@ -131,6 +132,15 @@ bool Launcher::GraphicsPage::loadSettings() framerateLimitSpinBox->setValue(fpsLimit); } + // Lighting + int lightingMethod = 1; + if (Settings::Manager::getString("lighting method", "Shaders") == "legacy") + lightingMethod = 0; + else if (Settings::Manager::getString("lighting method", "Shaders") == "shaders") + lightingMethod = 2; + lightingMethodComboBox->setCurrentIndex(lightingMethod); + + // Shadows if (Settings::Manager::getBool("actor shadows", "Shadows")) actorShadowsCheckBox->setCheckState(Qt::Checked); if (Settings::Manager::getBool("player shadows", "Shadows")) @@ -167,6 +177,8 @@ bool Launcher::GraphicsPage::loadSettings() void Launcher::GraphicsPage::saveSettings() { + // Visuals + // Ensure we only set the new settings if they changed. This is to avoid cluttering the // user settings file (which by definition should only contain settings the user has touched) bool cVSync = vSyncCheckBox->checkState(); @@ -219,6 +231,11 @@ void Launcher::GraphicsPage::saveSettings() Settings::Manager::setFloat("framerate limit", "Video", 0); } + // Lighting + static std::array lightingMethodMap = {"legacy", "shaders compatibility", "shaders"}; + Settings::Manager::setString("lighting method", "Shaders", lightingMethodMap[lightingMethodComboBox->currentIndex()]); + + // Shadows int cShadowDist = shadowDistanceCheckBox->checkState() != Qt::Unchecked ? shadowDistanceSpinBox->value() : 0; if (Settings::Manager::getInt("maximum shadow map distance", "Shadows") != cShadowDist) Settings::Manager::setInt("maximum shadow map distance", "Shadows", cShadowDist); diff --git a/files/ui/advancedpage.ui b/files/ui/advancedpage.ui index 645f8629f4..5859f1f382 100644 --- a/files/ui/advancedpage.ui +++ b/files/ui/advancedpage.ui @@ -444,36 +444,6 @@ - - - - - - Lighting Method: - - - - - - - - legacy - - - - - shaders compatibility - - - - - shaders - - - - - - diff --git a/files/ui/graphicspage.ui b/files/ui/graphicspage.ui index 5ec72611f8..508a955d7b 100644 --- a/files/ui/graphicspage.ui +++ b/files/ui/graphicspage.ui @@ -187,6 +187,56 @@ + + + Lighting + + + + + + + + Lighting Method: + + + + + + + + legacy + + + + + shaders compatibility + + + + + shaders + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + Shadows