diff --git a/src/openrct2/drawing/LightFX.cpp b/src/openrct2/drawing/LightFX.cpp index a0811c598c..a3897a3197 100644 --- a/src/openrct2/drawing/LightFX.cpp +++ b/src/openrct2/drawing/LightFX.cpp @@ -866,7 +866,7 @@ void lightfx_apply_palette_filter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b) natLightB *= 1.0f + overExpose; overExpose *= 255.0f; - float targetFogginess = static_cast(gClimateCurrent.RainLevel) / 8.0f; + float targetFogginess = static_cast(gClimateCurrent.Level) / 8.0f; targetFogginess += (night * night) * 0.15f; if (gClimateCurrent.Temperature < 10) @@ -909,7 +909,7 @@ void lightfx_apply_palette_filter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b) natLightG /= 1.0f + lightPolution; natLightB /= 1.0f + lightPolution; - reduceColourLit += static_cast(gClimateCurrent.RainLevel) / 2.0f; + reduceColourLit += static_cast(gClimateCurrent.Level) / 2.0f; reduceColourNat /= 1.0f + fogginess; reduceColourLit /= 1.0f + fogginess; diff --git a/src/openrct2/drawing/Rain.cpp b/src/openrct2/drawing/Rain.cpp index f6ddf65a95..4bc60d8cd5 100644 --- a/src/openrct2/drawing/Rain.cpp +++ b/src/openrct2/drawing/Rain.cpp @@ -49,10 +49,10 @@ void DrawRain(rct_drawpixelinfo* dpi, IRainDrawer* rainDrawer) viewFlags = viewport->flags; // Get rain draw function and draw rain - uint32_t rainType = gClimateCurrent.RainLevel; - if (rainType != RAIN_LEVEL_NONE && !gTrackDesignSaveMode && !(viewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)) + RainLevel rainType = gClimateCurrent.Level; + if (rainType != RainLevel::None && !gTrackDesignSaveMode && !(viewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)) { - auto drawFunc = DrawRainFunctions[rainType]; + auto drawFunc = DrawRainFunctions[static_cast(rainType)]; auto uiContext = GetContext()->GetUiContext(); uiContext->DrawRainAnimation(rainDrawer, dpi, drawFunc); } diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index b105f65b41..c8a2416bc8 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2651,12 +2651,12 @@ private: gClimateCurrent.Weather = _s4.weather; gClimateCurrent.WeatherEffect = WEATHER_EFFECT_NONE; gClimateCurrent.WeatherGloom = _s4.weather_gloom; - gClimateCurrent.RainLevel = _s4.rain; + gClimateCurrent.Level = static_cast(_s4.rain); gClimateNext.Temperature = _s4.target_temperature; gClimateNext.Weather = _s4.target_weather; gClimateNext.WeatherEffect = WEATHER_EFFECT_NONE; gClimateNext.WeatherGloom = _s4.target_weather_gloom; - gClimateNext.RainLevel = _s4.target_rain; + gClimateNext.Level = static_cast(_s4.target_rain); } void ImportScenarioNameDetails() diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index c3d8376251..6e8779a020 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -391,8 +391,8 @@ void S6Exporter::Export() _s6.next_weather_effect = gClimateNext.WeatherEffect; _s6.current_weather_gloom = gClimateCurrent.WeatherGloom; _s6.next_weather_gloom = gClimateNext.WeatherGloom; - _s6.current_rain_level = gClimateCurrent.RainLevel; - _s6.next_rain_level = gClimateNext.RainLevel; + _s6.current_rain_level = static_cast(gClimateCurrent.Level); + _s6.next_rain_level = static_cast(gClimateNext.Level); // News items for (size_t i = 0; i < RCT12_MAX_NEWS_ITEMS; i++) diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index a4790a9244..84cc8bf628 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -418,8 +418,8 @@ public: gClimateNext.WeatherEffect = _s6.next_weather_effect; gClimateCurrent.WeatherGloom = _s6.current_weather_gloom; gClimateNext.WeatherGloom = _s6.next_weather_gloom; - gClimateCurrent.RainLevel = _s6.current_rain_level; - gClimateNext.RainLevel = _s6.next_rain_level; + gClimateCurrent.Level = static_cast(_s6.current_rain_level); + gClimateNext.Level = static_cast(_s6.next_rain_level); // News items news_item_init_queue(); diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index b5b8cd6be0..f47e013451 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -91,7 +91,7 @@ void climate_reset(int32_t climate) gClimateCurrent.Temperature = transition->BaseTemperature + weatherState->TemperatureDelta; gClimateCurrent.WeatherEffect = weatherState->EffectLevel; gClimateCurrent.WeatherGloom = weatherState->GloomLevel; - gClimateCurrent.RainLevel = weatherState->RainLevel; + gClimateCurrent.Level = weatherState->Level; _lightningTimer = 0; _thunderTimer = 0; @@ -135,17 +135,17 @@ void climate_update() _thunderTimer = 0; _lightningTimer = 0; - if (gClimateCurrent.RainLevel == gClimateNext.RainLevel) + if (gClimateCurrent.Level == gClimateNext.Level) { gClimateCurrent.Weather = gClimateNext.Weather; climate_determine_future_weather(scenario_rand()); auto intent = Intent(INTENT_ACTION_UPDATE_CLIMATE); context_broadcast_intent(&intent); } - else if (gClimateNext.RainLevel <= RAIN_LEVEL_HEAVY) + else if (gClimateNext.Level <= RainLevel::Heavy) { - gClimateCurrent.RainLevel = climate_step_weather_level( - gClimateCurrent.RainLevel, gClimateNext.RainLevel); + gClimateCurrent.Level = static_cast(climate_step_weather_level( + static_cast(gClimateCurrent.Level), static_cast(gClimateNext.Level))); } } else @@ -187,7 +187,7 @@ void climate_force_weather(uint8_t weather) const auto weatherState = &ClimateWeatherData[weather]; gClimateCurrent.Weather = weather; gClimateCurrent.WeatherGloom = weatherState->GloomLevel; - gClimateCurrent.RainLevel = weatherState->RainLevel; + gClimateCurrent.Level = weatherState->Level; gClimateCurrent.WeatherEffect = weatherState->EffectLevel; gClimateUpdateTimer = 1920; @@ -214,7 +214,7 @@ void climate_update_sound() bool climate_is_raining() { - return gClimateCurrent.RainLevel != RAIN_LEVEL_NONE; + return gClimateCurrent.Level != RainLevel::None; } FILTER_PALETTE_ID climate_get_weather_gloom_palette_id(const ClimateState& state) @@ -270,7 +270,7 @@ static void climate_determine_future_weather(int32_t randomDistribution) gClimateNext.Temperature = transition->BaseTemperature + nextWeatherState->TemperatureDelta; gClimateNext.WeatherEffect = nextWeatherState->EffectLevel; gClimateNext.WeatherGloom = nextWeatherState->GloomLevel; - gClimateNext.RainLevel = nextWeatherState->RainLevel; + gClimateNext.Level = nextWeatherState->Level; gClimateUpdateTimer = 1920; } @@ -412,12 +412,12 @@ const FILTER_PALETTE_ID ClimateWeatherGloomColours[4] = { // There is actually a sprite at 0x5A9C for snow but only these weather types seem to be fully implemented const WeatherState ClimateWeatherData[6] = { - { 10, WEATHER_EFFECT_NONE, 0, RAIN_LEVEL_NONE, SPR_WEATHER_SUN }, // Sunny - { 5, WEATHER_EFFECT_NONE, 0, RAIN_LEVEL_NONE, SPR_WEATHER_SUN_CLOUD }, // Partially Cloudy - { 0, WEATHER_EFFECT_NONE, 0, RAIN_LEVEL_NONE, SPR_WEATHER_CLOUD }, // Cloudy - { -2, WEATHER_EFFECT_RAIN, 1, RAIN_LEVEL_LIGHT, SPR_WEATHER_LIGHT_RAIN }, // Rain - { -4, WEATHER_EFFECT_RAIN, 2, RAIN_LEVEL_HEAVY, SPR_WEATHER_HEAVY_RAIN }, // Heavy Rain - { 2, WEATHER_EFFECT_STORM, 2, RAIN_LEVEL_HEAVY, SPR_WEATHER_STORM }, // Thunderstorm + { 10, WEATHER_EFFECT_NONE, 0, RainLevel::None, SPR_WEATHER_SUN }, // Sunny + { 5, WEATHER_EFFECT_NONE, 0, RainLevel::None, SPR_WEATHER_SUN_CLOUD }, // Partially Cloudy + { 0, WEATHER_EFFECT_NONE, 0, RainLevel::None, SPR_WEATHER_CLOUD }, // Cloudy + { -2, WEATHER_EFFECT_RAIN, 1, RainLevel::Light, SPR_WEATHER_LIGHT_RAIN }, // Rain + { -4, WEATHER_EFFECT_RAIN, 2, RainLevel::Heavy, SPR_WEATHER_HEAVY_RAIN }, // Heavy Rain + { 2, WEATHER_EFFECT_STORM, 2, RainLevel::Heavy, SPR_WEATHER_STORM }, // Thunderstorm }; static constexpr const WeatherTransition ClimateTransitionsCoolAndWet[] = { diff --git a/src/openrct2/world/Climate.h b/src/openrct2/world/Climate.h index 3b80c1fa08..c549375379 100644 --- a/src/openrct2/world/Climate.h +++ b/src/openrct2/world/Climate.h @@ -38,11 +38,11 @@ enum WEATHER_EFFECT WEATHER_EFFECT_STORM, }; -enum RAIN_LEVEL +enum class RainLevel { - RAIN_LEVEL_NONE, - RAIN_LEVEL_LIGHT, - RAIN_LEVEL_HEAVY, + None, + Light, + Heavy, }; struct WeatherState @@ -50,7 +50,7 @@ struct WeatherState int8_t TemperatureDelta; int8_t EffectLevel; int8_t GloomLevel; - int8_t RainLevel; + RainLevel Level; uint32_t SpriteId; }; @@ -60,7 +60,7 @@ struct ClimateState int8_t Temperature; uint8_t WeatherEffect; uint8_t WeatherGloom; - uint8_t RainLevel; + RainLevel Level; }; extern uint8_t gClimate;