feat(editor): implement overworld map editing features in ScreenEditor

- Added functionality for managing the overworld map, including loading, rendering, and saving map data for both Light and Dark Worlds.
- Introduced new canvas components for overworld map editing, allowing users to select and paint tiles directly onto the map.
- Enhanced the ScreenEditor with controls for tile flipping and palette selection, improving the user interface for overworld map management.

Benefits:
- Expands the capabilities of the ScreenEditor, providing users with tools to edit and manage the overworld map effectively.
- Improves user experience by enabling intuitive tile editing and visual feedback during map modifications.
This commit is contained in:
scawful
2025-10-13 16:51:55 -04:00
parent 965bb0946b
commit 1314d9daf9
7 changed files with 760 additions and 36 deletions

View File

@@ -33,6 +33,10 @@ class TitleScreen {
auto& bg1_buffer() { return tiles_bg1_buffer_; }
auto& bg2_buffer() { return tiles_bg2_buffer_; }
auto& oam_buffer() { return oam_data_; }
// Mutable accessors for editing
auto& mutable_bg1_buffer() { return tiles_bg1_buffer_; }
auto& mutable_bg2_buffer() { return tiles_bg2_buffer_; }
// Accessors for bitmaps
auto& bg1_bitmap() { return tiles_bg1_bitmap_; }
@@ -47,6 +51,18 @@ class TitleScreen {
// Save changes back to ROM
absl::Status Save(Rom* rom);
/**
* @brief Render BG1 tilemap into bitmap pixels
* Converts tile IDs from tiles_bg1_buffer_ into pixel data
*/
absl::Status RenderBG1Layer();
/**
* @brief Render BG2 tilemap into bitmap pixels
* Converts tile IDs from tiles_bg2_buffer_ into pixel data
*/
absl::Status RenderBG2Layer();
private:
/**
* @brief Build the tile16 blockset from ROM graphics
@@ -60,18 +76,6 @@ class TitleScreen {
*/
absl::Status LoadTitleScreen(Rom* rom);
/**
* @brief Render BG1 tilemap into bitmap pixels
* Converts tile IDs from tiles_bg1_buffer_ into pixel data
*/
absl::Status RenderBG1Layer();
/**
* @brief Render BG2 tilemap into bitmap pixels
* Converts tile IDs from tiles_bg2_buffer_ into pixel data
*/
absl::Status RenderBG2Layer();
int pal_selected_ = 2;
std::array<uint16_t, 0x1000> tiles_bg1_buffer_; // BG1 tilemap (32x32 tiles)