From 410eee4d4a78d1ad5886f8fc5e2a052d7dc4c996 Mon Sep 17 00:00:00 2001 From: Sebanisu Date: Sun, 24 May 2026 10:18:54 -0400 Subject: [PATCH 1/4] Remove duplicate fmt formatter specializations Delete local formatter specializations for BlendModeT, BPPT, and Point now provided or instantiated earlier by upstream OpenVIII_CPP_WIP headers. Fixes fmt v11 redefinition and specialization-after-instantiation build errors. --- src/opengl/main/formatters.hpp | 82 ---------------------------------- 1 file changed, 82 deletions(-) diff --git a/src/opengl/main/formatters.hpp b/src/opengl/main/formatters.hpp index a2ef6474..6c75e9da 100644 --- a/src/opengl/main/formatters.hpp +++ b/src/opengl/main/formatters.hpp @@ -118,42 +118,6 @@ struct fmt::formatter : fmt::formatter } }; -template<> -struct fmt::formatter - : fmt::formatter -{ - // parse is inherited from formatter. - template - constexpr auto format( - open_viii::graphics::background::BlendModeT blend_mode_t, - FormatContext &ctx) const - { - using namespace open_viii::graphics::background; - using namespace std::string_view_literals; - std::string_view name = {}; - switch (blend_mode_t) - { - case BlendModeT::add: - name = "add"sv; - break; - case BlendModeT::half_add: - name = "half add"sv; - break; - case BlendModeT::none: - name = "none"sv; - break; - case BlendModeT::quarter_add: - name = "quarter add"sv; - break; - case BlendModeT::subtract: - name = "subtract"sv; - break; - } - return fmt::formatter::format(name, ctx); - } -}; - - template<> struct fmt::formatter : fmt::formatter { @@ -265,23 +229,6 @@ struct fmt::formatter : fmt::formatter } }; -template -struct fmt::formatter> : fmt::formatter -{ - // parse is inherited from formatter>. - template - constexpr auto format( - open_viii::graphics::Point point, - FormatContext &ctx) const - { - fmt::format_to(ctx.out(), "{}", '('); - fmt::formatter::format(point.x(), ctx); - fmt::format_to(ctx.out(), "{}", ", "); - fmt::formatter::format(point.y(), ctx); - return fmt::format_to(ctx.out(), "{}", ')'); - } -}; - template<> struct fmt::formatter { @@ -350,35 +297,6 @@ struct fmt::formatter> } }; -template<> -struct fmt::formatter : fmt::formatter -{ - // parse is inherited from formatter. - template - constexpr auto format( - open_viii::graphics::BPPT bppt, - FormatContext &ctx) const - { - using namespace open_viii::graphics; - using namespace std::string_view_literals; - - if (bppt.bpp8()) - { - return fmt::formatter::format(BPPT::BPP8, ctx); - } - if (bppt.bpp16()) - { - return fmt::formatter::format(BPPT::BPP16, ctx); - } - if (bppt.bpp24()) - { - return fmt::formatter::format(BPPT::BPP24, ctx); - } - return fmt::formatter::format(BPPT::BPP4, ctx); - } -}; - - template struct fmt::formatter : fmt::formatter { From 5c776d3eaa45660e3dc29b73ddb3813ce111a9d8 Mon Sep 17 00:00:00 2001 From: Sebanisu Date: Sun, 24 May 2026 10:25:21 -0400 Subject: [PATCH 2/4] Update mim_sprite PNG save call for new API Replace deprecated positional Png::save arguments with SaveSettings initialization to match upstream OpenVIII_CPP_WIP API changes. --- src/opengl/main/mim_sprite.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/opengl/main/mim_sprite.cpp b/src/opengl/main/mim_sprite.cpp index 7e293f60..00f5ce58 100644 --- a/src/opengl/main/mim_sprite.cpp +++ b/src/opengl/main/mim_sprite.cpp @@ -128,9 +128,7 @@ void mim_sprite::save(const std::filesystem::path &dest_path) const m_colors, width(), height(), - dest_path.string(), - dest_path.stem().string(), - ""); + { .filename = dest_path.string(), .prefix = "" }); } } From d6d98c4447999fc6a8c38bfa5a963b153f462016 Mon Sep 17 00:00:00 2001 From: Sebanisu Date: Sun, 24 May 2026 21:45:10 -0400 Subject: [PATCH 3/4] build: add fmt dependency and update vcpkg baseline - add fmt to vcpkg dependencies - pin fmt version to 12.0.0 - update vcpkg builtin baseline --- vcpkg.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index 8a6e1d3f..34ec1570 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,10 +1,11 @@ { "name": "field-map-editor", "version": "1.0.5", - "builtin-baseline": "4334d8b4c8916018600212ab4dd4bbdc343065d1", + "builtin-baseline": "4f1406d8f7923c3fff34738b6177f72b143ad5b6", "dependencies": [ "lz4", "spdlog", + "fmt", "glfw3", "glew", "glm", @@ -36,6 +37,11 @@ "version": "1.15.3", "port-version": 0 }, + { + "name": "fmt", + "version": "12.0.0", + "port-version": 0 + }, { "name": "glfw3", "version": "3.4", From 5334391233327e64cbfc19ebc61d4353219e3eef Mon Sep 17 00:00:00 2001 From: Sebanisu Date: Sun, 24 May 2026 22:44:11 -0400 Subject: [PATCH 4/4] ## Summary Refactors formatting and layout in `import.cpp` for improved readability and consistency. Also replaces implicit optional clearing: ```cpp m_import_image_map = {}; ``` with the more explicit: ```cpp m_import_image_map.reset(); ``` ## Changes - Reformat multiline `ImGui::*` conditionals - Normalize wrapping of `if constexpr` and comparison expressions - Align local variable spacing - Replace optional clearing assignment with `.reset()` - General readability cleanup in import GUI code ## Notes No functional changes intended besides the explicit optional reset behavior. --- src/opengl/main/gui/import.cpp | 116 +++++++++++++++++---------------- 1 file changed, 61 insertions(+), 55 deletions(-) diff --git a/src/opengl/main/gui/import.cpp b/src/opengl/main/gui/import.cpp index fd5b269a..a3823f57 100644 --- a/src/opengl/main/gui/import.cpp +++ b/src/opengl/main/gui/import.cpp @@ -202,8 +202,9 @@ open_viii::graphics::background::Map::variant_tile & const auto pop_item_width = glengine::ScopeGuard(&ImGui::PopItemWidth); - if (ImGui::BeginCombo( - "##Select Existing Tile", "", ImGuiComboFlags_HeightLarge)) + if ( + ImGui::BeginCombo( + "##Select Existing Tile", "", ImGuiComboFlags_HeightLarge)) { static constexpr int columnWidth = 100;// Adjust as needed const auto num_columns = std::max( @@ -228,43 +229,44 @@ open_viii::graphics::background::Map::variant_tile & bool is_selected = (selections->get() == tile_id);// You can store your selection however you // want, outside or inside your objects - if (std::ranges::any_of( - std::array{ - [&]() -> bool - { - bool const selected - = ImGui::Selectable("", is_selected); - tool_tip( - [&]() - { - format_imgui_text("{}", tile_id); - const tile_button_options options - = { .size = { tooltips_size, - tooltips_size } }; - (void)create_tile_button( - map_sprite, tile, options); - // map_sprite->enable_square(tile); - was_hovered = true; - }); - return selected; - }(), - []() -> bool - { - ImGui::SameLine(); - return false; - }(), - create_tile_button(map_sprite, tile), - []() -> bool - { - ImGui::SameLine(); - return false; - }(), - [&tile_id]() -> bool - { - format_imgui_text("{}", tile_id); - return false; - }() }, - std::identity{})) + if ( + std::ranges::any_of( + std::array{ + [&]() -> bool + { + bool const selected + = ImGui::Selectable("", is_selected); + tool_tip( + [&]() + { + format_imgui_text("{}", tile_id); + const tile_button_options options + = { .size = { tooltips_size, + tooltips_size } }; + (void)create_tile_button( + map_sprite, tile, options); + // map_sprite->enable_square(tile); + was_hovered = true; + }); + return selected; + }(), + []() -> bool + { + ImGui::SameLine(); + return false; + }(), + create_tile_button(map_sprite, tile), + []() -> bool + { + ImGui::SameLine(); + return false; + }(), + [&tile_id]() -> bool + { + format_imgui_text("{}", tile_id); + return false; + }() }, + std::identity{})) { selections->get() = tile_id; @@ -437,9 +439,10 @@ bool import::browse_for_image_display_preview() const glengine::ConvertGliDtoImTextureId( m_loaded_image_texture.id()), ImVec2(width, height)); - if (ImGui::Checkbox( - gui_labels::draw_grid.data(), - &selections->get())) + if ( + ImGui::Checkbox( + gui_labels::draw_grid.data(), + &selections->get())) { selections->update(); } @@ -512,7 +515,7 @@ bool import::combo_tile_size() const tile_sizes::x_16_size }; static const auto strings = values | std::views::transform(AsString{}) | std::ranges::to(); - const auto gcc = GenericCombo( + const auto gcc = GenericCombo( gui_labels::tile_size, values, strings, @@ -570,8 +573,8 @@ void import::generate_map_for_imported_image( [&](auto tile) -> open_viii::graphics::background::Map::variant_tile { - if constexpr (is_tile< - std::remove_cvref_t>) + if constexpr ( + is_tile>) { if (x_tile == tiles_wide) { @@ -840,7 +843,7 @@ void import::reset_imported_image() const return; } map_sprite->update_render_texture(nullptr, {}, tile_sizes::default_size); - m_import_image_map = {}; + m_import_image_map.reset(); m_loaded_image_texture = {}; // m_loaded_image_cpu = {}; m_import_image_path = {}; @@ -885,15 +888,17 @@ void import::find_selected_tile_for_import( std::visit( [&](const auto &tile) { - if (std::cmp_less( - selections->get(), - tiles.size())) + if ( + std::cmp_less( + selections->get(), + tiles.size())) { const auto &tmp_tile = tiles[static_cast( selections->get())]; - if constexpr (std::is_same_v< - std::decay_t, - std::decay_t>) + if constexpr ( + std::is_same_v< + std::decay_t, + std::decay_t>) { if (tile != tmp_tile) { @@ -982,9 +987,10 @@ bool import::checkbox_render_imported_image() const return false; } - if (ImGui::Checkbox( - gui_labels::render_imported_image.data(), - &selections->get())) + if ( + ImGui::Checkbox( + gui_labels::render_imported_image.data(), + &selections->get())) { selections->update(); // Pass texture and map and tile_size