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

#include <minecart_track_editor_panel.h>

Inheritance diagram for yaze::editor::MinecartTrackEditorPanel:
Collaboration diagram for yaze::editor::MinecartTrackEditorPanel:

Classes

struct  RoomTrackAudit
 

Public Types

using RoomNavigationCallback = std::function<void(int room_id)>
 

Public Member Functions

 MinecartTrackEditorPanel (const std::string &start_root="")
 
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.
 
void Draw (bool *p_open) override
 Draw the panel content.
 
void SetProjectRoot (const std::string &root)
 
void SetRooms (std::array< zelda3::Room, 0x128 > *rooms)
 
void SetProject (project::YazeProject *project)
 
void SetRom (Rom *rom)
 
void SaveTracks ()
 
void SetPickedCoordinates (int room_id, uint16_t camera_x, uint16_t camera_y)
 
bool IsPickingCoordinates () const
 
int GetPickingTrackIndex () const
 
const std::vector< MinecartTrack > & GetTracks ()
 
void SetRoomNavigationCallback (RoomNavigationCallback callback)
 
- 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 int GetPriority () const
 Get display priority for menu ordering.
 
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 LoadTracks ()
 
bool ParseSection (const std::string &content, const std::string &label, std::vector< int > &out_values)
 
std::string FormatSection (const std::string &label, const std::vector< int > &values)
 
void StartCoordinatePicking (int track_index)
 
void CancelCoordinatePicking ()
 
void RebuildAuditCache ()
 
bool IsDefaultTrack (const MinecartTrack &track) const
 
void DrawOverlaySettings ()
 
void InitializeOverlayInputs ()
 
bool UpdateOverlayList (const char *label, std::string &input, std::vector< uint16_t > &target)
 

Private Attributes

std::vector< MinecartTracktracks_
 
std::string project_root_
 
Romrom_ = nullptr
 
std::array< zelda3::Room, 0x128 > * rooms_ = nullptr
 
project::YazeProjectproject_ = nullptr
 
std::unordered_map< int, RoomTrackAuditroom_audit_
 
std::unordered_map< int, std::vector< int > > track_usage_rooms_
 
std::vector< bool > track_subtype_used_
 
bool audit_dirty_ = true
 
bool loaded_ = false
 
std::string status_message_
 
bool show_success_ = false
 
float success_timer_ = 0.0f
 
bool picking_mode_ = false
 
int picking_track_index_ = -1
 
uint16_t last_picked_x_ = 0
 
uint16_t last_picked_y_ = 0
 
bool has_picked_coords_ = false
 
RoomNavigationCallback room_navigation_callback_
 
bool overlay_inputs_initialized_ = false
 
std::string overlay_track_tiles_input_
 
std::string overlay_track_stop_tiles_input_
 
std::string overlay_track_switch_tiles_input_
 
std::string overlay_track_object_ids_input_
 
std::string overlay_minecart_sprite_ids_input_
 

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

Definition at line 31 of file minecart_track_editor_panel.h.

Member Typedef Documentation

◆ RoomNavigationCallback

using yaze::editor::MinecartTrackEditorPanel::RoomNavigationCallback = std::function<void(int room_id)>

Definition at line 67 of file minecart_track_editor_panel.h.

Constructor & Destructor Documentation

◆ MinecartTrackEditorPanel()

yaze::editor::MinecartTrackEditorPanel::MinecartTrackEditorPanel ( const std::string & start_root = "")
inlineexplicit

Definition at line 33 of file minecart_track_editor_panel.h.

Member Function Documentation

◆ GetId()

std::string yaze::editor::MinecartTrackEditorPanel::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 37 of file minecart_track_editor_panel.h.

◆ GetDisplayName()

std::string yaze::editor::MinecartTrackEditorPanel::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 38 of file minecart_track_editor_panel.h.

◆ GetIcon()

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

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::EditorPanel.

Definition at line 39 of file minecart_track_editor_panel.h.

References ICON_MD_TRAIN.

◆ GetEditorCategory()

std::string yaze::editor::MinecartTrackEditorPanel::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 40 of file minecart_track_editor_panel.h.

◆ Draw()

◆ SetProjectRoot()

void yaze::editor::MinecartTrackEditorPanel::SetProjectRoot ( const std::string & root)

Definition at line 69 of file minecart_track_editor_panel.cc.

References audit_dirty_, loaded_, and project_root_.

Referenced by yaze::editor::DungeonEditorV2::Load().

◆ SetRooms()

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

Definition at line 46 of file minecart_track_editor_panel.h.

References audit_dirty_, and rooms_.

Referenced by yaze::editor::DungeonEditorV2::Load().

◆ SetProject()

void yaze::editor::MinecartTrackEditorPanel::SetProject ( project::YazeProject * project)
inline

◆ SetRom()

void yaze::editor::MinecartTrackEditorPanel::SetRom ( Rom * rom)
inline

Definition at line 55 of file minecart_track_editor_panel.h.

References rom_.

Referenced by yaze::editor::DungeonEditorV2::Load().

◆ SaveTracks()

void yaze::editor::MinecartTrackEditorPanel::SaveTracks ( )

Definition at line 815 of file minecart_track_editor_panel.cc.

References FormatSection(), project_root_, show_success_, status_message_, and tracks_.

Referenced by Draw().

Here is the call graph for this function:

◆ SetPickedCoordinates()

void yaze::editor::MinecartTrackEditorPanel::SetPickedCoordinates ( int room_id,
uint16_t camera_x,
uint16_t camera_y )

◆ IsPickingCoordinates()

bool yaze::editor::MinecartTrackEditorPanel::IsPickingCoordinates ( ) const
inline

Definition at line 62 of file minecart_track_editor_panel.h.

References picking_mode_.

◆ GetPickingTrackIndex()

int yaze::editor::MinecartTrackEditorPanel::GetPickingTrackIndex ( ) const
inline

Definition at line 63 of file minecart_track_editor_panel.h.

References picking_track_index_.

◆ GetTracks()

const std::vector< MinecartTrack > & yaze::editor::MinecartTrackEditorPanel::GetTracks ( )

Definition at line 159 of file minecart_track_editor_panel.cc.

References loaded_, LoadTracks(), and tracks_.

Here is the call graph for this function:

◆ SetRoomNavigationCallback()

void yaze::editor::MinecartTrackEditorPanel::SetRoomNavigationCallback ( RoomNavigationCallback callback)
inline

◆ LoadTracks()

void yaze::editor::MinecartTrackEditorPanel::LoadTracks ( )
private

Definition at line 731 of file minecart_track_editor_panel.cc.

References audit_dirty_, loaded_, ParseSection(), project_root_, show_success_, status_message_, and tracks_.

Referenced by Draw(), and GetTracks().

Here is the call graph for this function:

◆ ParseSection()

bool yaze::editor::MinecartTrackEditorPanel::ParseSection ( const std::string & content,
const std::string & label,
std::vector< int > & out_values )
private

Definition at line 774 of file minecart_track_editor_panel.cc.

Referenced by LoadTracks().

◆ FormatSection()

std::string yaze::editor::MinecartTrackEditorPanel::FormatSection ( const std::string & label,
const std::vector< int > & values )
private

Definition at line 853 of file minecart_track_editor_panel.cc.

Referenced by SaveTracks().

◆ StartCoordinatePicking()

void yaze::editor::MinecartTrackEditorPanel::StartCoordinatePicking ( int track_index)
private

Definition at line 191 of file minecart_track_editor_panel.cc.

References picking_mode_, picking_track_index_, show_success_, and status_message_.

Referenced by Draw().

◆ CancelCoordinatePicking()

void yaze::editor::MinecartTrackEditorPanel::CancelCoordinatePicking ( )
private

Definition at line 199 of file minecart_track_editor_panel.cc.

References picking_mode_, picking_track_index_, and status_message_.

Referenced by Draw().

◆ RebuildAuditCache()

◆ IsDefaultTrack()

bool yaze::editor::MinecartTrackEditorPanel::IsDefaultTrack ( const MinecartTrack & track) const
private

◆ DrawOverlaySettings()

◆ InitializeOverlayInputs()

◆ UpdateOverlayList()

bool yaze::editor::MinecartTrackEditorPanel::UpdateOverlayList ( const char * label,
std::string & input,
std::vector< uint16_t > & target )
private

Definition at line 94 of file minecart_track_editor_panel.cc.

References audit_dirty_.

Referenced by DrawOverlaySettings().

Member Data Documentation

◆ tracks_

std::vector<MinecartTrack> yaze::editor::MinecartTrackEditorPanel::tracks_
private

◆ project_root_

std::string yaze::editor::MinecartTrackEditorPanel::project_root_
private

Definition at line 96 of file minecart_track_editor_panel.h.

Referenced by Draw(), LoadTracks(), SaveTracks(), and SetProjectRoot().

◆ rom_

Rom* yaze::editor::MinecartTrackEditorPanel::rom_ = nullptr
private

Definition at line 97 of file minecart_track_editor_panel.h.

Referenced by Draw(), and SetRom().

◆ rooms_

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

Definition at line 98 of file minecart_track_editor_panel.h.

Referenced by Draw(), RebuildAuditCache(), and SetRooms().

◆ project_

project::YazeProject* yaze::editor::MinecartTrackEditorPanel::project_ = nullptr
private

◆ room_audit_

std::unordered_map<int, RoomTrackAudit> yaze::editor::MinecartTrackEditorPanel::room_audit_
private

Definition at line 100 of file minecart_track_editor_panel.h.

Referenced by Draw(), and RebuildAuditCache().

◆ track_usage_rooms_

std::unordered_map<int, std::vector<int> > yaze::editor::MinecartTrackEditorPanel::track_usage_rooms_
private

Definition at line 101 of file minecart_track_editor_panel.h.

Referenced by Draw(), and RebuildAuditCache().

◆ track_subtype_used_

std::vector<bool> yaze::editor::MinecartTrackEditorPanel::track_subtype_used_
private

Definition at line 102 of file minecart_track_editor_panel.h.

Referenced by Draw(), and RebuildAuditCache().

◆ audit_dirty_

bool yaze::editor::MinecartTrackEditorPanel::audit_dirty_ = true
private

◆ loaded_

bool yaze::editor::MinecartTrackEditorPanel::loaded_ = false
private

Definition at line 104 of file minecart_track_editor_panel.h.

Referenced by Draw(), GetTracks(), LoadTracks(), and SetProjectRoot().

◆ status_message_

std::string yaze::editor::MinecartTrackEditorPanel::status_message_
private

◆ show_success_

bool yaze::editor::MinecartTrackEditorPanel::show_success_ = false
private

◆ success_timer_

float yaze::editor::MinecartTrackEditorPanel::success_timer_ = 0.0f
private

Definition at line 107 of file minecart_track_editor_panel.h.

◆ picking_mode_

bool yaze::editor::MinecartTrackEditorPanel::picking_mode_ = false
private

◆ picking_track_index_

int yaze::editor::MinecartTrackEditorPanel::picking_track_index_ = -1
private

◆ last_picked_x_

uint16_t yaze::editor::MinecartTrackEditorPanel::last_picked_x_ = 0
private

Definition at line 114 of file minecart_track_editor_panel.h.

Referenced by SetPickedCoordinates().

◆ last_picked_y_

uint16_t yaze::editor::MinecartTrackEditorPanel::last_picked_y_ = 0
private

Definition at line 115 of file minecart_track_editor_panel.h.

Referenced by SetPickedCoordinates().

◆ has_picked_coords_

bool yaze::editor::MinecartTrackEditorPanel::has_picked_coords_ = false
private

Definition at line 116 of file minecart_track_editor_panel.h.

Referenced by SetPickedCoordinates().

◆ room_navigation_callback_

RoomNavigationCallback yaze::editor::MinecartTrackEditorPanel::room_navigation_callback_
private

Definition at line 118 of file minecart_track_editor_panel.h.

Referenced by Draw(), and SetRoomNavigationCallback().

◆ overlay_inputs_initialized_

bool yaze::editor::MinecartTrackEditorPanel::overlay_inputs_initialized_ = false
private

Definition at line 121 of file minecart_track_editor_panel.h.

Referenced by InitializeOverlayInputs(), and SetProject().

◆ overlay_track_tiles_input_

std::string yaze::editor::MinecartTrackEditorPanel::overlay_track_tiles_input_
private

Definition at line 122 of file minecart_track_editor_panel.h.

Referenced by DrawOverlaySettings(), and InitializeOverlayInputs().

◆ overlay_track_stop_tiles_input_

std::string yaze::editor::MinecartTrackEditorPanel::overlay_track_stop_tiles_input_
private

Definition at line 123 of file minecart_track_editor_panel.h.

Referenced by DrawOverlaySettings(), and InitializeOverlayInputs().

◆ overlay_track_switch_tiles_input_

std::string yaze::editor::MinecartTrackEditorPanel::overlay_track_switch_tiles_input_
private

Definition at line 124 of file minecart_track_editor_panel.h.

Referenced by DrawOverlaySettings(), and InitializeOverlayInputs().

◆ overlay_track_object_ids_input_

std::string yaze::editor::MinecartTrackEditorPanel::overlay_track_object_ids_input_
private

Definition at line 125 of file minecart_track_editor_panel.h.

Referenced by DrawOverlaySettings(), and InitializeOverlayInputs().

◆ overlay_minecart_sprite_ids_input_

std::string yaze::editor::MinecartTrackEditorPanel::overlay_minecart_sprite_ids_input_
private

Definition at line 126 of file minecart_track_editor_panel.h.

Referenced by DrawOverlaySettings(), and InitializeOverlayInputs().


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