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

The ScreenEditor class allows the user to edit a variety of screens in the game or create a custom menu. More...

#include <screen_editor.h>

Inheritance diagram for yaze::editor::ScreenEditor:

Public Member Functions

 ScreenEditor (Rom *rom=nullptr)
 
void Initialize () override
 
absl::Status Load () override
 
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
 
absl::Status Save () override
 
void set_rom (Rom *rom)
 
Romrom () const
 
- Public Member Functions inherited from yaze::editor::Editor
 Editor ()=default
 
virtual ~Editor ()=default
 
void SetDependencies (const EditorDependencies &deps)
 
virtual absl::Status Clear ()
 
EditorType type () const
 
bool * active ()
 
void set_active (bool active)
 
void toggle_active ()
 
virtual bool IsRomLoaded () const
 
virtual std::string GetRomStatus () const
 

Public Attributes

std::vector< zelda3::DungeonMapdungeon_maps_
 

Private Types

enum class  EditingMode { DRAW , EDIT }
 

Private Member Functions

void DrawTitleScreenEditor ()
 
void DrawNamingScreenEditor ()
 
void DrawOverworldMapEditor ()
 
void DrawInventoryMenuEditor ()
 
void DrawInventoryItemIcons ()
 
void DrawToolset ()
 
void DrawDungeonMapToolset ()
 
void DrawInventoryToolset ()
 
void DrawTitleScreenCompositeCanvas ()
 
void DrawTitleScreenBG1Canvas ()
 
void DrawTitleScreenBG2Canvas ()
 
void DrawTitleScreenBlocksetSelector ()
 
absl::Status LoadDungeonMapTile16 (const std::vector< uint8_t > &gfx_data, bool bin_mode=false)
 
absl::Status SaveDungeonMapTile16 ()
 
void DrawDungeonMapScreen (int i)
 
void DrawDungeonMapsTabs ()
 
void DrawDungeonMapsEditor ()
 Draw dungeon maps editor with enhanced ROM hacking features.
 
void DrawDungeonMapsRoomGfx ()
 Draw dungeon room graphics editor with enhanced tile16 editing.
 
void LoadBinaryGfx ()
 

Private Attributes

EditingMode current_mode_ = EditingMode::DRAW
 
bool binary_gfx_loaded_ = false
 
uint8_t selected_room = 0
 
int selected_tile16_ = 0
 
int selected_tile8_ = 0
 
int selected_dungeon = 0
 
int floor_number = 1
 
bool copy_button_pressed = false
 
bool paste_button_pressed = false
 
zelda3::DungeonMapLabels dungeon_map_labels_
 
gfx::SnesPalette palette_
 
gfx::BitmapTable sheets_
 
gfx::Tilemap tile16_blockset_
 
gfx::Tilemap tile8_tilemap_
 
std::array< gfx::TileInfo, 4 > current_tile16_info
 
gui::Canvas current_tile_canvas_
 
gui::Canvas screen_canvas_
 
gui::Canvas tilesheet_canvas_
 
gui::Canvas tilemap_canvas_
 
gui::Canvas title_bg1_canvas_
 
gui::Canvas title_bg2_canvas_
 
gui::Canvas title_blockset_canvas_
 
zelda3::Inventory inventory_
 
zelda3::TitleScreen title_screen_
 
zelda3::OverworldMapScreen ow_map_screen_
 
int selected_title_tile16_ = 0
 
bool title_screen_loaded_ = false
 
bool title_h_flip_ = false
 
bool title_v_flip_ = false
 
int title_palette_ = 0
 
bool show_title_bg1_ = true
 
bool show_title_bg2_ = true
 
int selected_ow_tile_ = 0
 
bool ow_map_loaded_ = false
 
bool ow_show_dark_world_ = false
 
gui::Canvas ow_map_canvas_
 
gui::Canvas ow_tileset_canvas_
 
Romrom_
 
absl::Status status_
 

Additional Inherited Members

- Protected Member Functions inherited from yaze::editor::Editor
std::string MakeCardTitle (const std::string &base_title) const
 
std::string MakeCardId (const std::string &base_id) const
 
template<typename T >
absl::StatusOr< T > SafeRomAccess (std::function< T()> accessor, const std::string &operation="") const
 
- Protected Attributes inherited from yaze::editor::Editor
bool active_ = false
 
EditorType type_
 
EditorDependencies dependencies_
 

Detailed Description

The ScreenEditor class allows the user to edit a variety of screens in the game or create a custom menu.

This class is currently a work in progress (WIP) and provides functionality for updating the screens, saving dungeon maps, drawing different types of screens, loading dungeon maps, and managing various properties related to the editor.

The screens that can be edited include the title screen, naming screen, overworld map, inventory menu, and more.

Definition at line 35 of file screen_editor.h.

Member Enumeration Documentation

◆ EditingMode

enum class yaze::editor::ScreenEditor::EditingMode
strongprivate
Enumerator
DRAW 
EDIT 

Definition at line 85 of file screen_editor.h.

Constructor & Destructor Documentation

◆ ScreenEditor()

yaze::editor::ScreenEditor::ScreenEditor ( Rom rom = nullptr)
inlineexplicit

Definition at line 37 of file screen_editor.h.

References yaze::editor::kScreen, screen_canvas_, yaze::gui::Canvas::SetCanvasSize(), and yaze::editor::Editor::type_.

Here is the call graph for this function:

Member Function Documentation

◆ Initialize()

void yaze::editor::ScreenEditor::Initialize ( )
overridevirtual

◆ Load()

◆ Update()

◆ Undo()

absl::Status yaze::editor::ScreenEditor::Undo ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 45 of file screen_editor.h.

◆ Redo()

absl::Status yaze::editor::ScreenEditor::Redo ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 46 of file screen_editor.h.

◆ Cut()

absl::Status yaze::editor::ScreenEditor::Cut ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 47 of file screen_editor.h.

◆ Copy()

absl::Status yaze::editor::ScreenEditor::Copy ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 48 of file screen_editor.h.

◆ Paste()

absl::Status yaze::editor::ScreenEditor::Paste ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 49 of file screen_editor.h.

◆ Find()

absl::Status yaze::editor::ScreenEditor::Find ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 50 of file screen_editor.h.

◆ Save()

absl::Status yaze::editor::ScreenEditor::Save ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 51 of file screen_editor.h.

◆ set_rom()

void yaze::editor::ScreenEditor::set_rom ( Rom rom)
inline

Definition at line 52 of file screen_editor.h.

References rom(), and rom_.

Here is the call graph for this function:

◆ rom()

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

◆ DrawTitleScreenEditor()

◆ DrawNamingScreenEditor()

void yaze::editor::ScreenEditor::DrawNamingScreenEditor ( )
private

Definition at line 986 of file screen_editor.cc.

Referenced by Update().

◆ DrawOverworldMapEditor()

◆ DrawInventoryMenuEditor()

◆ DrawInventoryItemIcons()

void yaze::editor::ScreenEditor::DrawInventoryItemIcons ( )
private
Todo:
Select this icon for editing

Definition at line 278 of file screen_editor.cc.

References inventory_, and yaze::zelda3::Inventory::item_icons().

Referenced by DrawInventoryMenuEditor().

Here is the call graph for this function:

◆ DrawToolset()

void yaze::editor::ScreenEditor::DrawToolset ( )
private

Definition at line 173 of file screen_editor.cc.

◆ DrawDungeonMapToolset()

void yaze::editor::ScreenEditor::DrawDungeonMapToolset ( )
private

Definition at line 1155 of file screen_editor.cc.

◆ DrawInventoryToolset()

void yaze::editor::ScreenEditor::DrawInventoryToolset ( )
private

◆ DrawTitleScreenCompositeCanvas()

◆ DrawTitleScreenBG1Canvas()

◆ DrawTitleScreenBG2Canvas()

◆ DrawTitleScreenBlocksetSelector()

◆ LoadDungeonMapTile16()

absl::Status yaze::editor::ScreenEditor::LoadDungeonMapTile16 ( const std::vector< uint8_t > &  gfx_data,
bool  bin_mode = false 
)
private

◆ SaveDungeonMapTile16()

absl::Status yaze::editor::ScreenEditor::SaveDungeonMapTile16 ( )
private

◆ DrawDungeonMapScreen()

◆ DrawDungeonMapsTabs()

void yaze::editor::ScreenEditor::DrawDungeonMapsTabs ( )
private

◆ DrawDungeonMapsEditor()

void yaze::editor::ScreenEditor::DrawDungeonMapsEditor ( )
private

Draw dungeon maps editor with enhanced ROM hacking features.

Enhanced Features:

  • Multi-mode editing (DRAW, EDIT, SELECT)
  • Real-time tile16 preview and editing
  • Floor/basement management for complex dungeons
  • Copy/paste operations for floor layouts
  • Integration with ROM tile16 data

Performance Notes:

  • Lazy loading of dungeon graphics
  • Cached tile16 rendering for fast updates
  • Batch operations for multiple tile changes
  • Efficient memory management for large dungeons

Definition at line 635 of file screen_editor.cc.

References current_mode_, DRAW, yaze::gui::Canvas::DrawBackground(), yaze::gui::Canvas::DrawBitmapTable(), yaze::gui::Canvas::DrawContextMenu(), DrawDungeonMapsRoomGfx(), DrawDungeonMapsTabs(), yaze::gui::Canvas::DrawGrid(), yaze::gui::Canvas::DrawOverlay(), yaze::gui::Canvas::DrawTileSelector(), EDIT, yaze::gui::Canvas::GetTileIdFromMousePos(), ICON_MD_DRAW, ICON_MD_EDIT, ICON_MD_SAVE, LoadBinaryGfx(), PRINT_IF_ERROR, yaze::Rom::resource_label(), rom(), yaze::zelda3::SaveDungeonMapTile16(), yaze::project::ResourceLabelManager::SelectableLabelWithNameEdit(), selected_dungeon, selected_tile8_, sheets_, tile16_blockset_, and tilemap_canvas_.

Referenced by Update().

◆ DrawDungeonMapsRoomGfx()

void yaze::editor::ScreenEditor::DrawDungeonMapsRoomGfx ( )
private

Draw dungeon room graphics editor with enhanced tile16 editing.

Enhanced Features:

  • Interactive tile16 selector with visual feedback
  • Real-time tile16 composition from 4x 8x8 tiles
  • Tile metadata editing (mirroring, palette, etc.)
  • Integration with ROM graphics buffer
  • Undo/redo support for tile modifications

Performance Notes:

  • Cached tile16 rendering to avoid repeated composition
  • Efficient tile selector with grid-based snapping
  • Batch tile updates to minimize ROM writes
  • Lazy loading of tile graphics data

Definition at line 505 of file screen_editor.cc.

References yaze::gfx::Tilemap::atlas, yaze::gfx::TileCache::CacheTile(), yaze::gfx::Arena::CREATE, current_tile16_info, current_tile_canvas_, yaze::gfx::Bitmap::data(), yaze::gui::Canvas::DrawBackground(), yaze::gui::Canvas::DrawBitmap(), yaze::gui::Canvas::DrawContextMenu(), yaze::gui::Canvas::DrawGrid(), yaze::gui::Canvas::DrawOverlay(), yaze::gui::Canvas::DrawTilePainter(), yaze::gui::Canvas::DrawTileSelector(), dungeon_maps_, floor_number, yaze::gfx::Arena::Get(), yaze::gfx::TileCache::GetTile(), yaze::gui::InputTileInfo(), yaze::gfx::ModifyTile16(), yaze::gui::Canvas::mutable_points(), yaze::gfx::Bitmap::palette(), yaze::gui::Canvas::points(), yaze::gfx::Arena::QueueTextureCommand(), yaze::gfx::RenderTile16(), rom(), screen_canvas_, selected_dungeon, selected_room, selected_tile16_, selected_tile8_, yaze::gfx::Bitmap::SetPalette(), yaze::gfx::Bitmap::size(), tile16_blockset_, tile8_tilemap_, yaze::gfx::Tilemap::tile_cache, yaze::gfx::Tilemap::tile_info, tilesheet_canvas_, yaze::gfx::UpdateTile16(), and yaze::gfx::Bitmap::width().

Referenced by DrawDungeonMapsEditor().

◆ LoadBinaryGfx()

Member Data Documentation

◆ dungeon_maps_

std::vector<zelda3::DungeonMap> yaze::editor::ScreenEditor::dungeon_maps_

◆ current_mode_

◆ binary_gfx_loaded_

bool yaze::editor::ScreenEditor::binary_gfx_loaded_ = false
private

Definition at line 89 of file screen_editor.h.

Referenced by LoadBinaryGfx().

◆ selected_room

uint8_t yaze::editor::ScreenEditor::selected_room = 0
private

◆ selected_tile16_

int yaze::editor::ScreenEditor::selected_tile16_ = 0
private

Definition at line 93 of file screen_editor.h.

Referenced by DrawDungeonMapsRoomGfx().

◆ selected_tile8_

int yaze::editor::ScreenEditor::selected_tile8_ = 0
private

Definition at line 94 of file screen_editor.h.

Referenced by DrawDungeonMapsEditor(), and DrawDungeonMapsRoomGfx().

◆ selected_dungeon

int yaze::editor::ScreenEditor::selected_dungeon = 0
private

◆ floor_number

int yaze::editor::ScreenEditor::floor_number = 1
private

◆ copy_button_pressed

bool yaze::editor::ScreenEditor::copy_button_pressed = false
private

Definition at line 98 of file screen_editor.h.

Referenced by DrawDungeonMapsTabs().

◆ paste_button_pressed

bool yaze::editor::ScreenEditor::paste_button_pressed = false
private

Definition at line 99 of file screen_editor.h.

Referenced by DrawDungeonMapsTabs().

◆ dungeon_map_labels_

zelda3::DungeonMapLabels yaze::editor::ScreenEditor::dungeon_map_labels_
private

Definition at line 101 of file screen_editor.h.

Referenced by DrawDungeonMapScreen(), DrawDungeonMapsTabs(), and Load().

◆ palette_

gfx::SnesPalette yaze::editor::ScreenEditor::palette_
private

Definition at line 103 of file screen_editor.h.

Referenced by DrawInventoryMenuEditor().

◆ sheets_

gfx::BitmapTable yaze::editor::ScreenEditor::sheets_
private

Definition at line 104 of file screen_editor.h.

Referenced by DrawDungeonMapsEditor(), Load(), and LoadBinaryGfx().

◆ tile16_blockset_

gfx::Tilemap yaze::editor::ScreenEditor::tile16_blockset_
private

◆ tile8_tilemap_

gfx::Tilemap yaze::editor::ScreenEditor::tile8_tilemap_
private

Definition at line 106 of file screen_editor.h.

Referenced by DrawDungeonMapsRoomGfx(), and Load().

◆ current_tile16_info

std::array<gfx::TileInfo, 4> yaze::editor::ScreenEditor::current_tile16_info
private

Definition at line 107 of file screen_editor.h.

Referenced by DrawDungeonMapsRoomGfx().

◆ current_tile_canvas_

gui::Canvas yaze::editor::ScreenEditor::current_tile_canvas_
private
Initial value:
{"##CurrentTileCanvas", ImVec2(32, 32),

Definition at line 109 of file screen_editor.h.

Referenced by DrawDungeonMapsRoomGfx().

◆ screen_canvas_

gui::Canvas yaze::editor::ScreenEditor::screen_canvas_
private

◆ tilesheet_canvas_

gui::Canvas yaze::editor::ScreenEditor::tilesheet_canvas_
private

Definition at line 112 of file screen_editor.h.

Referenced by DrawDungeonMapsRoomGfx(), and DrawInventoryMenuEditor().

◆ tilemap_canvas_

gui::Canvas yaze::editor::ScreenEditor::tilemap_canvas_
private
Initial value:
{"##TilemapCanvas", ImVec2(128 + 2, (192) + 4),

Definition at line 113 of file screen_editor.h.

Referenced by DrawDungeonMapsEditor().

◆ title_bg1_canvas_

gui::Canvas yaze::editor::ScreenEditor::title_bg1_canvas_
private
Initial value:
{"##TitleBG1Canvas", ImVec2(256, 256),

Definition at line 118 of file screen_editor.h.

Referenced by DrawTitleScreenBG1Canvas(), and DrawTitleScreenCompositeCanvas().

◆ title_bg2_canvas_

gui::Canvas yaze::editor::ScreenEditor::title_bg2_canvas_
private
Initial value:
{"##TitleBG2Canvas", ImVec2(256, 256),

Definition at line 120 of file screen_editor.h.

Referenced by DrawTitleScreenBG2Canvas().

◆ title_blockset_canvas_

gui::Canvas yaze::editor::ScreenEditor::title_blockset_canvas_
private
Initial value:
{"##TitleBlocksetCanvas",
ImVec2(128, 512),

Definition at line 123 of file screen_editor.h.

Referenced by DrawTitleScreenBlocksetSelector().

◆ inventory_

zelda3::Inventory yaze::editor::ScreenEditor::inventory_
private

Definition at line 127 of file screen_editor.h.

Referenced by DrawInventoryItemIcons(), and DrawInventoryMenuEditor().

◆ title_screen_

◆ ow_map_screen_

zelda3::OverworldMapScreen yaze::editor::ScreenEditor::ow_map_screen_
private

Definition at line 129 of file screen_editor.h.

Referenced by DrawOverworldMapEditor().

◆ selected_title_tile16_

int yaze::editor::ScreenEditor::selected_title_tile16_ = 0
private

◆ title_screen_loaded_

bool yaze::editor::ScreenEditor::title_screen_loaded_ = false
private

Definition at line 133 of file screen_editor.h.

Referenced by DrawTitleScreenEditor().

◆ title_h_flip_

bool yaze::editor::ScreenEditor::title_h_flip_ = false
private

◆ title_v_flip_

bool yaze::editor::ScreenEditor::title_v_flip_ = false
private

◆ title_palette_

int yaze::editor::ScreenEditor::title_palette_ = 0
private

◆ show_title_bg1_

bool yaze::editor::ScreenEditor::show_title_bg1_ = true
private

Definition at line 137 of file screen_editor.h.

Referenced by DrawTitleScreenCompositeCanvas(), and DrawTitleScreenEditor().

◆ show_title_bg2_

bool yaze::editor::ScreenEditor::show_title_bg2_ = true
private

Definition at line 138 of file screen_editor.h.

Referenced by DrawTitleScreenCompositeCanvas(), and DrawTitleScreenEditor().

◆ selected_ow_tile_

int yaze::editor::ScreenEditor::selected_ow_tile_ = 0
private

Definition at line 141 of file screen_editor.h.

Referenced by DrawOverworldMapEditor().

◆ ow_map_loaded_

bool yaze::editor::ScreenEditor::ow_map_loaded_ = false
private

Definition at line 142 of file screen_editor.h.

Referenced by DrawOverworldMapEditor().

◆ ow_show_dark_world_

bool yaze::editor::ScreenEditor::ow_show_dark_world_ = false
private

Definition at line 143 of file screen_editor.h.

Referenced by DrawOverworldMapEditor().

◆ ow_map_canvas_

gui::Canvas yaze::editor::ScreenEditor::ow_map_canvas_
private
Initial value:
{"##OWMapCanvas", ImVec2(512, 512),

Definition at line 146 of file screen_editor.h.

Referenced by DrawOverworldMapEditor().

◆ ow_tileset_canvas_

gui::Canvas yaze::editor::ScreenEditor::ow_tileset_canvas_
private
Initial value:
{"##OWTilesetCanvas", ImVec2(128, 128),

Definition at line 148 of file screen_editor.h.

Referenced by DrawOverworldMapEditor().

◆ rom_

Rom* yaze::editor::ScreenEditor::rom_
private

Definition at line 151 of file screen_editor.h.

Referenced by rom(), and set_rom().

◆ status_


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