diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index a726c0faf2..930ced2f1a 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -4228,6 +4228,8 @@ STR_5916 :{COMMA16} player STR_5917 :{COMMA16} players STR_5918 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{COMMA16} STR_5919 :{COMMA16} +STR_5920 :Render weather effects +STR_5921 :{SMALLFONT}{BLACK}If enabled, rain and gloomy colours will be rendered during storms. ############# # Scenarios # diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 6a6af9eb05..963fd42691 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.0.5 (in development) ------------------------------------------------------------------------ +- Feature: Ability to disable rendering of weather effects and gloom - Feature: New view option: "See-Through Paths" - Feature: Add cheat to reset date. - Feature: Add OpenGL drawing engine. diff --git a/src/config.c b/src/config.c index 940416a633..736028511f 100644 --- a/src/config.c +++ b/src/config.c @@ -227,6 +227,8 @@ config_property_definition _generalDefinitions[] = { { offsetof(general_configuration, last_save_track_directory), "last_track_directory", CONFIG_VALUE_TYPE_STRING, { .value_string = NULL }, NULL }, { offsetof(general_configuration, window_limit), "window_limit", CONFIG_VALUE_TYPE_UINT8, WINDOW_LIMIT_MAX, NULL }, { offsetof(general_configuration, zoom_to_cursor), "zoom_to_cursor", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL }, + { offsetof(general_configuration, render_weather_effects), "render_weather_effects", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL }, + { offsetof(general_configuration, render_weather_gloom), "render_weather_gloom", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL }, }; config_property_definition _interfaceDefinitions[] = { diff --git a/src/config.h b/src/config.h index 5a08f2f680..dcf76859bb 100644 --- a/src/config.h +++ b/src/config.h @@ -200,6 +200,8 @@ typedef struct general_configuration { utf8string last_save_track_directory; uint8 window_limit; uint8 zoom_to_cursor; + uint8 render_weather_effects; + uint8 render_weather_gloom; } general_configuration; typedef struct interface_configuration { diff --git a/src/drawing/Rain.cpp b/src/drawing/Rain.cpp index c8cbb6701c..e8c5e00631 100644 --- a/src/drawing/Rain.cpp +++ b/src/drawing/Rain.cpp @@ -19,6 +19,7 @@ extern "C" #include "../interface/window.h" #include "../world/climate.h" #include "drawing.h" + #include "../config.h" } #include "IDrawingEngine.h" @@ -86,6 +87,9 @@ static void DrawRainWindow(IRainDrawer * rainDrawer, sint16 bottom, uint32 rainType) { + if (!gConfigGeneral.render_weather_effects) + return; + rct_window * newWindow = gWindowNextSlot; rct_window * w = original_w + 1; // Start from second window for (; ; w++) diff --git a/src/game.c b/src/game.c index 9ac5b51d3a..968464335f 100644 --- a/src/game.c +++ b/src/game.c @@ -186,7 +186,7 @@ void update_palette_effects() int q = 0; extern const sint32 WeatherColours[4]; int weather_colour = WeatherColours[gClimateCurrentWeatherGloom]; - if (weather_colour != -1) { + if (weather_colour != -1 && gConfigGeneral.render_weather_gloom) { q = 1; if (weather_colour != 0x2000031) { q = 2; diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 689f8ed31b..b5277541c3 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -777,13 +777,28 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in paint_quadrant_ps(); int weather_colour = WeatherColours[gClimateCurrentWeatherGloom]; - if ((weather_colour != -1) && (!(gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES)) && !gTrackDesignSaveMode) { - gfx_fill_rect(dpi2, dpi2->x, dpi2->y, dpi2->width + dpi2->x - 1, dpi2->height + dpi2->y - 1, weather_colour); + if ( + (weather_colour != -1) + && (!(gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES)) + && (!gTrackDesignSaveMode) + && (gConfigGeneral.render_weather_gloom) + ) { + gfx_fill_rect( + dpi2, + dpi2->x, + dpi2->y, + dpi2->width + dpi2->x - 1, + dpi2->height + dpi2->y - 1, + weather_colour + ); } + viewport_draw_money_effects(); } } + + /** * * rct2: 0x0068958D diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index aa215e076c..de00fbb6ae 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -3570,6 +3570,8 @@ enum { STR_MULTIPLAYER_PLAYER_COUNT_PLURAL = 5917, STR_SERVER_MAX_PLAYERS_VALUE = 5918, STR_COMMA16 = 5919, + STR_RENDER_WEATHER_EFFECTS = 5920, + STR_RENDER_WEATHER_EFFECTS_TIP = 5921, // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 diff --git a/src/windows/options.c b/src/windows/options.c index eb8fd07eb8..0d234f6e5d 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -96,6 +96,7 @@ enum WINDOW_OPTIONS_WIDGET_IDX { WIDX_CONSTRUCTION_MARKER_DROPDOWN, WIDX_DAY_NIGHT_CHECKBOX, WIDX_UPPER_CASE_BANNERS_CHECKBOX, + WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX, WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX, // Culture / Units @@ -224,14 +225,15 @@ static rct_widget window_options_display_widgets[] = { static rct_widget window_options_rendering_widgets[] = { MAIN_OPTIONS_WIDGETS, #define FRAME_RENDERING_START 53 - { WWT_GROUPBOX, 1, 5, 304, FRAME_RENDERING_START + 0, FRAME_RENDERING_START + 106, STR_RENDERING_GROUP, STR_NONE }, // Rendering group - { WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 15, FRAME_RENDERING_START + 26, STR_TILE_SMOOTHING, STR_TILE_SMOOTHING_TIP }, // Landscape smoothing - { WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 30, FRAME_RENDERING_START + 41, STR_GRIDLINES, STR_GRIDLINES_TIP }, // Gridlines - { WWT_DROPDOWN, 1, 155, 299, FRAME_RENDERING_START + 45, FRAME_RENDERING_START + 55, STR_NONE, STR_NONE }, // Construction marker - { WWT_DROPDOWN_BUTTON, 1, 288, 298, FRAME_RENDERING_START + 46, FRAME_RENDERING_START + 54, STR_DROPDOWN_GLYPH, STR_CONSTRUCTION_MARKER_COLOUR_TIP }, - { WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 60, FRAME_RENDERING_START + 71, STR_CYCLE_DAY_NIGHT, STR_CYCLE_DAY_NIGHT_TIP }, // Cycle day-night - { WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 75, FRAME_RENDERING_START + 86, STR_UPPERCASE_BANNERS, STR_UPPERCASE_BANNERS_TIP }, // Uppercase banners - { WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 90, FRAME_RENDERING_START + 101, STR_DISABLE_LIGHTNING_EFFECT, STR_DISABLE_LIGHTNING_EFFECT_TIP }, // Disable lightning effect + { WWT_GROUPBOX, 1, 5, 304, FRAME_RENDERING_START + 0, FRAME_RENDERING_START + 136, STR_RENDERING_GROUP, STR_NONE }, // Rendering group + { WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 15, FRAME_RENDERING_START + 26, STR_TILE_SMOOTHING, STR_TILE_SMOOTHING_TIP }, // Landscape smoothing + { WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 30, FRAME_RENDERING_START + 41, STR_GRIDLINES, STR_GRIDLINES_TIP }, // Gridlines + { WWT_DROPDOWN, 1, 155, 299, FRAME_RENDERING_START + 45, FRAME_RENDERING_START + 55, STR_NONE, STR_NONE }, // Construction marker + { WWT_DROPDOWN_BUTTON, 1, 288, 298, FRAME_RENDERING_START + 46, FRAME_RENDERING_START + 54, STR_DROPDOWN_GLYPH, STR_CONSTRUCTION_MARKER_COLOUR_TIP }, + { WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 60, FRAME_RENDERING_START + 71, STR_CYCLE_DAY_NIGHT, STR_CYCLE_DAY_NIGHT_TIP }, // Cycle day-night + { WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 75, FRAME_RENDERING_START + 86, STR_UPPERCASE_BANNERS, STR_UPPERCASE_BANNERS_TIP }, // Uppercase banners + { WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 90, FRAME_RENDERING_START + 101, STR_RENDER_WEATHER_EFFECTS, STR_RENDER_WEATHER_EFFECTS_TIP }, // Render weather effects + { WWT_CHECKBOX, 1, 31, 290, FRAME_RENDERING_START + 105, FRAME_RENDERING_START + 116, STR_DISABLE_LIGHTNING_EFFECT, STR_DISABLE_LIGHTNING_EFFECT_TIP }, // Disable lightning effect #undef FRAME_RENDERING_START { WIDGETS_END }, }; @@ -463,6 +465,7 @@ static uint32 window_options_page_enabled_widgets[] = { (1 << WIDX_CONSTRUCTION_MARKER_DROPDOWN) | (1 << WIDX_DAY_NIGHT_CHECKBOX) | (1 << WIDX_UPPER_CASE_BANNERS_CHECKBOX) | + (1 << WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX) | (1 << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX), MAIN_OPTIONS_ENABLED_WIDGETS | @@ -651,6 +654,13 @@ static void window_options_mouseup(rct_window *w, int widgetIndex) config_save_default(); window_invalidate(w); break; + case WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX: + gConfigGeneral.render_weather_effects ^= 1; + gConfigGeneral.render_weather_gloom = gConfigGeneral.render_weather_effects; + config_save_default(); + window_invalidate(w); + gfx_invalidate_screen(); + break; } break; @@ -1461,8 +1471,17 @@ static void window_options_invalidate(rct_window *w) widget_set_checkbox_value(w, WIDX_GRIDLINES_CHECKBOX, gConfigGeneral.always_show_gridlines); widget_set_checkbox_value(w, WIDX_DAY_NIGHT_CHECKBOX, gConfigGeneral.day_night_cycle); widget_set_checkbox_value(w, WIDX_UPPER_CASE_BANNERS_CHECKBOX, gConfigGeneral.upper_case_banners); + widget_set_checkbox_value(w, WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX, gConfigGeneral.render_weather_effects || gConfigGeneral.render_weather_gloom); widget_set_checkbox_value(w, WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX, gConfigGeneral.disable_lightning_effect); - + if (!gConfigGeneral.render_weather_effects && !gConfigGeneral.render_weather_gloom) { + widget_set_checkbox_value(w, WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX, true); + w->enabled_widgets &= ~(1 << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX); + w->disabled_widgets |= (1 << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX); + } + else { + w->enabled_widgets |= (1 << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX); + w->disabled_widgets &= ~(1 << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX); + } // construction marker: white/translucent static const rct_string_id construction_marker_colours[] = { STR_CONSTRUCTION_MARKER_COLOUR_WHITE, @@ -1476,6 +1495,7 @@ static void window_options_invalidate(rct_window *w) window_options_rendering_widgets[WIDX_CONSTRUCTION_MARKER_DROPDOWN].type = WWT_DROPDOWN_BUTTON; window_options_rendering_widgets[WIDX_DAY_NIGHT_CHECKBOX].type = WWT_CHECKBOX; window_options_rendering_widgets[WIDX_UPPER_CASE_BANNERS_CHECKBOX].type = WWT_CHECKBOX; + window_options_rendering_widgets[WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX].type = WWT_CHECKBOX; window_options_rendering_widgets[WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX].type = WWT_CHECKBOX; break; diff --git a/src/world/climate.c b/src/world/climate.c index c104ca51da..a61782c8c9 100644 --- a/src/world/climate.c +++ b/src/world/climate.c @@ -296,15 +296,14 @@ static void climate_update_thunder_sound() static void climate_update_lightning() { - if (_lightningTimer == 0) + if (_lightningTimer == 0 || gConfigGeneral.disable_lightning_effect || + (!gConfigGeneral.render_weather_effects && !gConfigGeneral.render_weather_gloom)) return; - - if (!gConfigGeneral.disable_lightning_effect) { - _lightningTimer--; - if (gClimateLightningFlash == 0) - if ((util_rand() & 0xFFFF) <= 0x2000) - gClimateLightningFlash = 1; - } + + _lightningTimer--; + if (gClimateLightningFlash == 0) + if ((util_rand() & 0xFFFF) <= 0x2000) + gClimateLightningFlash = 1; } static void climate_update_thunder()