summaryrefslogtreecommitdiffstats
path: root/src/core/re3.cpp
diff options
context:
space:
mode:
authorerorcun <erayorcunus@gmail.com>2020-11-07 21:51:07 +0100
committerGitHub <noreply@github.com>2020-11-07 21:51:07 +0100
commitc96ffb05b181ee658a91f11c09b1d99cae727ccd (patch)
tree4e6633064a9d5eb75a44b7715a1c9022dcb8339b /src/core/re3.cpp
parentCheck if buttons txd exsist (diff)
parentFix build without CFO, NO_ISLAND_LOADING, save postfx/pipeline mults (diff)
downloadre3-c96ffb05b181ee658a91f11c09b1d99cae727ccd.tar
re3-c96ffb05b181ee658a91f11c09b1d99cae727ccd.tar.gz
re3-c96ffb05b181ee658a91f11c09b1d99cae727ccd.tar.bz2
re3-c96ffb05b181ee658a91f11c09b1d99cae727ccd.tar.lz
re3-c96ffb05b181ee658a91f11c09b1d99cae727ccd.tar.xz
re3-c96ffb05b181ee658a91f11c09b1d99cae727ccd.tar.zst
re3-c96ffb05b181ee658a91f11c09b1d99cae727ccd.zip
Diffstat (limited to 'src/core/re3.cpp')
-rw-r--r--src/core/re3.cpp48
1 files changed, 32 insertions, 16 deletions
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index aa13ba29..6bf5573e 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -102,6 +102,26 @@ float CheckAndReadIniFloat(const char *cat, const char *key, float original)
return original;
}
+void CheckAndSaveIniInt(const char *cat, const char *key, int val, bool &changed)
+{
+ char temp[10];
+ if (atoi(cfg.get(cat, key, "xxx").c_str()) != val) { // if .ini doesn't have our key, compare with xxx and forcefully add it
+ changed = true;
+ sprintf(temp, "%u", val);
+ cfg.set(cat, key, temp);
+ }
+}
+
+void CheckAndSaveIniFloat(const char *cat, const char *key, float val, bool &changed)
+{
+ char temp[10];
+ if (atof(cfg.get(cat, key, "xxx").c_str()) != val) { // if .ini doesn't have our key, compare with xxx and forcefully add it
+ changed = true;
+ sprintf(temp, "%f", val);
+ cfg.set(cat, key, temp);
+ }
+}
+
void LoadINISettings()
{
cfg.load_file("re3.ini");
@@ -156,11 +176,6 @@ void LoadINISettings()
}
#endif
-#ifdef NO_ISLAND_LOADING
- CMenuManager::m_PrefsIslandLoading = CheckAndReadIniInt("FrontendOptions", "NoIslandLoading", CMenuManager::m_PrefsIslandLoading);
- CMenuManager::m_DisplayIslandLoading = CMenuManager::m_PrefsIslandLoading;
-#endif
-
#ifdef EXTENDED_COLOURFILTER
CPostFX::Intensity = CheckAndReadIniFloat("CustomPipesValues", "PostFXIntensity", CPostFX::Intensity);
#endif
@@ -192,21 +207,22 @@ void SaveINISettings()
break;
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
- if (atoi(cfg.get("FrontendOptions", option.m_CFO->save, "xxx").c_str()) != *option.m_CFO->value) { // if .ini doesn't have that key compare with xxx, so we can add it
- changed = true;
- sprintf(temp, "%u", *option.m_CFO->value);
- cfg.set("FrontendOptions", option.m_CFO->save, temp);
- }
+ // Beware: CFO only supports saving uint8 right now
+ CheckAndSaveIniInt("FrontendOptions", option.m_CFO->save, *option.m_CFO->value, changed);
}
}
}
#endif
-#ifdef NO_ISLAND_LOADING
- if (atoi(cfg.get("FrontendOptions", "NoIslandLoading", "xxx").c_str()) != CMenuManager::m_PrefsIslandLoading) {
- changed = true;
- sprintf(temp, "%u", CMenuManager::m_PrefsIslandLoading);
- cfg.set("FrontendOptions", "NoIslandLoading", temp);
- }
+
+#ifdef EXTENDED_COLOURFILTER
+ CheckAndSaveIniFloat("CustomPipesValues", "PostFXIntensity", CPostFX::Intensity, changed);
+#endif
+#ifdef EXTENDED_PIPELINES
+ CheckAndSaveIniFloat("CustomPipesValues", "NeoVehicleShininess", CustomPipes::VehicleShininess, changed);
+ CheckAndSaveIniFloat("CustomPipesValues", "NeoVehicleSpecularity", CustomPipes::VehicleSpecularity, changed);
+ CheckAndSaveIniFloat("CustomPipesValues", "RimlightMult", CustomPipes::RimlightMult, changed);
+ CheckAndSaveIniFloat("CustomPipesValues", "LightmapMult", CustomPipes::LightmapMult, changed);
+ CheckAndSaveIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult, changed);
#endif
if (changed)