1#ifndef YAZE_APP_EDITOR_OVERWORLDEDITOR_H
2#define YAZE_APP_EDITOR_OVERWORLDEDITOR_H
4#include "absl/status/status.h"
20#include "imgui/imgui.h"
26constexpr unsigned int k4BPP = 4;
38 ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable |
39 ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingStretchProp;
42 "Light World\0Dark World\0Extra World\0";
74 absl::Status
Load()
override;
75 absl::Status
Update() final;
76 absl::Status
Undo()
override {
return absl::UnimplementedError(
"Undo"); }
77 absl::Status
Redo()
override {
return absl::UnimplementedError(
"Redo"); }
78 absl::Status
Cut()
override {
return absl::UnimplementedError(
"Cut"); }
79 absl::Status
Copy()
override;
80 absl::Status
Paste()
override;
81 absl::Status
Find()
override {
return absl::UnimplementedError(
"Find"); }
82 absl::Status
Save()
override;
83 absl::Status
Clear()
override;
102 if (!
rom_)
return "No ROM loaded";
104 return absl::StrFormat(
"ROM loaded: %s",
rom_->
title());
142 const std::vector<uint8_t>& tile_data);
344 std::array<gfx::Bitmap, zelda3::kNumOverworldMaps>
maps_bmp_;
The Rom class is used to load, save, and modify Rom data.
Interface for editor classes.
Manage graphics group configurations in a Rom.
Manipulates the Overworld and OverworldMap data in a Rom.
absl::Status Clear() override
std::unique_ptr< MapPropertiesSystem > map_properties_system_
zelda3::OverworldItem current_item_
void HandleMapInteraction()
bool overworld_canvas_fullscreen_
bool map_blockset_loaded_
absl::Status UpdateUsageStats()
bool selected_tile_loaded_
absl::Status DrawScratchSpace()
zelda3::OverworldEntranceTileTypes entrance_tiletypes_
zelda3::OverworldEntrance current_entrance_
void CenterOverworldView()
std::array< ScratchSpaceSlot, 4 > scratch_spaces_
absl::Status ApplyZSCustomOverworldASM(int target_version)
Apply ZSCustomOverworld ASM patch to upgrade ROM version.
zelda3::Sprite current_sprite_
absl::Status ClearScratchSpace(int slot)
absl::Status CheckForCurrentMap()
Check for changes to the overworld map. Calls RefreshOverworldMap and RefreshTile16Blockset on the cu...
void DrawOverworldEdits()
absl::Status Cut() override
void ForceRefreshGraphics(int map_index)
std::vector< int > selected_tile16_ids_
gfx::Bitmap current_gfx_bmp_
gfx::Tilemap tile16_blockset_
bool show_tile8_selector_
zelda3::OverworldBlockset refresh_blockset_
gfx::Bitmap selected_tile_bmp_
void ResetOverworldView()
bool middle_mouse_dragging_
Tile16Editor tile16_editor_
void DrawScratchSpaceSelection()
gui::Canvas ow_map_canvas_
bool use_area_specific_bg_color_
absl::Status Undo() override
zelda3::GameEntity * dragged_entity_
bool show_tile16_selector_
std::array< gfx::Bitmap, zelda3::kNumOverworldMaps > maps_bmp_
bool show_map_properties_panel_
void RefreshOverworldMap()
void CheckForOverworldEdits()
Check for changes to the overworld map.
absl::Status UpdateROMVersionMarkers(int target_version)
Update ROM version markers and feature flags after ASM patching.
zelda3::OverworldExit current_exit_
void RefreshMapProperties()
void RefreshSiblingMapGraphics(int map_index, bool include_self=false)
void DrawScratchSpacePattern()
gui::Canvas scratch_canvas_
void RenderUpdatedMapBitmap(const ImVec2 &click_position, const std::vector< uint8_t > &tile_data)
gui::Canvas * GetOverworldCanvas()
absl::Status SaveCurrentSelectionToScratch(int slot)
void set_current_map(int map_id)
void DrawScratchSpaceEdits()
void RefreshOverworldMapOnDemand(int map_index)
On-demand map refresh that only updates what's actually needed.
gui::Canvas current_gfx_canvas_
void Initialize() override
bool show_overlay_editor_
absl::Status Redo() override
void SetupCanvasAutomation()
void HandleOverworldPan()
void DrawFullscreenCanvas()
bool dragged_entity_free_movement_
void DrawOverworldProperties()
bool AutomationSetTile(int x, int y, int tile_id)
absl::Status RefreshMapPalette()
void RefreshMultiAreaMapsSafely(int map_index, zelda3::OverworldMap *map)
Safely refresh multi-area maps without recursion.
void DrawOverworldCanvas()
gui::Canvas blockset_canvas_
absl::Status RefreshTile16Blockset()
zelda3::Overworld & overworld()
void UpdateBlocksetSelectorState()
void CheckForSelectRectangle()
Draw and create the tile16 IDs that are currently selected.
void RefreshChildMap(int map_index)
std::unique_ptr< OverworldEntityRenderer > entity_renderer_
absl::Status Load() override
void EnsureMapTexture(int map_index)
Ensure a specific map has its texture created.
absl::Status LoadScratchToSelection(int slot)
void Initialize(gfx::IRenderer *renderer, Rom *rom)
std::vector< gfx::Bitmap > sprite_previews_
absl::Status Copy() override
std::string GetRomStatus() const override
absl::Status DrawAreaGraphics()
EntityEditMode entity_edit_mode_
PaletteEditor palette_editor_
bool IsRomLoaded() const override
bool show_gfx_group_editor_
GfxGroupEditor gfx_group_editor_
void ProcessDeferredTextures()
Create textures for deferred map bitmaps on demand.
absl::Status Update() final
std::unique_ptr< gui::TileSelectorWidget > blockset_selector_
bool show_overlay_preview_
bool show_properties_editor_
absl::Status Paste() override
void ScrollBlocksetCanvasToCurrentTile()
Scroll the blockset canvas to show the current selected tile16.
EditingMode previous_mode
gui::Canvas graphics_bin_canvas_
gfx::BitmapTable current_graphics_set_
bool show_custom_bg_color_editor_
zelda3::Overworld overworld_
absl::Status LoadGraphics()
Load the Bitmap objects for each OverworldMap.
void RefreshChildMapOnDemand(int map_index)
On-demand child map refresh with selective updates.
absl::Status Find() override
absl::Status LoadSpriteGraphics()
gfx::IRenderer * renderer_
absl::Status Save() override
void HandleOverworldZoom()
zelda3::GameEntity * current_entity_
void UpdateScratchBitmapTile(int tile_x, int tile_y, int tile_id, int slot=-1)
gui::Canvas properties_canvas_
int current_scratch_slot_
int AutomationGetTile(int x, int y)
gfx::SnesPalette palette_
gfx::Bitmap tile16_blockset_bmp_
absl::Status DrawTile16Selector()
OverworldEditor(Rom *rom)
Allows the user to view and edit in game palettes.
Popup window to edit Tile16 data.
Represents a bitmap image optimized for SNES ROM hacking.
Shared graphical context across editors.
Defines an abstract interface for all rendering operations.
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Modern, robust canvas for drawing and manipulating graphics.
Base class for all overworld and dungeon entities.
Represents a single Overworld map screen.
Represents the full Overworld data, light and dark world.
A class for managing sprites in the overworld and underworld.
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, gfx::Bitmap > BitmapTable
constexpr int kNumOverworldMaps
std::vector< std::vector< uint16_t > > OverworldBlockset
Represents tile32 data for the overworld.
Main namespace for the application.
std::array< std::array< int, 32 >, 32 > tile_data
std::vector< ImVec2 > selected_tiles
gfx::Bitmap scratch_bitmap
std::vector< ImVec2 > selected_points
Tilemap structure for SNES tile-based graphics management.