@@ -149,7 +149,23 @@ bool Settings::SaveToJson(const std::filesystem::path& file) {
149149 j[" kScaleCompEnabled" ] = scaleCompEnabled.load ();
150150 j[" kScaleCompOnlyBelowOne" ] = scaleCompOnlyBelowOne.load ();
151151 j[" kScaleCompPerUnitSM" ] = scaleCompPerUnitSM.load ();
152+ switch (scaleCompMode) {
153+ case ScaleCompMode::Inverse:
154+ j[" kScaleCompMode" ] = " Inverse" ;
155+ break ;
156+ case ScaleCompMode::Additive:
157+ default :
158+ j[" kScaleCompMode" ] = " Additive" ;
159+ break ;
160+ }
152161
162+ j[" kDwEnabled" ] = dwEnabled.load ();
163+ j[" kDwSlopeFeatureEnabled" ] = dwSlopeFeatureEnabled.load ();
164+ j[" kDwStartDeg" ] = dwStartDeg.load ();
165+ j[" kDwFullDeg" ] = dwFullDeg.load ();
166+
167+ j[" kDwBuildUpPerSec" ] = dwBuildUpPerSec.load ();
168+ j[" kDwDryPerSec" ] = dwDryPerSec.load ();
153169
154170 std::ofstream out (file);
155171 if (!out.is_open ()) return false ;
@@ -481,5 +497,39 @@ bool Settings::LoadFromJson(const std::filesystem::path& file) {
481497 scaleCompPerUnitSM = std::clamp (v, -300 .0f , 300 .0f );
482498 }
483499
500+ // DW (Dynamic Wetness) integration settings
501+ if (j.contains (" kDwEnabled" )) {
502+ dwEnabled = j[" kDwEnabled" ].get <bool >();
503+ }
504+ if (j.contains (" kDwSlopeFeatureEnabled" )) {
505+ dwSlopeFeatureEnabled = j[" kDwSlopeFeatureEnabled" ].get <bool >();
506+ }
507+ if (j.contains (" kDwStartDeg" )) {
508+ float v = j[" kDwStartDeg" ].get <float >();
509+ dwStartDeg = std::clamp (v, 0 .0f , dwFullDeg.load ());
510+ }
511+ if (j.contains (" kDwFullDeg" )) {
512+ float v = j[" kDwFullDeg" ].get <float >();
513+ dwFullDeg = std::clamp (v, dwStartDeg.load (), 90 .0f );
514+ }
515+ if (j.contains (" kDwBuildUpPerSec" )) {
516+ float v = j[" kDwBuildUpPerSec" ].get <float >();
517+ dwBuildUpPerSec = std::clamp (v, 0 .0f , 20 .0f );
518+ }
519+ if (j.contains (" kDwDryPerSec" )) {
520+ float v = j[" kDwDryPerSec" ].get <float >();
521+ dwDryPerSec = std::clamp (v, 0 .0f , 20 .0f );
522+ }
523+ if (j.contains (" kScaleCompMode" )) {
524+ auto & m = j[" kScaleCompMode" ];
525+ if (m.is_string ()) {
526+ std::string s = m.get <std::string>();
527+ std::transform (s.begin (), s.end (), s.begin (), ::tolower);
528+ scaleCompMode = (s == " inverse" ) ? ScaleCompMode::Inverse : ScaleCompMode::Additive;
529+ } else if (m.is_number_integer ()) {
530+ int v = m.get <int >();
531+ scaleCompMode = (v == 1 ) ? ScaleCompMode::Inverse : ScaleCompMode::Additive;
532+ }
533+ }
484534 return true ;
485535}
0 commit comments