Map now has a color theme rather than random colors.

master
Zed A. Shaw 2 days ago
parent 379060b8c7
commit 973495b687
  1. BIN
      assets/map_tiles.png
  2. 53
      assets/palette.json
  3. 7
      assets/tiles.json
  4. 23
      tools/icongen.cpp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

@ -1,6 +1,7 @@
{ {
"color": { "color": {
"transparent": [255, 255, 255, 255] "transparent": [255, 255, 255, 255],
"BAD": [255, 0, 0]
}, },
"gui/theme": { "gui/theme": {
"black": [0, 0, 0, 255], "black": [0, 0, 0, 255],
@ -18,34 +19,46 @@
"border_color": "gui/theme:dark_dark", "border_color": "gui/theme:dark_dark",
"bg_color_dark": "gui/theme:black" "bg_color_dark": "gui/theme:black"
}, },
"map/theme": {
"black": [0, 0, 0, 255],
"dark_dark": [10, 10, 10, 255],
"dark_mid": [30, 30, 30, 255],
"dark_light": [60, 60, 60, 255],
"mid": [100, 100, 100, 255],
"light_dark": [150, 150, 150, 255],
"light_mid": [200, 200, 200, 255],
"light_light": [230, 230, 230, 255],
"white": [255, 255, 255, 255]
},
"items/fg": { "items/fg": {
"flame": [24, 120, 189], "flame": "map/theme:white",
"potion": [255, 205, 189] "potion": "map/theme:white"
}, },
"enemies/fg": { "enemies/fg": {
"player": [255, 200, 125], "player": "map/theme:white",
"gold_savior": [131, 213, 238], "gold_savior": "map/theme:white",
"knight": [131, 213, 238], "knight": "map/theme:white",
"axe_ranger": [156, 172, 197], "axe_ranger": "map/theme:white",
"rat_giant": [205, 164, 246], "rat_giant": "map/theme:white",
"spider_giant": [205, 164, 246] "spider_giant": "map/theme:white"
}, },
"tiles/fg": { "tiles/fg": {
"floor_tile": [40, 40, 40], "floor_tile": "map/theme:mid",
"wall_plain": [100, 100, 100], "wall_plain": "map/theme:dark_mid",
"wall_moss": [100, 150, 100], "wall_moss": "map/theme:dark_light",
"ceiling_black": [100, 100, 100], "ceiling_black": "color:transparent",
"lava_floor": [200, 100, 100], "lava_floor": [200, 100, 100],
"gray_stone_floor_light": [40, 60, 180], "gray_stone_floor_light": [40, 60, 180],
"wood_wall": [70, 70, 70], "wood_wall": "map/theme:dark_mid"
"BAD": [255, 0, 0]
}, },
"tiles/bg": { "tiles/bg": {
"wall_plain": [10, 10, 10], "floor_tile": "map/theme:dark_dark",
"wall_moss": [100, 100, 180], "wall_plain": "map/theme:dark_dark",
"lava_floor": [100, 100, 50], "wall_moss": "map/theme:light_dark",
"gray_stone_floor_light": [80, 80, 80], "ceiling_black": "color:transparent",
"wood_wall": [100, 100, 100] "lava_floor": "map/theme:dark_dark",
"gray_stone_floor_light": "map/theme:dark_mid",
"wood_wall": "map/theme:dark_dark"
}, },
"devices/fg": { "devices/fg": {
"stairs_down": [24, 205, 189], "stairs_down": [24, 205, 189],

@ -6,6 +6,7 @@
"ceiling": "ceiling_black", "ceiling": "ceiling_black",
"light": 0, "light": 0,
"foreground": "tiles/fg:floor_tile", "foreground": "tiles/fg:floor_tile",
"background": "tiles/bg:floor_tile",
"id": 0 "id": 0
}, },
"wall_plain": { "wall_plain": {
@ -22,8 +23,8 @@
"collision": true, "collision": true,
"display": 9256, "display": 9256,
"light": 20, "light": 20,
"background": "tiles/bg:wall_moss",
"foreground": "tiles/fg:wall_moss", "foreground": "tiles/fg:wall_moss",
"background": "tiles/bg:wall_moss",
"id": 2 "id": 2
}, },
"ceiling_black": { "ceiling_black": {
@ -32,6 +33,7 @@
"display": 35, "display": 35,
"light": 0, "light": 0,
"foreground": "tiles/fg:ceiling_black", "foreground": "tiles/fg:ceiling_black",
"background": "tiles/bg:ceiling_black",
"id": 4 "id": 4
}, },
"lava_floor": { "lava_floor": {
@ -68,7 +70,8 @@
"collision": false, "collision": false,
"display": 8285, "display": 8285,
"light": 0, "light": 0,
"foreground": "tiles/fg:BAD", "foreground": "color:BAD",
"background": "color:BAD",
"id": 7 "id": 7
} }
} }

@ -217,20 +217,17 @@ void load_config(MapConfig& config, bool is_centered, std::string path, std::fun
fmt::format("duplicate color for display={} key={}", fmt::format("duplicate color for display={} key={}",
(int)display, (std::string)key)); (int)display, (std::string)key));
if(data.contains("foreground")) { dbc::check(data.contains("foreground"),
auto fg = palette::get(data["foreground"]); fmt::format("{} has no foreground", std::string(key)));
config.colors.insert_or_assign(display, fg);
} else {
config.colors.insert_or_assign(display, DEFAULT_COLOR);
}
if(data.contains("background")) { auto fg = palette::get(data["foreground"]);
auto bg = palette::get(data["background"]); config.colors.insert_or_assign(display, fg);
config.backgrounds.insert_or_assign(display, bg);
} else { dbc::check(data.contains("background"),
sf::Color bg{0, 0, 0, 0}; fmt::format("{} has no background", std::string(key)));
config.backgrounds.insert_or_assign(display, bg);
} auto bg = palette::get(data["background"]);
config.backgrounds.insert_or_assign(display, bg);
} }
} }

Loading…
Cancel
Save