yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
map_refresh_coordinator.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_OVERWORLD_MAP_REFRESH_COORDINATOR_H
2#define YAZE_APP_EDITOR_OVERWORLD_MAP_REFRESH_COORDINATOR_H
3
4#include <array>
5#include <functional>
6
7#include "absl/status/status.h"
11#include "zelda3/common.h"
13
14namespace yaze {
15
16class Rom;
17
18namespace gfx {
19class IRenderer;
20} // namespace gfx
21
22namespace editor {
23
24class Tile16Editor;
25
26// =============================================================================
27// MapRefreshCoordinator
28// =============================================================================
29//
30// Extracted from OverworldEditor to encapsulate the Map Refresh System.
31// Handles refreshing map graphics, palettes, tilesets, and multi-area
32// coordination after property changes.
33//
34// This class does not own any of the data it operates on. It holds
35// pointers/references to data owned by OverworldEditor.
36// =============================================================================
37
42 Rom* rom = nullptr;
44 std::array<gfx::Bitmap, zelda3::kNumOverworldMaps>* maps_bmp = nullptr;
51
52 // Mutable state references (owned by OverworldEditor)
53 int* current_world = nullptr;
54 int* current_map = nullptr;
55 int* current_blockset = nullptr;
56 int* game_state = nullptr;
57 bool* map_blockset_loaded = nullptr;
58 absl::Status* status = nullptr;
59
62 std::function<void(int map_index)> ensure_map_texture;
63};
64
66 public:
67 explicit MapRefreshCoordinator(const MapRefreshContext& ctx) : ctx_(ctx) {}
68
69 // ===========================================================================
70 // Map Refresh Methods
71 // ===========================================================================
72
75 void InvalidateGraphicsCache(int map_id = -1);
76
78 void RefreshChildMap(int map_index);
79
82
84 void RefreshOverworldMapOnDemand(int map_index);
85
87 void RefreshChildMapOnDemand(int map_index);
88
90 void RefreshMultiAreaMapsSafely(int map_index, zelda3::OverworldMap* map);
91
93 absl::Status RefreshMapPalette();
94
96 void ForceRefreshGraphics(int map_index);
97
99 void RefreshSiblingMapGraphics(int map_index, bool include_self = false);
100
103
105 absl::Status RefreshTile16Blockset();
106
109
110 private:
112};
113
114} // namespace editor
115} // namespace yaze
116
117#endif // YAZE_APP_EDITOR_OVERWORLD_MAP_REFRESH_COORDINATOR_H
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
void RefreshMapProperties()
Refresh map properties (copy parent properties to siblings)
void RefreshMultiAreaMapsSafely(int map_index, zelda3::OverworldMap *map)
Safely refresh multi-area maps without recursion.
void RefreshChildMapOnDemand(int map_index)
On-demand child map refresh with selective updates.
void RefreshChildMap(int map_index)
Refresh a child map's graphics pipeline (legacy full rebuild)
absl::Status RefreshMapPalette()
Refresh map palette after palette property changes.
void InvalidateGraphicsCache(int map_id=-1)
Invalidate cached graphics for a specific map or all maps.
void RefreshOverworldMap()
Refresh the current overworld map.
absl::Status RefreshTile16Blockset()
Refresh the tile16 blockset after graphics/palette changes.
MapRefreshCoordinator(const MapRefreshContext &ctx)
void RefreshSiblingMapGraphics(int map_index, bool include_self=false)
Refresh sibling map graphics for multi-area maps.
void UpdateBlocksetWithPendingTileChanges()
Update blockset atlas with pending tile16 editor changes.
void RefreshOverworldMapOnDemand(int map_index)
On-demand map refresh that only updates what's actually needed.
void ForceRefreshGraphics(int map_index)
Force refresh graphics for a specific map.
Popup window to edit Tile16 data.
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:67
Defines an abstract interface for all rendering operations.
Definition irenderer.h:60
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Represents a single Overworld map screen.
Represents the full Overworld data, light and dark world.
Definition overworld.h:261
std::unordered_map< int, std::unique_ptr< gfx::Bitmap > > BitmapTable
Definition bitmap.h:497
Context struct holding all data dependencies for map refresh operations. All pointers/references must...
std::function< void(int map_index)> ensure_map_texture
Callback to ensure a map texture is created (stays in OverworldEditor)
std::array< gfx::Bitmap, zelda3::kNumOverworldMaps > * maps_bmp
Tilemap structure for SNES tile-based graphics management.
Definition tilemap.h:118