feat: Add visual diagnostic tool for dungeon rendering, enabling texture previews, palette inspection, and tile analysis

This commit is contained in:
scawful
2025-10-04 02:45:50 -04:00
parent f39ce79048
commit 9d1f3a0cea
7 changed files with 442 additions and 5 deletions

View File

@@ -13,6 +13,7 @@
#include "app/zelda3/dungeon/dungeon_editor_system.h"
#include "app/zelda3/dungeon/dungeon_object_editor.h"
#include "app/zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_visual_diagnostic.h"
#include "imgui/imgui.h"
namespace yaze::editor {
@@ -283,6 +284,36 @@ void DungeonEditor::DrawCanvasAndPropertiesPanel() {
ImGui::EndTabItem();
}
// Visual Diagnostic tab - for debugging rendering
if (ImGui::BeginTabItem("Visual Diagnostic")) {
if (!active_rooms_.empty()) {
int room_id = active_rooms_[current_active_room_tab_];
auto& room = rooms_[room_id];
// Show button to toggle diagnostic window
if (ImGui::Button("Open Diagnostic Window")) {
show_visual_diagnostic_ = true;
}
// Render visual diagnostic
if (show_visual_diagnostic_) {
// Get the global graphics buffer for tile decoding
static std::vector<uint8_t> empty_gfx;
const auto& gfx_buffer = rom()->graphics_buffer();
zelda3::dungeon::RoomVisualDiagnostic::DrawDiagnosticWindow(
&show_visual_diagnostic_,
gfx::Arena::Get().bg1(),
gfx::Arena::Get().bg2(),
current_palette_,
gfx_buffer.empty() ? empty_gfx : gfx_buffer);
}
} else {
ImGui::TextColored(ImVec4(1, 1, 0, 1), "No room selected. Open a room to see diagnostics.");
}
ImGui::EndTabItem();
}
// Room Properties tab - debug and editing controls
if (ImGui::BeginTabItem("Room Properties")) {
if (ImGui::Button("Room Debug Info")) {

View File

@@ -146,6 +146,7 @@ class DungeonEditor : public Editor {
bool show_door_editor_ = false;
bool show_chest_editor_ = false;
bool show_properties_editor_ = false;
bool show_visual_diagnostic_ = false;
uint16_t current_entrance_id_ = 0;
uint16_t current_room_id_ = 0;