yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
overworld_editor.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_OVERWORLDEDITOR_H
2#define YAZE_APP_EDITOR_OVERWORLDEDITOR_H
3
4#include <chrono>
5#include <memory>
6#include <optional>
7
8#include "absl/status/status.h"
9#include "app/editor/editor.h"
29#include "app/gfx/core/bitmap.h"
33#include "app/gui/core/input.h"
35#include "imgui/imgui.h"
36#include "rom/rom.h"
39
40// =============================================================================
41// Overworld Editor - UI Layer
42// =============================================================================
43//
44// ARCHITECTURE OVERVIEW:
45// ----------------------
46// The OverworldEditor is the main UI class for editing overworld maps.
47// It orchestrates several subsystems:
48//
49// 1. TILE EDITING SYSTEM
50// - Tile16Editor: Popup for editing individual 16x16 tiles
51// - Tile selection and painting on the main canvas
52// - Undo/Redo stack for paint operations
53//
54// 2. ENTITY SYSTEM
55// - OverworldEntityRenderer: Draws entities on the canvas
56// - entity_operations.cc: Insertion/deletion logic
57// - overworld_entity_interaction.cc: Drag/drop and click handling
58//
59// 3. MAP PROPERTIES SYSTEM
60// - MapPropertiesSystem: Toolbar and context menus
61// - OverworldSidebar: Property editing tabs
62// - Graphics, palettes, music per area
63//
64// 4. CANVAS SYSTEM
65// - ow_map_canvas_: Main overworld display (4096x4096)
66// - blockset_canvas_: Tile16 selector
67// - scratch_canvas_: Layout workspace
68//
69// EDITING MODES:
70// --------------
71// - DRAW_TILE: Left-click paints tiles, right-click opens tile16 editor
72// - MOUSE: Left-click selects entities, right-click opens context menus
73//
74// KEY WORKFLOWS:
75// --------------
76// See README.md in this directory for complete workflow documentation.
77//
78// SUBSYSTEM ORGANIZATION:
79// -----------------------
80// The class is organized into logical sections marked with comment blocks.
81// Each section groups related methods and state for a specific subsystem.
82// =============================================================================
83
84namespace yaze {
85namespace editor {
86
87struct OverworldItemsSnapshot;
88
89// =============================================================================
90// Constants
91// =============================================================================
92
93constexpr unsigned int k4BPP = 4;
94constexpr unsigned int kByteSize = 3;
95constexpr unsigned int kMessageIdSize = 5;
96constexpr unsigned int kNumSheetsToLoad = 223;
99constexpr ImVec2 kCurrentGfxCanvasSize(0x100 + 1, 0x10 * 0x40 + 1);
100constexpr ImVec2 kBlocksetCanvasSize(0x100 + 1, 0x4000 + 1);
101constexpr ImVec2 kGraphicsBinCanvasSize(0x100 + 1, kNumSheetsToLoad * 0x40 + 1);
102
103constexpr ImGuiTableFlags kOWMapFlags =
104 ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable |
105 ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingStretchProp;
106
107constexpr absl::string_view kWorldList =
108 "Light World\0Dark World\0Extra World\0";
109
110constexpr absl::string_view kGamePartComboString = "Part 0\0Part 1\0Part 2\0";
111
112constexpr absl::string_view kOWMapTable = "#MapSettingsTable";
113
132class OverworldEditor : public Editor, public gfx::GfxContext {
134
135 public:
136 // ===========================================================================
137 // Construction and Initialization
138 // ===========================================================================
139
143 // MapPropertiesSystem will be initialized after maps_bmp_ and canvas are
144 // ready
145 }
146
149 dependencies_ = deps;
150 }
151 ~OverworldEditor() override;
152
157
164
165 // ===========================================================================
166 // Editor Interface Implementation
167 // ===========================================================================
168
169 void Initialize() override;
170 absl::Status Load() override;
171 absl::Status Update() final;
172 absl::Status Undo() override;
173 absl::Status Redo() override;
174 absl::Status Cut() override { return absl::UnimplementedError("Cut"); }
175 absl::Status Copy() override;
176 absl::Status Paste() override;
177 absl::Status Find() override { return absl::UnimplementedError("Find"); }
178 absl::Status Save() override;
179 absl::Status Clear() override;
180 void ContributeStatus(StatusBar* status_bar) override;
181
184
185 int jump_to_tab() { return jump_to_tab_; }
186 int jump_to_tab_ = -1;
187
188 // ===========================================================================
189 // ROM State
190 // ===========================================================================
191
192 bool IsRomLoaded() const override { return rom_ && rom_->is_loaded(); }
193 std::string GetRomStatus() const override {
194 if (!rom_)
195 return "No ROM loaded";
196 if (!rom_->is_loaded())
197 return "ROM failed to load";
198 return absl::StrFormat("ROM loaded: %s", rom_->title());
199 }
200
201 Rom* rom() const { return rom_; }
202
205 static bool NormalizeMapSelection(int& current_world, int& current_map);
206
208 void set_current_map(int map_id) {
209 if (map_id >= 0 && map_id < zelda3::kNumOverworldMaps) {
210 // Finalize any pending paint operation before switching maps
212 current_map_ = map_id;
214 map_id / 0x40; // Calculate which world the map belongs to
215 if (const auto* map = overworld_.overworld_map(current_map_)) {
216 current_parent_ = map->parent();
217 } else {
219 }
222 }
223 }
224 void SetCurrentMap(int map_id) { set_current_map(map_id); }
225 void SelectMapForEditing(int map_id, bool respect_pin = true);
226
227 void set_current_tile16(int tile_id) { current_tile16_ = tile_id; }
228 int current_map_id() const { return current_map_; }
229 int current_world_id() const { return current_world_; }
230 int hovered_map_id() const { return hovered_map_; }
231
232 // ===========================================================================
233 // Graphics Loading
234 // ===========================================================================
235
243 absl::Status LoadGraphics();
244
245 // ===========================================================================
246 // Entity Interaction API
247 // ===========================================================================
248
252
256
258 void RequestJumpToRoom(int room_id) { jump_to_tab_ = room_id; }
259
261 void RequestJumpToEntrance(int entrance_id) { jump_to_tab_ = entrance_id; }
262
267
272
273 std::string& pending_insert_type() { return pending_insert_type_; }
275 std::string& insert_error() { return insert_error_; }
276
278 int game_state() const { return game_state_; }
279
280 // ===========================================================================
281 // Entity System - Insertion and Editing
282 // ===========================================================================
283 // Entity operations are delegated to entity_operations.cc helper functions.
284 // Entity rendering is handled by OverworldEntityRenderer.
285 // Entity interaction (drag/drop) is in overworld_entity_interaction.cc.
286
289 void HandleEntityInsertion(const std::string& entity_type);
290
295
298 void HandleTile16Edit();
299
301 bool SelectItemByIdentity(const zelda3::OverworldItem& item_identity);
302
304 void ClearSelectedItem();
305
307 std::optional<zelda3::OverworldItem> selected_item_identity() const {
309 }
310
314
316 bool DuplicateSelectedItem(int offset_x = 16, int offset_y = 0);
317
319 bool NudgeSelectedItem(int delta_x, int delta_y);
320
322 bool DeleteSelectedItem();
323 bool DeleteItemByIdentity(const zelda3::OverworldItem& item_identity);
324
325 // ===========================================================================
326 // Keyboard Shortcuts
327 // ===========================================================================
328
330 if (tile_painting_)
331 tile_painting_->ToggleBrushTool();
332 }
334 if (tile_painting_)
335 tile_painting_->ActivateFillTool();
336 }
337 void CycleTileSelection(int delta);
338
342 void RequestTile16Selection(int tile_id);
343
345 return tile_painting_ && tile_painting_->PickTile16FromHoveredCanvas();
346 }
347
348 // ===========================================================================
349 // WindowContent View Hooks
350 // ===========================================================================
351 // These are used by focused WindowContent wrappers around Overworld views.
352 // Drawing is delegated to OverworldCanvasRenderer.
353
354 absl::Status DrawAreaGraphics() {
356 if (!canvas_renderer_)
357 return absl::FailedPreconditionError("Renderer not initialized");
358 return canvas_renderer_->DrawAreaGraphics();
359 }
360 absl::Status DrawTile16Selector() {
361 if (!canvas_renderer_)
362 return absl::FailedPreconditionError("Renderer not initialized");
363 return canvas_renderer_->DrawTile16Selector();
364 }
368 canvas_renderer_->DrawMapProperties();
369 }
370
374 void InvalidateGraphicsCache(int map_id = -1) {
375 if (map_refresh_)
376 map_refresh_->InvalidateGraphicsCache(map_id);
377 }
378 absl::Status DrawScratchSpace();
381 canvas_renderer_->DrawTile8Selector();
382 }
383 absl::Status UpdateGfxGroupEditor();
387 canvas_renderer_->DrawV3Settings();
388 }
389
392
395
398 const Tile16Editor& tile16_editor() const { return tile16_editor_; }
399
403 return current_gfx_bmp_;
404 }
405
408
410 void DrawOverworldCanvas();
411
412 private:
413 // ===========================================================================
414 // Entity Interaction System
415 // ===========================================================================
416 // Handles mouse interactions with entities in MOUSE mode.
417
420
423
424 // ===========================================================================
425 // Map Refresh System (delegated to MapRefreshCoordinator)
426 // ===========================================================================
427
432
433 // Convenience delegation methods for internal use
434 void RefreshChildMap(int map_index) {
435 if (map_refresh_)
436 map_refresh_->RefreshChildMap(map_index);
437 }
439 if (map_refresh_)
440 map_refresh_->RefreshOverworldMap();
441 }
442 void RefreshOverworldMapOnDemand(int map_index) {
443 if (map_refresh_)
444 map_refresh_->RefreshOverworldMapOnDemand(map_index);
445 }
446 void RefreshChildMapOnDemand(int map_index) {
447 if (map_refresh_)
448 map_refresh_->RefreshChildMapOnDemand(map_index);
449 }
450 absl::Status RefreshMapPalette() {
451 if (map_refresh_)
452 return map_refresh_->RefreshMapPalette();
453 return absl::FailedPreconditionError(
454 "MapRefreshCoordinator not initialized");
455 }
457 if (map_refresh_)
458 map_refresh_->RefreshMapProperties();
459 }
460 absl::Status RefreshTile16Blockset() {
461 if (map_refresh_)
462 return map_refresh_->RefreshTile16Blockset();
463 return absl::FailedPreconditionError(
464 "MapRefreshCoordinator not initialized");
465 }
467 if (map_refresh_)
468 map_refresh_->UpdateBlocksetWithPendingTileChanges();
469 }
470 void ForceRefreshGraphics(int map_index) {
471 if (map_refresh_)
472 map_refresh_->ForceRefreshGraphics(map_index);
473 }
474 void RefreshSiblingMapGraphics(int map_index, bool include_self = false) {
475 if (map_refresh_)
476 map_refresh_->RefreshSiblingMapGraphics(map_index, include_self);
477 }
478
479 // ===========================================================================
480 // Tile Editing System
481 // ===========================================================================
482 // Handles tile painting and selection on the main canvas.
483
486
489
491 absl::Status CheckForCurrentMap();
492
495
498
501
502 // Canvas navigation (delegated to CanvasNavigationManager)
507 void HandleOverworldPan();
508 void HandleOverworldZoom();
509 void ZoomIn();
510 void ZoomOut();
512 void ResetOverworldView();
513 void CenterOverworldView();
514
515 // ===========================================================================
516 // Texture and Graphics Loading
517 // ===========================================================================
518
519 absl::Status LoadSpriteGraphics();
520
523
525 void EnsureMapTexture(int map_index);
526 void PrimeWorldMaps(int world, bool process_texture_queue = false);
527 void SwitchToWorld(int world);
528
529 // ===========================================================================
530 // Canvas Navigation (delegated to CanvasNavigationManager)
531 // ===========================================================================
532
533 // ===========================================================================
534 // Canvas Automation API
535 // ===========================================================================
536 // Integration with automation testing system.
537
540 bool AutomationSetTile(int x, int y, int tile_id);
541 int AutomationGetTile(int x, int y);
542
543 // ===========================================================================
544 // Scratch Space System
545 // ===========================================================================
546 // Workspace for planning tile layouts before placing them on the map.
547
548 absl::Status SaveCurrentSelectionToScratch();
549 absl::Status LoadScratchToSelection();
550 absl::Status ClearScratchSpace();
554 void UpdateScratchBitmapTile(int tile_x, int tile_y, int tile_id);
555 absl::Status LoadScratchPad();
556 absl::Status SaveScratchPad() const;
557 absl::Status FlushScratchPadIfDirty();
560
561 // ===========================================================================
562 // Undo/Redo System
563 // ===========================================================================
564 // Tracks tile paint operations for undo/redo functionality.
565 // Operations within 500ms are batched to reduce undo point count.
566
568 int map_id = 0;
569 int world = 0; // 0=Light, 1=Dark, 2=Special
570 std::vector<std::pair<std::pair<int, int>, int>>
571 tile_changes; // ((x,y), old_tile_id)
572 std::chrono::steady_clock::time_point timestamp;
573 };
574
575 void CreateUndoPoint(int map_id, int world, int x, int y, int old_tile_id);
577 auto& GetWorldTiles(int world);
581 std::string description);
582 absl::Status ApplyOverworldPropertyEdit(const OverworldPropertyEdit& edit,
583 bool record_undo = true);
584 absl::Status ApplyOverworldPropertyEdits(
585 const std::vector<OverworldPropertyEdit>& edits,
586 const std::string& description, bool record_undo = true);
587 absl::Status RenameProjectResourceLabelWithUndo(const std::string& type,
588 int id,
589 const std::string& label);
590
591 // ===========================================================================
592 // Editing Mode State
593 // ===========================================================================
594
598
613
614 // ===========================================================================
615 // Current Selection State
616 // ===========================================================================
617
618 int current_world_ = 0; // 0=Light, 1=Dark, 2=Special
619 int current_map_ = 0; // Current map index (0-159)
620 int current_parent_ = 0; // Parent map for multi-area
621 int hovered_map_ = -1; // Last map under the cursor, preview only
623 int game_state_ = 1; // 0=Beginning, 1=Pendants, 2=Crystals
624 int current_tile16_ = 0; // Selected tile16 for painting
627
628 // Selected tile IDs for rectangle selection
629 std::vector<int> selected_tile16_ids_;
630
631 // ===========================================================================
632 // Loading State
633 // ===========================================================================
634
635 bool all_gfx_loaded_ = false;
637
641
642 // ===========================================================================
643 // Canvas Interaction State
644 // ===========================================================================
645
649 bool current_map_lock_ = false;
650
651 // ===========================================================================
652 // Property Windows (Standalone, Not PanelManager)
653 // ===========================================================================
654
659
660 // ===========================================================================
661 // UI Subsystem Components
662 // ===========================================================================
663
664 std::unique_ptr<OverworldCanvasRenderer> canvas_renderer_;
665 std::unique_ptr<CanvasNavigationManager> canvas_nav_;
666 std::unique_ptr<TilePaintingManager> tile_painting_;
667 std::unique_ptr<zelda3::OverworldUpgradeSystem> upgrade_system_;
668 std::unique_ptr<EntityMutationService> entity_mutation_service_;
669 std::unique_ptr<OverworldInteractionCoordinator> interaction_coordinator_;
670 std::unique_ptr<MapRefreshCoordinator> map_refresh_;
671 std::unique_ptr<OverworldMapTextureCoordinator> map_texture_;
672 std::unique_ptr<MapPropertiesSystem> map_properties_system_;
673 std::unique_ptr<OverworldSidebar> sidebar_;
674 std::unique_ptr<OverworldEntityRenderer> entity_renderer_;
675 std::unique_ptr<OverworldToolbar> toolbar_;
676
677 // ===========================================================================
678 // Scratch Space System (Unified Single Workspace)
679 // ===========================================================================
680
683 std::array<std::array<int, 32>, 32> tile_data{};
684 bool in_use = false;
685 std::string name = "Scratch Space";
686 int width = 16;
687 int height = 16;
688 std::vector<ImVec2> selected_tiles;
689 std::vector<ImVec2> selected_points;
690 bool select_rect_active = false;
691 };
694
695 // ===========================================================================
696 // Core Data References
697 // ===========================================================================
698
700
704
705 // Sub-editors
709
710 // ===========================================================================
711 // Graphics Data
712 // ===========================================================================
713
719 std::array<gfx::Bitmap, zelda3::kNumOverworldMaps> maps_bmp_;
721 std::vector<gfx::Bitmap> sprite_previews_;
722
723 // ===========================================================================
724 // Overworld Data Layer
725 // ===========================================================================
726
729
730 // ===========================================================================
731 // Entity State
732 // ===========================================================================
733
735
738 std::optional<zelda3::OverworldItem> selected_item_identity_;
739 std::optional<OverworldEntityEditingTarget> editing_target_;
740
741 // Edit buffers for popups (session-specific)
746
747 // Deferred entity insertion (needed for popup flow from context menu)
749 ImVec2 pending_insert_pos_ = ImVec2(0.0f, 0.0f);
750 std::string insert_error_;
751
752 // ===========================================================================
753 // Canvas Components
754 // ===========================================================================
755
762 std::unique_ptr<gui::TileSelectorWidget> blockset_selector_;
766 gui::Canvas scratch_canvas_{"ScratchSpace", ImVec2(320, 480),
768
769 // ===========================================================================
770 // Panel Cards
771 // ===========================================================================
772
773 std::unique_ptr<UsageStatisticsCard> usage_stats_card_;
774 std::unique_ptr<DebugWindowCard> debug_window_card_;
775
776 absl::Status status_;
777
778 // ===========================================================================
779 // Undo/Redo State
780 // ===========================================================================
781
782 std::optional<OverworldUndoPoint> current_paint_operation_;
783 std::chrono::steady_clock::time_point last_paint_time_;
784 static constexpr auto kPaintBatchTimeout = std::chrono::milliseconds(500);
785
786 // ===========================================================================
787 // Event Listeners
788 // ===========================================================================
789
791};
792} // namespace editor
793} // namespace yaze
794
795#endif
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:28
bool is_loaded() const
Definition rom.h:144
auto title() const
Definition rom.h:149
Interface for editor classes.
Definition editor.h:245
virtual void SetDependencies(const EditorDependencies &deps)
Definition editor.h:250
zelda3::GameData * game_data() const
Definition editor.h:320
EditorDependencies dependencies_
Definition editor.h:333
EditorType type() const
Definition editor.h:306
EditorType type_
Definition editor.h:332
Editor-level service responsible for overworld entity mutations.
Manage graphics group configurations in a Rom.
void SetWorkspaceState(GfxGroupWorkspaceState *state)
void SetGameData(zelda3::GameData *data)
Handles all canvas drawing and panel rendering for the overworld editor.
Main UI class for editing overworld maps in A Link to the Past.
std::unique_ptr< UsageStatisticsCard > usage_stats_card_
absl::Status Clear() override
std::unique_ptr< MapPropertiesSystem > map_properties_system_
std::unique_ptr< OverworldCanvasRenderer > canvas_renderer_
OverworldEntityWorkbench * GetWorkbench()
Resolve the entity workbench window content (may be null).
zelda3::OverworldEntranceTileTypes entrance_tiletypes_
void OpenEntityContextMenu(zelda3::GameEntity *entity)
void HandleTile16Edit()
Handle tile16 editing from context menu (MOUSE mode) Gets the tile16 under the cursor and opens the T...
zelda3::OverworldExit & edit_exit()
std::optional< OverworldUndoPoint > current_paint_operation_
void PushItemUndoAction(OverworldItemsSnapshot before, std::string description)
absl::Status CheckForCurrentMap()
Check for map changes and refresh if needed.
void CreateUndoPoint(int map_id, int world, int x, int y, int old_tile_id)
absl::Status Cut() override
void ForceRefreshGraphics(int map_index)
zelda3::GameEntity * ResolveEditingEntity()
void RestoreItemUndoSnapshot(const OverworldItemsSnapshot &snapshot)
std::vector< int > selected_tile16_ids_
absl::Status ApplyOverworldPropertyEdit(const OverworldPropertyEdit &edit, bool record_undo=true)
zelda3::OverworldEntrance edit_entrance_
const gfx::Tilemap & tile16_blockset() const
Read-only access for integration tests that verify refresh output.
void ProcessPendingEntityInsertion()
Process any pending entity insertion request Called from Update() - needed because ImGui::OpenPopup()...
Definition automation.cc:87
void InitCanvasNavigationManager()
Initialize the canvas navigation manager (called during Initialize)
void InitMapRefreshCoordinator()
Initialize the map refresh coordinator (called during Initialize)
std::optional< zelda3::OverworldItem > selected_item_identity_
zelda3::OverworldBlockset refresh_blockset_
zelda3::OverworldItem & edit_item()
std::unique_ptr< zelda3::OverworldUpgradeSystem > upgrade_system_
void RequestJumpToEntrance(int entrance_id)
Trigger a jump to a dungeon entrance.
void SetDependencies(const EditorDependencies &deps) override
bool DeleteItemByIdentity(const zelda3::OverworldItem &item_identity)
void NotifyEntityModified(zelda3::GameEntity *entity)
Notify that an entity has been modified, marking ROM as dirty.
void HandleEntityInsertion(const std::string &entity_type)
Handle entity insertion from context menu.
Definition automation.cc:75
zelda3::GameEntity * dragged_entity_
std::unique_ptr< MapRefreshCoordinator > map_refresh_
std::array< gfx::Bitmap, zelda3::kNumOverworldMaps > maps_bmp_
std::unique_ptr< OverworldMapTextureCoordinator > map_texture_
static bool NormalizeMapSelection(int &current_world, int &current_map)
Clamp a possibly stale world/map selection back into a valid overworld range.
void CheckForOverworldEdits()
Check for tile edits - delegates to TilePaintingManager.
void UpdateScratchBitmapTile(int tile_x, int tile_y, int tile_id)
UsageStatisticsCard * usage_stats_card()
Access usage statistics card for panel.
void ContributeStatus(StatusBar *status_bar) override
EntityMutationService * entity_mutation_service()
Access the entity mutation service.
void SetGameData(zelda3::GameData *game_data) override
void RefreshSiblingMapGraphics(int map_index, bool include_self=false)
void PrimeWorldMaps(int world, bool process_texture_queue=false)
std::optional< zelda3::OverworldItem > selected_item_identity() const
Get current selected item identity snapshot.
absl::Status ApplyOverworldPropertyEdits(const std::vector< OverworldPropertyEdit > &edits, const std::string &description, bool record_undo=true)
void set_current_map(int map_id)
Set the current map for editing (also updates world)
void RefreshOverworldMapOnDemand(int map_index)
std::unique_ptr< OverworldSidebar > sidebar_
std::chrono::steady_clock::time_point last_paint_time_
void InvalidateGraphicsCache(int map_id=-1)
Invalidate cached graphics for a specific map or all maps.
DebugWindowCard * debug_window_card()
Access debug window card for panel.
std::optional< int > pending_tile16_selection_after_gfx_
absl::Status RenameProjectResourceLabelWithUndo(const std::string &type, int id, const std::string &label)
absl::Status SaveCurrentSelectionToScratch()
zelda3::OverworldItem * GetSelectedItem()
Resolve selected item identity to the current live item pointer.
bool NormalizeCurrentSelectionState()
Clamp and synchronize stale map/world selection before panels draw.
bool DuplicateSelectedItem(int offset_x=16, int offset_y=0)
Duplicate selected item with optional pixel offset.
bool AutomationSetTile(int x, int y, int tile_id)
Definition automation.cc:29
void DrawOverworldCanvas()
Draw the main overworld canvas.
void OpenEntityEditor(zelda3::GameEntity *entity)
zelda3::Overworld & overworld()
Access the underlying Overworld data.
void SetCurrentEntity(zelda3::GameEntity *entity)
Set the currently active entity for editing.
zelda3::OverworldItem edit_item_
void RefreshChildMap(int map_index)
std::unique_ptr< OverworldEntityRenderer > entity_renderer_
absl::Status Load() override
absl::Status RebuildScratchBitmapFromTileData()
void EnsureMapTexture(int map_index)
Ensure a specific map has its texture created.
const gfx::Bitmap & current_gfx_bmp_for_testing() const
std::vector< gfx::Bitmap > sprite_previews_
std::unique_ptr< CanvasNavigationManager > canvas_nav_
OverworldEditor(Rom *rom, const EditorDependencies &deps)
std::string GetRomStatus() const override
bool NudgeSelectedItem(int delta_x, int delta_y)
Move selected item by signed pixel deltas.
std::unique_ptr< OverworldToolbar > toolbar_
bool IsRomLoaded() const override
Tile16Editor & tile16_editor()
Access the Tile16 Editor for panel integration.
void ProcessDeferredTextures()
Create textures for deferred map bitmaps on demand.
const Tile16Editor & tile16_editor() const
zelda3::OverworldEntrance & edit_entrance()
std::unique_ptr< gui::TileSelectorWidget > blockset_selector_
std::optional< OverworldEntityEditingTarget > editing_target_
zelda3::GameEntity * current_entity() const
absl::Status Paste() override
void ScrollBlocksetCanvasToCurrentTile()
Scroll the blockset canvas to show the current selected tile16.
static constexpr auto kPaintBatchTimeout
bool DeleteSelectedItem()
Delete selected item and preserve nearest-item selection continuity.
std::unique_ptr< TilePaintingManager > tile_painting_
absl::Status LoadGraphics()
Load the Bitmap objects for each OverworldMap.
void RefreshChildMapOnDemand(int map_index)
absl::Status Find() override
OverworldItemsSnapshot CaptureItemUndoSnapshot() const
void RequestJumpToRoom(int room_id)
Trigger a jump to a dungeon room.
absl::Status SaveScratchPad() const
std::unique_ptr< DebugWindowCard > debug_window_card_
void SelectMapForEditing(int map_id, bool respect_pin=true)
std::unique_ptr< OverworldInteractionCoordinator > interaction_coordinator_
zelda3::GameEntity * current_entity_
void HandleKeyboardShortcuts()
Handle overworld keyboard shortcuts and edit-mode hotkeys.
zelda3::OverworldExit edit_exit_
int AutomationGetTile(int x, int y)
Definition automation.cc:58
std::unique_ptr< EntityMutationService > entity_mutation_service_
void ClearSelectedItem()
Clear active item selection.
void InitTilePaintingManager()
Initialize the tile painting manager (called after graphics load)
bool SelectItemByIdentity(const zelda3::OverworldItem &item_identity)
Select an overworld item using value identity matching.
Authoritative component for entity editing state and UI.
Allows the user to view and edit in game palettes.
A session-aware status bar displayed at the bottom of the application.
Definition status_bar.h:54
Popup window to edit Tile16 data.
void SetGameData(zelda3::GameData *game_data)
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:67
Shared graphical context across editors.
Defines an abstract interface for all rendering operations.
Definition irenderer.h:60
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Modern, robust canvas for drawing and manipulating graphics.
Definition canvas.h:64
Base class for all overworld and dungeon entities.
Definition common.h:31
Represents an overworld exit that transitions from dungeon to overworld.
Represents the full Overworld data, light and dark world.
Definition overworld.h:389
void set_current_world(int world)
Definition overworld.h:735
void SetGameData(GameData *game_data)
Definition overworld.h:394
auto overworld_map(int i) const
Definition overworld.h:662
void set_current_map(int i)
Definition overworld.h:734
A class for managing sprites in the overworld and underworld.
Definition sprite.h:37
constexpr ImVec2 kOverworldCanvasSize(kOverworldMapSize *8, kOverworldMapSize *8)
constexpr absl::string_view kOWMapTable
constexpr ImGuiTableFlags kOWMapFlags
constexpr unsigned int kOverworldMapSize
constexpr absl::string_view kWorldList
constexpr absl::string_view kGamePartComboString
constexpr unsigned int kNumSheetsToLoad
constexpr ImVec2 kCurrentGfxCanvasSize(0x100+1, 0x10 *0x40+1)
constexpr ImVec2 kBlocksetCanvasSize(0x100+1, 0x4000+1)
constexpr ImVec2 kGraphicsBinCanvasSize(0x100+1, kNumSheetsToLoad *0x40+1)
constexpr unsigned int kByteSize
constexpr unsigned int k4BPP
constexpr unsigned int kMessageIdSize
std::unordered_map< int, std::unique_ptr< gfx::Bitmap > > BitmapTable
Definition bitmap.h:518
constexpr int kNumOverworldMaps
Definition common.h:85
std::vector< std::vector< uint16_t > > OverworldBlockset
Represents tile32 data for the overworld.
Unified dependency container for all editor types.
Definition editor.h:169
GfxGroupWorkspaceState * gfx_group_workspace
Definition editor.h:178
std::vector< std::pair< std::pair< int, int >, int > > tile_changes
std::chrono::steady_clock::time_point timestamp
std::array< std::array< int, 32 >, 32 > tile_data
Snapshot of overworld item list + current item selection.
Tilemap structure for SNES tile-based graphics management.
Definition tilemap.h:118