From 1d64846a379097a16fd8c83de00e26e3585dc81e Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 12 Apr 2025 11:33:03 -0400 Subject: [PATCH] initialize blank editor set in EditorManager; update overworld initialization to use Rom pointers; add Clear and CleanupUnusedTextures methods in OverworldEditor. --- src/CMakeLists.txt | 2 -- src/app/editor/editor_manager.cc | 5 +++++ src/app/editor/graphics/graphics_editor.h | 2 +- src/app/editor/overworld/overworld_editor.h | 3 +++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 225100d2..5f82a306 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -136,8 +136,6 @@ if (YAZE_BUILD_LIB) incl/yaze.h incl/zelda.h incl/snes.h - incl/overworld.h - incl/dungeon.h DESTINATION include ) diff --git a/src/app/editor/editor_manager.cc b/src/app/editor/editor_manager.cc index ed01666a..9711149f 100644 --- a/src/app/editor/editor_manager.cc +++ b/src/app/editor/editor_manager.cc @@ -73,6 +73,11 @@ void DrawRomSelector(EditorManager &editor_manager) { } // namespace void EditorManager::Initialize(const std::string &filename) { + // Create a blank editor set + auto blank_editor_set = std::make_unique(); + editor_sets_[nullptr] = std::move(blank_editor_set); + current_editor_set_ = editor_sets_[nullptr].get(); + if (!filename.empty()) { PRINT_IF_ERROR(OpenRomOrProject(filename)); } diff --git a/src/app/editor/graphics/graphics_editor.h b/src/app/editor/graphics/graphics_editor.h index f0564e91..253ba452 100644 --- a/src/app/editor/graphics/graphics_editor.h +++ b/src/app/editor/graphics/graphics_editor.h @@ -169,7 +169,7 @@ class GraphicsEditor : public Editor { Rom temp_rom_; Rom tilemap_rom_; - zelda3::Overworld overworld_{temp_rom_}; + zelda3::Overworld overworld_{&temp_rom_}; MemoryEditor cgx_memory_editor_; MemoryEditor col_memory_editor_; PaletteEditor palette_editor_; diff --git a/src/app/editor/overworld/overworld_editor.h b/src/app/editor/overworld/overworld_editor.h index a73fa2c7..39a0fc11 100644 --- a/src/app/editor/overworld/overworld_editor.h +++ b/src/app/editor/overworld/overworld_editor.h @@ -86,7 +86,10 @@ class OverworldEditor : public Editor, public gfx::GfxContext { absl::Status Paste() override { return absl::UnimplementedError("Paste"); } absl::Status Find() override { return absl::UnimplementedError("Find"); } absl::Status Save() override; + absl::Status Clear() override; + void CleanupUnusedTextures(uint64_t current_time, uint64_t timeout) override; + int jump_to_tab() { return jump_to_tab_; } int jump_to_tab_ = -1;