yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::app::editor::DungeonEditor Class Reference

DungeonEditor class for editing dungeons. More...

#include <dungeon_editor.h>

Inheritance diagram for yaze::app::editor::DungeonEditor:
Collaboration diagram for yaze::app::editor::DungeonEditor:

Public Member Functions

 DungeonEditor ()
 
absl::Status Update () override
 
absl::Status Undo () override
 
absl::Status Redo () override
 
absl::Status Cut () override
 
absl::Status Copy () override
 
absl::Status Paste () override
 
absl::Status Find () override
 
void add_room (int i)
 
- Public Member Functions inherited from yaze::app::editor::Editor
 Editor ()=default
 
virtual ~Editor ()=default
 
EditorType type () const
 
- Public Member Functions inherited from yaze::app::SharedRom
 SharedRom ()=default
 
virtual ~SharedRom ()=default
 
std::shared_ptr< Romshared_rom ()
 
auto rom ()
 
- Public Member Functions inherited from yaze::app::core::ExperimentFlags
 ExperimentFlags ()=default
 
virtual ~ExperimentFlags ()=default
 
auto flags () const
 
Flagsmutable_flags ()
 
std::string Serialize () const
 

Private Types

enum  BackgroundType {
  kNoBackground , kBackground1 , kBackground2 , kBackground3 ,
  kBackgroundAny
}
 
enum  PlacementType {
  kNoType , kSprite , kItem , kDoor ,
  kBlock
}
 

Private Member Functions

absl::Status Initialize ()
 
absl::Status RefreshGraphics ()
 
void LoadDungeonRoomSize ()
 
absl::Status UpdateDungeonRoomView ()
 
void DrawToolset ()
 
void DrawRoomSelector ()
 
void DrawEntranceSelector ()
 
void DrawDungeonTabView ()
 
void DrawDungeonCanvas (int room_id)
 
void DrawRoomGraphics ()
 
void DrawTileSelector ()
 
void DrawObjectRenderer ()
 
void CalculateUsageStats ()
 
void DrawUsageStats ()
 
void DrawUsageGrid ()
 
void RenderSetUsage (const absl::flat_hash_map< uint16_t, int > &usage_map, uint16_t &selected_set, int spriteset_offset=0x00)
 

Private Attributes

int background_type_ = kNoBackground
 
int placement_type_ = kNoType
 
int current_object_ = 0
 
bool is_loaded_ = false
 
bool object_loaded_ = false
 
bool palette_showing_ = false
 
bool refresh_graphics_ = false
 
uint16_t current_entrance_id_ = 0
 
uint16_t current_room_id_ = 0
 
uint64_t current_palette_id_ = 0
 
uint64_t current_palette_group_id_ = 0
 
ImVector< int > active_rooms_
 
GfxGroupEditor gfx_group_editor_
 
PaletteEditor palette_editor_
 
gfx::SnesPalette current_palette_
 
gfx::SnesPalette full_palette_
 
gfx::PaletteGroup current_palette_group_
 
gui::Canvas canvas_
 
gui::Canvas room_gfx_canvas_
 
gui::Canvas object_canvas_
 
gfx::Bitmap room_gfx_bmp_
 
std::array< gfx::Bitmap, kNumGfxSheetsgraphics_bin_
 
std::vector< gfx::Bitmap * > room_gfx_sheets_
 
std::vector< zelda3::dungeon::Roomrooms_
 
std::vector< zelda3::dungeon::RoomEntranceentrances_
 
zelda3::dungeon::DungeonObjectRenderer object_renderer_
 
absl::flat_hash_map< uint16_t, int > spriteset_usage_
 
absl::flat_hash_map< uint16_t, int > blockset_usage_
 
absl::flat_hash_map< uint16_t, int > palette_usage_
 
std::vector< int64_t > room_size_pointers_
 
uint16_t selected_blockset_ = 0xFFFF
 
uint16_t selected_spriteset_ = 0xFFFF
 
uint16_t selected_palette_ = 0xFFFF
 
uint64_t total_room_size_ = 0
 
std::unordered_map< int, int > room_size_addresses_
 
std::unordered_map< int, ImVec4 > room_palette_
 
absl::Status status_
 

Additional Inherited Members

- Static Public Attributes inherited from yaze::app::SharedRom
static std::shared_ptr< Romshared_rom_ = nullptr
 
- Protected Attributes inherited from yaze::app::editor::Editor
EditorType type_
 

Detailed Description

DungeonEditor class for editing dungeons.

This class is currently a work in progress and is used for editing dungeons. It provides various functions for updating, cutting, copying, pasting, undoing, and redoing. It also includes methods for drawing the toolset, room selector, entrance selector, dungeon tab view, dungeon canvas, room graphics, tile selector, and object renderer. Additionally, it handles loading room entrances, calculating usage statistics, and rendering set usage.

Definition at line 44 of file dungeon_editor.h.

Member Enumeration Documentation

◆ BackgroundType

Enumerator
kNoBackground 
kBackground1 
kBackground2 
kBackground3 
kBackgroundAny 

Definition at line 85 of file dungeon_editor.h.

◆ PlacementType

Enumerator
kNoType 
kSprite 
kItem 
kDoor 
kBlock 

Definition at line 92 of file dungeon_editor.h.

Constructor & Destructor Documentation

◆ DungeonEditor()

yaze::app::editor::DungeonEditor::DungeonEditor ( )
inline

Member Function Documentation

◆ Update()

absl::Status yaze::app::editor::DungeonEditor::Update ( )
overridevirtual

◆ Undo()

absl::Status yaze::app::editor::DungeonEditor::Undo ( )
inlineoverridevirtual

Implements yaze::app::editor::Editor.

Definition at line 51 of file dungeon_editor.h.

Referenced by DrawToolset().

◆ Redo()

absl::Status yaze::app::editor::DungeonEditor::Redo ( )
inlineoverridevirtual

Implements yaze::app::editor::Editor.

Definition at line 52 of file dungeon_editor.h.

Referenced by DrawToolset().

◆ Cut()

absl::Status yaze::app::editor::DungeonEditor::Cut ( )
inlineoverridevirtual

Implements yaze::app::editor::Editor.

Definition at line 53 of file dungeon_editor.h.

◆ Copy()

absl::Status yaze::app::editor::DungeonEditor::Copy ( )
inlineoverridevirtual

Implements yaze::app::editor::Editor.

Definition at line 54 of file dungeon_editor.h.

◆ Paste()

absl::Status yaze::app::editor::DungeonEditor::Paste ( )
inlineoverridevirtual

Implements yaze::app::editor::Editor.

Definition at line 55 of file dungeon_editor.h.

◆ Find()

absl::Status yaze::app::editor::DungeonEditor::Find ( )
inlineoverridevirtual

Implements yaze::app::editor::Editor.

Definition at line 56 of file dungeon_editor.h.

◆ add_room()

void yaze::app::editor::DungeonEditor::add_room ( int i)
inline

Definition at line 58 of file dungeon_editor.h.

References active_rooms_.

Referenced by yaze::app::editor::EditorManager::ManageActiveEditors().

◆ Initialize()

◆ RefreshGraphics()

absl::Status yaze::app::editor::DungeonEditor::RefreshGraphics ( )
private

◆ LoadDungeonRoomSize()

void yaze::app::editor::DungeonEditor::LoadDungeonRoomSize ( )
private

Definition at line 135 of file dungeon_editor.cc.

References room_size_addresses_, rooms_, and total_room_size_.

Referenced by Initialize().

◆ UpdateDungeonRoomView()

◆ DrawToolset()

◆ DrawRoomSelector()

void yaze::app::editor::DungeonEditor::DrawRoomSelector ( )
private

◆ DrawEntranceSelector()

void yaze::app::editor::DungeonEditor::DrawEntranceSelector ( )
private

◆ DrawDungeonTabView()

void yaze::app::editor::DungeonEditor::DrawDungeonTabView ( )
private

◆ DrawDungeonCanvas()

◆ DrawRoomGraphics()

◆ DrawTileSelector()

void yaze::app::editor::DungeonEditor::DrawTileSelector ( )
private

Definition at line 512 of file dungeon_editor.cc.

References DrawObjectRenderer(), and DrawRoomGraphics().

Referenced by UpdateDungeonRoomView().

Here is the call graph for this function:

◆ DrawObjectRenderer()

◆ CalculateUsageStats()

void yaze::app::editor::DungeonEditor::CalculateUsageStats ( )
private

Definition at line 586 of file dungeon_editor.cc.

References blockset_usage_, palette_usage_, rooms_, and spriteset_usage_.

Referenced by DrawUsageStats(), and Update().

◆ DrawUsageStats()

◆ DrawUsageGrid()

void yaze::app::editor::DungeonEditor::DrawUsageGrid ( )
private

◆ RenderSetUsage()

void yaze::app::editor::DungeonEditor::RenderSetUsage ( const absl::flat_hash_map< uint16_t, int > & usage_map,
uint16_t & selected_set,
int spriteset_offset = 0x00 )
private

Definition at line 608 of file dungeon_editor.cc.

Referenced by DrawUsageStats().

Member Data Documentation

◆ background_type_

int yaze::app::editor::DungeonEditor::background_type_ = kNoBackground
private

Definition at line 94 of file dungeon_editor.h.

Referenced by DrawToolset().

◆ placement_type_

int yaze::app::editor::DungeonEditor::placement_type_ = kNoType
private

Definition at line 95 of file dungeon_editor.h.

Referenced by DrawToolset().

◆ current_object_

int yaze::app::editor::DungeonEditor::current_object_ = 0
private

Definition at line 96 of file dungeon_editor.h.

Referenced by DrawObjectRenderer().

◆ is_loaded_

bool yaze::app::editor::DungeonEditor::is_loaded_ = false
private

Definition at line 98 of file dungeon_editor.h.

Referenced by DrawDungeonCanvas(), DrawRoomGraphics(), and Update().

◆ object_loaded_

bool yaze::app::editor::DungeonEditor::object_loaded_ = false
private

Definition at line 99 of file dungeon_editor.h.

Referenced by DrawObjectRenderer().

◆ palette_showing_

bool yaze::app::editor::DungeonEditor::palette_showing_ = false
private

Definition at line 100 of file dungeon_editor.h.

Referenced by DrawToolset(), and UpdateDungeonRoomView().

◆ refresh_graphics_

bool yaze::app::editor::DungeonEditor::refresh_graphics_ = false
private

Definition at line 101 of file dungeon_editor.h.

Referenced by Update(), and UpdateDungeonRoomView().

◆ current_entrance_id_

uint16_t yaze::app::editor::DungeonEditor::current_entrance_id_ = 0
private

Definition at line 103 of file dungeon_editor.h.

Referenced by DrawEntranceSelector().

◆ current_room_id_

uint16_t yaze::app::editor::DungeonEditor::current_room_id_ = 0
private

◆ current_palette_id_

uint64_t yaze::app::editor::DungeonEditor::current_palette_id_ = 0
private

Definition at line 105 of file dungeon_editor.h.

Referenced by DrawRoomSelector(), RefreshGraphics(), and UpdateDungeonRoomView().

◆ current_palette_group_id_

uint64_t yaze::app::editor::DungeonEditor::current_palette_group_id_ = 0
private

Definition at line 106 of file dungeon_editor.h.

Referenced by Initialize(), and UpdateDungeonRoomView().

◆ active_rooms_

ImVector<int> yaze::app::editor::DungeonEditor::active_rooms_
private

◆ gfx_group_editor_

GfxGroupEditor yaze::app::editor::DungeonEditor::gfx_group_editor_
private

Definition at line 110 of file dungeon_editor.h.

Referenced by DrawUsageStats().

◆ palette_editor_

PaletteEditor yaze::app::editor::DungeonEditor::palette_editor_
private

Definition at line 111 of file dungeon_editor.h.

◆ current_palette_

gfx::SnesPalette yaze::app::editor::DungeonEditor::current_palette_
private

Definition at line 112 of file dungeon_editor.h.

Referenced by UpdateDungeonRoomView().

◆ full_palette_

gfx::SnesPalette yaze::app::editor::DungeonEditor::full_palette_
private

Definition at line 113 of file dungeon_editor.h.

Referenced by Initialize().

◆ current_palette_group_

gfx::PaletteGroup yaze::app::editor::DungeonEditor::current_palette_group_
private

Definition at line 114 of file dungeon_editor.h.

Referenced by Initialize(), and RefreshGraphics().

◆ canvas_

gui::Canvas yaze::app::editor::DungeonEditor::canvas_
private

Definition at line 116 of file dungeon_editor.h.

Referenced by DrawDungeonCanvas().

◆ room_gfx_canvas_

gui::Canvas yaze::app::editor::DungeonEditor::room_gfx_canvas_
private

Definition at line 117 of file dungeon_editor.h.

Referenced by DrawRoomGraphics().

◆ object_canvas_

gui::Canvas yaze::app::editor::DungeonEditor::object_canvas_
private

Definition at line 118 of file dungeon_editor.h.

Referenced by DrawObjectRenderer().

◆ room_gfx_bmp_

gfx::Bitmap yaze::app::editor::DungeonEditor::room_gfx_bmp_
private

Definition at line 120 of file dungeon_editor.h.

◆ graphics_bin_

std::array<gfx::Bitmap, kNumGfxSheets> yaze::app::editor::DungeonEditor::graphics_bin_
private

Definition at line 121 of file dungeon_editor.h.

Referenced by DrawRoomGraphics(), Initialize(), and RefreshGraphics().

◆ room_gfx_sheets_

std::vector<gfx::Bitmap*> yaze::app::editor::DungeonEditor::room_gfx_sheets_
private

Definition at line 123 of file dungeon_editor.h.

Referenced by Initialize().

◆ rooms_

std::vector<zelda3::dungeon::Room> yaze::app::editor::DungeonEditor::rooms_
private

◆ entrances_

std::vector<zelda3::dungeon::RoomEntrance> yaze::app::editor::DungeonEditor::entrances_
private

Definition at line 125 of file dungeon_editor.h.

Referenced by DrawEntranceSelector(), and Initialize().

◆ object_renderer_

zelda3::dungeon::DungeonObjectRenderer yaze::app::editor::DungeonEditor::object_renderer_
private

Definition at line 126 of file dungeon_editor.h.

Referenced by DrawObjectRenderer().

◆ spriteset_usage_

absl::flat_hash_map<uint16_t, int> yaze::app::editor::DungeonEditor::spriteset_usage_
private

Definition at line 128 of file dungeon_editor.h.

Referenced by CalculateUsageStats(), and DrawUsageStats().

◆ blockset_usage_

absl::flat_hash_map<uint16_t, int> yaze::app::editor::DungeonEditor::blockset_usage_
private

Definition at line 129 of file dungeon_editor.h.

Referenced by CalculateUsageStats(), and DrawUsageStats().

◆ palette_usage_

absl::flat_hash_map<uint16_t, int> yaze::app::editor::DungeonEditor::palette_usage_
private

Definition at line 130 of file dungeon_editor.h.

Referenced by CalculateUsageStats(), and DrawUsageStats().

◆ room_size_pointers_

std::vector<int64_t> yaze::app::editor::DungeonEditor::room_size_pointers_
private

Definition at line 132 of file dungeon_editor.h.

Referenced by Initialize().

◆ selected_blockset_

uint16_t yaze::app::editor::DungeonEditor::selected_blockset_ = 0xFFFF
private

Definition at line 134 of file dungeon_editor.h.

Referenced by DrawUsageGrid(), and DrawUsageStats().

◆ selected_spriteset_

uint16_t yaze::app::editor::DungeonEditor::selected_spriteset_ = 0xFFFF
private

Definition at line 135 of file dungeon_editor.h.

Referenced by DrawUsageGrid(), and DrawUsageStats().

◆ selected_palette_

uint16_t yaze::app::editor::DungeonEditor::selected_palette_ = 0xFFFF
private

Definition at line 136 of file dungeon_editor.h.

Referenced by DrawUsageGrid(), and DrawUsageStats().

◆ total_room_size_

uint64_t yaze::app::editor::DungeonEditor::total_room_size_ = 0
private

Definition at line 138 of file dungeon_editor.h.

Referenced by DrawUsageStats(), and LoadDungeonRoomSize().

◆ room_size_addresses_

std::unordered_map<int, int> yaze::app::editor::DungeonEditor::room_size_addresses_
private

Definition at line 140 of file dungeon_editor.h.

Referenced by Initialize(), and LoadDungeonRoomSize().

◆ room_palette_

std::unordered_map<int, ImVec4> yaze::app::editor::DungeonEditor::room_palette_
private

Definition at line 141 of file dungeon_editor.h.

Referenced by DrawUsageGrid(), and Initialize().

◆ status_

absl::Status yaze::app::editor::DungeonEditor::status_
private

Definition at line 143 of file dungeon_editor.h.

Referenced by Update().


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