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#include <string>
7
8#include "absl/status/status.h"
12#include "zelda3/common.h"
14
15namespace yaze {
16
17class Rom;
18
19namespace gfx {
20class IRenderer;
21} // namespace gfx
22
23namespace editor {
24
25class Tile16Editor;
26
27// =============================================================================
28// MapRefreshCoordinator
29// =============================================================================
30//
31// Extracted from OverworldEditor to encapsulate the Map Refresh System.
32// Handles refreshing map graphics, palettes, tilesets, and multi-area
33// coordination after property changes.
34//
35// This class does not own any of the data it operates on. It holds
36// pointers/references to data owned by OverworldEditor.
37// =============================================================================
38
43 Rom* rom = nullptr;
45 std::array<gfx::Bitmap, zelda3::kExpandedMapCount>* maps_bmp = nullptr;
52
53 // Mutable state references (owned by OverworldEditor)
54 int* current_world = nullptr;
55 int* current_map = nullptr;
56 int* current_blockset = nullptr;
57 int* game_state = nullptr;
58 bool* map_blockset_loaded = nullptr;
59 absl::Status* status = nullptr;
60
63 std::function<void(int map_index)> ensure_map_texture;
64};
65
67 public:
68 explicit MapRefreshCoordinator(const MapRefreshContext& ctx) : ctx_(ctx) {}
69
70 // ===========================================================================
71 // Map Refresh Methods
72 // ===========================================================================
73
76 void InvalidateGraphicsCache(int map_id = -1);
77
80
81 // Color-only refresh of materialized maps, including cached other worlds.
82 // Unbuilt maps resolve current GameData colors when they are first built.
83 absl::Status RefreshPaletteUsers(const std::string& group, int palette_index);
84
86 void RefreshChildMap(int map_index);
87
90
92 void RefreshOverworldMapOnDemand(int map_index);
93
95 void RefreshChildMapOnDemand(int map_index);
96
98 void RefreshMultiAreaMapsSafely(int map_index, zelda3::OverworldMap* map);
99
101 // Explicit targets let undo refresh an area without changing selection.
102 absl::Status RefreshMapPalette(int map_id = -1);
103
105 void ForceRefreshGraphics(int map_index);
106
108 void RefreshSiblingMapGraphics(int map_index, bool include_self = false);
109
111 void RefreshMapProperties(int map_id = -1);
112
114 absl::Status RefreshTile16Blockset();
115
118
119 private:
121};
122
123} // namespace editor
124} // namespace yaze
125
126#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:49
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 RefreshPaletteUsers(const std::string &group, int palette_index)
void InvalidateTile16Definitions()
Shared Tile16 definitions affect maps in every world, including hidden maps.
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.
absl::Status RefreshMapPalette(int map_id=-1)
Refresh map palette after palette property changes.
MapRefreshCoordinator(const MapRefreshContext &ctx)
void RefreshMapProperties(int map_id=-1)
Refresh map properties (copy parent properties to siblings)
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.
ImGui façade for Tile16 editing; domain state lives in Tile16EditSession.
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:70
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.
std::unordered_map< int, std::unique_ptr< gfx::Bitmap > > BitmapTable
Definition bitmap.h:549
Context struct holding all data dependencies for map refresh operations. All pointers/references must...
std::array< gfx::Bitmap, zelda3::kExpandedMapCount > * maps_bmp
std::function< void(int map_index)> ensure_map_texture
Callback to ensure a map texture is created (stays in OverworldEditor)
Tilemap structure for SNES tile-based graphics management.
Definition tilemap.h:118