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

Handles room and entrance selection UI. More...

#include <dungeon_room_selector.h>

Collaboration diagram for yaze::editor::DungeonRoomSelector:

Public Member Functions

 DungeonRoomSelector (Rom *rom=nullptr)
 
void Draw ()
 
void DrawRoomSelector (RoomSelectionIntent single_click_intent=RoomSelectionIntent::kFocusInWorkbench)
 
void DrawEntranceSelector ()
 
void SetContext (EditorContext ctx)
 
EditorContext context () const
 
void SetRom (Rom *rom)
 
Romrom () const
 
void SetGameData (zelda3::GameData *game_data)
 
zelda3::GameDatagame_data () const
 
void set_current_room_id (uint16_t room_id)
 
int current_room_id () const
 
void set_active_rooms (const ImVector< int > &rooms)
 
const ImVector< int > & active_rooms () const
 
ImVector< int > & mutable_active_rooms ()
 
void set_current_entrance_id (int entrance_id)
 
int current_entrance_id () const
 
void set_rooms (std::array< zelda3::Room, 0x128 > *rooms)
 
void set_entrances (std::array< zelda3::RoomEntrance, 0x8C > *entrances)
 
void SetRoomSelectedCallback (std::function< void(int)> callback)
 
void set_room_selected_callback (std::function< void(int)> callback)
 
void SetRoomSelectedWithIntentCallback (std::function< void(int, RoomSelectionIntent)> callback)
 
void SetEntranceSelectedCallback (std::function< void(int)> callback)
 
void set_entrance_selected_callback (std::function< void(int)> callback)
 

Static Public Member Functions

static const char * GetBlocksetGroupName (uint8_t blockset)
 

Private Types

enum  ViewMode : uint8_t { kViewList = 0 , kViewGrouped = 1 }
 
enum  EntityTypeFilter : uint8_t { kFilterAll = 0 , kFilterHasSprites = 1 , kFilterHasItems = 2 , kFilterHasObjects = 3 }
 

Private Member Functions

void RebuildRoomFilterCache ()
 
void RebuildEntranceFilterCache ()
 
bool PassesEntityTypeFilter (int room_id) const
 
void DrawGroupedRoomList (RoomSelectionIntent single_click_intent)
 

Private Attributes

Romrom_ = nullptr
 
zelda3::GameDatagame_data_ = nullptr
 
uint16_t current_room_id_ = 0
 
int current_entrance_id_ = 0
 
ImVector< int > active_rooms_
 
std::array< zelda3::Room, 0x128 > * rooms_ = nullptr
 
std::array< zelda3::RoomEntrance, 0x8C > * entrances_ = nullptr
 
std::function< void(int)> room_selected_callback_
 
std::function< void(int, RoomSelectionIntent)> room_intent_callback_
 
std::function< void(int)> entrance_selected_callback_
 
ImGuiTextFilter room_filter_
 
ImGuiTextFilter entrance_filter_
 
ViewMode view_mode_ = kViewList
 
EntityTypeFilter entity_type_filter_ = kFilterAll
 
std::vector< int > filtered_room_indices_
 
std::vector< int > filtered_entrance_indices_
 
std::string last_room_filter_
 
std::string last_entrance_filter_
 

Detailed Description

Handles room and entrance selection UI.

Definition at line 30 of file dungeon_room_selector.h.

Member Enumeration Documentation

◆ ViewMode

Enumerator
kViewList 
kViewGrouped 

Definition at line 122 of file dungeon_room_selector.h.

◆ EntityTypeFilter

Enumerator
kFilterAll 
kFilterHasSprites 
kFilterHasItems 
kFilterHasObjects 

Definition at line 130 of file dungeon_room_selector.h.

Constructor & Destructor Documentation

◆ DungeonRoomSelector()

yaze::editor::DungeonRoomSelector::DungeonRoomSelector ( Rom * rom = nullptr)
inlineexplicit

Definition at line 32 of file dungeon_room_selector.h.

Member Function Documentation

◆ Draw()

void yaze::editor::DungeonRoomSelector::Draw ( )

Definition at line 27 of file dungeon_room_selector.cc.

References DrawRoomSelector().

Here is the call graph for this function:

◆ DrawRoomSelector()

◆ DrawEntranceSelector()

◆ SetContext()

void yaze::editor::DungeonRoomSelector::SetContext ( EditorContext ctx)
inline

◆ context()

EditorContext yaze::editor::DungeonRoomSelector::context ( ) const
inline

Definition at line 44 of file dungeon_room_selector.h.

References game_data_, and rom_.

◆ SetRom()

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

Definition at line 47 of file dungeon_room_selector.h.

References rom(), and rom_.

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

Here is the call graph for this function:

◆ rom()

Rom * yaze::editor::DungeonRoomSelector::rom ( ) const
inline

Definition at line 48 of file dungeon_room_selector.h.

References rom_.

Referenced by SetRom().

◆ SetGameData()

void yaze::editor::DungeonRoomSelector::SetGameData ( zelda3::GameData * game_data)
inline

Definition at line 49 of file dungeon_room_selector.h.

References game_data(), and game_data_.

Here is the call graph for this function:

◆ game_data()

zelda3::GameData * yaze::editor::DungeonRoomSelector::game_data ( ) const
inline

Definition at line 50 of file dungeon_room_selector.h.

References game_data_.

Referenced by SetGameData().

◆ set_current_room_id()

void yaze::editor::DungeonRoomSelector::set_current_room_id ( uint16_t room_id)
inline

Definition at line 53 of file dungeon_room_selector.h.

References current_room_id_.

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

◆ current_room_id()

int yaze::editor::DungeonRoomSelector::current_room_id ( ) const
inline

Definition at line 54 of file dungeon_room_selector.h.

References current_room_id_.

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

◆ set_active_rooms()

void yaze::editor::DungeonRoomSelector::set_active_rooms ( const ImVector< int > & rooms)
inline

◆ active_rooms()

const ImVector< int > & yaze::editor::DungeonRoomSelector::active_rooms ( ) const
inline

Definition at line 57 of file dungeon_room_selector.h.

References active_rooms_.

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

◆ mutable_active_rooms()

ImVector< int > & yaze::editor::DungeonRoomSelector::mutable_active_rooms ( )
inline

Definition at line 58 of file dungeon_room_selector.h.

References active_rooms_.

◆ set_current_entrance_id()

void yaze::editor::DungeonRoomSelector::set_current_entrance_id ( int entrance_id)
inline

Definition at line 61 of file dungeon_room_selector.h.

References current_entrance_id_.

◆ current_entrance_id()

int yaze::editor::DungeonRoomSelector::current_entrance_id ( ) const
inline

Definition at line 64 of file dungeon_room_selector.h.

References current_entrance_id_.

◆ set_rooms()

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

Definition at line 67 of file dungeon_room_selector.h.

References rooms_.

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

◆ set_entrances()

void yaze::editor::DungeonRoomSelector::set_entrances ( std::array< zelda3::RoomEntrance, 0x8C > * entrances)
inline

Definition at line 68 of file dungeon_room_selector.h.

References entrances_.

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

◆ SetRoomSelectedCallback()

void yaze::editor::DungeonRoomSelector::SetRoomSelectedCallback ( std::function< void(int)> callback)
inline

◆ set_room_selected_callback()

void yaze::editor::DungeonRoomSelector::set_room_selected_callback ( std::function< void(int)> callback)
inline

Definition at line 77 of file dungeon_room_selector.h.

References SetRoomSelectedCallback().

Here is the call graph for this function:

◆ SetRoomSelectedWithIntentCallback()

void yaze::editor::DungeonRoomSelector::SetRoomSelectedWithIntentCallback ( std::function< void(int, RoomSelectionIntent)> callback)
inline

◆ SetEntranceSelectedCallback()

void yaze::editor::DungeonRoomSelector::SetEntranceSelectedCallback ( std::function< void(int)> callback)
inline

◆ set_entrance_selected_callback()

void yaze::editor::DungeonRoomSelector::set_entrance_selected_callback ( std::function< void(int)> callback)
inline

Definition at line 92 of file dungeon_room_selector.h.

References SetEntranceSelectedCallback().

Here is the call graph for this function:

◆ GetBlocksetGroupName()

const char * yaze::editor::DungeonRoomSelector::GetBlocksetGroupName ( uint8_t blockset)
static

Definition at line 450 of file dungeon_room_selector.cc.

Referenced by DrawGroupedRoomList().

◆ RebuildRoomFilterCache()

void yaze::editor::DungeonRoomSelector::RebuildRoomFilterCache ( )
private

Definition at line 33 of file dungeon_room_selector.cc.

References filtered_room_indices_, yaze::zelda3::GetRoomLabel(), yaze::zelda3::kNumberOfRooms, PassesEntityTypeFilter(), and room_filter_.

Referenced by DrawRoomSelector().

Here is the call graph for this function:

◆ RebuildEntranceFilterCache()

void yaze::editor::DungeonRoomSelector::RebuildEntranceFilterCache ( )
private

Definition at line 258 of file dungeon_room_selector.cc.

References entrance_filter_, entrances_, filtered_entrance_indices_, and yaze::zelda3::GetEntranceLabel().

Referenced by DrawEntranceSelector().

Here is the call graph for this function:

◆ PassesEntityTypeFilter()

bool yaze::editor::DungeonRoomSelector::PassesEntityTypeFilter ( int room_id) const
private

◆ DrawGroupedRoomList()

Member Data Documentation

◆ rom_

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

◆ game_data_

zelda3::GameData* yaze::editor::DungeonRoomSelector::game_data_ = nullptr
private

Definition at line 101 of file dungeon_room_selector.h.

Referenced by context(), game_data(), SetContext(), and SetGameData().

◆ current_room_id_

uint16_t yaze::editor::DungeonRoomSelector::current_room_id_ = 0
private

◆ current_entrance_id_

int yaze::editor::DungeonRoomSelector::current_entrance_id_ = 0
private

◆ active_rooms_

ImVector<int> yaze::editor::DungeonRoomSelector::active_rooms_
private

Definition at line 104 of file dungeon_room_selector.h.

Referenced by active_rooms(), mutable_active_rooms(), and set_active_rooms().

◆ rooms_

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

◆ entrances_

std::array<zelda3::RoomEntrance, 0x8C>* yaze::editor::DungeonRoomSelector::entrances_ = nullptr
private

◆ room_selected_callback_

std::function<void(int)> yaze::editor::DungeonRoomSelector::room_selected_callback_
private

◆ room_intent_callback_

std::function<void(int, RoomSelectionIntent)> yaze::editor::DungeonRoomSelector::room_intent_callback_
private

◆ entrance_selected_callback_

std::function<void(int)> yaze::editor::DungeonRoomSelector::entrance_selected_callback_
private

Definition at line 116 of file dungeon_room_selector.h.

Referenced by DrawEntranceSelector(), and SetEntranceSelectedCallback().

◆ room_filter_

ImGuiTextFilter yaze::editor::DungeonRoomSelector::room_filter_
private

Definition at line 118 of file dungeon_room_selector.h.

Referenced by DrawRoomSelector(), and RebuildRoomFilterCache().

◆ entrance_filter_

ImGuiTextFilter yaze::editor::DungeonRoomSelector::entrance_filter_
private

Definition at line 119 of file dungeon_room_selector.h.

Referenced by DrawEntranceSelector(), and RebuildEntranceFilterCache().

◆ view_mode_

ViewMode yaze::editor::DungeonRoomSelector::view_mode_ = kViewList
private

Definition at line 126 of file dungeon_room_selector.h.

Referenced by DrawRoomSelector().

◆ entity_type_filter_

EntityTypeFilter yaze::editor::DungeonRoomSelector::entity_type_filter_ = kFilterAll
private

Definition at line 136 of file dungeon_room_selector.h.

Referenced by DrawRoomSelector(), and PassesEntityTypeFilter().

◆ filtered_room_indices_

std::vector<int> yaze::editor::DungeonRoomSelector::filtered_room_indices_
private

◆ filtered_entrance_indices_

std::vector<int> yaze::editor::DungeonRoomSelector::filtered_entrance_indices_
private

Definition at line 140 of file dungeon_room_selector.h.

Referenced by DrawEntranceSelector(), and RebuildEntranceFilterCache().

◆ last_room_filter_

std::string yaze::editor::DungeonRoomSelector::last_room_filter_
private

Definition at line 141 of file dungeon_room_selector.h.

Referenced by DrawRoomSelector().

◆ last_entrance_filter_

std::string yaze::editor::DungeonRoomSelector::last_entrance_filter_
private

Definition at line 142 of file dungeon_room_selector.h.

Referenced by DrawEntranceSelector().


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