diff --git a/src/app/editor/graphics/graphics_editor.h b/src/app/editor/graphics/graphics_editor.h index 3171f130..65c5d57a 100644 --- a/src/app/editor/graphics/graphics_editor.h +++ b/src/app/editor/graphics/graphics_editor.h @@ -159,7 +159,7 @@ class GraphicsEditor : public SharedRom, public Editor { Rom temp_rom_; Rom tilemap_rom_; - zelda3::overworld::Overworld overworld_; + zelda3::Overworld overworld_; MemoryEditor cgx_memory_editor_; MemoryEditor col_memory_editor_; PaletteEditor palette_editor_; diff --git a/src/app/editor/graphics/screen_editor.cc b/src/app/editor/graphics/screen_editor.cc index 0ba2ca3d..460fc7f5 100644 --- a/src/app/editor/graphics/screen_editor.cc +++ b/src/app/editor/graphics/screen_editor.cc @@ -13,6 +13,7 @@ #include "app/gfx/snes_tile.h" #include "app/gfx/tilesheet.h" #include "app/gui/canvas.h" +#include "app/gui/color.h" #include "app/gui/icons.h" #include "app/gui/input.h" #include "imgui/imgui.h" @@ -413,7 +414,8 @@ void ScreenEditor::DrawDungeonMapsEditor() { } } - if (ImGui::BeginTable("##DungeonMapToolset", 2, ImGuiTableFlags_SizingFixedFit)) { + if (ImGui::BeginTable("##DungeonMapToolset", 2, + ImGuiTableFlags_SizingFixedFit)) { ImGui::TableSetupColumn("Draw Mode"); ImGui::TableSetupColumn("Edit Mode"); @@ -485,7 +487,8 @@ void ScreenEditor::DrawDungeonMapsEditor() { } ImGui::Separator(); - current_tile_canvas_.DrawBackground(); // ImVec2(64 * 2 + 2, 64 * 2 + 4)); + current_tile_canvas_ + .DrawBackground(); // ImVec2(64 * 2 + 2, 64 * 2 + 4)); current_tile_canvas_.DrawContextMenu(); if (current_tile_canvas_.DrawTilePainter( tile8_individual_[selected_tile8_], 16)) { diff --git a/src/app/editor/graphics/tile16_editor.h b/src/app/editor/graphics/tile16_editor.h index 083ad2a2..f40d988c 100644 --- a/src/app/editor/graphics/tile16_editor.h +++ b/src/app/editor/graphics/tile16_editor.h @@ -90,7 +90,7 @@ class Tile16Editor : public GfxContext, public SharedRom { PaletteEditor palette_editor_; gfx::SnesPalette palette_; - zelda3::overworld::Overworld transfer_overworld_; + zelda3::Overworld transfer_overworld_; absl::Status status_; diff --git a/src/app/editor/overworld/entity.cc b/src/app/editor/overworld/entity.cc index 43d7af7d..b516dc64 100644 --- a/src/app/editor/overworld/entity.cc +++ b/src/app/editor/overworld/entity.cc @@ -127,7 +127,7 @@ bool DrawEntranceInserterPopup() { // TODO: Implement deleting OverworldEntrance objects, currently only hides them bool DrawOverworldEntrancePopup( - zelda3::overworld::OverworldEntrance &entrance) { + zelda3::OverworldEntrance &entrance) { static bool set_done = false; if (set_done) { set_done = false; @@ -177,7 +177,7 @@ void DrawExitInserterPopup() { } } -bool DrawExitEditorPopup(zelda3::overworld::OverworldExit &exit) { +bool DrawExitEditorPopup(zelda3::OverworldExit &exit) { static bool set_done = false; if (set_done) { set_done = false; @@ -316,8 +316,8 @@ void DrawItemInsertPopup() { Text("Add Item"); BeginChild("ScrollRegion", ImVec2(150, 150), true, ImGuiWindowFlags_AlwaysVerticalScrollbar); - for (size_t i = 0; i < zelda3::overworld::kSecretItemNames.size(); i++) { - if (Selectable(zelda3::overworld::kSecretItemNames[i].c_str(), + for (size_t i = 0; i < zelda3::kSecretItemNames.size(); i++) { + if (Selectable(zelda3::kSecretItemNames[i].c_str(), i == new_item_id)) { new_item_id = i; } @@ -340,7 +340,7 @@ void DrawItemInsertPopup() { } // TODO: Implement deleting OverworldItem objects, currently only hides them -bool DrawItemEditorPopup(zelda3::overworld::OverworldItem &item) { +bool DrawItemEditorPopup(zelda3::OverworldItem &item) { static bool set_done = false; if (set_done) { set_done = false; @@ -350,8 +350,8 @@ bool DrawItemEditorPopup(zelda3::overworld::OverworldItem &item) { BeginChild("ScrollRegion", ImVec2(150, 150), true, ImGuiWindowFlags_AlwaysVerticalScrollbar); ImGui::BeginGroup(); - for (size_t i = 0; i < zelda3::overworld::kSecretItemNames.size(); i++) { - if (Selectable(zelda3::overworld::kSecretItemNames[i].c_str(), + for (size_t i = 0; i < zelda3::kSecretItemNames.size(); i++) { + if (Selectable(zelda3::kSecretItemNames[i].c_str(), item.id_ == i)) { item.id_ = i; } diff --git a/src/app/editor/overworld/entity.h b/src/app/editor/overworld/entity.h index 2bb5eeb4..f38e3d78 100644 --- a/src/app/editor/overworld/entity.h +++ b/src/app/editor/overworld/entity.h @@ -22,14 +22,14 @@ void HandleEntityDragging(zelda3::GameEntity *entity, ImVec2 canvas_p0, bool free_movement = false); bool DrawEntranceInserterPopup(); -bool DrawOverworldEntrancePopup(zelda3::overworld::OverworldEntrance &entrance); +bool DrawOverworldEntrancePopup(zelda3::OverworldEntrance &entrance); void DrawExitInserterPopup(); -bool DrawExitEditorPopup(zelda3::overworld::OverworldExit &exit); +bool DrawExitEditorPopup(zelda3::OverworldExit &exit); void DrawItemInsertPopup(); -bool DrawItemEditorPopup(zelda3::overworld::OverworldItem &item); +bool DrawItemEditorPopup(zelda3::OverworldItem &item); enum MyItemColumnID { MyItemColumnID_ID, diff --git a/src/app/editor/overworld/overworld_editor.cc b/src/app/editor/overworld/overworld_editor.cc index 1376711c..aa41d6f1 100644 --- a/src/app/editor/overworld/overworld_editor.cc +++ b/src/app/editor/overworld/overworld_editor.cc @@ -920,8 +920,8 @@ void OverworldEditor::DrawOverworldItems() { } } std::string item_name = ""; - if (item.id_ < zelda3::overworld::kSecretItemNames.size()) { - item_name = zelda3::overworld::kSecretItemNames[item.id_]; + if (item.id_ < zelda3::kSecretItemNames.size()) { + item_name = zelda3::kSecretItemNames[item.id_]; } else { item_name = absl::StrFormat("0x%02X", item.id_); } @@ -1049,10 +1049,10 @@ absl::Status OverworldEditor::LoadGraphics() { // Copy the tile16 data into individual tiles. auto tile16_data = overworld_.tile16_blockset_data(); - tile16_individual_.reserve(zelda3::overworld::kNumTile16Individual); + tile16_individual_.reserve(zelda3::kNumTile16Individual); // Loop through the tiles and copy their pixel data into separate vectors - for (uint i = 0; i < zelda3::overworld::kNumTile16Individual; i++) { + for (uint i = 0; i < zelda3::kNumTile16Individual; i++) { std::vector tile_data(kTile16Size * kTile16Size, 0x00); // Copy the pixel data for the current tile into the vector @@ -1075,7 +1075,7 @@ absl::Status OverworldEditor::LoadGraphics() { } // Render the overworld maps loaded from the ROM. - for (int i = 0; i < zelda3::overworld::kNumOverworldMaps; ++i) { + for (int i = 0; i < zelda3::kNumOverworldMaps; ++i) { overworld_.set_current_map(i); auto palette = overworld_.current_area_palette(); RETURN_IF_ERROR(Renderer::GetInstance().CreateAndRenderBitmap( @@ -1218,7 +1218,7 @@ absl::Status OverworldEditor::RefreshTile16Blockset() { std::vector> futures; // Loop through the tiles and copy their pixel data into separate vectors - for (uint i = 0; i < zelda3::overworld::kNumTile16Individual; i++) { + for (uint i = 0; i < zelda3::kNumTile16Individual; i++) { futures.push_back(std::async( std::launch::async, [&](int index) { @@ -1242,7 +1242,7 @@ absl::Status OverworldEditor::RefreshTile16Blockset() { } // Render the bitmaps of each tile. - for (uint id = 0; id < zelda3::overworld::kNumTile16Individual; id++) { + for (uint id = 0; id < zelda3::kNumTile16Individual; id++) { RETURN_IF_ERROR(tile16_individual_[id].ApplyPalette(palette_)); Renderer::GetInstance().UpdateBitmap(&tile16_individual_[id]); } diff --git a/src/app/editor/overworld/overworld_editor.h b/src/app/editor/overworld/overworld_editor.h index 4d441e74..d9bc14d0 100644 --- a/src/app/editor/overworld/overworld_editor.h +++ b/src/app/editor/overworld/overworld_editor.h @@ -284,14 +284,14 @@ class OverworldEditor : public Editor, gfx::BitmapTable current_graphics_set_; gfx::BitmapTable sprite_previews_; - zelda3::overworld::Overworld overworld_; + zelda3::Overworld overworld_; zelda3::OWBlockset refresh_blockset_; zelda3::Sprite current_sprite_; - zelda3::overworld::OverworldEntrance current_entrance_; - zelda3::overworld::OverworldExit current_exit_; - zelda3::overworld::OverworldItem current_item_; + zelda3::OverworldEntrance current_entrance_; + zelda3::OverworldExit current_exit_; + zelda3::OverworldItem current_item_; zelda3::GameEntity* current_entity_; zelda3::GameEntity* dragged_entity_; @@ -307,6 +307,7 @@ class OverworldEditor : public Editor, gui::Canvas properties_canvas_; gui::Table toolset_table_{"##ToolsetTable0", 22, kToolsetTableFlags}; + gui::Table map_settings_table_{kOWMapTable.data(), 8, kOWMapFlags, ImVec2(0,0)}; gui::zeml::Node layout_node_; absl::Status status_; diff --git a/src/app/editor/system/constant_manager.h b/src/app/editor/system/constant_manager.h index 4b3498d8..c966d713 100644 --- a/src/app/editor/system/constant_manager.h +++ b/src/app/editor/system/constant_manager.h @@ -26,23 +26,23 @@ class ConstantManager { ImGui::Text("Overworld constants"); ImGui::Separator(); ImGui::Text("OverworldCustomASMHasBeenApplied: %d", - zelda3::overworld::OverworldCustomASMHasBeenApplied); + zelda3::OverworldCustomASMHasBeenApplied); ImGui::Text("OverworldCustomAreaSpecificBGPalette: %d", - zelda3::overworld::OverworldCustomAreaSpecificBGPalette); + zelda3::OverworldCustomAreaSpecificBGPalette); ImGui::Text("OverworldCustomAreaSpecificBGEnabled: %d", - zelda3::overworld::OverworldCustomAreaSpecificBGEnabled); + zelda3::OverworldCustomAreaSpecificBGEnabled); ImGui::Text("OverworldCustomMainPaletteArray: %d", - zelda3::overworld::OverworldCustomMainPaletteArray); + zelda3::OverworldCustomMainPaletteArray); ImGui::Text("OverworldCustomMainPaletteEnabled: %d", - zelda3::overworld::OverworldCustomMainPaletteEnabled); + zelda3::OverworldCustomMainPaletteEnabled); ImGui::Text("OverworldCustomMosaicArray: %d", - zelda3::overworld::OverworldCustomMosaicArray); + zelda3::OverworldCustomMosaicArray); ImGui::Text("OverworldCustomMosaicEnabled: %d", - zelda3::overworld::OverworldCustomMosaicEnabled); + zelda3::OverworldCustomMosaicEnabled); ImGui::Text("OverworldCustomAnimatedGFXArray: %d", - zelda3::overworld::OverworldCustomAnimatedGFXArray); + zelda3::OverworldCustomAnimatedGFXArray); ImGui::Text("OverworldCustomAnimatedGFXEnabled: %d", - zelda3::overworld::OverworldCustomAnimatedGFXEnabled); + zelda3::OverworldCustomAnimatedGFXEnabled); ImGui::EndTabItem(); } diff --git a/src/app/zelda3/overworld/overworld.cc b/src/app/zelda3/overworld/overworld.cc index 5219cc1a..a013627c 100644 --- a/src/app/zelda3/overworld/overworld.cc +++ b/src/app/zelda3/overworld/overworld.cc @@ -13,7 +13,6 @@ namespace yaze { namespace zelda3 { -namespace overworld { absl::Status Overworld::Load(Rom &rom) { rom_ = rom; @@ -407,7 +406,7 @@ absl::Status Overworld::LoadExits() { absl::Status Overworld::LoadItems() { ASSIGN_OR_RETURN(uint32_t pointer, - rom()->ReadLong(zelda3::overworld::kOverworldItemsAddress)); + rom()->ReadLong(zelda3::kOverworldItemsAddress)); uint32_t pointer_pc = core::SnesToPc(pointer); // 1BC2F9 -> 0DC2F9 for (int i = 0; i < 128; i++) { ASSIGN_OR_RETURN(uint16_t word_address, @@ -1586,7 +1585,5 @@ absl::Status Overworld::SaveMapProperties() { return absl::OkStatus(); } -} // namespace overworld } // namespace zelda3 - } // namespace yaze diff --git a/src/app/zelda3/overworld/overworld.h b/src/app/zelda3/overworld/overworld.h index a733969a..b2fa95fa 100644 --- a/src/app/zelda3/overworld/overworld.h +++ b/src/app/zelda3/overworld/overworld.h @@ -19,12 +19,6 @@ namespace yaze { namespace zelda3 { -/** - * @namespace yaze::zelda3::overworld - * @brief Represents the Overworld data. - */ -namespace overworld { - constexpr int GravesYTilePos = 0x49968; // short (0x0F entries) constexpr int GravesXTilePos = 0x49986; // short (0x0F entries) constexpr int GravesTilemapPos = 0x499A4; // short (0x0F entries) @@ -274,9 +268,7 @@ private: std::vector> usage_stats_; }; -} // namespace overworld } // namespace zelda3 - } // namespace yaze #endif diff --git a/src/app/zelda3/overworld/overworld_entrance.h b/src/app/zelda3/overworld/overworld_entrance.h index a86f9d11..bbd81760 100644 --- a/src/app/zelda3/overworld/overworld_entrance.h +++ b/src/app/zelda3/overworld/overworld_entrance.h @@ -8,7 +8,6 @@ namespace yaze { namespace zelda3 { -namespace overworld { constexpr int OWEntranceMap = 0xDB96F; constexpr int OWEntrancePos = 0xDBA71; @@ -81,9 +80,7 @@ public: } }; -} // namespace overworld } // namespace zelda3 - } // namespace yaze #endif diff --git a/src/app/zelda3/overworld/overworld_exit.h b/src/app/zelda3/overworld/overworld_exit.h index 2ada0071..f663b917 100644 --- a/src/app/zelda3/overworld/overworld_exit.h +++ b/src/app/zelda3/overworld/overworld_exit.h @@ -9,7 +9,6 @@ namespace yaze { namespace zelda3 { -namespace overworld { constexpr int OWExitRoomId = 0x15D8A; // 0x15E07 Credits sequences // 105C2 Ending maps @@ -201,9 +200,7 @@ class OverworldExit : public GameEntity { } }; -} // namespace overworld } // namespace zelda3 - } // namespace yaze #endif // YAZE_APP_ZELDA3_OVERWORLD_EXIT_H_ diff --git a/src/app/zelda3/overworld/overworld_item.h b/src/app/zelda3/overworld/overworld_item.h index 7f3ba13a..ac8c744f 100644 --- a/src/app/zelda3/overworld/overworld_item.h +++ b/src/app/zelda3/overworld/overworld_item.h @@ -11,7 +11,6 @@ namespace yaze { namespace zelda3 { -namespace overworld { // List of secret item names const std::vector kSecretItemNames = { @@ -99,9 +98,7 @@ public: } }; -} // namespace overworld } // namespace zelda3 - } // namespace yaze #endif // YAZE_APP_ZELDA3_OVERWORLD_ITEM_H_ diff --git a/src/app/zelda3/overworld/overworld_map.cc b/src/app/zelda3/overworld/overworld_map.cc index 3b200377..827dba7b 100644 --- a/src/app/zelda3/overworld/overworld_map.cc +++ b/src/app/zelda3/overworld/overworld_map.cc @@ -11,7 +11,6 @@ namespace yaze { namespace zelda3 { -namespace overworld { OverworldMap::OverworldMap(int index, Rom& rom, bool load_custom_data) : index_(index), parent_(index), rom_(rom) { @@ -742,7 +741,5 @@ absl::Status OverworldMap::BuildBitmap(OWBlockset& world_blockset) { return absl::OkStatus(); } -} // namespace overworld } // namespace zelda3 - } // namespace yaze diff --git a/src/app/zelda3/overworld/overworld_map.h b/src/app/zelda3/overworld/overworld_map.h index eef35e6a..7864f343 100644 --- a/src/app/zelda3/overworld/overworld_map.h +++ b/src/app/zelda3/overworld/overworld_map.h @@ -13,7 +13,6 @@ namespace yaze { namespace zelda3 { -namespace overworld { static constexpr int kTileOffsets[] = {0, 8, 4096, 4104}; @@ -184,9 +183,7 @@ class OverworldMap : public GfxContext { gfx::SnesPalette current_palette_; }; -} // namespace overworld } // namespace zelda3 - } // namespace yaze #endif