From be18ceea733ce8720fa9e94e90446e05b253a9ff Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 5 May 2026 09:29:57 -0700 Subject: [PATCH] feat(editor): Export Content Pack button in File menu - File > Export Content Pack (.wcp) saves zone + packs into WCP archive - Auto-saves zone first, then bundles into the novel WCP format - WCP is a custom format unique to wowee (not MPQ, not CASC) - Output: output/MapName.wcp ready for distribution - Toast notification on success/failure --- tools/editor/editor_app.cpp | 18 ++++++++++++++++++ tools/editor/editor_app.hpp | 1 + tools/editor/editor_ui.cpp | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/tools/editor/editor_app.cpp b/tools/editor/editor_app.cpp index 50392834..1bc8a23e 100644 --- a/tools/editor/editor_app.cpp +++ b/tools/editor/editor_app.cpp @@ -1,6 +1,7 @@ #include "editor_app.hpp" #include "adt_writer.hpp" #include "zone_manifest.hpp" +#include "content_pack.hpp" #include "core/coordinates.hpp" #include "rendering/vk_context.hpp" #include "pipeline/adt_loader.hpp" @@ -762,6 +763,23 @@ void EditorApp::exportZone(const std::string& outputDir) { LOG_INFO("Zone exported to: ", base); } +void EditorApp::exportContentPack(const std::string& destPath) { + if (!terrain_.isLoaded()) return; + // Save zone first + std::string dir = lastSavePath_.empty() ? "output" : lastSavePath_; + exportZone(dir); + // Pack into WCP + ContentPackInfo info; + info.name = loadedMap_; + info.author = "Kelsi Davis"; + info.description = "Custom zone created with Wowee World Editor"; + info.mapId = 9000; + if (ContentPacker::packZone(dir, loadedMap_, destPath, info)) + showToast("Content pack exported: " + destPath); + else + showToast("Failed to create content pack"); +} + void EditorApp::quickSave() { if (!terrain_.isLoaded()) return; std::string dir = lastSavePath_.empty() ? "output" : lastSavePath_; diff --git a/tools/editor/editor_app.hpp b/tools/editor/editor_app.hpp index c2d31a01..cf8b9a1d 100644 --- a/tools/editor/editor_app.hpp +++ b/tools/editor/editor_app.hpp @@ -36,6 +36,7 @@ public: void saveWDT(const std::string& path); void exportZone(const std::string& outputDir); void quickSave(); + void exportContentPack(const std::string& destPath); void requestQuit(); void resetCamera(); diff --git a/tools/editor/editor_ui.cpp b/tools/editor/editor_ui.cpp index 6e19d65e..622fb480 100644 --- a/tools/editor/editor_ui.cpp +++ b/tools/editor/editor_ui.cpp @@ -158,6 +158,10 @@ void EditorUI::renderMenuBar(EditorApp& app) { app.quickSave(); if (ImGui::MenuItem("Export Zone...", nullptr, false, app.hasTerrainLoaded())) showSaveDialog_ = true; + if (ImGui::MenuItem("Export Content Pack (.wcp)", nullptr, false, app.hasTerrainLoaded())) { + std::string wcpPath = "output/" + app.getLoadedMap() + ".wcp"; + app.exportContentPack(wcpPath); + } if (ImGui::BeginMenu("Add Adjacent Tile", app.hasTerrainLoaded())) { if (ImGui::MenuItem("North (+X)")) app.addAdjacentTile(1, 0); if (ImGui::MenuItem("South (-X)")) app.addAdjacentTile(-1, 0);