From 5e01eb29a9de4db6482d25cdeb323123d6f11d6f Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Fri, 11 Jul 2025 01:02:27 -0400 Subject: [PATCH] There's a bug where the last item in tiles.json draws a black square, which is why I named ceiling_blue to zceiling_blue to temporarily solve it. --- assets/enemies.json | 16 ++++----- assets/items.json | 4 +-- assets/map_tiles.json | 76 +++++++++++++++++++++--------------------- assets/map_tiles.png | Bin 2984 -> 7932 bytes assets/tiles.json | 37 ++++++++++---------- tests/map.cpp | 4 +-- tools/icongen.cpp | 57 +++++++++++++++++++------------ 7 files changed, 104 insertions(+), 90 deletions(-) diff --git a/assets/enemies.json b/assets/enemies.json index 33700f7..a72c7d0 100644 --- a/assets/enemies.json +++ b/assets/enemies.json @@ -2,9 +2,9 @@ "PLAYER_TILE": { "placement": "fixed", "components": [ - {"_type": "Tile", "display": 42603, + {"_type": "Tile", "display": 41981, "foreground": [255, 200, 125], - "background": [30, 20, 75] + "background": [0,0,0] }, {"_type": "Combat", "hp": 200, "max_hp": 200, "damage": 10, "dead": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, @@ -13,9 +13,9 @@ }, "GOLD_SAVIOR": { "components": [ - {"_type": "Tile", "display": 2189, + {"_type": "Tile", "display": 42586, "foreground": [131, 213, 238], - "background": [30, 20, 75] + "background": [0,0,0] }, {"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 1, "dead": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, @@ -30,7 +30,7 @@ "components": [ {"_type": "Tile", "display": 2189, "foreground": [131, 213, 238], - "background": [30, 20, 75] + "background": [0,0,0] }, {"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 1, "dead": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, @@ -45,7 +45,7 @@ "components": [ {"_type": "Tile", "display": 1898, "foreground": [156, 172, 197], - "background": [30, 20, 75] + "background": [0,0,0] }, {"_type": "Combat", "hp": 40, "max_hp": 40, "damage": 10, "dead": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": true}, @@ -60,7 +60,7 @@ "components": [ {"_type": "Tile", "display": 2220, "foreground": [205, 164, 246], - "background": [30, 20, 75] + "background": [0,0,0] }, {"_type": "Combat", "hp": 50, "max_hp": 50, "damage": 2, "dead": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, @@ -75,7 +75,7 @@ "components": [ {"_type": "Tile", "display": 1218, "foreground": [205, 164, 246], - "background": [30, 20, 75] + "background": [0,0,0] }, {"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 20, "dead": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, diff --git a/assets/items.json b/assets/items.json index d523e57..bfefd71 100644 --- a/assets/items.json +++ b/assets/items.json @@ -8,7 +8,7 @@ {"_type": "LightSource", "strength": 50, "radius": 2.5}, {"_type": "Tile", "display": 3848, "foreground": [24, 120, 189], - "background": [230,120, 120] + "background": [0,0,0] }, {"_type": "Sprite", "name": "torch_horizontal_floor", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sound", "attack": "pickup", "death": "blank"} @@ -22,7 +22,7 @@ "components": [ {"_type": "Tile", "display": 1003, "foreground": [255, 205, 189], - "background": [255, 205, 189] + "background": [0,0,0] }, {"_type": "Curative", "hp": 20}, {"_type": "Sprite", "name": "healing_potion_small", "width": 256, "height": 256, "scale": 1.0}, diff --git a/assets/map_tiles.json b/assets/map_tiles.json index 545e8ed..3523cd8 100644 --- a/assets/map_tiles.json +++ b/assets/map_tiles.json @@ -7,122 +7,122 @@ }, { "centered": false, - "display": 35, - "x": 32, + "display": 8284, + "x": 64, "y": 0 }, { "centered": false, - "display": 10398, - "x": 64, + "display": 11590, + "x": 128, "y": 0 }, { "centered": false, - "display": 35, - "x": 96, + "display": 10899, + "x": 192, "y": 0 }, { "centered": false, - "display": 35, - "x": 128, + "display": 9256, + "x": 256, "y": 0 }, { "centered": false, - "display": 8820, - "x": 160, + "display": 9608, + "x": 320, "y": 0 }, { "centered": false, - "display": 9608, - "x": 192, + "display": 10747, + "x": 384, "y": 0 }, { "centered": false, - "display": 35, - "x": 224, + "display": 8285, + "x": 448, "y": 0 }, { "centered": true, "display": 1003, - "x": 256, + "x": 512, "y": 0 }, { "centered": true, "display": 3848, - "x": 288, + "x": 576, "y": 0 }, { "centered": true, "display": 85, "x": 0, - "y": 32 + "y": 64 }, { "centered": true, "display": 8687, - "x": 32, - "y": 32 + "x": 64, + "y": 64 }, { "centered": true, "display": 10949, - "x": 64, - "y": 32 + "x": 128, + "y": 64 }, { "centered": true, "display": 8793, - "x": 96, - "y": 32 + "x": 192, + "y": 64 }, { "centered": true, "display": 95, - "x": 128, - "y": 32 + "x": 256, + "y": 64 }, { "centered": true, "display": 1898, - "x": 160, - "y": 32 + "x": 320, + "y": 64 }, { "centered": true, - "display": 2189, - "x": 192, - "y": 32 + "display": 42586, + "x": 384, + "y": 64 }, { "centered": true, "display": 2189, - "x": 224, - "y": 32 + "x": 448, + "y": 64 }, { "centered": true, - "display": 42603, - "x": 256, - "y": 32 + "display": 41981, + "x": 512, + "y": 64 }, { "centered": true, "display": 2220, - "x": 288, - "y": 32 + "x": 576, + "y": 64 }, { "centered": true, "display": 1218, "x": 0, - "y": 64 + "y": 128 } ] diff --git a/assets/map_tiles.png b/assets/map_tiles.png index fc25b4aec6305351ccf89f106383dd3c8e2bcfcf..40d3093be36f382e976c395bcfbe357ce0143712 100644 GIT binary patch literal 7932 zcmd5>c|4TuyPpk{v5XeR*i)j#45sV`Q--t%Ekwo=lVmTl&R9mu`ldoVeXsk8x7tS(6-En#Kp;^I z^PScp5QGBUQ{aNY^{O=s_(Q(IVyB61@G)1n9I&~C#oYdcl7RkZY3zcyyg@q1Us+4* z2gEw6cXq5te6;)VU31Uk6J#>yR=MGe7cXY*?CjQ=`(HH|e{VyfHObm<*g})>u`ci~ zOf-{gFpky{48No6yshDMg`Jahgv5^argO!ahhHGKN80(_J-#5Ax+Ws#XiI?TXO7xg z=)=kd733qlY{h%uh?u754k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}KO`jrsAFBd)f|pQPXs}V4Eif_(%MY-u4nP zU{w0mh4Pjp)40VOmm#p$E%SS?iY*U_?hB%g-xs^z?Mso5+SHt!kh=obbS#T}zOV)S zxkg{Ou7E#$>J}toQ1Ov~?O7|r=IJGzb8wmAeD7JJJ*u}gKELynRdpu&`%^vGi+syR zt>MA_hkt0p@U;Dox2N)XsnbL%P6@Ib+v*2K(t^dWeQ`V5ATIQE}&?Chgn7>4kmmYN^e&6B~J`Yxw*Lv~4vDHhQOHOo@>6SH*ggFan%>t#_ zDJ9=}GpfG&hInj1Q@dIkX{eJ%mgQYJm!{_bTd5@sBza4L@@7N8(jpzDd~27h!+Gl1 zWhFY^OcVVO{f7O%rdi9fpFhE3>)mo=YW~Y3?fJOeC0xEAzaMBSybgP;GUEFL#47Sq zSRAsxE|*x8Syp}k#J^_TUm6Gn{c;ZJd#p9m(Ey!* zA%`(}wCRq0Rt)?8$Q-jr98{JE8I3BIMmMNBjo4OWxA*Kb)%TP(iNG^&yuv}-N`bU@ s8wbm=;U$y81`9*ce}3Zss9rJwDC?U!qRQkcbO{`A*8~UF_zT4U0u*}fvj6}9 diff --git a/assets/tiles.json b/assets/tiles.json index d6b1694..0d81922 100644 --- a/assets/tiles.json +++ b/assets/tiles.json @@ -2,7 +2,7 @@ "floor_tile": { "texture": "assets/textures/floor_gray_stone.png", "collision": false, - "display": 10398, + "display": 8284, "ceiling": "ceiling_black", "light": 0, "foreground": [40, 40, 40], @@ -20,10 +20,10 @@ "wall_moss": { "texture": "assets/textures/glowing_moss_wall.png", "collision": true, - "display": 8820, + "display": 9256, "light": 20, - "foreground": [100, 150, 100], - "background": [100, 100, 100], + "foreground": [100, 100, 180], + "background": [100, 150, 100], "id": 2 }, "ceiling_black": { @@ -37,37 +37,38 @@ "lava_floor": { "texture": "assets/textures/lava_floor.png", "collision": false, - "display": 35, + "display": 10899, "ceiling": "ceiling_black", "light": 20, "foreground": [200, 100, 100], - "background": [10, 10, 10], + "background": [100, 100, 50], "id": 5 }, "gray_stone_floor_light": { "texture": "assets/textures/gray_stone_floor_light.png", "collision": false, - "display": 35, - "ceiling": "ceiling_blue_light", + "display": 11590, + "ceiling": "zceiling_blue_light", "light": 40, - "foreground": [40, 40, 40], + "background": [80, 80, 80], + "foreground": [40, 60, 180], "id": 6 }, - "ceiling_blue_light": { - "texture": "assets/textures/ceiling_blue_light.png", - "collision": false, - "display": 35, - "light": 0, - "foreground": [100, 100, 100], - "id": 7 - }, "wood_wall": { "texture": "assets/textures/wood_wall.png", "collision": false, - "display": 35, + "display": 10747, "light": 0, "foreground": [70, 70, 70], "background": [100, 100, 100], "id": 8 + }, + "zceiling_blue_light": { + "texture": "assets/textures/ceiling_blue_light.png", + "collision": false, + "display": 8285, + "light": 0, + "foreground": [100, 100, 100], + "id": 7 } } diff --git a/tests/map.cpp b/tests/map.cpp index 47f1ea0..938e26f 100644 --- a/tests/map.cpp +++ b/tests/map.cpp @@ -96,7 +96,7 @@ TEST_CASE("map image test", "[map-sprite]") { auto &walls = level.map->tiles(); auto &tile_set = textures::get_map_tile_set(); - sf::Vector2i size{32,32}; + sf::Vector2i size{64,64}; matrix::dump("TILES?", walls); std::unordered_map sprite_coord; @@ -140,8 +140,6 @@ TEST_CASE("map image test", "[map-sprite]") { REQUIRE(sprite_coord.contains(entity_glyph.display)); auto sprite = render_sprite(sprite_coord, size, entity_glyph.display, map_sprites); - - sprite.setColor({255,150,150,255}); sprite.setPosition({float(pos.location.x * size.x), float(pos.location.y * size.y)}); render.draw(sprite); }); diff --git a/tools/icongen.cpp b/tools/icongen.cpp index 7188328..ba4277c 100644 --- a/tools/icongen.cpp +++ b/tools/icongen.cpp @@ -12,7 +12,8 @@ namespace fs = std::filesystem; constexpr const int TILE_COUNT=10; constexpr const sf::Color DEFAULT_COLOR{255, 255, 255, 255}; -constexpr const size_t DEFAULT_DIM=32; +constexpr const size_t DEFAULT_DIM=64; +using namespace nlohmann; using namespace shiterator; @@ -92,30 +93,36 @@ struct MapTileBuilder { for(each_row_t it{config.map}; it.next();) { // a 0 slot means we're done if(config.map[it.y][it.x] == 0) break; + cell_pos.x = it.x * $size.x; cell_pos.y = it.y * $size.y; bool is_centered = config.centered[it.y][it.x]; wchar_t display_char = config.map[it.y][it.x]; std::wstring content{display_char}; + auto bg = config.backgrounds.at(display_char); + auto fg = config.colors.at(display_char); best_size(display_char, is_centered); sf::Text icon{$font, content, $font_size}; - icon.setFillColor({0, 0, 0, 255}); + icon.setFillColor({255, 255, 255, 255}); $temp_render.draw(icon); $temp_render.clear({0,0,0,0}); - auto font_texture = $font.getTexture($font_size); + auto& font_texture = $font.getTexture($font_size); sf::Sprite sprite{font_texture, $glyph.textureRect}; auto t_size = $glyph.textureRect.size; dbc::check($size.x - t_size.x >= 0, "font too big on x"); dbc::check($size.y - t_size.y >= 0, "font too big on y"); + fmt::println("display: {}, bg: {},{},{},{}; fg: {},{},{},{}", + (int)display_char, bg.r, bg.g, bg.b, bg.a, fg.r, fg.g, fg.b, fg.a); + // draw the background first - background.setFillColor(config.backgrounds[display_char]); + background.setFillColor(bg); if(is_centered) { sf::Vector2f center{ @@ -131,23 +138,22 @@ struct MapTileBuilder { background.setPosition(cell_pos); } - sprite.setColor(config.colors[display_char]); + sprite.setColor(fg); $render->draw(background); $render->draw(sprite); + $render->display(); } - - $render->display(); } void save_config(MapConfig& config, const std::string &path) { (void)path; - nlohmann::json result = nlohmann::json::array(); + json result = json::array(); for(each_row_t it{config.map}; it.next();) { if(config.map[it.y][it.x] == 0) break; - nlohmann::json val; + json val; val["x"] = $size.x * it.x; val["y"] = $size.y * it.y; @@ -162,60 +168,69 @@ struct MapTileBuilder { } }; -void load_config(MapConfig& config, bool is_centered, std::string path, std::function finder) +void load_config(MapConfig& config, bool is_centered, std::string path, std::function finder) { Config tiles(path); for(auto [key, val] : tiles.json().items()) { config.it.next(); - auto display = finder(val); + auto data = finder(val); + wchar_t display = data["display"]; config.map[config.it.y][config.it.x] = display; config.centered[config.it.y][config.it.x] = is_centered; - if(val.contains("foreground")) { - auto fg_color = val["foreground"]; + dbc::check(!config.colors.contains(display), + fmt::format("duplicate color for display={} key={}", + (int)display, (std::string)key)); + + if(data.contains("foreground")) { + auto fg_color = data["foreground"]; sf::Color fg{fg_color[0], fg_color[1], fg_color[2]}; + fmt::println("TILE {}, display: {} has foreground: {},{},{}", key, (int)display, fg.r, fg.g, fg.b); config.colors.insert_or_assign(display, fg); } else { + fmt::println("TILE {}, {} has DEFAULT COLOR", key, (int)display); config.colors.insert_or_assign(display, DEFAULT_COLOR); } - if(val.contains("background")) { - auto bg_color = val["background"]; + if(data.contains("background")) { + auto bg_color = data["background"]; sf::Color bg{bg_color[0], bg_color[1], bg_color[2]}; + fmt::println("TILE {} display: {} has background: {},{},{}", key, (int)display, bg.r, bg.g, bg.b); config.backgrounds.insert_or_assign(display, bg); } else { + fmt::println("TILE {} display: {} has transparent background", key, (int)display); sf::Color bg{0, 0, 0, 0}; config.backgrounds.insert_or_assign(display, bg); } - } } -wchar_t component_display(nlohmann::json& val) { +json& component_display(json& val) { auto& components = val["components"]; for(auto& comp : components) { if(comp["_type"] == "Tile") { - return comp["display"]; + return comp; } } dbc::log("BAD CHAR"); - return L'!'; + return val; } int main() { MapConfig config; - load_config(config, false, "./assets/tiles.json", [](nlohmann::json& val) -> wchar_t { - return val["display"]; + load_config(config, false, "./assets/tiles.json", [](json& val) -> json& { + return val; }); load_config(config, true, "./assets/items.json", component_display); load_config(config, true, "./assets/devices.json", component_display); load_config(config, true, "./assets/enemies.json", component_display); + fmt::println("-----------------------------------------"); MapTileBuilder builder(DEFAULT_DIM, DEFAULT_DIM); builder.run(config);