From 9cf61abcc529a8a67b1d3bcba0c73da67c31ebbc Mon Sep 17 00:00:00 2001 From: SkrubbySkrubInAShrub Date: Fri, 24 Apr 2026 22:28:19 +0200 Subject: [PATCH 1/3] fix: types and conversions --- src/WeatherEditor/Weather/WeatherWidget.cpp | 10 +++++----- src/WeatherEditor/WeatherUtils.cpp | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/WeatherEditor/Weather/WeatherWidget.cpp b/src/WeatherEditor/Weather/WeatherWidget.cpp index 447bf05bf0..11c2529ca0 100644 --- a/src/WeatherEditor/Weather/WeatherWidget.cpp +++ b/src/WeatherEditor/Weather/WeatherWidget.cpp @@ -171,7 +171,7 @@ void WeatherWidget::DrawWidget() if (ImGui::BeginTabItem("Basic", nullptr, basicFlags)) { BeginScrollableContent("##BasicScroll"); DrawProperties("Sun", { { "Sun Damage", UINT8_SLIDER } }); - DrawProperties("Wind", { { "Wind Speed", UINT8_SLIDER }, { "Wind Direction", INT8_SLIDER }, { "Wind Direction Range", INT8_SLIDER } }); + DrawProperties("Wind", { { "Wind Speed", UINT8_SLIDER }, { "Wind Direction", UINT8_SLIDER }, { "Wind Direction Range", UINT8_SLIDER } }); DrawProperties("Precipitation", { { "Precipitation Begin Fade In", UINT8_SLIDER }, { "Precipitation End Fade Out", UINT8_SLIDER } }); DrawProperties("Lightning", { { "Thunder Lightning Begin Fade In", UINT8_SLIDER }, { "Thunder Lightning End Fade Out", UINT8_SLIDER }, { "Thunder Lightning Frequency", UINT8_SLIDER }, { "Lightning Color", COLOR3_PICKER } }); @@ -571,7 +571,7 @@ void WeatherWidget::SetWeatherValues() // Lightning data.thunderLightningBeginFadeIn = (uint8_t)weatherProps["Thunder Lightning Begin Fade In"]; data.thunderLightningEndFadeOut = (uint8_t)weatherProps["Thunder Lightning End Fade Out"]; - data.thunderLightningFrequency = (int8_t)weatherProps["Thunder Lightning Frequency"]; + data.thunderLightningFrequency = static_cast(static_cast(weatherProps["Thunder Lightning Frequency"])); Float3ToColor(weatherColors["Lightning Color"], weather->data.lightningColor); // Visual Effects @@ -580,8 +580,8 @@ void WeatherWidget::SetWeatherValues() // Wind data.windSpeed = (uint8_t)weatherProps["Wind Speed"]; - data.windDirection = (int8_t)weatherProps["Wind Direction"]; - data.windDirectionRange = (int8_t)weatherProps["Wind Direction Range"]; + data.windDirection = (uint8_t)weatherProps["Wind Direction"]; + data.windDirectionRange = (uint8_t)weatherProps["Wind Direction Range"]; // Fog fogData.dayNear = fogProperties["Day Near"]; @@ -746,7 +746,7 @@ void WeatherWidget::LoadWeatherValues() // Lightning weatherProps["Thunder Lightning Begin Fade In"] = data.thunderLightningBeginFadeIn; weatherProps["Thunder Lightning End Fade Out"] = data.thunderLightningEndFadeOut; - weatherProps["Thunder Lightning Frequency"] = (uint8_t)data.thunderLightningFrequency; + weatherProps["Thunder Lightning Frequency"] = static_cast(data.thunderLightningFrequency); ColorToFloat3(data.lightningColor, weatherColors["Lightning Color"]); // Visual Effects diff --git a/src/WeatherEditor/WeatherUtils.cpp b/src/WeatherEditor/WeatherUtils.cpp index 647367c259..07af52065d 100644 --- a/src/WeatherEditor/WeatherUtils.cpp +++ b/src/WeatherEditor/WeatherUtils.cpp @@ -162,9 +162,9 @@ void Float3ToColor(const float3& f3, RE::Color& color) void Float3ToColor(const float3& f3, RE::TESWeather::Data::Color3& color) { - color.red = FloatToInt8(f3.x); - color.green = FloatToInt8(f3.y); - color.blue = FloatToInt8(f3.z); + color.red = FloatToUint8(f3.x); + color.green = FloatToUint8(f3.y); + color.blue = FloatToUint8(f3.z); } void ColorToFloat3(const RE::Color& color, float3& f3) @@ -176,9 +176,9 @@ void ColorToFloat3(const RE::Color& color, float3& f3) void ColorToFloat3(const RE::TESWeather::Data::Color3& color, float3& f3) { - f3.x = Int8ToFloat(color.red); - f3.y = Int8ToFloat(color.green); - f3.z = Int8ToFloat(color.blue); + f3.x = Uint8ToFloat(color.red); + f3.y = Uint8ToFloat(color.green); + f3.z = Uint8ToFloat(color.blue); } std::string ColorTimeLabel(const int i) From c7a23f4da34735722b8ac63cb7558cee007e9eed Mon Sep 17 00:00:00 2001 From: Skrubby Skrub In A Shrub <87662196+SkrubbySkrubInAShrub@users.noreply.github.com> Date: Sat, 25 Apr 2026 11:19:34 +0200 Subject: [PATCH 2/3] fix: don't use C-style casting --- .../Weather/PrecipitationWidget.cpp | 24 ++++++++-------- src/WeatherEditor/Weather/WeatherWidget.cpp | 28 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/WeatherEditor/Weather/PrecipitationWidget.cpp b/src/WeatherEditor/Weather/PrecipitationWidget.cpp index a7624d8592..35042d8af2 100644 --- a/src/WeatherEditor/Weather/PrecipitationWidget.cpp +++ b/src/WeatherEditor/Weather/PrecipitationWidget.cpp @@ -208,18 +208,18 @@ void PrecipitationWidget::ApplyChanges() auto& runtime = precipitation->GetRuntimeData(); - runtime.data[(uint32_t)RE::BGSShaderParticleGeometryData::DataID::kGravityVelocity].f = settings.gravityVelocity; - runtime.data[(uint32_t)RE::BGSShaderParticleGeometryData::DataID::kRotationVelocity].f = settings.rotationVelocity; - runtime.data[(uint32_t)RE::BGSShaderParticleGeometryData::DataID::kParticleSizeX].f = settings.particleSizeX; - runtime.data[(uint32_t)RE::BGSShaderParticleGeometryData::DataID::kParticleSizeY].f = settings.particleSizeY; - runtime.data[(uint32_t)RE::BGSShaderParticleGeometryData::DataID::kCenterOffsetMin].f = settings.centerOffsetMin; - runtime.data[(uint32_t)RE::BGSShaderParticleGeometryData::DataID::kCenterOffsetMax].f = settings.centerOffsetMax; - runtime.data[(uint32_t)RE::BGSShaderParticleGeometryData::DataID::kStartRotationRange].f = settings.startRotationRange; - runtime.data[(uint32_t)RE::BGSShaderParticleGeometryData::DataID::kNumSubtexturesX].i = settings.numSubtexturesX; - runtime.data[(uint32_t)RE::BGSShaderParticleGeometryData::DataID::kNumSubtexturesY].i = settings.numSubtexturesY; - runtime.data[(uint32_t)RE::BGSShaderParticleGeometryData::DataID::kParticleType].i = settings.particleType; - runtime.data[(uint32_t)RE::BGSShaderParticleGeometryData::DataID::kBoxSize].f = settings.boxSize; - runtime.data[(uint32_t)RE::BGSShaderParticleGeometryData::DataID::kParticleDensity].f = settings.particleDensity; + runtime.data[static_cast(RE::BGSShaderParticleGeometryData::DataID::kGravityVelocity)].f = settings.gravityVelocity; + runtime.data[static_cast(RE::BGSShaderParticleGeometryData::DataID::kRotationVelocity)].f = settings.rotationVelocity; + runtime.data[static_cast(RE::BGSShaderParticleGeometryData::DataID::kParticleSizeX)].f = settings.particleSizeX; + runtime.data[static_cast(RE::BGSShaderParticleGeometryData::DataID::kParticleSizeY)].f = settings.particleSizeY; + runtime.data[static_cast(RE::BGSShaderParticleGeometryData::DataID::kCenterOffsetMin)].f = settings.centerOffsetMin; + runtime.data[static_cast(RE::BGSShaderParticleGeometryData::DataID::kCenterOffsetMax)].f = settings.centerOffsetMax; + runtime.data[static_cast(RE::BGSShaderParticleGeometryData::DataID::kStartRotationRange)].f = settings.startRotationRange; + runtime.data[static_cast(RE::BGSShaderParticleGeometryData::DataID::kNumSubtexturesX)].i = settings.numSubtexturesX; + runtime.data[static_cast(RE::BGSShaderParticleGeometryData::DataID::kNumSubtexturesY)].i = settings.numSubtexturesY; + runtime.data[static_cast(RE::BGSShaderParticleGeometryData::DataID::kParticleType)].i = settings.particleType; + runtime.data[static_cast(RE::BGSShaderParticleGeometryData::DataID::kBoxSize)].f = settings.boxSize; + runtime.data[static_cast(RE::BGSShaderParticleGeometryData::DataID::kParticleDensity)].f = settings.particleDensity; runtime.particleTexture.textureName = settings.particleTexture.c_str(); ApplyLiveParticleTexture(settings.particleTexture); Widget::ForceCurrentWeatherReinit(); diff --git a/src/WeatherEditor/Weather/WeatherWidget.cpp b/src/WeatherEditor/Weather/WeatherWidget.cpp index 11c2529ca0..e2488b349c 100644 --- a/src/WeatherEditor/Weather/WeatherWidget.cpp +++ b/src/WeatherEditor/Weather/WeatherWidget.cpp @@ -558,30 +558,30 @@ void WeatherWidget::SetWeatherValues() auto& colorData = weather->colorData; auto& fogData = weather->fogData; - weather->data.transDelta = (uint8_t)weatherProps["Trans Delta"]; + weather->data.transDelta = static_cast(weatherProps["Trans Delta"]); // Sun - data.sunGlare = (uint8_t)weatherProps["Sun Glare"]; - data.sunDamage = (uint8_t)weatherProps["Sun Damage"]; + data.sunGlare = static_cast(weatherProps["Sun Glare"]); + data.sunDamage = static_cast(weatherProps["Sun Damage"]); // Precipitation - data.precipitationBeginFadeIn = (uint8_t)weatherProps["Precipitation Begin Fade In"]; - data.precipitationEndFadeOut = (uint8_t)weatherProps["Precipitation End Fade Out"]; + data.precipitationBeginFadeIn = static_cast(weatherProps["Precipitation Begin Fade In"]); + data.precipitationEndFadeOut = static_cast(weatherProps["Precipitation End Fade Out"]); // Lightning - data.thunderLightningBeginFadeIn = (uint8_t)weatherProps["Thunder Lightning Begin Fade In"]; - data.thunderLightningEndFadeOut = (uint8_t)weatherProps["Thunder Lightning End Fade Out"]; + data.thunderLightningBeginFadeIn = static_cast(weatherProps["Thunder Lightning Begin Fade In"]); + data.thunderLightningEndFadeOut = static_cast(weatherProps["Thunder Lightning End Fade Out"]); data.thunderLightningFrequency = static_cast(static_cast(weatherProps["Thunder Lightning Frequency"])); Float3ToColor(weatherColors["Lightning Color"], weather->data.lightningColor); // Visual Effects - data.visualEffectBegin = (uint8_t)weatherProps["Visual Effect Begin"]; - data.visualEffectEnd = (uint8_t)weatherProps["Visual Effect End"]; + data.visualEffectBegin = static_cast(weatherProps["Visual Effect Begin"]); + data.visualEffectEnd = static_cast(weatherProps["Visual Effect End"]); // Wind - data.windSpeed = (uint8_t)weatherProps["Wind Speed"]; - data.windDirection = (uint8_t)weatherProps["Wind Direction"]; - data.windDirectionRange = (uint8_t)weatherProps["Wind Direction Range"]; + data.windSpeed = static_cast(weatherProps["Wind Speed"]); + data.windDirection = static_cast(weatherProps["Wind Direction"]); + data.windDirectionRange = static_cast(weatherProps["Wind Direction Range"]); // Fog fogData.dayNear = fogProperties["Day Near"]; @@ -624,8 +624,8 @@ void WeatherWidget::SetWeatherValues() for (size_t i = 0; i < TESWeather::kTotalLayers; i++) { auto& settingsCloud = settings.clouds[i]; - weather->cloudLayerSpeedX[i] = (int8_t)settingsCloud.cloudLayerSpeedX; - weather->cloudLayerSpeedY[i] = (int8_t)settingsCloud.cloudLayerSpeedY; + weather->cloudLayerSpeedX[i] = static_cast(settingsCloud.cloudLayerSpeedX); + weather->cloudLayerSpeedY[i] = static_cast(settingsCloud.cloudLayerSpeedY); if (!settingsCloud.enabled) { disabledBits |= (1 << i); From 60745ff4f896e191995c0b0b7085fb0d7dfe2b01 Mon Sep 17 00:00:00 2001 From: Skrubby Skrub In A Shrub <87662196+SkrubbySkrubInAShrub@users.noreply.github.com> Date: Sat, 25 Apr 2026 11:33:39 +0200 Subject: [PATCH 3/3] fix: lerp --- src/Features/WeatherEditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Features/WeatherEditor.cpp b/src/Features/WeatherEditor.cpp index 7611dc03fc..105a8bd687 100644 --- a/src/Features/WeatherEditor.cpp +++ b/src/Features/WeatherEditor.cpp @@ -152,8 +152,8 @@ void WeatherEditor::LerpWeather(RE::TESWeather* oldWeather, RE::TESWeather* newW newWeather->data.visualEffectEnd = LerpUint8_t(oldWeather->data.visualEffectEnd, newWeather->data.visualEffectEnd, currentWeatherPct); //// Wind - newWeather->data.windDirection = LerpInt8_t(oldWeather->data.windDirection, newWeather->data.windDirection, currentWeatherPct); - newWeather->data.windDirectionRange = LerpInt8_t(oldWeather->data.windDirectionRange, newWeather->data.windDirectionRange, currentWeatherPct); + newWeather->data.windDirection = LerpUint8_t(oldWeather->data.windDirection, newWeather->data.windDirection, currentWeatherPct); + newWeather->data.windDirectionRange = LerpUint8_t(oldWeather->data.windDirectionRange, newWeather->data.windDirectionRange, currentWeatherPct); newWeather->data.windSpeed = LerpUint8_t(oldWeather->data.windSpeed, newWeather->data.windSpeed, currentWeatherPct); //// Fog