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

Main UI class for editing overworld maps in A Link to the Past. More...

#include <overworld_editor.h>

Inheritance diagram for yaze::editor::OverworldEditor:

Classes

struct  OverworldUndoPoint
 
struct  ScratchSpace
 

Public Member Functions

 OverworldEditor (Rom *rom)
 
 OverworldEditor (Rom *rom, const EditorDependencies &deps)
 
void SetGameData (zelda3::GameData *game_data) override
 
void Initialize () override
 
absl::Status Load () override
 
absl::Status Update () final
 
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
 
absl::Status Clear () override
 
zelda3::Overworldoverworld ()
 Access the underlying Overworld data.
 
absl::Status ApplyZSCustomOverworldASM (int target_version)
 Apply ZSCustomOverworld ASM patch to upgrade ROM version.
 
absl::Status UpdateROMVersionMarkers (int target_version)
 Update ROM version markers and feature flags after ASM patching.
 
int jump_to_tab ()
 
bool IsRomLoaded () const override
 
std::string GetRomStatus () const override
 
Romrom () const
 
void set_current_map (int map_id)
 Set the current map for editing (also updates world)
 
void set_current_tile16 (int tile_id)
 
absl::Status LoadGraphics ()
 Load the Bitmap objects for each OverworldMap.
 
void HandleEntityInsertion (const std::string &entity_type)
 Handle entity insertion from context menu.
 
void ProcessPendingEntityInsertion ()
 Process any pending entity insertion request Called from Update() - needed because ImGui::OpenPopup() doesn't work correctly when called from within another popup's callback.
 
void HandleTile16Edit ()
 Handle tile16 editing from context menu (MOUSE mode) Gets the tile16 under the cursor and opens the Tile16Editor focused on it.
 
void ToggleBrushTool ()
 
void ActivateFillTool ()
 
void CycleTileSelection (int delta)
 
bool PickTile16FromHoveredCanvas ()
 
void HandleKeyboardShortcuts ()
 Handle keyboard shortcuts for the Overworld Editor Shortcuts: 1-2 (modes), 3-8 (entities), F11 (fullscreen), I/Right-click (eyedropper in paint modes), Ctrl+L (map lock), Ctrl+T (Tile16 editor), Ctrl+Z/Y (undo/redo)
 
absl::Status DrawAreaGraphics ()
 
absl::Status DrawTile16Selector ()
 
void DrawMapProperties ()
 
void InvalidateGraphicsCache (int map_id=-1)
 Invalidate cached graphics for a specific map or all maps.
 
absl::Status DrawScratchSpace ()
 
void DrawTile8Selector ()
 
absl::Status UpdateGfxGroupEditor ()
 
void DrawV3Settings ()
 
UsageStatisticsCardusage_stats_card ()
 Access usage statistics card for panel.
 
DebugWindowCarddebug_window_card ()
 Access debug window card for panel.
 
Tile16Editortile16_editor ()
 Access the Tile16 Editor for panel integration.
 
void DrawOverworldCanvas ()
 Draw the main overworld canvas.
 
- Public Member Functions inherited from yaze::editor::Editor
 Editor ()=default
 
virtual ~Editor ()=default
 
virtual void SetDependencies (const EditorDependencies &deps)
 
virtual std::string GetUndoDescription () const
 
virtual std::string GetRedoDescription () const
 
const UndoManagerundo_manager () const
 
EditorType type () const
 
bool * active ()
 
void set_active (bool active)
 
void toggle_active ()
 
Romrom () const
 
zelda3::GameDatagame_data () const
 
EditorContext context () const
 
bool HasContext () const
 

Public Attributes

int jump_to_tab_ = -1
 

Private Types

enum  OverworldProperty {
  LW_AREA_GFX , DW_AREA_GFX , LW_AREA_PAL , DW_AREA_PAL ,
  LW_SPR_GFX_PART1 , LW_SPR_GFX_PART2 , DW_SPR_GFX_PART1 , DW_SPR_GFX_PART2 ,
  LW_SPR_PAL_PART1 , LW_SPR_PAL_PART2 , DW_SPR_PAL_PART1 , DW_SPR_PAL_PART2
}
 

Private Member Functions

void HandleEntityEditingShortcuts ()
 
void HandleUndoRedoShortcuts ()
 
void HandleEntityInteraction ()
 Handle entity interaction in MOUSE mode Includes: right-click context menus, double-click navigation, popups.
 
void HandleEntityContextMenus (zelda3::GameEntity *hovered_entity)
 Handle right-click context menus for entities.
 
void HandleEntityDoubleClick (zelda3::GameEntity *hovered_entity)
 Handle double-click actions on entities (e.g., jump to room)
 
void DrawEntityEditorPopups ()
 Draw entity editor popups and update entity data.
 
void InitMapRefreshCoordinator ()
 Initialize the map refresh coordinator (called during Initialize)
 
void RefreshChildMap (int map_index)
 
void RefreshOverworldMap ()
 
void RefreshOverworldMapOnDemand (int map_index)
 
void RefreshChildMapOnDemand (int map_index)
 
absl::Status RefreshMapPalette ()
 
void RefreshMapProperties ()
 
absl::Status RefreshTile16Blockset ()
 
void UpdateBlocksetWithPendingTileChanges ()
 
void ForceRefreshGraphics (int map_index)
 
void RefreshSiblingMapGraphics (int map_index, bool include_self=false)
 
void InitTilePaintingManager ()
 Initialize the tile painting manager (called after graphics load)
 
void CheckForOverworldEdits ()
 Check for tile edits - delegates to TilePaintingManager.
 
absl::Status CheckForCurrentMap ()
 Check for map changes and refresh if needed.
 
void HandleMapInteraction ()
 
void UpdateBlocksetSelectorState ()
 
void ScrollBlocksetCanvasToCurrentTile ()
 Scroll the blockset canvas to show the current selected tile16.
 
void InitCanvasNavigationManager ()
 Initialize the canvas navigation manager (called during Initialize)
 
void HandleOverworldPan ()
 
void HandleOverworldZoom ()
 
void ZoomIn ()
 
void ZoomOut ()
 
void ClampOverworldScroll ()
 
void ResetOverworldView ()
 
void CenterOverworldView ()
 
absl::Status LoadSpriteGraphics ()
 
void ProcessDeferredTextures ()
 Create textures for deferred map bitmaps on demand.
 
void EnsureMapTexture (int map_index)
 Ensure a specific map has its texture created.
 
void SetupCanvasAutomation ()
 
gui::CanvasGetOverworldCanvas ()
 
bool AutomationSetTile (int x, int y, int tile_id)
 
int AutomationGetTile (int x, int y)
 
absl::Status SaveCurrentSelectionToScratch ()
 
absl::Status LoadScratchToSelection ()
 
absl::Status ClearScratchSpace ()
 
void DrawScratchSpaceEdits ()
 
void DrawScratchSpacePattern ()
 
void DrawScratchSpaceSelection ()
 
void UpdateScratchBitmapTile (int tile_x, int tile_y, int tile_id)
 
void CreateUndoPoint (int map_id, int world, int x, int y, int old_tile_id)
 
void FinalizePaintOperation ()
 
auto & GetWorldTiles (int world)
 

Private Attributes

EditingMode current_mode = EditingMode::DRAW_TILE
 
EditingMode previous_mode = EditingMode::DRAW_TILE
 
EntityEditMode entity_edit_mode_ = EntityEditMode::NONE
 
int current_world_ = 0
 
int current_map_ = 0
 
int current_parent_ = 0
 
int current_entrance_id_ = 0
 
int current_exit_id_ = 0
 
int current_item_id_ = 0
 
int current_sprite_id_ = 0
 
int current_blockset_ = 0
 
int game_state_ = 1
 
int current_tile16_ = 0
 
int selected_entrance_ = 0
 
int selected_usage_map_ = 0xFFFF
 
std::vector< int > selected_tile16_ids_
 
bool all_gfx_loaded_ = false
 
bool map_blockset_loaded_ = false
 
bool overworld_canvas_fullscreen_ = false
 
bool is_dragging_entity_ = false
 
bool dragged_entity_free_movement_ = false
 
bool current_map_lock_ = false
 
bool show_custom_bg_color_editor_ = false
 
bool show_overlay_editor_ = false
 
bool show_map_properties_panel_ = false
 
bool show_overlay_preview_ = false
 
std::unique_ptr< OverworldCanvasRenderercanvas_renderer_
 
std::unique_ptr< CanvasNavigationManagercanvas_nav_
 
std::unique_ptr< TilePaintingManagertile_painting_
 
std::unique_ptr< MapRefreshCoordinatormap_refresh_
 
std::unique_ptr< MapPropertiesSystemmap_properties_system_
 
std::unique_ptr< OverworldSidebarsidebar_
 
std::unique_ptr< OverworldEntityRendererentity_renderer_
 
std::unique_ptr< OverworldToolbartoolbar_
 
ScratchSpace scratch_space_
 
gfx::Tilemap tile16_blockset_
 
Romrom_
 
zelda3::GameDatagame_data_ = nullptr
 
gfx::IRendererrenderer_
 
Tile16Editor tile16_editor_ {rom_, &tile16_blockset_}
 
GfxGroupEditor gfx_group_editor_
 
PaletteEditor palette_editor_
 
gfx::SnesPalette palette_
 
gfx::Bitmap selected_tile_bmp_
 
gfx::Bitmap tile16_blockset_bmp_
 
gfx::Bitmap current_gfx_bmp_
 
gfx::Bitmap all_gfx_bmp
 
std::array< gfx::Bitmap, zelda3::kNumOverworldMapsmaps_bmp_
 
gfx::BitmapTable current_graphics_set_
 
std::vector< gfx::Bitmapsprite_previews_
 
zelda3::Overworld overworld_ {rom_}
 
zelda3::OverworldBlockset refresh_blockset_
 
zelda3::Sprite current_sprite_
 
zelda3::OverworldEntrance current_entrance_
 
zelda3::OverworldExit current_exit_
 
zelda3::OverworldItem current_item_
 
zelda3::OverworldEntranceTileTypes entrance_tiletypes_ = {}
 
zelda3::GameEntitycurrent_entity_ = nullptr
 
zelda3::GameEntitydragged_entity_ = nullptr
 
std::string pending_entity_insert_type_
 
ImVec2 pending_entity_insert_pos_
 
std::string entity_insert_error_message_
 
gui::Canvas ow_map_canvas_
 
gui::Canvas current_gfx_canvas_
 
gui::Canvas blockset_canvas_
 
std::unique_ptr< gui::TileSelectorWidgetblockset_selector_
 
gui::Canvas graphics_bin_canvas_
 
gui::Canvas properties_canvas_
 
gui::Canvas scratch_canvas_
 
std::unique_ptr< UsageStatisticsCardusage_stats_card_
 
std::unique_ptr< DebugWindowCarddebug_window_card_
 
absl::Status status_
 
std::optional< OverworldUndoPointcurrent_paint_operation_
 
std::chrono::steady_clock::time_point last_paint_time_
 
int palette_listener_id_ = -1
 

Static Private Attributes

static constexpr auto kPaintBatchTimeout = std::chrono::milliseconds(500)
 

Friends

class OverworldCanvasRenderer
 

Additional Inherited Members

- Protected Member Functions inherited from yaze::editor::Editor
std::string MakePanelTitle (const std::string &base_title) const
 
std::string MakePanelId (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_
 
UndoManager undo_manager_
 
- Static Protected Attributes inherited from yaze::gfx::GfxContext
static std::unordered_map< uint8_t, gfx::Palettesetpalettesets_
 

Detailed Description

Main UI class for editing overworld maps in A Link to the Past.

The OverworldEditor orchestrates tile editing, entity management, and map property configuration. It coordinates between the data layer (zelda3::Overworld) and the UI components (canvas, panels, popups).

Key subsystems:

  • Tile16Editor: Individual tile editing with pending changes workflow
  • MapPropertiesSystem: Toolbar, context menus, property panels
  • Entity system: Entrances, exits, items, sprites
  • Canvas system: Main map display and tile selection
See also
README.md in this directory for architecture documentation
zelda3/overworld/overworld.h for the data layer
tile16_editor.h for tile editing details

Definition at line 124 of file overworld_editor.h.

Member Enumeration Documentation

◆ OverworldProperty

Enumerator
LW_AREA_GFX 
DW_AREA_GFX 
LW_AREA_PAL 
DW_AREA_PAL 
LW_SPR_GFX_PART1 
LW_SPR_GFX_PART2 
DW_SPR_GFX_PART1 
DW_SPR_GFX_PART2 
LW_SPR_PAL_PART1 
LW_SPR_PAL_PART2 
DW_SPR_PAL_PART1 
DW_SPR_PAL_PART2 

Definition at line 465 of file overworld_editor.h.

Constructor & Destructor Documentation

◆ OverworldEditor() [1/2]

yaze::editor::OverworldEditor::OverworldEditor ( Rom * rom)
inlineexplicit

Definition at line 132 of file overworld_editor.h.

References gfx_group_editor_, yaze::editor::kOverworld, rom(), yaze::editor::GfxGroupEditor::SetRom(), and yaze::editor::Editor::type_.

Here is the call graph for this function:

◆ OverworldEditor() [2/2]

yaze::editor::OverworldEditor::OverworldEditor ( Rom * rom,
const EditorDependencies & deps )
inlineexplicit

Definition at line 139 of file overworld_editor.h.

References yaze::editor::Editor::dependencies_.

Member Function Documentation

◆ SetGameData()

◆ Initialize()

◆ Load()

◆ Update()

◆ Undo()

absl::Status yaze::editor::OverworldEditor::Undo ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 994 of file overworld_editor.cc.

References FinalizePaintOperation(), yaze::editor::UndoManager::Undo(), and yaze::editor::Editor::undo_manager_.

Referenced by HandleUndoRedoShortcuts().

Here is the call graph for this function:

◆ Redo()

absl::Status yaze::editor::OverworldEditor::Redo ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 1000 of file overworld_editor.cc.

References yaze::editor::UndoManager::Redo(), and yaze::editor::Editor::undo_manager_.

Referenced by HandleUndoRedoShortcuts().

Here is the call graph for this function:

◆ Cut()

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

Implements yaze::editor::Editor.

Definition at line 160 of file overworld_editor.h.

◆ Copy()

◆ Paste()

◆ Find()

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

Implements yaze::editor::Editor.

Definition at line 163 of file overworld_editor.h.

◆ Save()

◆ Clear()

absl::Status yaze::editor::OverworldEditor::Clear ( )
overridevirtual

◆ overworld()

zelda3::Overworld & yaze::editor::OverworldEditor::overworld ( )
inline

Access the underlying Overworld data.

Definition at line 168 of file overworld_editor.h.

References overworld_.

Referenced by LoadGraphics(), yaze::test::OverworldEditorTestSuite::RunEntityManipulationTest(), and Save().

◆ ApplyZSCustomOverworldASM()

absl::Status yaze::editor::OverworldEditor::ApplyZSCustomOverworldASM ( int target_version)

Apply ZSCustomOverworld ASM patch to upgrade ROM version.

Parameters
target_versionTarget version (2 for v2, 3 for v3)

Definition at line 1307 of file overworld_editor.cc.

References yaze::util::GetResourcePath(), yaze::zelda3::Overworld::Load(), yaze::Rom::LoadFromData(), LOG_DEBUG, LOG_ERROR, overworld_, yaze::zelda3::OverworldCustomASMHasBeenApplied, RETURN_IF_ERROR, rom_, UpdateROMVersionMarkers(), and yaze::Rom::vector().

Referenced by Update().

◆ UpdateROMVersionMarkers()

◆ jump_to_tab()

int yaze::editor::OverworldEditor::jump_to_tab ( )
inline

Definition at line 183 of file overworld_editor.h.

References jump_to_tab_.

◆ IsRomLoaded()

bool yaze::editor::OverworldEditor::IsRomLoaded ( ) const
inlineoverridevirtual

Reimplemented from yaze::editor::Editor.

Definition at line 190 of file overworld_editor.h.

References yaze::Rom::is_loaded(), and rom_.

Here is the call graph for this function:

◆ GetRomStatus()

std::string yaze::editor::OverworldEditor::GetRomStatus ( ) const
inlineoverridevirtual

Reimplemented from yaze::editor::Editor.

Definition at line 191 of file overworld_editor.h.

References yaze::Rom::is_loaded(), rom_, and yaze::Rom::title().

Here is the call graph for this function:

◆ rom()

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

Definition at line 199 of file overworld_editor.h.

References rom_.

Referenced by OverworldEditor().

◆ set_current_map()

void yaze::editor::OverworldEditor::set_current_map ( int map_id)
inline

◆ set_current_tile16()

void yaze::editor::OverworldEditor::set_current_tile16 ( int tile_id)
inline

Definition at line 214 of file overworld_editor.h.

References current_tile16_.

◆ LoadGraphics()

◆ HandleEntityInsertion()

void yaze::editor::OverworldEditor::HandleEntityInsertion ( const std::string & entity_type)

Handle entity insertion from context menu.

Parameters
entity_typeType: "entrance", "hole", "exit", "item", "sprite"

Definition at line 75 of file automation.cc.

References yaze::gui::Canvas::hover_mouse_pos(), LOG_DEBUG, ow_map_canvas_, pending_entity_insert_pos_, and pending_entity_insert_type_.

Referenced by Load().

Here is the call graph for this function:

◆ ProcessPendingEntityInsertion()

◆ HandleTile16Edit()

void yaze::editor::OverworldEditor::HandleTile16Edit ( )

Handle tile16 editing from context menu (MOUSE mode) Gets the tile16 under the cursor and opens the Tile16Editor focused on it.

Definition at line 215 of file automation.cc.

References yaze::editor::Editor::dependencies_, yaze::zelda3::Overworld::is_loaded(), yaze::editor::OverworldPanelIds::kTile16Editor, LOG_ERROR, map_blockset_loaded_, overworld_, yaze::editor::EditorDependencies::panel_manager, and yaze::editor::PanelManager::ShowPanel().

Referenced by Load().

Here is the call graph for this function:

◆ ToggleBrushTool()

void yaze::editor::OverworldEditor::ToggleBrushTool ( )
inline

Definition at line 253 of file overworld_editor.h.

References tile_painting_.

Referenced by HandleKeyboardShortcuts().

◆ ActivateFillTool()

void yaze::editor::OverworldEditor::ActivateFillTool ( )
inline

Definition at line 254 of file overworld_editor.h.

References tile_painting_.

Referenced by HandleKeyboardShortcuts().

◆ CycleTileSelection()

void yaze::editor::OverworldEditor::CycleTileSelection ( int delta)

Definition at line 1475 of file overworld_editor.cc.

References current_tile16_.

◆ PickTile16FromHoveredCanvas()

bool yaze::editor::OverworldEditor::PickTile16FromHoveredCanvas ( )
inline

Definition at line 256 of file overworld_editor.h.

References tile_painting_.

Referenced by HandleKeyboardShortcuts(), and InitCanvasNavigationManager().

◆ HandleKeyboardShortcuts()

void yaze::editor::OverworldEditor::HandleKeyboardShortcuts ( )

◆ DrawAreaGraphics()

absl::Status yaze::editor::OverworldEditor::DrawAreaGraphics ( )
inline

Definition at line 272 of file overworld_editor.h.

References canvas_renderer_.

◆ DrawTile16Selector()

absl::Status yaze::editor::OverworldEditor::DrawTile16Selector ( )
inline

Definition at line 276 of file overworld_editor.h.

References canvas_renderer_.

◆ DrawMapProperties()

void yaze::editor::OverworldEditor::DrawMapProperties ( )
inline

Definition at line 280 of file overworld_editor.h.

References canvas_renderer_.

◆ InvalidateGraphicsCache()

void yaze::editor::OverworldEditor::InvalidateGraphicsCache ( int map_id = -1)
inline

Invalidate cached graphics for a specific map or all maps.

Parameters
map_idThe map to invalidate (-1 to invalidate all maps) Call this when palette or graphics settings change.

Definition at line 285 of file overworld_editor.h.

References map_refresh_.

Referenced by Initialize().

◆ DrawScratchSpace()

◆ DrawTile8Selector()

void yaze::editor::OverworldEditor::DrawTile8Selector ( )
inline

Definition at line 289 of file overworld_editor.h.

References canvas_renderer_.

◆ UpdateGfxGroupEditor()

absl::Status yaze::editor::OverworldEditor::UpdateGfxGroupEditor ( )

Definition at line 839 of file overworld_editor.cc.

References yaze::gui::CenterText(), gfx_group_editor_, yaze::Rom::is_loaded(), rom_, and yaze::editor::GfxGroupEditor::Update().

Here is the call graph for this function:

◆ DrawV3Settings()

void yaze::editor::OverworldEditor::DrawV3Settings ( )
inline

Definition at line 291 of file overworld_editor.h.

References canvas_renderer_.

◆ usage_stats_card()

UsageStatisticsCard * yaze::editor::OverworldEditor::usage_stats_card ( )
inline

Access usage statistics card for panel.

Definition at line 294 of file overworld_editor.h.

References usage_stats_card_.

◆ debug_window_card()

DebugWindowCard * yaze::editor::OverworldEditor::debug_window_card ( )
inline

Access debug window card for panel.

Definition at line 297 of file overworld_editor.h.

References debug_window_card_.

◆ tile16_editor()

Tile16Editor & yaze::editor::OverworldEditor::tile16_editor ( )
inline

Access the Tile16 Editor for panel integration.

Definition at line 300 of file overworld_editor.h.

References tile16_editor_.

◆ DrawOverworldCanvas()

void yaze::editor::OverworldEditor::DrawOverworldCanvas ( )
inline

Draw the main overworld canvas.

Definition at line 303 of file overworld_editor.h.

References canvas_renderer_.

◆ HandleEntityEditingShortcuts()

void yaze::editor::OverworldEditor::HandleEntityEditingShortcuts ( )
private

◆ HandleUndoRedoShortcuts()

void yaze::editor::OverworldEditor::HandleUndoRedoShortcuts ( )
private

Definition at line 566 of file overworld_editor.cc.

References Redo(), status_, and Undo().

Referenced by HandleKeyboardShortcuts().

Here is the call graph for this function:

◆ HandleEntityInteraction()

void yaze::editor::OverworldEditor::HandleEntityInteraction ( )
private

Handle entity interaction in MOUSE mode Includes: right-click context menus, double-click navigation, popups.

Definition at line 591 of file overworld_editor.cc.

References current_mode, DrawEntityEditorPopups(), entity_renderer_, HandleEntityContextMenus(), HandleEntityDoubleClick(), yaze::editor::MOUSE, and ProcessPendingEntityInsertion().

Referenced by Update().

Here is the call graph for this function:

◆ HandleEntityContextMenus()

void yaze::editor::OverworldEditor::HandleEntityContextMenus ( zelda3::GameEntity * hovered_entity)
private

◆ HandleEntityDoubleClick()

void yaze::editor::OverworldEditor::HandleEntityDoubleClick ( zelda3::GameEntity * hovered_entity)
private

Handle double-click actions on entities (e.g., jump to room)

Definition at line 653 of file overworld_editor.cc.

References yaze::zelda3::GameEntity::entity_type_, jump_to_tab_, yaze::zelda3::GameEntity::kEntrance, and yaze::zelda3::GameEntity::kExit.

Referenced by HandleEntityInteraction().

◆ DrawEntityEditorPopups()

◆ InitMapRefreshCoordinator()

◆ RefreshChildMap()

void yaze::editor::OverworldEditor::RefreshChildMap ( int map_index)
inlineprivate

Definition at line 335 of file overworld_editor.h.

References map_refresh_.

◆ RefreshOverworldMap()

void yaze::editor::OverworldEditor::RefreshOverworldMap ( )
inlineprivate

◆ RefreshOverworldMapOnDemand()

void yaze::editor::OverworldEditor::RefreshOverworldMapOnDemand ( int map_index)
inlineprivate

Definition at line 341 of file overworld_editor.h.

References map_refresh_.

Referenced by InitTilePaintingManager(), and ProcessDeferredTextures().

◆ RefreshChildMapOnDemand()

void yaze::editor::OverworldEditor::RefreshChildMapOnDemand ( int map_index)
inlineprivate

Definition at line 344 of file overworld_editor.h.

References map_refresh_.

◆ RefreshMapPalette()

absl::Status yaze::editor::OverworldEditor::RefreshMapPalette ( )
inlineprivate

Definition at line 347 of file overworld_editor.h.

References map_refresh_.

Referenced by Initialize().

◆ RefreshMapProperties()

void yaze::editor::OverworldEditor::RefreshMapProperties ( )
inlineprivate

Definition at line 351 of file overworld_editor.h.

References map_refresh_.

Referenced by Initialize().

◆ RefreshTile16Blockset()

absl::Status yaze::editor::OverworldEditor::RefreshTile16Blockset ( )
inlineprivate

Definition at line 354 of file overworld_editor.h.

References map_refresh_.

Referenced by InitCanvasNavigationManager(), Initialize(), and Load().

◆ UpdateBlocksetWithPendingTileChanges()

void yaze::editor::OverworldEditor::UpdateBlocksetWithPendingTileChanges ( )
inlineprivate

Definition at line 358 of file overworld_editor.h.

References map_refresh_.

Referenced by Update().

◆ ForceRefreshGraphics()

void yaze::editor::OverworldEditor::ForceRefreshGraphics ( int map_index)
inlineprivate

Definition at line 361 of file overworld_editor.h.

References map_refresh_.

Referenced by Initialize().

◆ RefreshSiblingMapGraphics()

void yaze::editor::OverworldEditor::RefreshSiblingMapGraphics ( int map_index,
bool include_self = false )
inlineprivate

Definition at line 364 of file overworld_editor.h.

References map_refresh_.

Referenced by Initialize().

◆ InitTilePaintingManager()

void yaze::editor::OverworldEditor::InitTilePaintingManager ( )
private

Initialize the tile painting manager (called after graphics load)

Definition at line 158 of file overworld_editor.cc.

References yaze::editor::TilePaintingCallbacks::create_undo_point, CreateUndoPoint(), yaze::editor::TilePaintingDependencies::current_map, current_map_, current_mode, yaze::editor::TilePaintingDependencies::current_mode, yaze::editor::TilePaintingDependencies::current_parent, current_parent_, yaze::editor::TilePaintingDependencies::current_tile16, current_tile16_, yaze::editor::TilePaintingDependencies::current_world, current_world_, yaze::editor::TilePaintingCallbacks::finalize_paint_operation, FinalizePaintOperation(), yaze::editor::TilePaintingDependencies::game_state, game_state_, yaze::editor::TilePaintingDependencies::maps_bmp, maps_bmp_, yaze::editor::TilePaintingDependencies::overworld, overworld_, yaze::editor::TilePaintingDependencies::ow_map_canvas, ow_map_canvas_, yaze::editor::TilePaintingCallbacks::refresh_overworld_map, yaze::editor::TilePaintingCallbacks::refresh_overworld_map_on_demand, RefreshOverworldMap(), RefreshOverworldMapOnDemand(), yaze::editor::TilePaintingDependencies::rom, rom_, yaze::editor::TilePaintingCallbacks::scroll_blockset_to_current_tile, ScrollBlocksetCanvasToCurrentTile(), yaze::editor::TilePaintingDependencies::selected_tile16_ids, selected_tile16_ids_, yaze::editor::TilePaintingDependencies::tile16_blockset, tile16_blockset_, yaze::editor::TilePaintingDependencies::tile16_editor, tile16_editor_, and tile_painting_.

Referenced by Initialize().

◆ CheckForOverworldEdits()

void yaze::editor::OverworldEditor::CheckForOverworldEdits ( )
private

Check for tile edits - delegates to TilePaintingManager.

Definition at line 707 of file overworld_editor.cc.

References tile_painting_.

Referenced by yaze::editor::OverworldCanvasRenderer::DrawOverworldCanvas().

◆ CheckForCurrentMap()

absl::Status yaze::editor::OverworldEditor::CheckForCurrentMap ( )
private

Check for map changes and refresh if needed.

Definition at line 834 of file overworld_editor.cc.

References canvas_nav_.

Referenced by yaze::editor::OverworldCanvasRenderer::DrawOverworldCanvas().

◆ HandleMapInteraction()

void yaze::editor::OverworldEditor::HandleMapInteraction ( )
private

◆ UpdateBlocksetSelectorState()

void yaze::editor::OverworldEditor::UpdateBlocksetSelectorState ( )
private

◆ ScrollBlocksetCanvasToCurrentTile()

void yaze::editor::OverworldEditor::ScrollBlocksetCanvasToCurrentTile ( )
private

Scroll the blockset canvas to show the current selected tile16.

Definition at line 1289 of file overworld_editor.cc.

References canvas_nav_.

Referenced by InitTilePaintingManager().

◆ InitCanvasNavigationManager()

void yaze::editor::OverworldEditor::InitCanvasNavigationManager ( )
private

Initialize the canvas navigation manager (called during Initialize)

Definition at line 195 of file overworld_editor.cc.

References yaze::editor::CanvasNavigationContext::blockset_selector, blockset_selector_, canvas_nav_, yaze::editor::CanvasNavigationContext::current_map, current_map_, yaze::editor::CanvasNavigationContext::current_map_lock, current_map_lock_, yaze::editor::CanvasNavigationContext::current_mode, current_mode, yaze::editor::CanvasNavigationContext::current_parent, current_parent_, yaze::editor::CanvasNavigationContext::current_tile16, current_tile16_, yaze::editor::CanvasNavigationContext::current_world, current_world_, yaze::editor::CanvasNavigationCallbacks::ensure_map_texture, EnsureMapTexture(), entity_renderer_, yaze::editor::CanvasNavigationContext::is_dragging_entity, is_dragging_entity_, yaze::editor::CanvasNavigationCallbacks::is_entity_hovered, yaze::editor::CanvasNavigationContext::maps_bmp, maps_bmp_, yaze::editor::CanvasNavigationContext::overworld, overworld_, yaze::editor::CanvasNavigationContext::ow_map_canvas, ow_map_canvas_, yaze::editor::CanvasNavigationCallbacks::pick_tile16_from_hovered_canvas, PickTile16FromHoveredCanvas(), yaze::editor::CanvasNavigationCallbacks::refresh_overworld_map, yaze::editor::CanvasNavigationCallbacks::refresh_tile16_blockset, RefreshOverworldMap(), RefreshTile16Blockset(), yaze::editor::CanvasNavigationContext::rom, rom_, yaze::editor::CanvasNavigationContext::show_map_properties_panel, show_map_properties_panel_, yaze::editor::CanvasNavigationContext::tile16_blockset, and tile16_blockset_.

Referenced by Initialize().

Here is the call graph for this function:

◆ HandleOverworldPan()

void yaze::editor::OverworldEditor::HandleOverworldPan ( )
private

◆ HandleOverworldZoom()

void yaze::editor::OverworldEditor::HandleOverworldZoom ( )
private

◆ ZoomIn()

void yaze::editor::OverworldEditor::ZoomIn ( )
private

Definition at line 15 of file overworld_navigation.cc.

References canvas_nav_.

◆ ZoomOut()

void yaze::editor::OverworldEditor::ZoomOut ( )
private

Definition at line 19 of file overworld_navigation.cc.

References canvas_nav_.

◆ ClampOverworldScroll()

void yaze::editor::OverworldEditor::ClampOverworldScroll ( )
private

Definition at line 23 of file overworld_navigation.cc.

References canvas_nav_.

◆ ResetOverworldView()

void yaze::editor::OverworldEditor::ResetOverworldView ( )
private

Definition at line 27 of file overworld_navigation.cc.

References canvas_nav_.

◆ CenterOverworldView()

void yaze::editor::OverworldEditor::CenterOverworldView ( )
private

Definition at line 31 of file overworld_navigation.cc.

References canvas_nav_.

◆ LoadSpriteGraphics()

absl::Status yaze::editor::OverworldEditor::LoadSpriteGraphics ( )
private

◆ ProcessDeferredTextures()

void yaze::editor::OverworldEditor::ProcessDeferredTextures ( )
private

Create textures for deferred map bitmaps on demand.

Definition at line 1199 of file overworld_editor.cc.

References current_map_, current_world_, yaze::gfx::Arena::Get(), yaze::zelda3::kNumOverworldMaps, maps_bmp_, yaze::gfx::Arena::ProcessTextureQueue(), RefreshOverworldMapOnDemand(), and renderer_.

Referenced by Update().

Here is the call graph for this function:

◆ EnsureMapTexture()

◆ SetupCanvasAutomation()

void yaze::editor::OverworldEditor::SetupCanvasAutomation ( )
private

Definition at line 16 of file automation.cc.

References AutomationGetTile(), AutomationSetTile(), yaze::gui::Canvas::GetAutomationAPI(), ow_map_canvas_, and yaze::gui::CanvasAutomationAPI::SetTilePaintCallback().

Referenced by Initialize().

Here is the call graph for this function:

◆ GetOverworldCanvas()

gui::Canvas * yaze::editor::OverworldEditor::GetOverworldCanvas ( )
inlineprivate

Definition at line 422 of file overworld_editor.h.

References ow_map_canvas_.

◆ AutomationSetTile()

◆ AutomationGetTile()

int yaze::editor::OverworldEditor::AutomationGetTile ( int x,
int y )
private

◆ SaveCurrentSelectionToScratch()

◆ LoadScratchToSelection()

absl::Status yaze::editor::OverworldEditor::LoadScratchToSelection ( )
private

Definition at line 300 of file scratch_space.cc.

References yaze::editor::OverworldEditor::ScratchSpace::in_use, yaze::util::logf(), yaze::editor::OverworldEditor::ScratchSpace::name, and scratch_space_.

Referenced by Initialize().

Here is the call graph for this function:

◆ ClearScratchSpace()

◆ DrawScratchSpaceEdits()

◆ DrawScratchSpacePattern()

◆ DrawScratchSpaceSelection()

void yaze::editor::OverworldEditor::DrawScratchSpaceSelection ( )
private

◆ UpdateScratchBitmapTile()

◆ CreateUndoPoint()

void yaze::editor::OverworldEditor::CreateUndoPoint ( int map_id,
int world,
int x,
int y,
int old_tile_id )
private

◆ FinalizePaintOperation()

void yaze::editor::OverworldEditor::FinalizePaintOperation ( )
private

◆ GetWorldTiles()

auto & yaze::editor::OverworldEditor::GetWorldTiles ( int world)
private

Definition at line 930 of file overworld_editor.cc.

References yaze::zelda3::Overworld::mutable_map_tiles(), and overworld_.

Referenced by FinalizePaintOperation().

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ OverworldCanvasRenderer

friend class OverworldCanvasRenderer
friend

Definition at line 125 of file overworld_editor.h.

Member Data Documentation

◆ jump_to_tab_

int yaze::editor::OverworldEditor::jump_to_tab_ = -1

◆ current_mode

◆ previous_mode

EditingMode yaze::editor::OverworldEditor::previous_mode = EditingMode::DRAW_TILE
private

Definition at line 462 of file overworld_editor.h.

◆ entity_edit_mode_

EntityEditMode yaze::editor::OverworldEditor::entity_edit_mode_ = EntityEditMode::NONE
private

◆ current_world_

◆ current_map_

◆ current_parent_

int yaze::editor::OverworldEditor::current_parent_ = 0
private

Definition at line 477 of file overworld_editor.h.

Referenced by InitCanvasNavigationManager(), and InitTilePaintingManager().

◆ current_entrance_id_

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

Definition at line 478 of file overworld_editor.h.

◆ current_exit_id_

int yaze::editor::OverworldEditor::current_exit_id_ = 0
private

Definition at line 479 of file overworld_editor.h.

◆ current_item_id_

int yaze::editor::OverworldEditor::current_item_id_ = 0
private

Definition at line 480 of file overworld_editor.h.

◆ current_sprite_id_

int yaze::editor::OverworldEditor::current_sprite_id_ = 0
private

Definition at line 481 of file overworld_editor.h.

◆ current_blockset_

int yaze::editor::OverworldEditor::current_blockset_ = 0
private

Definition at line 482 of file overworld_editor.h.

Referenced by InitMapRefreshCoordinator().

◆ game_state_

int yaze::editor::OverworldEditor::game_state_ = 1
private

◆ current_tile16_

◆ selected_entrance_

int yaze::editor::OverworldEditor::selected_entrance_ = 0
private

Definition at line 485 of file overworld_editor.h.

◆ selected_usage_map_

int yaze::editor::OverworldEditor::selected_usage_map_ = 0xFFFF
private

Definition at line 486 of file overworld_editor.h.

◆ selected_tile16_ids_

std::vector<int> yaze::editor::OverworldEditor::selected_tile16_ids_
private

Definition at line 489 of file overworld_editor.h.

Referenced by InitTilePaintingManager().

◆ all_gfx_loaded_

bool yaze::editor::OverworldEditor::all_gfx_loaded_ = false
private

◆ map_blockset_loaded_

bool yaze::editor::OverworldEditor::map_blockset_loaded_ = false
private

◆ overworld_canvas_fullscreen_

bool yaze::editor::OverworldEditor::overworld_canvas_fullscreen_ = false
private

Definition at line 502 of file overworld_editor.h.

Referenced by HandleKeyboardShortcuts(), and Update().

◆ is_dragging_entity_

bool yaze::editor::OverworldEditor::is_dragging_entity_ = false
private

◆ dragged_entity_free_movement_

bool yaze::editor::OverworldEditor::dragged_entity_free_movement_ = false
private

◆ current_map_lock_

◆ show_custom_bg_color_editor_

bool yaze::editor::OverworldEditor::show_custom_bg_color_editor_ = false
private

◆ show_overlay_editor_

bool yaze::editor::OverworldEditor::show_overlay_editor_ = false
private

◆ show_map_properties_panel_

bool yaze::editor::OverworldEditor::show_map_properties_panel_ = false
private

◆ show_overlay_preview_

bool yaze::editor::OverworldEditor::show_overlay_preview_ = false
private

◆ canvas_renderer_

std::unique_ptr<OverworldCanvasRenderer> yaze::editor::OverworldEditor::canvas_renderer_
private

◆ canvas_nav_

◆ tile_painting_

std::unique_ptr<TilePaintingManager> yaze::editor::OverworldEditor::tile_painting_
private

◆ map_refresh_

◆ map_properties_system_

std::unique_ptr<MapPropertiesSystem> yaze::editor::OverworldEditor::map_properties_system_
private

◆ sidebar_

std::unique_ptr<OverworldSidebar> yaze::editor::OverworldEditor::sidebar_
private

◆ entity_renderer_

std::unique_ptr<OverworldEntityRenderer> yaze::editor::OverworldEditor::entity_renderer_
private

◆ toolbar_

std::unique_ptr<OverworldToolbar> yaze::editor::OverworldEditor::toolbar_
private

◆ scratch_space_

◆ tile16_blockset_

◆ rom_

◆ game_data_

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

Definition at line 553 of file overworld_editor.h.

Referenced by SetGameData().

◆ renderer_

gfx::IRenderer* yaze::editor::OverworldEditor::renderer_
private

◆ tile16_editor_

◆ gfx_group_editor_

GfxGroupEditor yaze::editor::OverworldEditor::gfx_group_editor_
private

◆ palette_editor_

PaletteEditor yaze::editor::OverworldEditor::palette_editor_
private

Definition at line 559 of file overworld_editor.h.

◆ palette_

◆ selected_tile_bmp_

gfx::Bitmap yaze::editor::OverworldEditor::selected_tile_bmp_
private

Definition at line 566 of file overworld_editor.h.

◆ tile16_blockset_bmp_

gfx::Bitmap yaze::editor::OverworldEditor::tile16_blockset_bmp_
private

Definition at line 567 of file overworld_editor.h.

Referenced by Load(), and LoadGraphics().

◆ current_gfx_bmp_

gfx::Bitmap yaze::editor::OverworldEditor::current_gfx_bmp_
private

Definition at line 568 of file overworld_editor.h.

Referenced by InitMapRefreshCoordinator(), Load(), and LoadGraphics().

◆ all_gfx_bmp

gfx::Bitmap yaze::editor::OverworldEditor::all_gfx_bmp
private

Definition at line 569 of file overworld_editor.h.

◆ maps_bmp_

◆ current_graphics_set_

gfx::BitmapTable yaze::editor::OverworldEditor::current_graphics_set_
private

◆ sprite_previews_

std::vector<gfx::Bitmap> yaze::editor::OverworldEditor::sprite_previews_
private

Definition at line 572 of file overworld_editor.h.

Referenced by Initialize(), and LoadSpriteGraphics().

◆ overworld_

◆ refresh_blockset_

zelda3::OverworldBlockset yaze::editor::OverworldEditor::refresh_blockset_
private

Definition at line 579 of file overworld_editor.h.

◆ current_sprite_

zelda3::Sprite yaze::editor::OverworldEditor::current_sprite_
private

◆ current_entrance_

zelda3::OverworldEntrance yaze::editor::OverworldEditor::current_entrance_
private

◆ current_exit_

zelda3::OverworldExit yaze::editor::OverworldEditor::current_exit_
private

◆ current_item_

zelda3::OverworldItem yaze::editor::OverworldEditor::current_item_
private

◆ entrance_tiletypes_

zelda3::OverworldEntranceTileTypes yaze::editor::OverworldEditor::entrance_tiletypes_ = {}
private

Definition at line 589 of file overworld_editor.h.

Referenced by Load().

◆ current_entity_

zelda3::GameEntity* yaze::editor::OverworldEditor::current_entity_ = nullptr
private

◆ dragged_entity_

zelda3::GameEntity* yaze::editor::OverworldEditor::dragged_entity_ = nullptr
private

◆ pending_entity_insert_type_

std::string yaze::editor::OverworldEditor::pending_entity_insert_type_
private

Definition at line 595 of file overworld_editor.h.

Referenced by HandleEntityInsertion(), and ProcessPendingEntityInsertion().

◆ pending_entity_insert_pos_

ImVec2 yaze::editor::OverworldEditor::pending_entity_insert_pos_
private

Definition at line 596 of file overworld_editor.h.

Referenced by HandleEntityInsertion(), and ProcessPendingEntityInsertion().

◆ entity_insert_error_message_

std::string yaze::editor::OverworldEditor::entity_insert_error_message_
private

Definition at line 597 of file overworld_editor.h.

Referenced by ProcessPendingEntityInsertion(), and Update().

◆ ow_map_canvas_

◆ current_gfx_canvas_

gui::Canvas yaze::editor::OverworldEditor::current_gfx_canvas_
private
Initial value:
{"CurrentGfx", kCurrentGfxCanvasSize,
constexpr ImVec2 kCurrentGfxCanvasSize(0x100+1, 0x10 *0x40+1)

Definition at line 605 of file overworld_editor.h.

Referenced by yaze::editor::OverworldCanvasRenderer::DrawAreaGraphics().

◆ blockset_canvas_

gui::Canvas yaze::editor::OverworldEditor::blockset_canvas_
private
Initial value:
{"OwBlockset", kBlocksetCanvasSize,
constexpr ImVec2 kBlocksetCanvasSize(0x100+1, 0x4000+1)

Definition at line 607 of file overworld_editor.h.

Referenced by yaze::editor::OverworldCanvasRenderer::DrawTile16Selector().

◆ blockset_selector_

std::unique_ptr<gui::TileSelectorWidget> yaze::editor::OverworldEditor::blockset_selector_
private

◆ graphics_bin_canvas_

gui::Canvas yaze::editor::OverworldEditor::graphics_bin_canvas_
private
Initial value:
{"GraphicsBin", kGraphicsBinCanvasSize,
constexpr ImVec2 kGraphicsBinCanvasSize(0x100+1, kNumSheetsToLoad *0x40+1)

Definition at line 610 of file overworld_editor.h.

Referenced by yaze::editor::OverworldCanvasRenderer::DrawTile8Selector().

◆ properties_canvas_

gui::Canvas yaze::editor::OverworldEditor::properties_canvas_
private

◆ scratch_canvas_

gui::Canvas yaze::editor::OverworldEditor::scratch_canvas_
private
Initial value:
{"ScratchSpace", ImVec2(320, 480),

Definition at line 613 of file overworld_editor.h.

Referenced by DrawScratchSpace(), DrawScratchSpaceEdits(), and DrawScratchSpacePattern().

◆ usage_stats_card_

std::unique_ptr<UsageStatisticsCard> yaze::editor::OverworldEditor::usage_stats_card_
private

Definition at line 620 of file overworld_editor.h.

Referenced by Initialize(), and usage_stats_card().

◆ debug_window_card_

std::unique_ptr<DebugWindowCard> yaze::editor::OverworldEditor::debug_window_card_
private

Definition at line 621 of file overworld_editor.h.

Referenced by debug_window_card(), and Initialize().

◆ status_

◆ current_paint_operation_

std::optional<OverworldUndoPoint> yaze::editor::OverworldEditor::current_paint_operation_
private

Definition at line 629 of file overworld_editor.h.

Referenced by CreateUndoPoint(), FinalizePaintOperation(), and Load().

◆ last_paint_time_

std::chrono::steady_clock::time_point yaze::editor::OverworldEditor::last_paint_time_
private

Definition at line 630 of file overworld_editor.h.

Referenced by CreateUndoPoint().

◆ kPaintBatchTimeout

constexpr auto yaze::editor::OverworldEditor::kPaintBatchTimeout = std::chrono::milliseconds(500)
staticconstexprprivate

Definition at line 631 of file overworld_editor.h.

Referenced by CreateUndoPoint().

◆ palette_listener_id_

int yaze::editor::OverworldEditor::palette_listener_id_ = -1
private

Definition at line 637 of file overworld_editor.h.

Referenced by Clear(), and Load().


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