From 39709beb54a9c4b56eafc244ab5971bc33c5a586 Mon Sep 17 00:00:00 2001 From: scawful Date: Thu, 25 Jan 2024 20:59:53 -0500 Subject: [PATCH] Reorganize experiment flags --- src/app/core/common.h | 22 ++++++++--- src/app/editor/master_editor.cc | 70 ++++++++++++++++++++++++--------- 2 files changed, 68 insertions(+), 24 deletions(-) diff --git a/src/app/core/common.h b/src/app/core/common.h index 1a56a065..bf200171 100644 --- a/src/app/core/common.h +++ b/src/app/core/common.h @@ -18,9 +18,6 @@ namespace core { class ExperimentFlags { public: struct Flags { - // Load and render overworld sprites to the screen. Unstable. - bool kDrawOverworldSprites = false; - // Bitmap manager abstraction to manage graphics bin of ROM. bool kUseBitmapManager = true; @@ -59,8 +56,23 @@ class ExperimentFlags { // Log to the console. bool kLogToConsole = false; - // Save overworld map edits to the ROM. - bool kSaveOverworldMaps = false; + // Overworld flags + struct Overworld { + // Load and render overworld sprites to the screen. Unstable. + bool kDrawOverworldSprites = false; + + // Save overworld map edits to the ROM. + bool kSaveOverworldMaps = false; + + // Save overworld entrances to the ROM. + bool kSaveOverworldEntrances = false; + + // Save overworld exits to the ROM. + bool kSaveOverworldExits = false; + + // Save overworld properties to the ROM. + bool kSaveOverworldProperties = false; + } overworld; }; ExperimentFlags() = default; diff --git a/src/app/editor/master_editor.cc b/src/app/editor/master_editor.cc index 6b2c65b9..e3bd15fe 100644 --- a/src/app/editor/master_editor.cc +++ b/src/app/editor/master_editor.cc @@ -325,23 +325,43 @@ void MasterEditor::DrawFileMenu() { if (BeginMenu("Options")) { MenuItem("Backup ROM", "", &backup_rom_); ImGui::Separator(); - Text("Experiment Flags"); - Checkbox("Enable console logging", &mutable_flags()->kLogToConsole); - Checkbox("Enable Texture Streaming", - &mutable_flags()->kLoadTexturesAsStreaming); - Checkbox("Enable Overworld Sprites", - &mutable_flags()->kDrawOverworldSprites); - Checkbox("Use Bitmap Manager", &mutable_flags()->kUseBitmapManager); - Checkbox("Log Instructions to Debugger", - &mutable_flags()->kLogInstructions); - Checkbox("Use New ImGui Input", &mutable_flags()->kUseNewImGuiInput); - Checkbox("Save All Palettes", &mutable_flags()->kSaveAllPalettes); - Checkbox("Save With Change Queue", - &mutable_flags()->kSaveWithChangeQueue); - Checkbox("Draw Dungeon Room Graphics", - &mutable_flags()->kDrawDungeonRoomGraphics); - Checkbox("Save Dungeon Maps", &mutable_flags()->kSaveDungeonMaps); - Checkbox("Save Overworld Maps", &mutable_flags()->kSaveOverworldMaps); + if (BeginMenu("Experiment Flags")) { + if (BeginMenu("Overworld Flags")) { + Checkbox("Enable Overworld Sprites", + &mutable_flags()->overworld.kDrawOverworldSprites); + ImGui::Separator(); + Checkbox("Save Overworld Maps", + &mutable_flags()->overworld.kSaveOverworldMaps); + Checkbox("Save Overworld Entrances", + &mutable_flags()->overworld.kSaveOverworldEntrances); + Checkbox("Save Overworld Exits", + &mutable_flags()->overworld.kSaveOverworldExits); + Checkbox("Save Overworld Properties", + &mutable_flags()->overworld.kSaveOverworldProperties); + ImGui::EndMenu(); + } + + if (BeginMenu("Dungeon Flags")) { + Checkbox("Draw Dungeon Room Graphics", + &mutable_flags()->kDrawDungeonRoomGraphics); + ImGui::Separator(); + Checkbox("Save Dungeon Maps", &mutable_flags()->kSaveDungeonMaps); + ImGui::EndMenu(); + } + + Checkbox("Enable console logging", &mutable_flags()->kLogToConsole); + Checkbox("Enable Texture Streaming", + &mutable_flags()->kLoadTexturesAsStreaming); + Checkbox("Use Bitmap Manager", &mutable_flags()->kUseBitmapManager); + Checkbox("Log Instructions to Debugger", + &mutable_flags()->kLogInstructions); + Checkbox("Use New ImGui Input", &mutable_flags()->kUseNewImGuiInput); + Checkbox("Save All Palettes", &mutable_flags()->kSaveAllPalettes); + Checkbox("Save With Change Queue", + &mutable_flags()->kSaveWithChangeQueue); + ImGui::EndMenu(); + } + ImGui::EndMenu(); } @@ -519,8 +539,20 @@ void MasterEditor::SaveRom() { status_ = screen_editor_.SaveDungeonMaps(); PRINT_IF_ERROR(status_); } - if (flags()->kSaveOverworldMaps) { - status_ = overworld_editor_.SaveOverworldMaps(); + if (flags()->overworld.kSaveOverworldMaps) { + status_ = overworld_editor_.overworld()->SaveOverworldMaps(); + PRINT_IF_ERROR(status_); + } + if (flags()->overworld.kSaveOverworldEntrances) { + status_ = overworld_editor_.overworld()->SaveEntrances(); + PRINT_IF_ERROR(status_); + } + if (flags()->overworld.kSaveOverworldExits) { + status_ = overworld_editor_.overworld()->SaveExits(); + PRINT_IF_ERROR(status_); + } + if (flags()->overworld.kSaveOverworldProperties) { + status_ = overworld_editor_.overworld()->SaveMapProperties(); PRINT_IF_ERROR(status_); }