Add GUI setting for shading trees on slopes in viewports

Deafult on, only for non-map mode
(Slope shading is always on in map mode)
pull/221/head
Jonathan G Rennison 3 years ago
parent 4ef363422a
commit 93f2d5e056

@ -1418,6 +1418,9 @@ STR_CONFIG_SETTING_VEHICLE_NAMES_TRADITIONAL :Traditional
STR_CONFIG_SETTING_VEHICLE_NAMES_MODERN :Modern STR_CONFIG_SETTING_VEHICLE_NAMES_MODERN :Modern
STR_CONFIG_SETTING_VEHICLE_NAMES_LONG :Long 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 :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. 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.

@ -1486,6 +1486,7 @@ static SettingsContainer &GetSettingsTree()
{ {
graphics->Add(new SettingEntry("gui.zoom_min")); graphics->Add(new SettingEntry("gui.zoom_min"));
graphics->Add(new SettingEntry("gui.zoom_max")); 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.smallmap_land_colour"));
graphics->Add(new SettingEntry("gui.linkgraph_colours")); graphics->Add(new SettingEntry("gui.linkgraph_colours"));
graphics->Add(new SettingEntry("gui.graph_line_thickness")); graphics->Add(new SettingEntry("gui.graph_line_thickness"));

@ -208,6 +208,7 @@ struct GUISettings : public TimeSettings {
uint8 linkgraph_colours; ///< linkgraph overlay colours uint8 linkgraph_colours; ///< linkgraph overlay colours
bool disable_vehicle_image_update; ///< Disable NewGRFs from continuously updating vehicle images bool disable_vehicle_image_update; ///< Disable NewGRFs from continuously updating vehicle images
uint8 vehicle_names; ///< Vehicle naming scheme 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_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. uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed.

@ -5094,6 +5094,15 @@ strval = STR_CONFIG_SETTING_VEHICLE_NAMES_TRADITIONAL
proc = RedrawScreen proc = RedrawScreen
cat = SC_BASIC 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. ; For the dedicated build we'll enable dates in logs by default.
[SDTC_BOOL] [SDTC_BOOL]
ifdef = DEDICATED ifdef = DEDICATED

@ -637,9 +637,19 @@ static void DrawTile_Trees(TileInfo *ti, DrawTileProcParams params)
/* put the trees to draw in a list */ /* put the trees to draw in a list */
uint trees = GetTreeCount(ti->tile); 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++) { for (uint i = 0; i < trees; i++) {
SpriteID sprite = s[0].sprite + (i == trees - 1 ? GetTreeGrowth(ti->tile) : 3); 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].sprite = sprite;
te[i].pal = pal; te[i].pal = pal;

Loading…
Cancel
Save