From 4bce329a40601d99275fc3de343d891ac553bc16 Mon Sep 17 00:00:00 2001 From: Haven Kim Date: Mon, 19 Oct 2020 09:58:47 -0700 Subject: [PATCH] Fix #12940: Windows cause issues with snow drawing (#13238) Windows' left value inside of cosine function is causing glitch-feel movement for snows but in fact, x_start can simply modified by another magic numbers. --- distribution/changelog.txt | 1 + src/openrct2/drawing/Weather.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 93815a863f..9a7328132e 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -20,6 +20,7 @@ - Fix: [#8015] RCT2 files are not found when put into the OpenRCT2 folder. - Fix: [#8957] Error title missing when building with insufficient funds - Fix: [#10186] Placing multiple saved rides ignores design name (original bug). +- Fix: [#12940] Windows cause issues with snow drawing. - Fix: [#13021] Mowed grass and weeds don't show up in extra zoom levels. - Fix: [#13024] Console cursor does not correctly render at current cursor position. - Fix: [#13029] Not all Junior Roller Coaster pieces are shown when "Show all track pieces" cheat is enabled. diff --git a/src/openrct2/drawing/Weather.cpp b/src/openrct2/drawing/Weather.cpp index 01ecc161ab..35eb7e0cff 100644 --- a/src/openrct2/drawing/Weather.cpp +++ b/src/openrct2/drawing/Weather.cpp @@ -130,16 +130,17 @@ static void DrawHeavyRain(IWeatherDrawer* weatherDrawer, int32_t left, int32_t t static void DrawLightSnow(IWeatherDrawer* weatherDrawer, int32_t left, int32_t top, int32_t width, int32_t height) { const uint32_t t = gScenarioTicks / 2; - const double t2 = static_cast(gScenarioTicks) / 2.0f; + const int32_t negT = -static_cast(t); + const double cosTick = static_cast(gScenarioTicks) * 0.05; - int32_t x_start = -static_cast(t) + 1 + (cos(1.0 + left + t2 / 10.0) * 3); + int32_t x_start = negT + 1 + (cos(1.0 + cosTick) * 6); int32_t y_start = t + 1; y_start = -y_start; x_start += left; y_start += top; weatherDrawer->Draw(left, top, width, height, x_start, y_start, SnowPattern); - x_start = -static_cast(t) + 16 + (cos(left + t2 / 10.0) * 3); + x_start = negT + 16 + (cos(cosTick) * 6); y_start = t + 16; y_start = -y_start; x_start += left;