From fc9595d013887d027d45e36d04570d742bca8427 Mon Sep 17 00:00:00 2001 From: Hugo Wallenburg Date: Sat, 18 Jun 2016 18:48:17 +0200 Subject: [PATCH] Freeze climate only freezes climate updates, allowing lightning to strike (#3904) --- src/world/climate.c | 55 +++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/world/climate.c b/src/world/climate.c index 9d6a856caf..8eeabf2e6c 100644 --- a/src/world/climate.c +++ b/src/world/climate.c @@ -120,40 +120,41 @@ void climate_update() cur_rain = gClimateCurrentRainLevel, next_rain = gClimateNextRainLevel; - if (gCheatsFreezeClimate) //for cheats - return; - if (screen_flags & (~SCREEN_FLAGS_PLAYING)) // only normal play mode gets climate return; - if (gClimateUpdateTimer) { - if (gClimateUpdateTimer == 960) { - gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE; - } - gClimateUpdateTimer--; - } else if (!(gCurrentTicks & 0x7F)) { - if (temperature == target_temperature) { - if (cur_gloom == next_gloom) { - gClimateCurrentWeatherEffect = gClimateNextWeatherEffect; - _thunderTimer = 0; - _lightningTimer = 0; + if (!gCheatsFreezeClimate) { - if (cur_rain == next_rain) { - gClimateCurrentWeather = gClimateNextWeather; - climate_determine_future_weather(scenario_rand()); - gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE; - } else if (next_rain <= 2) { // Safe-guard - gClimateCurrentRainLevel = step_weather_level(cur_rain, next_rain); - } - } else { - gClimateCurrentWeatherGloom = step_weather_level(cur_gloom, next_gloom); - gfx_invalidate_screen(); + if (gClimateUpdateTimer) { + if (gClimateUpdateTimer == 960) { + gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE; } + gClimateUpdateTimer--; + } else if (!(gCurrentTicks & 0x7F)) { + if (temperature == target_temperature) { + if (cur_gloom == next_gloom) { + gClimateCurrentWeatherEffect = gClimateNextWeatherEffect; + _thunderTimer = 0; + _lightningTimer = 0; - } else { - gClimateCurrentTemperature = step_weather_level(temperature, target_temperature); - gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE; + if (cur_rain == next_rain) { + gClimateCurrentWeather = gClimateNextWeather; + climate_determine_future_weather(scenario_rand()); + gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE; + } else if (next_rain <= 2) { // Safe-guard + gClimateCurrentRainLevel = step_weather_level(cur_rain, next_rain); + } + } else { + gClimateCurrentWeatherGloom = step_weather_level(cur_gloom, next_gloom); + gfx_invalidate_screen(); + } + + } else { + gClimateCurrentTemperature = step_weather_level(temperature, target_temperature); + gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE; + } } + } if (_thunderTimer != 0) {