Skip to content

Commit

Permalink
Add more experiment flags
Browse files Browse the repository at this point in the history
  • Loading branch information
scawful committed Nov 21, 2023
1 parent bbe76ac commit 8ff9f28
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 37 deletions.
7 changes: 7 additions & 0 deletions src/app/core/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions src/app/editor/dungeon_editor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
}
Expand Down
4 changes: 3 additions & 1 deletion src/app/editor/dungeon_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down
14 changes: 11 additions & 3 deletions src/app/editor/master_editor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -183,6 +183,7 @@ void MasterEditor::DrawYazeMenu() {
DrawHelpMenu();
END_MENU_BAR()
}

void MasterEditor::DrawFileMenu() {
static bool save_as_menu = false;

Expand Down Expand Up @@ -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();
}

Expand Down
55 changes: 25 additions & 30 deletions src/app/editor/modules/gfx_group_editor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -54,7 +54,7 @@ absl::Status GfxGroupEditor::Update() {
}
ImGui::EndGroup();
}
ImGui::TableNextColumn();
TableNextColumn();
{
ImGui::BeginGroup();
for (int i = 0; i < 8; i++) {
Expand All @@ -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++) {
Expand All @@ -104,7 +102,7 @@ absl::Status GfxGroupEditor::Update() {
}
ImGui::EndGroup();
}
ImGui::TableNextColumn();
TableNextColumn();
{
ImGui::BeginGroup();
for (int i = 0; i < 4; i++) {
Expand All @@ -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++) {
Expand All @@ -147,7 +143,7 @@ absl::Status GfxGroupEditor::Update() {
}
ImGui::EndGroup();
}
ImGui::TableNextColumn();
TableNextColumn();
{
ImGui::BeginGroup();
for (int i = 0; i < 4; i++) {
Expand All @@ -163,7 +159,6 @@ absl::Status GfxGroupEditor::Update() {
ImGui::EndTabItem();
}

// Palettes tab
if (ImGui::BeginTabItem("Palettes")) {
ImGui::EndTabItem();
}
Expand Down
7 changes: 6 additions & 1 deletion src/app/editor/overworld_editor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8ff9f28

Please sign in to comment.