Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/core/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ static const char *ini_keys[] = {
[CONFIG_UI_MESSAGE_ALERTS] = "ui_message_alerts",
[CONFIG_UI_SHOW_GRID] = "ui_show_grid",
[CONFIG_UI_SHOW_PARTIAL_GRID_AROUND_CONSTRUCTION] = "ui_show_partial_grid_around_construction",
[CONFIG_UI_CLIMATE_GRID_COLORS] = "ui_climate_grid_colors",
[CONFIG_UI_ALWAYS_SHOW_ROTATION_BUTTONS] = "ui_always_show_rotation_buttons",
[CONFIG_UI_SHOW_ROAMING_PATH] = "ui_show_roaming_path",
[CONFIG_UI_DRAW_CLOUD_SHADOWS] = "ui_draw_cloud_shadows",
Expand Down
1 change: 1 addition & 0 deletions src/core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ typedef enum {
CONFIG_UI_MESSAGE_ALERTS,
CONFIG_UI_SHOW_GRID,
CONFIG_UI_SHOW_PARTIAL_GRID_AROUND_CONSTRUCTION,
CONFIG_UI_CLIMATE_GRID_COLORS,
CONFIG_UI_ALWAYS_SHOW_ROTATION_BUTTONS,
CONFIG_UI_SHOW_ROAMING_PATH,
CONFIG_UI_DRAW_CLOUD_SHADOWS,
Expand Down
3 changes: 3 additions & 0 deletions src/graphics/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ typedef uint32_t color_t;
#define COLOR_WHITE 0xffffffff

#define COLOR_GRID 0xff180800
#define COLOR_GRID_CENTRAL 0xff162d39
#define COLOR_GRID_DESERT 0xff464646
#define COLOR_GRID_NORTHERN 0xff131b1f

#define COLOR_SG2_TRANSPARENT 0xfff700ff
#define COLOR_TOOLTIP 0xff424242
Expand Down
1 change: 1 addition & 0 deletions src/translation/english.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ static translation_string all_strings[] = {
{TR_CONFIG_UI_MESSAGE_ALERTS, "Show new messages as alerts instead of popups"},
{TR_CONFIG_UI_SHOW_GRID, "Show grid"},
{TR_CONFIG_UI_SHOW_PARTIAL_GRID_AROUND_CONSTRUCTION, "Show partial grid around construction"},
{TR_CONFIG_UI_CLIMATE_GRID_COLORS, "Show climate-based colors for full grid"},
{TR_CONFIG_UI_ALWAYS_SHOW_ROTATION_BUTTONS, "Always show rotation buttons"},
{TR_CONFIG_FIX_IMMIGRATION_BUG, "Fix immigration bug on very hard"},
{TR_CONFIG_FIX_100_YEAR_GHOSTS, "Fix 100-year-old ghosts"},
Expand Down
1 change: 1 addition & 0 deletions src/translation/french.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ static translation_string all_strings[] = {
{TR_CONFIG_UI_MESSAGE_ALERTS, "Remplacer les messages urgents par des bandeaux d'alerte"},
{TR_CONFIG_UI_SHOW_GRID, "Afficher la grille complète"},
{TR_CONFIG_UI_SHOW_PARTIAL_GRID_AROUND_CONSTRUCTION, "Afficher la grille partielle en plaçant un bâtiment"},
{TR_CONFIG_UI_CLIMATE_GRID_COLORS, "Adapter la couleur de la grille complète au climat de la carte"},
{TR_CONFIG_UI_ALWAYS_SHOW_ROTATION_BUTTONS, "Toujours afficher les boutons de rotation"},
{TR_CONFIG_FIX_IMMIGRATION_BUG, "Corrige le bug d'immigration en mode très difficile"},
{TR_CONFIG_FIX_100_YEAR_GHOSTS, "Corrige le bug des fantômes de 100 ans"},
Expand Down
1 change: 1 addition & 0 deletions src/translation/translation.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ typedef enum {
TR_CONFIG_UI_MESSAGE_ALERTS,
TR_CONFIG_UI_SHOW_GRID,
TR_CONFIG_UI_SHOW_PARTIAL_GRID_AROUND_CONSTRUCTION,
TR_CONFIG_UI_CLIMATE_GRID_COLORS,
TR_CONFIG_UI_ALWAYS_SHOW_ROTATION_BUTTONS,
TR_CONFIG_FIX_IMMIGRATION_BUG,
TR_CONFIG_FIX_100_YEAR_GHOSTS,
Expand Down
17 changes: 16 additions & 1 deletion src/widget/city/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,21 @@ color_t city_draw_get_color_mask(int grid_offset, int is_top)
return color_mask;
}

static color_t full_grid_color(void)
{
if (!config_get(CONFIG_UI_CLIMATE_GRID_COLORS)) {
return COLOR_GRID;
}
switch (scenario_property_climate()) {
case CLIMATE_DESERT:
return COLOR_GRID_DESERT;
case CLIMATE_NORTHERN:
return COLOR_GRID_NORTHERN;
default:
return COLOR_GRID_CENTRAL;
}
}

static void draw_footprint(int x, int y, int grid_offset)
{
sound_city_progress_ambient();
Expand Down Expand Up @@ -391,7 +406,7 @@ static void draw_footprint(int x, int y, int grid_offset)

// Grid is drawn by the renderer directly at zoom > 200%
if (!building_id && config_get(CONFIG_UI_SHOW_GRID) && draw_context.scale <= 2.0f) {
image_draw(assets_lookup_image_id(ASSET_UI_GRID), x, y, COLOR_GRID, draw_context.scale);
image_draw(assets_lookup_image_id(ASSET_UI_GRID), x, y, full_grid_color(), draw_context.scale);
}

draw_roamer_frequency(x, y, grid_offset);
Expand Down
20 changes: 18 additions & 2 deletions src/widget/map_editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
#include "map/terrain.h"
#include "scenario/custom_variable.h"
#include "scenario/event/controller.h"
#include "scenario/empire.h"
#include "scenario/empire.h"
#include "scenario/property.h"
#include "sound/city.h"
#include "sound/effect.h"
#include "translation/translation.h"
Expand Down Expand Up @@ -99,6 +100,21 @@ int widget_map_editor_add_draw_context_event_tile(int grid_offset, int event_id)
return 0;
}

static color_t full_grid_color(void)
{
if (!config_get(CONFIG_UI_CLIMATE_GRID_COLORS)) {
return COLOR_GRID;
}
switch (scenario_property_climate()) {
case CLIMATE_DESERT:
return COLOR_GRID_DESERT;
case CLIMATE_NORTHERN:
return COLOR_GRID_NORTHERN;
default:
return COLOR_GRID_CENTRAL;
}
}

static void draw_footprint(int x, int y, int grid_offset)
{
if (grid_offset < 0 || !map_property_is_draw_tile(grid_offset)) {
Expand Down Expand Up @@ -127,7 +143,7 @@ static void draw_footprint(int x, int y, int grid_offset)
if (!grid_id) {
grid_id = assets_get_image_id("UI", "Grid_Full");
}
image_draw(grid_id, x, y, COLOR_GRID, draw_context.scale);
image_draw(grid_id, x, y, full_grid_color(), draw_context.scale);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/window/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ static config_widget ui_widgets_by_category[CATEGORY_UI_COUNT][MAX_WIDGETS] = {
{TYPE_CHECKBOX, CONFIG_UI_ALWAYS_SHOW_ROTATION_BUTTONS, TR_CONFIG_UI_ALWAYS_SHOW_ROTATION_BUTTONS, NULL, 0, 1, ITEM_BASE_H, CHECKBOX_MARGIN},
{TYPE_CHECKBOX, CONFIG_UI_SHOW_GRID, TR_CONFIG_UI_SHOW_GRID, NULL, 0, 1, ITEM_BASE_H, CHECKBOX_MARGIN},
{TYPE_CHECKBOX, CONFIG_UI_SHOW_PARTIAL_GRID_AROUND_CONSTRUCTION, TR_CONFIG_UI_SHOW_PARTIAL_GRID_AROUND_CONSTRUCTION, NULL, 0, 1, ITEM_BASE_H, CHECKBOX_MARGIN},
{TYPE_CHECKBOX, CONFIG_UI_CLIMATE_GRID_COLORS, TR_CONFIG_UI_CLIMATE_GRID_COLORS, NULL, 0, 1, ITEM_BASE_H, CHECKBOX_MARGIN},
{TYPE_CHECKBOX, CONFIG_UI_SHOW_ROAMING_PATH, TR_CONFIG_SHOW_ROAMING_PATH, NULL, 0, 1, ITEM_BASE_H, CHECKBOX_MARGIN},
{TYPE_HEADER, 0, TR_CONFIG_HEADER_DESIRABILITY, NULL, 0, 1, ITEM_BASE_H, 14},
{TYPE_CHECKBOX, CONFIG_UI_SHOW_DESIRABILITY_RANGE, TR_CONFIG_SHOW_DESIRABILITY_RANGE, NULL, 0, 1, ITEM_BASE_H, CHECKBOX_MARGIN},
Expand Down
Loading