diff --git a/src/lang/english.txt b/src/lang/english.txt index 85d1850431..1f0362658a 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1418,6 +1418,9 @@ STR_CONFIG_SETTING_VEHICLE_NAMES_TRADITIONAL :Traditional STR_CONFIG_SETTING_VEHICLE_NAMES_MODERN :Modern STR_CONFIG_SETTING_VEHICLE_NAMES_LONG :Long +STR_CONFIG_SETTING_SHADED_TREES_ON_SLOPES :Shade trees on slopes: {STRING2} +STR_CONFIG_SETTING_SHADED_TREES_ON_SLOPES_HELPTEXT :Change brightness of trees drawn on slopes. Improves the look of tree cover in mountainous areas. + STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES :Enable signals on bridges/tunnels advanced modes: {STRING2} STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES_HELPTEXT :Enables use of advanced modes of signal simulation on bridges and tunnels. When disabled, bridges/tunnels which are not already in an advanced mode cannot be changed to an advanced mode, however other players may choose to enable this setting and use an advanced mode. diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 2f80932196..0af90f06aa 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1486,6 +1486,7 @@ static SettingsContainer &GetSettingsTree() { graphics->Add(new SettingEntry("gui.zoom_min")); graphics->Add(new SettingEntry("gui.zoom_max")); + graphics->Add(new SettingEntry("gui.shade_trees_on_slopes")); graphics->Add(new SettingEntry("gui.smallmap_land_colour")); graphics->Add(new SettingEntry("gui.linkgraph_colours")); graphics->Add(new SettingEntry("gui.graph_line_thickness")); diff --git a/src/settings_type.h b/src/settings_type.h index a8a19dc235..fedbad0273 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -208,6 +208,7 @@ struct GUISettings : public TimeSettings { uint8 linkgraph_colours; ///< linkgraph overlay colours bool disable_vehicle_image_update; ///< Disable NewGRFs from continuously updating vehicle images uint8 vehicle_names; ///< Vehicle naming scheme + bool shade_trees_on_slopes; ///< Shade trees on slopes uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity. uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed. diff --git a/src/table/settings.ini b/src/table/settings.ini index ad93b78bf9..d3c98761b8 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -5094,6 +5094,15 @@ strval = STR_CONFIG_SETTING_VEHICLE_NAMES_TRADITIONAL proc = RedrawScreen cat = SC_BASIC +[SDTC_BOOL] +var = gui.shade_trees_on_slopes +flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC +def = true +str = STR_CONFIG_SETTING_SHADED_TREES_ON_SLOPES +strhelp = STR_CONFIG_SETTING_SHADED_TREES_ON_SLOPES_HELPTEXT +proc = RedrawScreen +cat = SC_BASIC + ; For the dedicated build we'll enable dates in logs by default. [SDTC_BOOL] ifdef = DEDICATED diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index 85575b677b..5c9e0af435 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -637,9 +637,19 @@ static void DrawTile_Trees(TileInfo *ti, DrawTileProcParams params) /* put the trees to draw in a list */ uint trees = GetTreeCount(ti->tile); + PaletteID palette_adjust = 0; + if (_settings_client.gui.shade_trees_on_slopes && ti->tileh != SLOPE_FLAT) { + extern int GetSlopeTreeBrightnessAdjust(Slope slope); + int adjust = GetSlopeTreeBrightnessAdjust(ti->tileh); + if (adjust != 0) { + SetBit(palette_adjust, PALETTE_BRIGHTNESS_MODIFY); + SB(palette_adjust, PALETTE_BRIGHTNESS_OFFSET, PALETTE_BRIGHTNESS_WIDTH, adjust & ((1 << PALETTE_BRIGHTNESS_WIDTH) - 1)); + } + } + for (uint i = 0; i < trees; i++) { SpriteID sprite = s[0].sprite + (i == trees - 1 ? GetTreeGrowth(ti->tile) : 3); - PaletteID pal = s[0].pal; + PaletteID pal = s[0].pal | palette_adjust; te[i].sprite = sprite; te[i].pal = pal;