diff --git a/src/app/core/common.h b/src/app/core/common.h index 9f5075f3f..7512e47ec 100644 --- a/src/app/core/common.h +++ b/src/app/core/common.h @@ -26,9 +26,16 @@ class ExperimentFlags { // ported away from that eventually. bool kUseNewImGuiInput = false; + // Flag to enable the saving of all palettes to the ROM. bool kSaveAllPalettes = false; + // Flag to enable the change queue, which could have any anonymous + // save routine for the ROM. In practice, just the overworld tilemap + // and tile32 save. bool kSaveWithChangeQueue = false; + + // Attempt to run the dungeon room draw routine when opening a room. + bool kDrawDungeonRoomGraphics = false; }; ExperimentFlags() = default; diff --git a/src/app/editor/dungeon_editor.cc b/src/app/editor/dungeon_editor.cc index b4f4a3f17..f52716d80 100644 --- a/src/app/editor/dungeon_editor.cc +++ b/src/app/editor/dungeon_editor.cc @@ -24,7 +24,9 @@ absl::Status DungeonEditor::Update() { for (int i = 0; i < 0x100; i++) { rooms_.emplace_back(zelda3::dungeon::Room(i)); rooms_[i].LoadHeader(); - rooms_[i].LoadRoomGraphics(rooms_[i].blockset); + if (flags()->kDrawDungeonRoomGraphics) { + rooms_[i].LoadRoomGraphics(rooms_[i].blockset); + } } is_loaded_ = true; } @@ -197,7 +199,7 @@ void DungeonEditor::DrawToolset() { ImGui::TableNextColumn(); if (ImGui::Button("Load Dungeon Objects")) { // object_renderer_.CreateVramFromRoomBlockset(); - object_renderer_.RenderObjectsAsBitmaps(*rom()); + object_renderer_.RenderObjectsAsBitmaps(); } ImGui::EndTable(); } diff --git a/src/app/editor/dungeon_editor.h b/src/app/editor/dungeon_editor.h index b9c81cacf..1d0a63d1e 100644 --- a/src/app/editor/dungeon_editor.h +++ b/src/app/editor/dungeon_editor.h @@ -15,7 +15,9 @@ namespace yaze { namespace app { namespace editor { -class DungeonEditor : public Editor, public SharedROM { +class DungeonEditor : public Editor, + public SharedROM, + public core::ExperimentFlags { public: absl::Status Update() override; absl::Status Cut() override { return absl::OkStatus(); } diff --git a/src/app/editor/master_editor.cc b/src/app/editor/master_editor.cc index bf8a7d746..d38b1c587 100644 --- a/src/app/editor/master_editor.cc +++ b/src/app/editor/master_editor.cc @@ -13,8 +13,8 @@ #include "app/editor/dungeon_editor.h" #include "app/editor/graphics_editor.h" #include "app/editor/modules/assembly_editor.h" -#include "app/editor/resources/music_editor.h" #include "app/editor/overworld_editor.h" +#include "app/editor/resources/music_editor.h" #include "app/editor/resources/palette_editor.h" #include "app/editor/screen_editor.h" #include "app/editor/sprite_editor.h" @@ -84,7 +84,7 @@ void MasterEditor::UpdateScreen() { END_TAB_ITEM() TAB_ITEM("Dungeon") - dungeon_editor_.Update(); + status_ = dungeon_editor_.Update(); END_TAB_ITEM() TAB_ITEM("Graphics") @@ -146,7 +146,7 @@ void MasterEditor::DrawAboutPopup() { if (about_) ImGui::OpenPopup("About"); if (ImGui::BeginPopupModal("About", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { - ImGui::Text("Yet Another Zelda3 Editor - v0.02"); + ImGui::Text("Yet Another Zelda3 Editor - v0.05"); ImGui::Text("Written by: scawful"); ImGui::Spacing(); ImGui::Text("Special Thanks: Zarby89, JaredBrian"); @@ -183,6 +183,7 @@ void MasterEditor::DrawYazeMenu() { DrawHelpMenu(); END_MENU_BAR() } + void MasterEditor::DrawFileMenu() { static bool save_as_menu = false; @@ -212,6 +213,13 @@ void MasterEditor::DrawFileMenu() { &mutable_flags()->kUseBitmapManager); ImGui::Checkbox("Log Instructions to Debugger", &mutable_flags()->kLogInstructions); + ImGui::Checkbox("Use New ImGui Input", + &mutable_flags()->kUseNewImGuiInput); + ImGui::Checkbox("Save All Palettes", &mutable_flags()->kSaveAllPalettes); + ImGui::Checkbox("Save With Change Queue", + &mutable_flags()->kSaveWithChangeQueue); + ImGui::Checkbox("Draw Dungeon Room Graphics", + &mutable_flags()->kDrawDungeonRoomGraphics); ImGui::EndMenu(); } diff --git a/src/app/editor/modules/gfx_group_editor.cc b/src/app/editor/modules/gfx_group_editor.cc index 78692c478..d75b188ee 100644 --- a/src/app/editor/modules/gfx_group_editor.cc +++ b/src/app/editor/modules/gfx_group_editor.cc @@ -24,24 +24,24 @@ namespace app { namespace editor { using ImGui::SameLine; +using ImGui::TableHeadersRow; +using ImGui::TableNextColumn; +using ImGui::TableNextRow; +using ImGui::TableSetupColumn; absl::Status GfxGroupEditor::Update() { if (ImGui::BeginTabBar("GfxGroupEditor")) { - // Main tab if (ImGui::BeginTabItem("Main")) { gui::InputHexByte("Selected Blockset", &selected_blockset_); - ImGui::Text("Values"); - if (ImGui::BeginTable("##BlocksetTable", 2, ImGuiTableFlags_Borders, ImVec2(0, 0))) { - ImGui::TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch, - ImGui::GetContentRegionAvail().x); - ImGui::TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, - 256); - ImGui::TableHeadersRow(); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); + TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch, + ImGui::GetContentRegionAvail().x); + TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, 256); + TableHeadersRow(); + TableNextRow(); + TableNextColumn(); { ImGui::BeginGroup(); for (int i = 0; i < 8; i++) { @@ -54,7 +54,7 @@ absl::Status GfxGroupEditor::Update() { } ImGui::EndGroup(); } - ImGui::TableNextColumn(); + TableNextColumn(); { ImGui::BeginGroup(); for (int i = 0; i < 8; i++) { @@ -78,20 +78,18 @@ absl::Status GfxGroupEditor::Update() { ImGui::EndTabItem(); } - // Rooms tab if (ImGui::BeginTabItem("Rooms")) { gui::InputHexByte("Selected Blockset", &selected_roomset_); ImGui::Text("Values - Overwrites 4 of main blockset"); if (ImGui::BeginTable("##Roomstable", 2, ImGuiTableFlags_Borders, ImVec2(0, 0))) { - ImGui::TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch, - ImGui::GetContentRegionAvail().x); - ImGui::TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, - 256); - ImGui::TableHeadersRow(); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); + TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch, + ImGui::GetContentRegionAvail().x); + TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, 256); + TableHeadersRow(); + TableNextRow(); + TableNextColumn(); { ImGui::BeginGroup(); for (int i = 0; i < 4; i++) { @@ -104,7 +102,7 @@ absl::Status GfxGroupEditor::Update() { } ImGui::EndGroup(); } - ImGui::TableNextColumn(); + TableNextColumn(); { ImGui::BeginGroup(); for (int i = 0; i < 4; i++) { @@ -121,20 +119,18 @@ absl::Status GfxGroupEditor::Update() { ImGui::EndTabItem(); } - // Sprites tab if (ImGui::BeginTabItem("Sprites")) { gui::InputHexByte("Selected Spriteset", &selected_spriteset_); ImGui::Text("Values"); if (ImGui::BeginTable("##SpritesTable", 2, ImGuiTableFlags_Borders, ImVec2(0, 0))) { - ImGui::TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch, - ImGui::GetContentRegionAvail().x); - ImGui::TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, - 256); - ImGui::TableHeadersRow(); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); + TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch, + ImGui::GetContentRegionAvail().x); + TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, 256); + TableHeadersRow(); + TableNextRow(); + TableNextColumn(); { ImGui::BeginGroup(); for (int i = 0; i < 4; i++) { @@ -147,7 +143,7 @@ absl::Status GfxGroupEditor::Update() { } ImGui::EndGroup(); } - ImGui::TableNextColumn(); + TableNextColumn(); { ImGui::BeginGroup(); for (int i = 0; i < 4; i++) { @@ -163,7 +159,6 @@ absl::Status GfxGroupEditor::Update() { ImGui::EndTabItem(); } - // Palettes tab if (ImGui::BeginTabItem("Palettes")) { ImGui::EndTabItem(); } diff --git a/src/app/editor/overworld_editor.cc b/src/app/editor/overworld_editor.cc index 02b4f7df8..ee23c733d 100644 --- a/src/app/editor/overworld_editor.cc +++ b/src/app/editor/overworld_editor.cc @@ -34,13 +34,18 @@ using ImGui::TableSetupColumn; using ImGui::Text; absl::Status OverworldEditor::Update() { - // Initialize overworld graphics, maps, and palettes if (rom()->isLoaded() && !all_gfx_loaded_) { + // Initialize overworld graphics, maps, and palettes RETURN_IF_ERROR(LoadGraphics()) RETURN_IF_ERROR(tile16_editor_.InitBlockset( tile16_blockset_bmp_, tile16_individual_, tile8_individual_)); gfx_group_editor_.InitBlockset(tile16_blockset_bmp_); all_gfx_loaded_ = true; + } else if (!rom()->isLoaded() && all_gfx_loaded_) { + // Reset the editor if the ROM is unloaded + Shutdown(); + all_gfx_loaded_ = false; + map_blockset_loaded_ = false; } // Draws the toolset for editing the Overworld.