remove overworld namespace

This commit is contained in:
scawful
2024-12-29 16:12:53 -05:00
parent ed36d53600
commit 8cf16906e6
15 changed files with 39 additions and 61 deletions

View File

@@ -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_;

View File

@@ -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)) {

View File

@@ -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_;

View File

@@ -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;
}

View File

@@ -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,

View File

@@ -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<uint8_t> 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<std::future<void>> 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]);
}

View File

@@ -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_;

View File

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

View File

@@ -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

View File

@@ -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<absl::flat_hash_map<uint16_t, int>> usage_stats_;
};
} // namespace overworld
} // namespace zelda3
} // namespace yaze
#endif

View File

@@ -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

View File

@@ -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_

View File

@@ -11,7 +11,6 @@
namespace yaze {
namespace zelda3 {
namespace overworld {
// List of secret item names
const std::vector<std::string> kSecretItemNames = {
@@ -99,9 +98,7 @@ public:
}
};
} // namespace overworld
} // namespace zelda3
} // namespace yaze
#endif // YAZE_APP_ZELDA3_OVERWORLD_ITEM_H_

View File

@@ -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

View File

@@ -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