remove dungeon namespace

This commit is contained in:
scawful
2024-12-29 16:14:20 -05:00
parent 8cf16906e6
commit 7e470f2b33
14 changed files with 43 additions and 34 deletions

View File

@@ -74,7 +74,7 @@ absl::Status DungeonEditor::Initialize() {
auto dungeon_man_pal_group = rom()->palette_group().dungeon_main; auto dungeon_man_pal_group = rom()->palette_group().dungeon_main;
for (int i = 0; i < 0x100 + 40; i++) { for (int i = 0; i < 0x100 + 40; i++) {
rooms_.emplace_back(zelda3::dungeon::Room(/*room_id=*/i)); rooms_.emplace_back(zelda3::Room(/*room_id=*/i));
rooms_[i].LoadHeader(); rooms_[i].LoadHeader();
rooms_[i].LoadRoomFromROM(); rooms_[i].LoadRoomFromROM();
if (flags()->kDrawDungeonRoomGraphics) { if (flags()->kDrawDungeonRoomGraphics) {
@@ -97,11 +97,11 @@ absl::Status DungeonEditor::Initialize() {
LoadDungeonRoomSize(); LoadDungeonRoomSize();
// LoadRoomEntrances // LoadRoomEntrances
for (int i = 0; i < 0x07; ++i) { for (int i = 0; i < 0x07; ++i) {
entrances_.emplace_back(zelda3::dungeon::RoomEntrance(*rom(), i, true)); entrances_.emplace_back(zelda3::RoomEntrance(*rom(), i, true));
} }
for (int i = 0; i < 0x85; ++i) { for (int i = 0; i < 0x85; ++i) {
entrances_.emplace_back(zelda3::dungeon::RoomEntrance(*rom(), i, false)); entrances_.emplace_back(zelda3::RoomEntrance(*rom(), i, false));
} }
// Load the palette group and palette for the dungeon // Load the palette group and palette for the dungeon
@@ -325,7 +325,7 @@ void DungeonEditor::DrawRoomSelector() {
BeginChild(child_id, ImGui::GetContentRegionAvail(), true, BeginChild(child_id, ImGui::GetContentRegionAvail(), true,
ImGuiWindowFlags_AlwaysVerticalScrollbar)) { ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
int i = 0; int i = 0;
for (const auto each_room_name : zelda3::dungeon::kRoomNames) { for (const auto each_room_name : zelda3::kRoomNames) {
rom()->resource_label()->SelectableLabelWithNameEdit( rom()->resource_label()->SelectableLabelWithNameEdit(
current_room_id_ == i, "Dungeon Room Names", current_room_id_ == i, "Dungeon Room Names",
core::UppercaseHexByte(i), each_room_name.data()); core::UppercaseHexByte(i), each_room_name.data());
@@ -403,7 +403,7 @@ void DungeonEditor::DrawEntranceSelector() {
rom()->resource_label()->SelectableLabelWithNameEdit( rom()->resource_label()->SelectableLabelWithNameEdit(
current_entrance_id_ == i, "Dungeon Entrance Names", current_entrance_id_ == i, "Dungeon Entrance Names",
core::UppercaseHexByte(i), core::UppercaseHexByte(i),
zelda3::dungeon::kEntranceNames[i].data()); zelda3::kEntranceNames[i].data());
if (ImGui::IsItemClicked()) { if (ImGui::IsItemClicked()) {
current_entrance_id_ = i; current_entrance_id_ = i;
@@ -434,12 +434,12 @@ void DungeonEditor::DrawDungeonTabView() {
for (int n = 0; n < active_rooms_.Size;) { for (int n = 0; n < active_rooms_.Size;) {
bool open = true; bool open = true;
if (active_rooms_[n] > sizeof(zelda3::dungeon::kRoomNames) / 4) { if (active_rooms_[n] > sizeof(zelda3::kRoomNames) / 4) {
active_rooms_.erase(active_rooms_.Data + n); active_rooms_.erase(active_rooms_.Data + n);
continue; continue;
} }
if (BeginTabItem(zelda3::dungeon::kRoomNames[active_rooms_[n]].data(), if (BeginTabItem(zelda3::kRoomNames[active_rooms_[n]].data(),
&open, ImGuiTabItemFlags_None)) { &open, ImGuiTabItemFlags_None)) {
DrawDungeonCanvas(active_rooms_[n]); DrawDungeonCanvas(active_rooms_[n]);
EndTabItem(); EndTabItem();
@@ -549,7 +549,7 @@ void DungeonEditor::DrawObjectRenderer() {
int selected_object = 0; int selected_object = 0;
int i = 0; int i = 0;
for (const auto object_name : zelda3::dungeon::Type1RoomObjectNames) { for (const auto object_name : zelda3::Type1RoomObjectNames) {
if (ImGui::Selectable(object_name.data(), selected_object == i)) { if (ImGui::Selectable(object_name.data(), selected_object == i)) {
selected_object = i; selected_object = i;
current_object_ = i; current_object_ = i;

View File

@@ -119,9 +119,9 @@ class DungeonEditor : public Editor,
std::array<gfx::Bitmap, kNumGfxSheets> graphics_bin_; std::array<gfx::Bitmap, kNumGfxSheets> graphics_bin_;
std::vector<gfx::Bitmap*> room_gfx_sheets_; std::vector<gfx::Bitmap*> room_gfx_sheets_;
std::vector<zelda3::dungeon::Room> rooms_; std::vector<zelda3::Room> rooms_;
std::vector<zelda3::dungeon::RoomEntrance> entrances_; std::vector<zelda3::RoomEntrance> entrances_;
zelda3::dungeon::DungeonObjectRenderer object_renderer_; zelda3::DungeonObjectRenderer object_renderer_;
absl::flat_hash_map<uint16_t, int> spriteset_usage_; absl::flat_hash_map<uint16_t, int> spriteset_usage_;
absl::flat_hash_map<uint16_t, int> blockset_usage_; absl::flat_hash_map<uint16_t, int> blockset_usage_;

View File

@@ -5,7 +5,7 @@
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {
namespace dungeon {
constexpr static inline absl::string_view Type1RoomObjectNames[] = { constexpr static inline absl::string_view Type1RoomObjectNames[] = {
"Ceiling ↔", "Ceiling ↔",
@@ -456,7 +456,8 @@ constexpr static inline absl::string_view Type3RoomObjectNames[] = {
"Nothing", "Nothing",
}; };
} // namespace dungeon
} // namespace zelda3 } // namespace zelda3
} // namespace yaze } // namespace yaze

View File

@@ -2,7 +2,7 @@
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {
namespace dungeon {
void DungeonObjectRenderer::LoadObject(uint32_t routine_ptr, void DungeonObjectRenderer::LoadObject(uint32_t routine_ptr,
std::array<uint8_t, 16>& sheet_ids) { std::array<uint8_t, 16>& sheet_ids) {
@@ -111,7 +111,8 @@ void DungeonObjectRenderer::UpdateObjectBitmap() {
bitmap_.Create(256, 256, 8, tilemap_); bitmap_.Create(256, 256, 8, tilemap_);
} }
} // namespace dungeon
} // namespace zelda3 } // namespace zelda3
} // namespace yaze } // namespace yaze

View File

@@ -15,7 +15,7 @@
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {
namespace dungeon {
struct PseudoVram { struct PseudoVram {
std::array<uint8_t, 16> sheets; std::array<uint8_t, 16> sheets;
@@ -50,7 +50,8 @@ class DungeonObjectRenderer : public SharedRom {
gfx::Bitmap bitmap_; gfx::Bitmap bitmap_;
}; };
} // namespace dungeon
} // namespace zelda3 } // namespace zelda3
} // namespace yaze } // namespace yaze

View File

@@ -17,7 +17,7 @@
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {
namespace dungeon {
void Room::LoadHeader() { void Room::LoadHeader() {
// Address of the room header // Address of the room header
@@ -485,7 +485,8 @@ void Room::LoadChests() {
} }
} }
} // namespace dungeon
} // namespace zelda3 } // namespace zelda3
} // namespace yaze } // namespace yaze

View File

@@ -15,7 +15,7 @@
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {
namespace dungeon {
// room_object_layout_pointer 0x882D // room_object_layout_pointer 0x882D
// room_object_pointer 0x874C // room_object_pointer 0x874C
@@ -600,7 +600,8 @@ constexpr std::string_view kEntranceNames[] = {
"Heart Piece Cave 3 (Drop In)", "Heart Piece Cave 3 (Drop In)",
"Ice Rod Cave"}; "Ice Rod Cave"};
} // namespace dungeon
} // namespace zelda3 } // namespace zelda3
} // namespace yaze } // namespace yaze

View File

@@ -7,7 +7,7 @@
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {
namespace dungeon {
// ============================================================================ // ============================================================================
// Dungeon Entrances Related Variables // Dungeon Entrances Related Variables
@@ -349,7 +349,8 @@ class RoomEntrance {
uint8_t camera_boundary_fe_; uint8_t camera_boundary_fe_;
}; };
} // namespace dungeon
} // namespace zelda3 } // namespace zelda3
} // namespace yaze } // namespace yaze

View File

@@ -2,7 +2,7 @@
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {
namespace dungeon {
ObjectOption operator|(ObjectOption lhs, ObjectOption rhs) { ObjectOption operator|(ObjectOption lhs, ObjectOption rhs) {
return static_cast<ObjectOption>(static_cast<int>(lhs) | return static_cast<ObjectOption>(static_cast<int>(lhs) |
@@ -130,7 +130,8 @@ void RoomObject::DrawTile(gfx::Tile16 t, int xx, int yy,
} }
} }
} // namespace dungeon
} // namespace zelda3 } // namespace zelda3
} // namespace yaze } // namespace yaze

View File

@@ -11,7 +11,7 @@
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {
namespace dungeon {
struct SubtypeInfo { struct SubtypeInfo {
uint32_t subtype_ptr; uint32_t subtype_ptr;
@@ -201,7 +201,8 @@ class Subtype3 : public RoomObject {
} }
}; };
} // namespace dungeon
} // namespace zelda3 } // namespace zelda3
} // namespace yaze } // namespace yaze

View File

@@ -5,7 +5,7 @@
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {
namespace dungeon {
static const std::string RoomEffect[] = {"Nothing", static const std::string RoomEffect[] = {"Nothing",
"Nothing", "Nothing",
@@ -85,7 +85,8 @@ static const std::string RoomTag[] = {"Nothing",
"Light Torches for Chest", "Light Torches for Chest",
"Kill Boss Again"}; "Kill Boss Again"};
} // namespace dungeon
} // namespace zelda3 } // namespace zelda3
} // namespace yaze } // namespace yaze

View File

@@ -25,7 +25,7 @@ class DungeonRoomTest : public ::testing::Test, public SharedRom {
}; };
TEST_F(DungeonRoomTest, SingleRoomLoadOk) { TEST_F(DungeonRoomTest, SingleRoomLoadOk) {
zelda3::dungeon::Room test_room(/*room_id=*/0); zelda3::Room test_room(/*room_id=*/0);
test_room.LoadHeader(); test_room.LoadHeader();
// Do some assertions based on the output in ZS // Do some assertions based on the output in ZS
test_room.LoadRoomFromROM(); test_room.LoadRoomFromROM();

View File

@@ -22,7 +22,7 @@ class OverworldTest : public ::testing::Test, public SharedRom {
} }
void TearDown() override {} void TearDown() override {}
zelda3::overworld::Overworld overworld_; zelda3::Overworld overworld_;
}; };
TEST_F(OverworldTest, OverworldLoadNoRomDataError) { TEST_F(OverworldTest, OverworldLoadNoRomDataError) {
@@ -48,9 +48,9 @@ TEST_F(OverworldTest, OverworldLoadRomDataOk) {
// Assert // Assert
EXPECT_TRUE(status.ok()); EXPECT_TRUE(status.ok());
EXPECT_EQ(overworld_.overworld_maps().size(), EXPECT_EQ(overworld_.overworld_maps().size(),
zelda3::overworld::kNumOverworldMaps); zelda3::kNumOverworldMaps);
EXPECT_EQ(overworld_.tiles16().size(), EXPECT_EQ(overworld_.tiles16().size(),
zelda3::overworld::kNumTile16Individual); zelda3::kNumTile16Individual);
} }
} // namespace zelda3 } // namespace zelda3

View File

@@ -107,7 +107,7 @@ z3_overworld *yaze_load_overworld(const z3_rom *rom) {
} }
yaze::Rom *internal_rom = static_cast<yaze::Rom *>(rom->impl); yaze::Rom *internal_rom = static_cast<yaze::Rom *>(rom->impl);
auto internal_overworld = new yaze::zelda3::overworld::Overworld(); auto internal_overworld = new yaze::zelda3::Overworld();
if (!internal_overworld->Load(*internal_rom).ok()) { if (!internal_overworld->Load(*internal_rom).ok()) {
return nullptr; return nullptr;
} }