From 6ff5841fb18fd27796d0f831800c3e9a6cfeb09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Sat, 26 Apr 2025 23:31:36 +0300 Subject: [PATCH] Fix OpenGL invalidation breaking for weather effects, they start before --- .../drawing/engines/opengl/OpenGLDrawingEngine.cpp | 2 +- src/openrct2/world/Climate.cpp | 7 +++++++ src/openrct2/world/Climate.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp index 48c99a424d..35af9f7705 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp @@ -362,7 +362,7 @@ public: { WindowResetVisibilities(); - if (ClimateIsRaining() || ClimateIsSnowing() || ClimateIsSnowingHeavily()) + if (ClimateHasWeatherEffect()) { WindowUpdateAllViewports(); // OpenGL doesn't support restoring pixels, always redraw. diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index c11e048655..a5e115595c 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -288,6 +288,13 @@ bool WeatherIsDry(WeatherType weather) return weather == WeatherType::Sunny || weather == WeatherType::PartiallyCloudy || weather == WeatherType::Cloudy; } +bool ClimateHasWeatherEffect() +{ + const auto& weatherCurrent = getGameState().weatherCurrent; + // The game starts drawing rain whenever this level is not none. + return weatherCurrent.level != WeatherLevel::None; +} + FilterPaletteID ClimateGetWeatherGloomPaletteId(const WeatherState& state) { auto paletteId = FilterPaletteID::PaletteNull; diff --git a/src/openrct2/world/Climate.h b/src/openrct2/world/Climate.h index e68c5faa26..3f29e51e0a 100644 --- a/src/openrct2/world/Climate.h +++ b/src/openrct2/world/Climate.h @@ -92,5 +92,6 @@ bool ClimateTransitioningToSnow(); bool ClimateIsSnowing(); bool ClimateIsSnowingHeavily(); bool WeatherIsDry(WeatherType); +bool ClimateHasWeatherEffect(); FilterPaletteID ClimateGetWeatherGloomPaletteId(const WeatherState& state); uint32_t ClimateGetWeatherSpriteId(const WeatherType weatherType);