yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::DungeonMapPanel Class Reference

EditorPanel for displaying multiple rooms in a spatial dungeon layout. More...

#include <dungeon_map_panel.h>

Inheritance diagram for yaze::editor::DungeonMapPanel:
Collaboration diagram for yaze::editor::DungeonMapPanel:

Public Member Functions

 DungeonMapPanel (int *current_room_id, ImVector< int > *active_rooms, std::function< void(int)> on_room_selected, std::array< zelda3::Room, 0x128 > *rooms=nullptr)
 Construct a dungeon map panel.
 
std::string GetId () const override
 Unique identifier for this panel.
 
std::string GetDisplayName () const override
 Human-readable name shown in menus and title bars.
 
std::string GetIcon () const override
 Material Design icon for this panel.
 
std::string GetEditorCategory () const override
 Editor category this panel belongs to.
 
int GetPriority () const override
 Get display priority for menu ordering.
 
void SetRoomIntentCallback (std::function< void(int, RoomSelectionIntent)> callback)
 
void SetDungeonRooms (const std::vector< int > &room_ids)
 Set which rooms to display in this dungeon map.
 
void AddRoom (int room_id)
 Add a single room to the dungeon map.
 
void ClearRooms ()
 Clear all rooms from the dungeon map.
 
void SetRoomPosition (int room_id, int grid_x, int grid_y)
 Manually set a room's position in the grid.
 
void SetRooms (std::array< zelda3::Room, 0x128 > *rooms)
 
void SetHackManifest (const core::HackManifest *manifest)
 Set the hack manifest for project registry access.
 
void LoadFromRegistry (const core::DungeonEntry &dungeon)
 Load rooms and connections from a DungeonEntry in the project registry.
 
void Draw (bool *p_open) override
 Draw the panel content.
 
- Public Member Functions inherited from yaze::editor::EditorPanel
virtual ~EditorPanel ()=default
 
virtual void OnFirstDraw ()
 Called once before the first Draw() in a session.
 
virtual bool RequiresLazyInit () const
 Whether this panel uses lazy initialization.
 
void InvalidateLazyInit ()
 Reset lazy init state so OnFirstDraw() runs again.
 
virtual void OnOpen ()
 Called when panel becomes visible.
 
virtual void OnClose ()
 Called when panel is hidden.
 
virtual void OnFocus ()
 Called when panel receives focus.
 
virtual PanelCategory GetPanelCategory () const
 Get the lifecycle category for this panel.
 
virtual PanelContextScope GetContextScope () const
 Optional context binding for this panel (room/selection/etc)
 
virtual PanelScope GetScope () const
 Get the registration scope for this panel.
 
virtual bool IsEnabled () const
 Check if this panel is currently enabled.
 
virtual std::string GetDisabledTooltip () const
 Get tooltip text when panel is disabled.
 
virtual std::string GetShortcutHint () const
 Get keyboard shortcut hint for display.
 
virtual float GetPreferredWidth () const
 Get preferred width for this panel (optional)
 
virtual bool IsVisibleByDefault () const
 Whether this panel should be visible by default.
 
virtual std::string GetParentPanelId () const
 Get parent panel ID for cascade behavior.
 
virtual bool CascadeCloseChildren () const
 Whether closing this panel should close child panels.
 
void DrawWithLazyInit (bool *p_open)
 Execute lazy initialization if needed, then call Draw()
 

Private Member Functions

void AutoLayoutRooms ()
 Auto-layout rooms in a grid based on their IDs.
 
void DrawDungeonSelector ()
 Draw dungeon preset selector — uses project registry if available, falls back to vanilla ALTTP presets.
 
void DrawRegistrySelector ()
 Selector using Oracle project registry dungeon entries.
 
void DrawVanillaPresetSelector ()
 Fallback selector using vanilla ALTTP dungeon presets.
 

Static Private Member Functions

static void DrawDashedLine (ImDrawList *dl, ImVec2 from, ImVec2 to, ImU32 color, float thickness, float dash_len)
 Draw a dashed line between two points.
 
static void DrawArrowhead (ImDrawList *dl, ImVec2 from, ImVec2 to, ImU32 color, float size)
 Draw a small triangle arrowhead at the 'to' end of a line.
 

Private Attributes

int * current_room_id_ = nullptr
 
ImVector< int > * active_rooms_ = nullptr
 
std::array< zelda3::Room, 0x128 > * rooms_ = nullptr
 
std::function< void(int)> on_room_selected_
 
std::function< void(int, RoomSelectionIntent)> on_room_intent_
 
std::vector< int > dungeon_room_ids_
 
std::map< int, ImVec2 > room_positions_
 
std::map< int, std::string > room_types_
 
int selected_preset_ = -1
 
const core::HackManifesthack_manifest_ = nullptr
 
std::vector< core::DungeonConnectionstair_connections_
 
std::vector< core::DungeonConnectionholewarp_connections_
 
std::string current_dungeon_name_ = "Select Dungeon..."
 

Additional Inherited Members

- Protected Member Functions inherited from yaze::editor::EditorPanel
void InvalidateCache ()
 Invalidate all cached computations.
 
template<typename T >
T & GetCached (const std::string &key, std::function< T()> compute)
 Get or compute a cached value.
 
bool IsCacheValid () const
 Check if cache has been invalidated.
 
void ClearCache ()
 Clear all cached values (more aggressive than InvalidateCache)
 

Detailed Description

EditorPanel for displaying multiple rooms in a spatial dungeon layout.

This panel provides an overview of multiple dungeon rooms arranged spatially, allowing users to see room connections and navigate between rooms quickly. Unlike the 16x19 Room Matrix which shows ALL rooms, this panel shows a focused subset of rooms that belong to a specific dungeon or user selection.

Features:

  • Spatial arrangement of 4-16 rooms
  • Thumbnail previews of each room
  • Room connection visualization
  • Click to select
See also
DungeonRoomMatrixPanel - For full 296-room grid view
EditorPanel - Base interface

Definition at line 42 of file dungeon_map_panel.h.

Constructor & Destructor Documentation

◆ DungeonMapPanel()

yaze::editor::DungeonMapPanel::DungeonMapPanel ( int * current_room_id,
ImVector< int > * active_rooms,
std::function< void(int)> on_room_selected,
std::array< zelda3::Room, 0x128 > * rooms = nullptr )
inline

Construct a dungeon map panel.

Parameters
current_room_idPointer to the current room ID (for highlighting)
active_roomsPointer to list of currently open rooms
on_room_selectedCallback when a room is clicked
roomsPointer to room data array

Definition at line 51 of file dungeon_map_panel.h.

Member Function Documentation

◆ GetId()

std::string yaze::editor::DungeonMapPanel::GetId ( ) const
inlineoverridevirtual

Unique identifier for this panel.

Returns
Panel ID in format "{category}.{name}" (e.g., "dungeon.room_selector")

IDs should be:

  • Lowercase with underscores
  • Prefixed with editor category
  • Unique across all panels

Implements yaze::editor::EditorPanel.

Definition at line 63 of file dungeon_map_panel.h.

◆ GetDisplayName()

std::string yaze::editor::DungeonMapPanel::GetDisplayName ( ) const
inlineoverridevirtual

Human-readable name shown in menus and title bars.

Returns
Display name (e.g., "Room Selector")

Implements yaze::editor::EditorPanel.

Definition at line 64 of file dungeon_map_panel.h.

◆ GetIcon()

std::string yaze::editor::DungeonMapPanel::GetIcon ( ) const
inlineoverridevirtual

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::EditorPanel.

Definition at line 65 of file dungeon_map_panel.h.

References ICON_MD_MAP.

◆ GetEditorCategory()

std::string yaze::editor::DungeonMapPanel::GetEditorCategory ( ) const
inlineoverridevirtual

Editor category this panel belongs to.

Returns
Category name matching EditorType (e.g., "Dungeon", "Overworld")

Implements yaze::editor::EditorPanel.

Definition at line 66 of file dungeon_map_panel.h.

◆ GetPriority()

int yaze::editor::DungeonMapPanel::GetPriority ( ) const
inlineoverridevirtual

Get display priority for menu ordering.

Returns
Priority value (lower = higher in list, default 50)

Reimplemented from yaze::editor::EditorPanel.

Definition at line 67 of file dungeon_map_panel.h.

◆ SetRoomIntentCallback()

void yaze::editor::DungeonMapPanel::SetRoomIntentCallback ( std::function< void(int, RoomSelectionIntent)> callback)
inline

Definition at line 69 of file dungeon_map_panel.h.

References on_room_intent_.

◆ SetDungeonRooms()

void yaze::editor::DungeonMapPanel::SetDungeonRooms ( const std::vector< int > & room_ids)
inline

Set which rooms to display in this dungeon map.

Parameters
room_idsVector of room IDs to include

Definition at line 82 of file dungeon_map_panel.h.

References AutoLayoutRooms(), and dungeon_room_ids_.

Here is the call graph for this function:

◆ AddRoom()

void yaze::editor::DungeonMapPanel::AddRoom ( int room_id)
inline

Add a single room to the dungeon map.

Definition at line 90 of file dungeon_map_panel.h.

References AutoLayoutRooms(), and dungeon_room_ids_.

Referenced by DrawDungeonSelector().

Here is the call graph for this function:

◆ ClearRooms()

void yaze::editor::DungeonMapPanel::ClearRooms ( )
inline

Clear all rooms from the dungeon map.

Definition at line 102 of file dungeon_map_panel.h.

References dungeon_room_ids_, and room_positions_.

Referenced by DrawDungeonSelector(), and LoadFromRegistry().

◆ SetRoomPosition()

void yaze::editor::DungeonMapPanel::SetRoomPosition ( int room_id,
int grid_x,
int grid_y )
inline

Manually set a room's position in the grid.

Definition at line 110 of file dungeon_map_panel.h.

References room_positions_.

◆ SetRooms()

void yaze::editor::DungeonMapPanel::SetRooms ( std::array< zelda3::Room, 0x128 > * rooms)
inline

Definition at line 115 of file dungeon_map_panel.h.

References rooms_.

◆ SetHackManifest()

void yaze::editor::DungeonMapPanel::SetHackManifest ( const core::HackManifest * manifest)
inline

Set the hack manifest for project registry access.

Definition at line 120 of file dungeon_map_panel.h.

References hack_manifest_.

◆ LoadFromRegistry()

void yaze::editor::DungeonMapPanel::LoadFromRegistry ( const core::DungeonEntry & dungeon)
inline

Load rooms and connections from a DungeonEntry in the project registry.

Definition at line 127 of file dungeon_map_panel.h.

References ClearRooms(), current_dungeon_name_, dungeon_room_ids_, holewarp_connections_, yaze::core::DungeonEntry::holewarps, yaze::core::DungeonEntry::name, room_positions_, room_types_, yaze::core::DungeonEntry::rooms, stair_connections_, and yaze::core::DungeonEntry::stairs.

Referenced by DrawRegistrySelector().

Here is the call graph for this function:

◆ Draw()

void yaze::editor::DungeonMapPanel::Draw ( bool * p_open)
inlineoverridevirtual

Draw the panel content.

Parameters
p_openPointer to visibility flag (nullptr if not closable)

Called by PanelManager when the panel is visible. Do NOT call ImGui::Begin/End - the PanelWindow wrapper handles that. Just draw your content directly.

Implements yaze::editor::EditorPanel.

Definition at line 145 of file dungeon_map_panel.h.

References active_rooms_, current_room_id_, DrawArrowhead(), DrawDashedLine(), DrawDungeonSelector(), dungeon_room_ids_, yaze::zelda3::GetRoomLabel(), yaze::editor::AgentUI::GetTheme(), holewarp_connections_, yaze::editor::kOpenStandalone, on_room_intent_, on_room_selected_, room_positions_, room_types_, rooms_, and stair_connections_.

◆ AutoLayoutRooms()

void yaze::editor::DungeonMapPanel::AutoLayoutRooms ( )
inlineprivate

Auto-layout rooms in a grid based on their IDs.

Definition at line 390 of file dungeon_map_panel.h.

References dungeon_room_ids_, and room_positions_.

Referenced by AddRoom(), DrawVanillaPresetSelector(), and SetDungeonRooms().

◆ DrawDungeonSelector()

void yaze::editor::DungeonMapPanel::DrawDungeonSelector ( )
inlineprivate

Draw dungeon preset selector — uses project registry if available, falls back to vanilla ALTTP presets.

Definition at line 410 of file dungeon_map_panel.h.

References AddRoom(), ClearRooms(), current_dungeon_name_, current_room_id_, DrawRegistrySelector(), DrawVanillaPresetSelector(), hack_manifest_, yaze::core::HackManifest::HasProjectRegistry(), holewarp_connections_, ICON_MD_ADD, ICON_MD_CLEAR, room_types_, selected_preset_, and stair_connections_.

Referenced by Draw().

◆ DrawRegistrySelector()

void yaze::editor::DungeonMapPanel::DrawRegistrySelector ( )
inlineprivate

Selector using Oracle project registry dungeon entries.

Definition at line 443 of file dungeon_map_panel.h.

References current_dungeon_name_, yaze::core::ProjectRegistry::dungeons, hack_manifest_, LoadFromRegistry(), yaze::core::HackManifest::project_registry(), and selected_preset_.

Referenced by DrawDungeonSelector().

Here is the call graph for this function:

◆ DrawVanillaPresetSelector()

void yaze::editor::DungeonMapPanel::DrawVanillaPresetSelector ( )
inlineprivate

Fallback selector using vanilla ALTTP dungeon presets.

Definition at line 473 of file dungeon_map_panel.h.

References AutoLayoutRooms(), dungeon_room_ids_, and selected_preset_.

Referenced by DrawDungeonSelector().

Here is the call graph for this function:

◆ DrawDashedLine()

static void yaze::editor::DungeonMapPanel::DrawDashedLine ( ImDrawList * dl,
ImVec2 from,
ImVec2 to,
ImU32 color,
float thickness,
float dash_len )
inlinestaticprivate

Draw a dashed line between two points.

Definition at line 519 of file dungeon_map_panel.h.

Referenced by Draw().

◆ DrawArrowhead()

static void yaze::editor::DungeonMapPanel::DrawArrowhead ( ImDrawList * dl,
ImVec2 from,
ImVec2 to,
ImU32 color,
float size )
inlinestaticprivate

Draw a small triangle arrowhead at the 'to' end of a line.

Definition at line 546 of file dungeon_map_panel.h.

Referenced by Draw().

Member Data Documentation

◆ current_room_id_

int* yaze::editor::DungeonMapPanel::current_room_id_ = nullptr
private

Definition at line 566 of file dungeon_map_panel.h.

Referenced by Draw(), and DrawDungeonSelector().

◆ active_rooms_

ImVector<int>* yaze::editor::DungeonMapPanel::active_rooms_ = nullptr
private

Definition at line 567 of file dungeon_map_panel.h.

Referenced by Draw().

◆ rooms_

std::array<zelda3::Room, 0x128>* yaze::editor::DungeonMapPanel::rooms_ = nullptr
private

Definition at line 568 of file dungeon_map_panel.h.

Referenced by Draw(), and SetRooms().

◆ on_room_selected_

std::function<void(int)> yaze::editor::DungeonMapPanel::on_room_selected_
private

Definition at line 569 of file dungeon_map_panel.h.

Referenced by Draw().

◆ on_room_intent_

std::function<void(int, RoomSelectionIntent)> yaze::editor::DungeonMapPanel::on_room_intent_
private

Definition at line 570 of file dungeon_map_panel.h.

Referenced by Draw(), and SetRoomIntentCallback().

◆ dungeon_room_ids_

std::vector<int> yaze::editor::DungeonMapPanel::dungeon_room_ids_
private

◆ room_positions_

std::map<int, ImVec2> yaze::editor::DungeonMapPanel::room_positions_
private

◆ room_types_

std::map<int, std::string> yaze::editor::DungeonMapPanel::room_types_
private

Definition at line 575 of file dungeon_map_panel.h.

Referenced by Draw(), DrawDungeonSelector(), and LoadFromRegistry().

◆ selected_preset_

int yaze::editor::DungeonMapPanel::selected_preset_ = -1
private

◆ hack_manifest_

const core::HackManifest* yaze::editor::DungeonMapPanel::hack_manifest_ = nullptr
private

Definition at line 579 of file dungeon_map_panel.h.

Referenced by DrawDungeonSelector(), DrawRegistrySelector(), and SetHackManifest().

◆ stair_connections_

std::vector<core::DungeonConnection> yaze::editor::DungeonMapPanel::stair_connections_
private

Definition at line 580 of file dungeon_map_panel.h.

Referenced by Draw(), DrawDungeonSelector(), and LoadFromRegistry().

◆ holewarp_connections_

std::vector<core::DungeonConnection> yaze::editor::DungeonMapPanel::holewarp_connections_
private

Definition at line 581 of file dungeon_map_panel.h.

Referenced by Draw(), DrawDungeonSelector(), and LoadFromRegistry().

◆ current_dungeon_name_

std::string yaze::editor::DungeonMapPanel::current_dungeon_name_ = "Select Dungeon..."
private

The documentation for this class was generated from the following file: