feat(editor): unified Export Zone, quick-save, cursor world coords

- Ctrl+S quick-saves entire zone (ADT + WDT + creatures.json) to output/
- File > Export Zone dialog saves all data to chosen directory
- exportZone() bundles ADT, WDT, and NPC spawns in one operation
- Info panel shows cursor world coordinates for placement debugging
- Info panel shows NPC count alongside object count
- Save state indicator: "Saved" (green) vs "* Unsaved (Ctrl+S)" (yellow)
- File menu reorganized: Quick Save + Export Zone replaces separate ADT/WDT
This commit is contained in:
Kelsi 2026-05-05 04:06:19 -07:00
parent 88abbfb564
commit d28c5ec842
3 changed files with 69 additions and 23 deletions

View file

@ -211,6 +211,9 @@ void EditorApp::processEvents() {
objectsDirty_ = true;
}
}
if (sc == SDL_SCANCODE_S && (event.key.keysym.mod & KMOD_CTRL)) {
quickSave();
}
if (sc == SDL_SCANCODE_Z && (event.key.keysym.mod & KMOD_CTRL)) {
if (mode_ == EditorMode::Sculpt) {
if (event.key.keysym.mod & KMOD_SHIFT)
@ -544,6 +547,37 @@ void EditorApp::saveWDT(const std::string& path) {
ADTWriter::writeWDT(loadedMap_, loadedTileX_, loadedTileY_, path);
}
void EditorApp::exportZone(const std::string& outputDir) {
if (!terrain_.isLoaded() || loadedMap_.empty()) return;
std::string base = outputDir + "/" + loadedMap_;
// Save ADT
std::string adtPath = base + "/" + loadedMap_ + "_" +
std::to_string(loadedTileX_) + "_" +
std::to_string(loadedTileY_) + ".adt";
saveADT(adtPath);
// Save WDT
std::string wdtPath = base + "/" + loadedMap_ + ".wdt";
saveWDT(wdtPath);
// Save creature spawns
if (npcSpawner_.spawnCount() > 0) {
std::string npcPath = base + "/creatures.json";
npcSpawner_.saveToFile(npcPath);
}
lastSavePath_ = outputDir;
LOG_INFO("Zone exported to: ", base);
}
void EditorApp::quickSave() {
if (!terrain_.isLoaded()) return;
std::string dir = lastSavePath_.empty() ? "output" : lastSavePath_;
exportZone(dir);
}
void EditorApp::requestQuit() {
window_->setShouldClose(true);
}