Add more experiment flags

This commit is contained in:
Justin Scofield
2023-11-20 21:50:40 -05:00
parent bbe76ac83c
commit 8ff9f281ac
6 changed files with 56 additions and 37 deletions

View File

@@ -26,9 +26,16 @@ class ExperimentFlags {
// ported away from that eventually. // ported away from that eventually.
bool kUseNewImGuiInput = false; bool kUseNewImGuiInput = false;
// Flag to enable the saving of all palettes to the ROM.
bool kSaveAllPalettes = false; 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; bool kSaveWithChangeQueue = false;
// Attempt to run the dungeon room draw routine when opening a room.
bool kDrawDungeonRoomGraphics = false;
}; };
ExperimentFlags() = default; ExperimentFlags() = default;

View File

@@ -24,7 +24,9 @@ absl::Status DungeonEditor::Update() {
for (int i = 0; i < 0x100; i++) { for (int i = 0; i < 0x100; i++) {
rooms_.emplace_back(zelda3::dungeon::Room(i)); rooms_.emplace_back(zelda3::dungeon::Room(i));
rooms_[i].LoadHeader(); rooms_[i].LoadHeader();
rooms_[i].LoadRoomGraphics(rooms_[i].blockset); if (flags()->kDrawDungeonRoomGraphics) {
rooms_[i].LoadRoomGraphics(rooms_[i].blockset);
}
} }
is_loaded_ = true; is_loaded_ = true;
} }
@@ -197,7 +199,7 @@ void DungeonEditor::DrawToolset() {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (ImGui::Button("Load Dungeon Objects")) { if (ImGui::Button("Load Dungeon Objects")) {
// object_renderer_.CreateVramFromRoomBlockset(); // object_renderer_.CreateVramFromRoomBlockset();
object_renderer_.RenderObjectsAsBitmaps(*rom()); object_renderer_.RenderObjectsAsBitmaps();
} }
ImGui::EndTable(); ImGui::EndTable();
} }

View File

@@ -15,7 +15,9 @@ namespace yaze {
namespace app { namespace app {
namespace editor { namespace editor {
class DungeonEditor : public Editor, public SharedROM { class DungeonEditor : public Editor,
public SharedROM,
public core::ExperimentFlags {
public: public:
absl::Status Update() override; absl::Status Update() override;
absl::Status Cut() override { return absl::OkStatus(); } absl::Status Cut() override { return absl::OkStatus(); }

View File

@@ -13,8 +13,8 @@
#include "app/editor/dungeon_editor.h" #include "app/editor/dungeon_editor.h"
#include "app/editor/graphics_editor.h" #include "app/editor/graphics_editor.h"
#include "app/editor/modules/assembly_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/overworld_editor.h"
#include "app/editor/resources/music_editor.h"
#include "app/editor/resources/palette_editor.h" #include "app/editor/resources/palette_editor.h"
#include "app/editor/screen_editor.h" #include "app/editor/screen_editor.h"
#include "app/editor/sprite_editor.h" #include "app/editor/sprite_editor.h"
@@ -84,7 +84,7 @@ void MasterEditor::UpdateScreen() {
END_TAB_ITEM() END_TAB_ITEM()
TAB_ITEM("Dungeon") TAB_ITEM("Dungeon")
dungeon_editor_.Update(); status_ = dungeon_editor_.Update();
END_TAB_ITEM() END_TAB_ITEM()
TAB_ITEM("Graphics") TAB_ITEM("Graphics")
@@ -146,7 +146,7 @@ void MasterEditor::DrawAboutPopup() {
if (about_) ImGui::OpenPopup("About"); if (about_) ImGui::OpenPopup("About");
if (ImGui::BeginPopupModal("About", nullptr, if (ImGui::BeginPopupModal("About", nullptr,
ImGuiWindowFlags_AlwaysAutoResize)) { ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::Text("Yet Another Zelda3 Editor - v0.02"); ImGui::Text("Yet Another Zelda3 Editor - v0.05");
ImGui::Text("Written by: scawful"); ImGui::Text("Written by: scawful");
ImGui::Spacing(); ImGui::Spacing();
ImGui::Text("Special Thanks: Zarby89, JaredBrian"); ImGui::Text("Special Thanks: Zarby89, JaredBrian");
@@ -183,6 +183,7 @@ void MasterEditor::DrawYazeMenu() {
DrawHelpMenu(); DrawHelpMenu();
END_MENU_BAR() END_MENU_BAR()
} }
void MasterEditor::DrawFileMenu() { void MasterEditor::DrawFileMenu() {
static bool save_as_menu = false; static bool save_as_menu = false;
@@ -212,6 +213,13 @@ void MasterEditor::DrawFileMenu() {
&mutable_flags()->kUseBitmapManager); &mutable_flags()->kUseBitmapManager);
ImGui::Checkbox("Log Instructions to Debugger", ImGui::Checkbox("Log Instructions to Debugger",
&mutable_flags()->kLogInstructions); &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(); ImGui::EndMenu();
} }

View File

@@ -24,24 +24,24 @@ namespace app {
namespace editor { namespace editor {
using ImGui::SameLine; using ImGui::SameLine;
using ImGui::TableHeadersRow;
using ImGui::TableNextColumn;
using ImGui::TableNextRow;
using ImGui::TableSetupColumn;
absl::Status GfxGroupEditor::Update() { absl::Status GfxGroupEditor::Update() {
if (ImGui::BeginTabBar("GfxGroupEditor")) { if (ImGui::BeginTabBar("GfxGroupEditor")) {
// Main tab
if (ImGui::BeginTabItem("Main")) { if (ImGui::BeginTabItem("Main")) {
gui::InputHexByte("Selected Blockset", &selected_blockset_); gui::InputHexByte("Selected Blockset", &selected_blockset_);
ImGui::Text("Values"); ImGui::Text("Values");
if (ImGui::BeginTable("##BlocksetTable", 2, ImGuiTableFlags_Borders, if (ImGui::BeginTable("##BlocksetTable", 2, ImGuiTableFlags_Borders,
ImVec2(0, 0))) { ImVec2(0, 0))) {
ImGui::TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch, TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch,
ImGui::GetContentRegionAvail().x); ImGui::GetContentRegionAvail().x);
ImGui::TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, 256);
256); TableHeadersRow();
ImGui::TableHeadersRow(); TableNextRow();
ImGui::TableNextRow(); TableNextColumn();
ImGui::TableNextColumn();
{ {
ImGui::BeginGroup(); ImGui::BeginGroup();
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
@@ -54,7 +54,7 @@ absl::Status GfxGroupEditor::Update() {
} }
ImGui::EndGroup(); ImGui::EndGroup();
} }
ImGui::TableNextColumn(); TableNextColumn();
{ {
ImGui::BeginGroup(); ImGui::BeginGroup();
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
@@ -78,20 +78,18 @@ absl::Status GfxGroupEditor::Update() {
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
// Rooms tab
if (ImGui::BeginTabItem("Rooms")) { if (ImGui::BeginTabItem("Rooms")) {
gui::InputHexByte("Selected Blockset", &selected_roomset_); gui::InputHexByte("Selected Blockset", &selected_roomset_);
ImGui::Text("Values - Overwrites 4 of main blockset"); ImGui::Text("Values - Overwrites 4 of main blockset");
if (ImGui::BeginTable("##Roomstable", 2, ImGuiTableFlags_Borders, if (ImGui::BeginTable("##Roomstable", 2, ImGuiTableFlags_Borders,
ImVec2(0, 0))) { ImVec2(0, 0))) {
ImGui::TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch, TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch,
ImGui::GetContentRegionAvail().x); ImGui::GetContentRegionAvail().x);
ImGui::TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, 256);
256); TableHeadersRow();
ImGui::TableHeadersRow(); TableNextRow();
ImGui::TableNextRow(); TableNextColumn();
ImGui::TableNextColumn();
{ {
ImGui::BeginGroup(); ImGui::BeginGroup();
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
@@ -104,7 +102,7 @@ absl::Status GfxGroupEditor::Update() {
} }
ImGui::EndGroup(); ImGui::EndGroup();
} }
ImGui::TableNextColumn(); TableNextColumn();
{ {
ImGui::BeginGroup(); ImGui::BeginGroup();
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
@@ -121,20 +119,18 @@ absl::Status GfxGroupEditor::Update() {
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
// Sprites tab
if (ImGui::BeginTabItem("Sprites")) { if (ImGui::BeginTabItem("Sprites")) {
gui::InputHexByte("Selected Spriteset", &selected_spriteset_); gui::InputHexByte("Selected Spriteset", &selected_spriteset_);
ImGui::Text("Values"); ImGui::Text("Values");
if (ImGui::BeginTable("##SpritesTable", 2, ImGuiTableFlags_Borders, if (ImGui::BeginTable("##SpritesTable", 2, ImGuiTableFlags_Borders,
ImVec2(0, 0))) { ImVec2(0, 0))) {
ImGui::TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch, TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch,
ImGui::GetContentRegionAvail().x); ImGui::GetContentRegionAvail().x);
ImGui::TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, 256);
256); TableHeadersRow();
ImGui::TableHeadersRow(); TableNextRow();
ImGui::TableNextRow(); TableNextColumn();
ImGui::TableNextColumn();
{ {
ImGui::BeginGroup(); ImGui::BeginGroup();
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
@@ -147,7 +143,7 @@ absl::Status GfxGroupEditor::Update() {
} }
ImGui::EndGroup(); ImGui::EndGroup();
} }
ImGui::TableNextColumn(); TableNextColumn();
{ {
ImGui::BeginGroup(); ImGui::BeginGroup();
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
@@ -163,7 +159,6 @@ absl::Status GfxGroupEditor::Update() {
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
// Palettes tab
if (ImGui::BeginTabItem("Palettes")) { if (ImGui::BeginTabItem("Palettes")) {
ImGui::EndTabItem(); ImGui::EndTabItem();
} }

View File

@@ -34,13 +34,18 @@ using ImGui::TableSetupColumn;
using ImGui::Text; using ImGui::Text;
absl::Status OverworldEditor::Update() { absl::Status OverworldEditor::Update() {
// Initialize overworld graphics, maps, and palettes
if (rom()->isLoaded() && !all_gfx_loaded_) { if (rom()->isLoaded() && !all_gfx_loaded_) {
// Initialize overworld graphics, maps, and palettes
RETURN_IF_ERROR(LoadGraphics()) RETURN_IF_ERROR(LoadGraphics())
RETURN_IF_ERROR(tile16_editor_.InitBlockset( RETURN_IF_ERROR(tile16_editor_.InitBlockset(
tile16_blockset_bmp_, tile16_individual_, tile8_individual_)); tile16_blockset_bmp_, tile16_individual_, tile8_individual_));
gfx_group_editor_.InitBlockset(tile16_blockset_bmp_); gfx_group_editor_.InitBlockset(tile16_blockset_bmp_);
all_gfx_loaded_ = true; 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. // Draws the toolset for editing the Overworld.