update editors based on namespace changes
This commit is contained in:
@@ -327,8 +327,8 @@ void DungeonEditor::DrawRoomSelector() {
|
||||
int i = 0;
|
||||
for (const auto each_room_name : zelda3::kRoomNames) {
|
||||
rom()->resource_label()->SelectableLabelWithNameEdit(
|
||||
current_room_id_ == i, "Dungeon Room Names",
|
||||
core::HexByte(i), each_room_name.data());
|
||||
current_room_id_ == i, "Dungeon Room Names", core::HexByte(i),
|
||||
each_room_name.data());
|
||||
if (ImGui::IsItemClicked()) {
|
||||
// TODO: Jump to tab if room is already open
|
||||
current_room_id_ = i;
|
||||
@@ -402,8 +402,7 @@ void DungeonEditor::DrawEntranceSelector() {
|
||||
for (int i = 0; i < 0x85 + 7; i++) {
|
||||
rom()->resource_label()->SelectableLabelWithNameEdit(
|
||||
current_entrance_id_ == i, "Dungeon Entrance Names",
|
||||
core::HexByte(i),
|
||||
zelda3::kEntranceNames[i].data());
|
||||
core::HexByte(i), zelda3::kEntranceNames[i].data());
|
||||
|
||||
if (ImGui::IsItemClicked()) {
|
||||
current_entrance_id_ = i;
|
||||
@@ -439,8 +438,8 @@ void DungeonEditor::DrawDungeonTabView() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (BeginTabItem(zelda3::kRoomNames[active_rooms_[n]].data(),
|
||||
&open, ImGuiTabItemFlags_None)) {
|
||||
if (BeginTabItem(zelda3::kRoomNames[active_rooms_[n]].data(), &open,
|
||||
ImGuiTabItemFlags_None)) {
|
||||
DrawDungeonCanvas(active_rooms_[n]);
|
||||
EndTabItem();
|
||||
}
|
||||
@@ -589,8 +588,6 @@ void DungeonEditor::DrawObjectRenderer() {
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
void DungeonEditor::CalculateUsageStats() {
|
||||
for (const auto &room : rooms_) {
|
||||
if (blockset_usage_.find(room.blockset) == blockset_usage_.end()) {
|
||||
|
||||
@@ -118,30 +118,25 @@ absl::Status ScreenEditor::LoadDungeonMaps() {
|
||||
for (int d = 0; d < 14; d++) {
|
||||
current_floor_rooms_d.clear();
|
||||
current_floor_gfx_d.clear();
|
||||
ASSIGN_OR_RETURN(
|
||||
int ptr,
|
||||
rom()->ReadWord(zelda3::screen::kDungeonMapRoomsPtr + (d * 2)));
|
||||
ASSIGN_OR_RETURN(
|
||||
int ptr_gfx,
|
||||
rom()->ReadWord(zelda3::screen::kDungeonMapGfxPtr + (d * 2)));
|
||||
ASSIGN_OR_RETURN(int ptr,
|
||||
rom()->ReadWord(zelda3::kDungeonMapRoomsPtr + (d * 2)));
|
||||
ASSIGN_OR_RETURN(int ptr_gfx,
|
||||
rom()->ReadWord(zelda3::kDungeonMapGfxPtr + (d * 2)));
|
||||
ptr |= 0x0A0000; // Add bank to the short ptr
|
||||
ptr_gfx |= 0x0A0000; // Add bank to the short ptr
|
||||
int pc_ptr = core::SnesToPc(ptr); // Contains data for the next 25 rooms
|
||||
int pc_ptr_gfx =
|
||||
core::SnesToPc(ptr_gfx); // Contains data for the next 25 rooms
|
||||
|
||||
ASSIGN_OR_RETURN(
|
||||
ushort boss_room_d,
|
||||
rom()->ReadWord(zelda3::screen::kDungeonMapBossRooms + (d * 2)));
|
||||
ASSIGN_OR_RETURN(ushort boss_room_d,
|
||||
rom()->ReadWord(zelda3::kDungeonMapBossRooms + (d * 2)));
|
||||
|
||||
ASSIGN_OR_RETURN(
|
||||
nbr_basement_d,
|
||||
rom()->ReadByte(zelda3::screen::kDungeonMapFloors + (d * 2)));
|
||||
ASSIGN_OR_RETURN(nbr_basement_d,
|
||||
rom()->ReadByte(zelda3::kDungeonMapFloors + (d * 2)));
|
||||
nbr_basement_d &= 0x0F;
|
||||
|
||||
ASSIGN_OR_RETURN(
|
||||
nbr_floor_d,
|
||||
rom()->ReadByte(zelda3::screen::kDungeonMapFloors + (d * 2)));
|
||||
ASSIGN_OR_RETURN(nbr_floor_d,
|
||||
rom()->ReadByte(zelda3::kDungeonMapFloors + (d * 2)));
|
||||
nbr_floor_d &= 0xF0;
|
||||
nbr_floor_d = nbr_floor_d >> 4;
|
||||
|
||||
@@ -184,8 +179,8 @@ absl::Status ScreenEditor::LoadDungeonMaps() {
|
||||
|
||||
absl::Status ScreenEditor::SaveDungeonMaps() {
|
||||
for (int d = 0; d < 14; d++) {
|
||||
int ptr = zelda3::screen::kDungeonMapRoomsPtr + (d * 2);
|
||||
int ptr_gfx = zelda3::screen::kDungeonMapGfxPtr + (d * 2);
|
||||
int ptr = zelda3::kDungeonMapRoomsPtr + (d * 2);
|
||||
int ptr_gfx = zelda3::kDungeonMapGfxPtr + (d * 2);
|
||||
int pc_ptr = core::SnesToPc(ptr);
|
||||
int pc_ptr_gfx = core::SnesToPc(ptr_gfx);
|
||||
|
||||
@@ -210,9 +205,9 @@ absl::Status ScreenEditor::LoadDungeonMapTile16(
|
||||
tile16_sheet_.Init(256, 192, gfx::TileType::Tile16);
|
||||
|
||||
for (int i = 0; i < 186; i++) {
|
||||
int addr = zelda3::screen::kDungeonMapTile16;
|
||||
if (rom()->data()[zelda3::screen::kDungeonMapExpCheck] != 0xB9) {
|
||||
addr = zelda3::screen::kDungeonMapTile16Expanded;
|
||||
int addr = zelda3::kDungeonMapTile16;
|
||||
if (rom()->data()[zelda3::kDungeonMapExpCheck] != 0xB9) {
|
||||
addr = zelda3::kDungeonMapTile16Expanded;
|
||||
}
|
||||
|
||||
ASSIGN_OR_RETURN(auto tl, rom()->ReadWord(addr + (i * 8)));
|
||||
@@ -251,9 +246,9 @@ absl::Status ScreenEditor::LoadDungeonMapTile16(
|
||||
|
||||
absl::Status ScreenEditor::SaveDungeonMapTile16() {
|
||||
for (int i = 0; i < 186; i++) {
|
||||
int addr = zelda3::screen::kDungeonMapTile16;
|
||||
if (rom()->data()[zelda3::screen::kDungeonMapExpCheck] != 0xB9) {
|
||||
addr = zelda3::screen::kDungeonMapTile16Expanded;
|
||||
int addr = zelda3::kDungeonMapTile16;
|
||||
if (rom()->data()[zelda3::kDungeonMapExpCheck] != 0xB9) {
|
||||
addr = zelda3::kDungeonMapTile16Expanded;
|
||||
}
|
||||
|
||||
gfx::TileInfo t1 = tile16_sheet_.tile_info()[i].tiles[0];
|
||||
|
||||
@@ -90,7 +90,7 @@ class ScreenEditor : public SharedRom, public Editor {
|
||||
std::vector<gfx::Bitmap> tile8_individual_;
|
||||
std::vector<uint8_t> all_gfx_;
|
||||
std::vector<uint8_t> gfx_bin_data_;
|
||||
std::vector<zelda3::screen::DungeonMap> dungeon_maps_;
|
||||
std::vector<zelda3::DungeonMap> dungeon_maps_;
|
||||
std::vector<std::vector<std::array<std::string, 25>>> dungeon_map_labels_;
|
||||
|
||||
absl::Status status_;
|
||||
@@ -107,7 +107,7 @@ class ScreenEditor : public SharedRom, public Editor {
|
||||
gui::Canvas tilemap_canvas_{"##TilemapCanvas", ImVec2(128 + 2, (192) + 4),
|
||||
gui::CanvasGridSize::k8x8, 2.f};
|
||||
|
||||
zelda3::screen::Inventory inventory_;
|
||||
zelda3::Inventory inventory_;
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
|
||||
@@ -1407,21 +1407,21 @@ absl::Status OverworldEditor::UpdateUsageStats() {
|
||||
|
||||
void OverworldEditor::DrawUsageGrid() {
|
||||
// Create a grid of 8x8 squares
|
||||
int totalSquares = 128;
|
||||
int squaresWide = 8;
|
||||
int squaresTall = (totalSquares + squaresWide - 1) /
|
||||
squaresWide; // Ceiling of totalSquares/squaresWide
|
||||
int total_squares = 128;
|
||||
int squares_wide = 8;
|
||||
int squares_tall = (total_squares + squares_wide - 1) /
|
||||
squares_wide; // Ceiling of total_squares/squares_wide
|
||||
|
||||
// Loop through each row
|
||||
for (int row = 0; row < squaresTall; ++row) {
|
||||
for (int row = 0; row < squares_tall; ++row) {
|
||||
NewLine();
|
||||
|
||||
for (int col = 0; col < squaresWide; ++col) {
|
||||
if (row * squaresWide + col >= totalSquares) {
|
||||
for (int col = 0; col < squares_wide; ++col) {
|
||||
if (row * squares_wide + col >= total_squares) {
|
||||
break;
|
||||
}
|
||||
// Determine if this square should be highlighted
|
||||
bool highlight = selected_usage_map_ == (row * squaresWide + col);
|
||||
bool highlight = selected_usage_map_ == (row * squares_wide + col);
|
||||
|
||||
// Set highlight color if needed
|
||||
if (highlight) {
|
||||
|
||||
Reference in New Issue
Block a user