yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::Tile16Editor Class Reference

Popup window to edit Tile16 data. More...

#include <tile16_editor.h>

Inheritance diagram for yaze::editor::Tile16Editor:

Classes

struct  LayoutScratch
 
struct  UndoState
 

Public Member Functions

 Tile16Editor (Rom *rom, gfx::Tilemap *tile16_blockset)
 
absl::Status Initialize (const gfx::Bitmap &tile16_blockset_bmp, const gfx::Bitmap &current_gfx_bmp, std::array< uint8_t, 0x200 > &all_tiles_types)
 
absl::Status Update ()
 
absl::Status UpdateAsPanel ()
 Update the editor content without MenuBar (for EditorPanel usage)
 
void DrawContextMenu ()
 Draw context menu with editor actions.
 
void DrawTile16Editor ()
 
absl::Status UpdateBlockset ()
 
void DrawScratchSpace ()
 
absl::Status SaveLayoutToScratch (int slot)
 
absl::Status LoadLayoutFromScratch (int slot)
 
absl::Status DrawToCurrentTile16 (ImVec2 pos, const gfx::Bitmap *source_tile=nullptr)
 
absl::Status UpdateTile16Edit ()
 
absl::Status LoadTile8 ()
 
absl::Status SetCurrentTile (int id)
 
void RequestTileSwitch (int target_tile_id)
 
absl::Status CopyTile16ToClipboard (int tile_id)
 
absl::Status PasteTile16FromClipboard ()
 
absl::Status SaveTile16ToScratchSpace (int slot)
 
absl::Status LoadTile16FromScratchSpace (int slot)
 
absl::Status ClearScratchSpace (int slot)
 
absl::Status FlipTile16Horizontal ()
 
absl::Status FlipTile16Vertical ()
 
absl::Status RotateTile16 ()
 
absl::Status FillTile16WithTile8 (int tile8_id)
 
absl::Status AutoTileTile16 ()
 
absl::Status ClearTile16 ()
 
absl::Status CyclePalette (bool forward=true)
 
absl::Status ApplyPaletteToAll (uint8_t palette_id)
 
absl::Status PreviewPaletteChange (uint8_t palette_id)
 
absl::Status ApplyToSelection (const std::function< void(int)> &operation)
 
absl::Status BatchEdit (const std::vector< int > &tile_ids, const std::function< void(int)> &operation)
 
absl::Status Undo ()
 
absl::Status Redo ()
 
void SaveUndoState ()
 
void EnableLivePreview (bool enable)
 
absl::Status UpdateLivePreview ()
 
absl::Status ValidateTile16Data ()
 
bool IsTile16Valid (int tile_id) const
 
absl::Status SaveTile16ToROM ()
 Write current tile16 data directly to ROM (bypasses pending system)
 
absl::Status UpdateOverworldTilemap ()
 Update the overworld tilemap to reflect tile changes.
 
absl::Status CommitChangesToBlockset ()
 Commit pending changes to the blockset atlas.
 
absl::Status CommitChangesToOverworld ()
 Full commit workflow: ROM + blockset + notify parent.
 
absl::Status DiscardChanges ()
 Discard current tile's changes (single tile)
 
bool has_pending_changes () const
 Check if any tiles have uncommitted changes.
 
int pending_changes_count () const
 Get count of tiles with pending changes.
 
bool is_tile_modified (int tile_id) const
 Check if a specific tile has pending changes.
 
const gfx::BitmapGetPendingTileBitmap (int tile_id) const
 Get preview bitmap for a pending tile (nullptr if not modified)
 
absl::Status CommitAllChanges ()
 Write all pending changes to ROM and notify parent.
 
void DiscardAllChanges ()
 Discard all pending changes (revert to ROM state)
 
void DiscardCurrentTileChanges ()
 Discard only the current tile's pending changes.
 
void MarkCurrentTileModified ()
 Mark the current tile as having pending changes.
 
absl::Status UpdateTile8Palette (int tile8_id)
 Update palette for a specific tile8.
 
absl::Status RefreshAllPalettes ()
 Refresh all tile8 palettes after a palette change.
 
void DrawPaletteSettings ()
 Draw palette settings UI.
 
int GetPaletteSlotForSheet (int sheet_index) const
 Get base palette slot for a graphics sheet.
 
int GetActualPaletteSlot (int palette_button, int sheet_index) const
 Calculate actual palette slot from button + sheet.
 
int GetPaletteBaseForSheet (int sheet_index) const
 Get palette base row for a graphics sheet.
 
int GetSheetIndexForTile8 (int tile8_id) const
 Determine which graphics sheet contains a tile8.
 
int GetActualPaletteSlotForCurrentTile16 () const
 Get the palette slot for the current tile being edited.
 
gfx::SnesPalette CreateRemappedPaletteForViewing (const gfx::SnesPalette &source, int target_row) const
 Create a remapped palette for viewing with user-selected palette.
 
int GetEncodedPaletteRow (uint8_t pixel_value) const
 Get the encoded palette row for a pixel value.
 
absl::Status UpdateROMTile16Data ()
 
absl::Status RefreshTile16Blockset ()
 
gfx::Tile16GetCurrentTile16Data ()
 
absl::Status RegenerateTile16BitmapFromROM ()
 
absl::Status UpdateBlocksetBitmap ()
 
absl::Status PickTile8FromTile16 (const ImVec2 &position)
 
void DrawManualTile8Inputs ()
 
void SetRom (Rom *rom)
 
Romrom () const
 
void SetGameData (zelda3::GameData *game_data)
 
zelda3::GameDatagame_data () const
 
void set_palette (const gfx::SnesPalette &palette)
 
void set_on_changes_committed (std::function< absl::Status()> callback)
 
int current_palette () const
 
void set_current_palette (int palette)
 
int current_tile16 () const
 
int current_tile8 () const
 
void AnalyzeTile8SourceData () const
 

Private Member Functions

void ApplyPaletteToCurrentTile16Bitmap ()
 

Private Attributes

Romrom_ = nullptr
 
zelda3::GameDatagame_data_ = nullptr
 
bool map_blockset_loaded_ = false
 
bool x_flip = false
 
bool y_flip = false
 
bool priority_tile = false
 
int tile_size
 
int current_tile16_ = 0
 
int current_tile8_ = 0
 
uint8_t current_palette_ = 0
 
gfx::Bitmap clipboard_tile16_
 
bool clipboard_has_data_ = false
 
std::array< gfx::Bitmap, 4 > scratch_space_
 
std::array< bool, 4 > scratch_space_used_ = {false, false, false, false}
 
std::array< LayoutScratch, 4 > layout_scratch_
 
std::vector< UndoStateundo_stack_
 
std::vector< UndoStateredo_stack_
 
bool live_preview_enabled_ = true
 
gfx::Bitmap preview_tile16_
 
bool preview_dirty_ = false
 
gfx::Bitmap tile8_preview_bmp_
 
std::vector< int > selected_tiles_
 
int selection_start_tile_ = -1
 
bool multi_select_mode_ = false
 
bool auto_tile_mode_ = false
 
bool grid_snap_enabled_ = true
 
bool show_tile_info_ = true
 
bool show_palette_preview_ = true
 
bool show_palette_settings_ = false
 
int current_palette_group_ = 0
 
uint8_t palette_normalization_mask_
 
bool auto_normalize_pixels_
 
std::chrono::steady_clock::time_point last_edit_time_
 
bool batch_mode_ = false
 
std::map< int, gfx::Tile16pending_tile16_changes_
 
std::map< int, gfx::Bitmappending_tile16_bitmaps_
 
bool show_unsaved_changes_dialog_ = false
 
int pending_tile_switch_target_ = -1
 
int jump_to_tile_id_ = 0
 
bool scroll_to_current_ = false
 
int current_page_ = 0
 
util::NotifyValue< uint32_t > notify_tile16
 
util::NotifyValue< uint8_t > notify_palette
 
std::array< uint8_t, 0x200 > all_tiles_types_
 
gui::Canvas blockset_canvas_
 
gui::TileSelectorWidget blockset_selector_ {"Tile16BlocksetSelector"}
 
gfx::Bitmap tile16_blockset_bmp_
 
gui::Canvas tile16_edit_canvas_
 
gfx::Bitmap current_tile16_bmp_
 
gui::Canvas tile8_source_canvas_
 
gfx::Bitmap current_gfx_bmp_
 
gui::Table tile_edit_table_
 
gfx::Tilemaptile16_blockset_ = nullptr
 
std::vector< gfx::Bitmapcurrent_gfx_individual_
 
PaletteEditor palette_editor_
 
gfx::SnesPalette palette_
 
gfx::SnesPalette overworld_palette_
 
absl::Status status_
 
std::function< absl::Status()> on_changes_committed_
 
gfx::Tile16 current_tile16_data_
 

Static Private Attributes

static constexpr size_t kMaxUndoStates_ = 50
 
static constexpr int kTilesPerPage = 64
 
static constexpr int kTilesPerRow = 8
 

Additional Inherited Members

- Static Protected Attributes inherited from yaze::gfx::GfxContext
static std::unordered_map< uint8_t, gfx::Palettesetpalettesets_
 

Detailed Description

Popup window to edit Tile16 data.

Provides visual editing of 16x16 tiles composed of four 8x8 sub-tiles. Uses a pending changes system to prevent accidental ROM modifications.

See also
README.md for architecture overview and workflow documentation

Definition at line 109 of file tile16_editor.h.

Constructor & Destructor Documentation

◆ Tile16Editor()

yaze::editor::Tile16Editor::Tile16Editor ( Rom * rom,
gfx::Tilemap * tile16_blockset )
inline

Definition at line 111 of file tile16_editor.h.

Member Function Documentation

◆ Initialize()

◆ Update()

◆ UpdateAsPanel()

◆ DrawContextMenu()

void yaze::editor::Tile16Editor::DrawContextMenu ( )

◆ DrawTile16Editor()

void yaze::editor::Tile16Editor::DrawTile16Editor ( )

Definition at line 335 of file tile16_editor.cc.

References status_, and UpdateTile16Edit().

Referenced by Update(), and UpdateAsPanel().

Here is the call graph for this function:

◆ UpdateBlockset()

◆ DrawScratchSpace()

void yaze::editor::Tile16Editor::DrawScratchSpace ( )

Definition at line 3323 of file tile16_editor.cc.

References layout_scratch_.

Referenced by UpdateTile16Edit().

◆ SaveLayoutToScratch()

absl::Status yaze::editor::Tile16Editor::SaveLayoutToScratch ( int slot)

Definition at line 3342 of file tile16_editor.cc.

References layout_scratch_.

◆ LoadLayoutFromScratch()

absl::Status yaze::editor::Tile16Editor::LoadLayoutFromScratch ( int slot)

Definition at line 3355 of file tile16_editor.cc.

References layout_scratch_.

◆ DrawToCurrentTile16()

◆ UpdateTile16Edit()

absl::Status yaze::editor::Tile16Editor::UpdateTile16Edit ( )

Definition at line 968 of file tile16_editor.cc.

References AnalyzeTile8SourceData(), yaze::gfx::Tilemap::atlas, yaze::gui::BeginCanvas(), blockset_canvas_, yaze::gui::CanvasFrameOptions::canvas_size, ClearTile16(), CommitAllChanges(), CommitChangesToOverworld(), CopyTile16ToClipboard(), yaze::gfx::Bitmap::Create(), yaze::gfx::Arena::CREATE, current_gfx_bmp_, current_gfx_individual_, current_page_, current_palette_, current_tile16_, current_tile16_bmp_, current_tile8_, DiscardAllChanges(), DiscardChanges(), yaze::gui::CanvasFrameOptions::draw_context_menu, yaze::gui::CanvasFrameOptions::draw_grid, yaze::gui::CanvasFrameOptions::draw_overlay, yaze::gui::Canvas::DrawBitmap(), DrawManualTile8Inputs(), DrawPaletteSettings(), DrawScratchSpace(), yaze::gui::Canvas::DrawTilePainter(), yaze::gui::Canvas::DrawTileSelector(), DrawToCurrentTile16(), yaze::gfx::SnesPalette::empty(), yaze::gui::EndCanvas(), yaze::gfx::Arena::Get(), GetActualPaletteSlot(), GetActualPaletteSlotForCurrentTile16(), yaze::gui::Canvas::GetGlobalScale(), GetSheetIndexForTile8(), yaze::gui::CanvasFrameOptions::grid_step, has_pending_changes(), HOVER_HINT, yaze::gfx::Bitmap::is_active(), yaze::gui::Canvas::IsMouseHovering(), jump_to_tile_id_, yaze::zelda3::kNumTile16Individual, yaze::editor::kTile8DisplayScale, yaze::editor::kTile8PixelCount, kTilesPerPage, kTilesPerRow, yaze::util::logf(), yaze::gfx::Bitmap::mutable_data(), overworld_palette_, palette_, PasteTile16FromClipboard(), pending_changes_count(), PickTile8FromTile16(), priority_tile, yaze::gfx::Arena::QueueTextureCommand(), RefreshAllPalettes(), RefreshTile16Blockset(), yaze::gui::CanvasFrameOptions::render_popups, RequestTileSwitch(), RETURN_IF_ERROR, scroll_to_current_, yaze::gfx::Bitmap::set_data(), yaze::gui::Canvas::set_draggable(), yaze::gfx::Bitmap::SetPaletteWithTransparent(), show_palette_settings_, yaze::gui::Canvas::ShowAdvancedCanvasProperties(), yaze::gui::Canvas::ShowScalingControls(), yaze::gfx::Bitmap::size(), yaze::gfx::SnesPalette::size(), yaze::gfx::Bitmap::texture(), tile16_blockset_, tile16_blockset_bmp_, tile16_edit_canvas_, tile8_preview_bmp_, tile8_source_canvas_, Undo(), undo_stack_, yaze::gfx::Arena::UPDATE, yaze::gfx::Bitmap::UpdateSurfacePixels(), UpdateTile8Palette(), yaze::gui::CanvasFrameOptions::use_child_window, yaze::gfx::Bitmap::width(), x_flip, y_flip, and yaze::gui::Canvas::zero_point().

Referenced by DrawTile16Editor().

◆ LoadTile8()

◆ SetCurrentTile()

◆ RequestTileSwitch()

void yaze::editor::Tile16Editor::RequestTileSwitch ( int target_tile_id)

◆ CopyTile16ToClipboard()

◆ PasteTile16FromClipboard()

◆ SaveTile16ToScratchSpace()

absl::Status yaze::editor::Tile16Editor::SaveTile16ToScratchSpace ( int slot)

◆ LoadTile16FromScratchSpace()

absl::Status yaze::editor::Tile16Editor::LoadTile16FromScratchSpace ( int slot)

◆ ClearScratchSpace()

absl::Status yaze::editor::Tile16Editor::ClearScratchSpace ( int slot)

Definition at line 2077 of file tile16_editor.cc.

References scratch_space_used_.

Referenced by DrawContextMenu(), and Update().

◆ FlipTile16Horizontal()

◆ FlipTile16Vertical()

◆ RotateTile16()

◆ FillTile16WithTile8()

◆ AutoTileTile16()

absl::Status yaze::editor::Tile16Editor::AutoTileTile16 ( )

◆ ClearTile16()

◆ CyclePalette()

absl::Status yaze::editor::Tile16Editor::CyclePalette ( bool forward = true)

Definition at line 2255 of file tile16_editor.cc.

References current_palette_, yaze::util::logf(), RefreshAllPalettes(), and RETURN_IF_ERROR.

Referenced by Update(), and UpdateAsPanel().

Here is the call graph for this function:

◆ ApplyPaletteToAll()

absl::Status yaze::editor::Tile16Editor::ApplyPaletteToAll ( uint8_t palette_id)

◆ PreviewPaletteChange()

◆ ApplyToSelection()

absl::Status yaze::editor::Tile16Editor::ApplyToSelection ( const std::function< void(int)> & operation)

◆ BatchEdit()

absl::Status yaze::editor::Tile16Editor::BatchEdit ( const std::vector< int > & tile_ids,
const std::function< void(int)> & operation )

◆ Undo()

◆ Redo()

◆ SaveUndoState()

◆ EnableLivePreview()

void yaze::editor::Tile16Editor::EnableLivePreview ( bool enable)
inline

Definition at line 186 of file tile16_editor.h.

References live_preview_enabled_.

Referenced by DrawContextMenu(), and Update().

◆ UpdateLivePreview()

◆ ValidateTile16Data()

absl::Status yaze::editor::Tile16Editor::ValidateTile16Data ( )

Definition at line 2387 of file tile16_editor.cc.

References yaze::gfx::Tilemap::atlas, current_palette_, current_tile16_, yaze::gfx::Bitmap::size(), and tile16_blockset_.

Here is the call graph for this function:

◆ IsTile16Valid()

bool yaze::editor::Tile16Editor::IsTile16Valid ( int tile_id) const

Definition at line 2404 of file tile16_editor.cc.

References yaze::gfx::Tilemap::atlas, yaze::gfx::Bitmap::size(), and tile16_blockset_.

Here is the call graph for this function:

◆ SaveTile16ToROM()

absl::Status yaze::editor::Tile16Editor::SaveTile16ToROM ( )

◆ UpdateOverworldTilemap()

◆ CommitChangesToBlockset()

absl::Status yaze::editor::Tile16Editor::CommitChangesToBlockset ( )

Commit pending changes to the blockset atlas.

Definition at line 2481 of file tile16_editor.cc.

References yaze::gfx::Tilemap::atlas, yaze::gfx::Arena::Get(), yaze::gfx::Bitmap::modified(), yaze::gfx::Arena::QueueTextureCommand(), tile16_blockset_, and yaze::gfx::Arena::UPDATE.

Referenced by DrawContextMenu(), SaveTile16ToROM(), Update(), and UpdateAsPanel().

Here is the call graph for this function:

◆ CommitChangesToOverworld()

◆ DiscardChanges()

absl::Status yaze::editor::Tile16Editor::DiscardChanges ( )

Discard current tile's changes (single tile)

Definition at line 2551 of file tile16_editor.cc.

References current_tile16_, yaze::util::logf(), RETURN_IF_ERROR, and SetCurrentTile().

Referenced by UpdateTile16Edit().

Here is the call graph for this function:

◆ has_pending_changes()

bool yaze::editor::Tile16Editor::has_pending_changes ( ) const
inline

Check if any tiles have uncommitted changes.

Definition at line 229 of file tile16_editor.h.

References pending_tile16_changes_.

Referenced by yaze::editor::OverworldEditor::Update(), yaze::editor::OverworldEditor::UpdateBlocksetWithPendingTileChanges(), and UpdateTile16Edit().

◆ pending_changes_count()

int yaze::editor::Tile16Editor::pending_changes_count ( ) const
inline

Get count of tiles with pending changes.

Definition at line 232 of file tile16_editor.h.

References pending_tile16_changes_.

Referenced by UpdateTile16Edit().

◆ is_tile_modified()

bool yaze::editor::Tile16Editor::is_tile_modified ( int tile_id) const
inline

Check if a specific tile has pending changes.

Definition at line 237 of file tile16_editor.h.

References pending_tile16_changes_.

Referenced by RequestTileSwitch(), and yaze::editor::OverworldEditor::UpdateBlocksetWithPendingTileChanges().

◆ GetPendingTileBitmap()

const gfx::Bitmap * yaze::editor::Tile16Editor::GetPendingTileBitmap ( int tile_id) const
inline

Get preview bitmap for a pending tile (nullptr if not modified)

Definition at line 242 of file tile16_editor.h.

References pending_tile16_bitmaps_.

Referenced by yaze::editor::OverworldEditor::UpdateBlocksetWithPendingTileChanges().

◆ CommitAllChanges()

absl::Status yaze::editor::Tile16Editor::CommitAllChanges ( )

Write all pending changes to ROM and notify parent.

Definition at line 2559 of file tile16_editor.cc.

References yaze::zelda3::kTile16Ptr, yaze::util::logf(), on_changes_committed_, pending_tile16_bitmaps_, pending_tile16_changes_, RefreshTile16Blockset(), RETURN_IF_ERROR, rom_, yaze::Rom::set_dirty(), and yaze::Rom::WriteTile16().

Referenced by UpdateTile16Edit().

Here is the call graph for this function:

◆ DiscardAllChanges()

void yaze::editor::Tile16Editor::DiscardAllChanges ( )

Discard all pending changes (revert to ROM state)

Definition at line 2594 of file tile16_editor.cc.

References current_tile16_, yaze::util::logf(), pending_tile16_bitmaps_, pending_tile16_changes_, and SetCurrentTile().

Referenced by UpdateTile16Edit().

Here is the call graph for this function:

◆ DiscardCurrentTileChanges()

void yaze::editor::Tile16Editor::DiscardCurrentTileChanges ( )

Discard only the current tile's pending changes.

Definition at line 2609 of file tile16_editor.cc.

References current_tile16_, yaze::util::logf(), pending_tile16_bitmaps_, pending_tile16_changes_, and SetCurrentTile().

Here is the call graph for this function:

◆ MarkCurrentTileModified()

void yaze::editor::Tile16Editor::MarkCurrentTileModified ( )

Mark the current tile as having pending changes.

Definition at line 2621 of file tile16_editor.cc.

References current_tile16_, current_tile16_bmp_, GetCurrentTile16Data(), yaze::util::logf(), pending_tile16_bitmaps_, and pending_tile16_changes_.

Referenced by ClearTile16(), DrawToCurrentTile16(), FillTile16WithTile8(), FlipTile16Horizontal(), FlipTile16Vertical(), and RotateTile16().

Here is the call graph for this function:

◆ UpdateTile8Palette()

◆ RefreshAllPalettes()

◆ DrawPaletteSettings()

◆ GetPaletteSlotForSheet()

int yaze::editor::Tile16Editor::GetPaletteSlotForSheet ( int sheet_index) const

Get base palette slot for a graphics sheet.

Parameters
sheet_indexGraphics sheet index (0-7)
Returns
Base palette offset (e.g., 10 for AUX, 2 for MAIN)

Definition at line 2688 of file tile16_editor.cc.

References current_palette_.

◆ GetActualPaletteSlot()

int yaze::editor::Tile16Editor::GetActualPaletteSlot ( int palette_button,
int sheet_index ) const

Calculate actual palette slot from button + sheet.

Parameters
palette_buttonUser-selected palette (0-7)
sheet_indexGraphics sheet the tile8 belongs to
Returns
Final palette slot index in 256-color palette

This is the core palette mapping function. It combines:

  • palette_button: Which of 8 sub-palettes user selected
  • sheet_index: Which graphics sheet contains the tile8 To produce the actual 256-color palette index.

Definition at line 2722 of file tile16_editor.cc.

Referenced by AnalyzeTile8SourceData(), GetActualPaletteSlotForCurrentTile16(), RefreshAllPalettes(), UpdateTile16Edit(), and UpdateTile8Palette().

◆ GetPaletteBaseForSheet()

int yaze::editor::Tile16Editor::GetPaletteBaseForSheet ( int sheet_index) const

Get palette base row for a graphics sheet.

Parameters
sheet_indexGraphics sheet index (0-7)
Returns
Base row index in the 16-row palette structure

Definition at line 2767 of file tile16_editor.cc.

◆ GetSheetIndexForTile8()

int yaze::editor::Tile16Editor::GetSheetIndexForTile8 ( int tile8_id) const

Determine which graphics sheet contains a tile8.

Parameters
tile8_idTile8 ID from the graphics buffer
Returns
Sheet index (0-7) based on tile position

Definition at line 2741 of file tile16_editor.cc.

Referenced by GetActualPaletteSlotForCurrentTile16(), RefreshAllPalettes(), UpdateTile16Edit(), and UpdateTile8Palette().

◆ GetActualPaletteSlotForCurrentTile16()

int yaze::editor::Tile16Editor::GetActualPaletteSlotForCurrentTile16 ( ) const

Get the palette slot for the current tile being edited.

Returns
Palette slot based on current_tile8_ and current_palette_

Definition at line 2753 of file tile16_editor.cc.

References current_gfx_individual_, current_palette_, current_tile8_, GetActualPaletteSlot(), and GetSheetIndexForTile8().

Referenced by ApplyPaletteToCurrentTile16Bitmap(), RefreshAllPalettes(), SetCurrentTile(), and UpdateTile16Edit().

Here is the call graph for this function:

◆ CreateRemappedPaletteForViewing()

gfx::SnesPalette yaze::editor::Tile16Editor::CreateRemappedPaletteForViewing ( const gfx::SnesPalette & source,
int target_row ) const

Create a remapped palette for viewing with user-selected palette.

Parameters
sourceFull 256-color palette
target_rowUser-selected palette row (0-7 maps to rows 2-9)
Returns
Remapped 256-color palette where all pixels map to target row

Definition at line 2797 of file tile16_editor.cc.

References yaze::gfx::SnesPalette::AddColor(), and yaze::gfx::SnesPalette::size().

Referenced by RefreshAllPalettes().

Here is the call graph for this function:

◆ GetEncodedPaletteRow()

int yaze::editor::Tile16Editor::GetEncodedPaletteRow ( uint8_t pixel_value) const

Get the encoded palette row for a pixel value.

Parameters
pixel_valueRaw pixel value from the graphics buffer
Returns
Palette row (0-15) that this pixel would use

Definition at line 2834 of file tile16_editor.cc.

Referenced by AnalyzeTile8SourceData().

◆ UpdateROMTile16Data()

absl::Status yaze::editor::Tile16Editor::UpdateROMTile16Data ( )

◆ RefreshTile16Blockset()

absl::Status yaze::editor::Tile16Editor::RefreshTile16Blockset ( )

◆ GetCurrentTile16Data()

gfx::Tile16 * yaze::editor::Tile16Editor::GetCurrentTile16Data ( )

◆ RegenerateTile16BitmapFromROM()

◆ UpdateBlocksetBitmap()

◆ PickTile8FromTile16()

◆ DrawManualTile8Inputs()

◆ SetRom()

void yaze::editor::Tile16Editor::SetRom ( Rom * rom)
inline

Definition at line 338 of file tile16_editor.h.

References rom(), and rom_.

Referenced by yaze::editor::OverworldEditor::Load().

Here is the call graph for this function:

◆ rom()

Rom * yaze::editor::Tile16Editor::rom ( ) const
inline

Definition at line 339 of file tile16_editor.h.

References rom_.

Referenced by SetRom().

◆ SetGameData()

void yaze::editor::Tile16Editor::SetGameData ( zelda3::GameData * game_data)
inline

Definition at line 340 of file tile16_editor.h.

References game_data(), and game_data_.

Referenced by yaze::editor::OverworldEditor::SetGameData().

Here is the call graph for this function:

◆ game_data()

zelda3::GameData * yaze::editor::Tile16Editor::game_data ( ) const
inline

◆ set_palette()

◆ set_on_changes_committed()

void yaze::editor::Tile16Editor::set_on_changes_committed ( std::function< absl::Status()> callback)
inline

Definition at line 376 of file tile16_editor.h.

References on_changes_committed_.

Referenced by yaze::editor::OverworldEditor::Load().

◆ current_palette()

int yaze::editor::Tile16Editor::current_palette ( ) const
inline

Definition at line 381 of file tile16_editor.h.

References current_palette_.

◆ set_current_palette()

void yaze::editor::Tile16Editor::set_current_palette ( int palette)
inline

Definition at line 382 of file tile16_editor.h.

References current_palette_.

◆ current_tile16()

int yaze::editor::Tile16Editor::current_tile16 ( ) const
inline

Definition at line 385 of file tile16_editor.h.

References current_tile16_.

◆ current_tile8()

int yaze::editor::Tile16Editor::current_tile8 ( ) const
inline

Definition at line 386 of file tile16_editor.h.

References current_tile8_.

◆ AnalyzeTile8SourceData()

◆ ApplyPaletteToCurrentTile16Bitmap()

Member Data Documentation

◆ rom_

◆ game_data_

zelda3::GameData* yaze::editor::Tile16Editor::game_data_ = nullptr
private

Definition at line 393 of file tile16_editor.h.

Referenced by game_data(), and SetGameData().

◆ map_blockset_loaded_

bool yaze::editor::Tile16Editor::map_blockset_loaded_ = false
private

Definition at line 394 of file tile16_editor.h.

Referenced by Initialize(), Update(), and UpdateAsPanel().

◆ x_flip

bool yaze::editor::Tile16Editor::x_flip = false
private

◆ y_flip

bool yaze::editor::Tile16Editor::y_flip = false
private

◆ priority_tile

bool yaze::editor::Tile16Editor::priority_tile = false
private

◆ tile_size

int yaze::editor::Tile16Editor::tile_size
private

Definition at line 399 of file tile16_editor.h.

◆ current_tile16_

◆ current_tile8_

int yaze::editor::Tile16Editor::current_tile8_ = 0
private

◆ current_palette_

◆ clipboard_tile16_

gfx::Bitmap yaze::editor::Tile16Editor::clipboard_tile16_
private

Definition at line 405 of file tile16_editor.h.

Referenced by CopyTile16ToClipboard(), and PasteTile16FromClipboard().

◆ clipboard_has_data_

bool yaze::editor::Tile16Editor::clipboard_has_data_ = false
private

Definition at line 406 of file tile16_editor.h.

Referenced by CopyTile16ToClipboard(), and PasteTile16FromClipboard().

◆ scratch_space_

std::array<gfx::Bitmap, 4> yaze::editor::Tile16Editor::scratch_space_
private

Definition at line 409 of file tile16_editor.h.

Referenced by LoadTile16FromScratchSpace(), and SaveTile16ToScratchSpace().

◆ scratch_space_used_

std::array<bool, 4> yaze::editor::Tile16Editor::scratch_space_used_ = {false, false, false, false}
private

◆ layout_scratch_

std::array<LayoutScratch, 4> yaze::editor::Tile16Editor::layout_scratch_
private

Definition at line 418 of file tile16_editor.h.

Referenced by DrawScratchSpace(), LoadLayoutFromScratch(), and SaveLayoutToScratch().

◆ undo_stack_

std::vector<UndoState> yaze::editor::Tile16Editor::undo_stack_
private

Definition at line 428 of file tile16_editor.h.

Referenced by SaveUndoState(), Undo(), and UpdateTile16Edit().

◆ redo_stack_

std::vector<UndoState> yaze::editor::Tile16Editor::redo_stack_
private

Definition at line 429 of file tile16_editor.h.

Referenced by Redo(), SaveUndoState(), and Undo().

◆ kMaxUndoStates_

constexpr size_t yaze::editor::Tile16Editor::kMaxUndoStates_ = 50
staticconstexprprivate

Definition at line 430 of file tile16_editor.h.

Referenced by SaveUndoState().

◆ live_preview_enabled_

bool yaze::editor::Tile16Editor::live_preview_enabled_ = true
private

◆ preview_tile16_

gfx::Bitmap yaze::editor::Tile16Editor::preview_tile16_
private

Definition at line 434 of file tile16_editor.h.

Referenced by PreviewPaletteChange(), and UpdateLivePreview().

◆ preview_dirty_

bool yaze::editor::Tile16Editor::preview_dirty_ = false
private

Definition at line 435 of file tile16_editor.h.

Referenced by PreviewPaletteChange(), and UpdateLivePreview().

◆ tile8_preview_bmp_

gfx::Bitmap yaze::editor::Tile16Editor::tile8_preview_bmp_
private

Definition at line 436 of file tile16_editor.h.

Referenced by UpdateTile16Edit().

◆ selected_tiles_

std::vector<int> yaze::editor::Tile16Editor::selected_tiles_
private

Definition at line 439 of file tile16_editor.h.

◆ selection_start_tile_

int yaze::editor::Tile16Editor::selection_start_tile_ = -1
private

Definition at line 440 of file tile16_editor.h.

◆ multi_select_mode_

bool yaze::editor::Tile16Editor::multi_select_mode_ = false
private

Definition at line 441 of file tile16_editor.h.

◆ auto_tile_mode_

bool yaze::editor::Tile16Editor::auto_tile_mode_ = false
private

Definition at line 444 of file tile16_editor.h.

◆ grid_snap_enabled_

bool yaze::editor::Tile16Editor::grid_snap_enabled_ = true
private

Definition at line 445 of file tile16_editor.h.

◆ show_tile_info_

bool yaze::editor::Tile16Editor::show_tile_info_ = true
private

Definition at line 446 of file tile16_editor.h.

◆ show_palette_preview_

bool yaze::editor::Tile16Editor::show_palette_preview_ = true
private

Definition at line 447 of file tile16_editor.h.

Referenced by PreviewPaletteChange().

◆ show_palette_settings_

bool yaze::editor::Tile16Editor::show_palette_settings_ = false
private

Definition at line 450 of file tile16_editor.h.

Referenced by DrawPaletteSettings(), and UpdateTile16Edit().

◆ current_palette_group_

int yaze::editor::Tile16Editor::current_palette_group_ = 0
private

Definition at line 451 of file tile16_editor.h.

Referenced by DrawPaletteSettings().

◆ palette_normalization_mask_

uint8_t yaze::editor::Tile16Editor::palette_normalization_mask_
private
Initial value:
=
0xFF

Definition at line 452 of file tile16_editor.h.

Referenced by DrawPaletteSettings().

◆ auto_normalize_pixels_

bool yaze::editor::Tile16Editor::auto_normalize_pixels_
private
Initial value:
=
false

Definition at line 454 of file tile16_editor.h.

Referenced by DrawPaletteSettings().

◆ last_edit_time_

std::chrono::steady_clock::time_point yaze::editor::Tile16Editor::last_edit_time_
private

Definition at line 458 of file tile16_editor.h.

Referenced by DrawToCurrentTile16().

◆ batch_mode_

bool yaze::editor::Tile16Editor::batch_mode_ = false
private

Definition at line 459 of file tile16_editor.h.

◆ pending_tile16_changes_

std::map<int, gfx::Tile16> yaze::editor::Tile16Editor::pending_tile16_changes_
private

◆ pending_tile16_bitmaps_

std::map<int, gfx::Bitmap> yaze::editor::Tile16Editor::pending_tile16_bitmaps_
private

◆ show_unsaved_changes_dialog_

bool yaze::editor::Tile16Editor::show_unsaved_changes_dialog_ = false
private

Definition at line 464 of file tile16_editor.h.

Referenced by RequestTileSwitch(), Update(), and UpdateAsPanel().

◆ pending_tile_switch_target_

int yaze::editor::Tile16Editor::pending_tile_switch_target_ = -1
private

Definition at line 465 of file tile16_editor.h.

Referenced by RequestTileSwitch(), Update(), and UpdateAsPanel().

◆ jump_to_tile_id_

int yaze::editor::Tile16Editor::jump_to_tile_id_ = 0
private

Definition at line 468 of file tile16_editor.h.

Referenced by SetCurrentTile(), and UpdateTile16Edit().

◆ scroll_to_current_

bool yaze::editor::Tile16Editor::scroll_to_current_ = false
private

Definition at line 469 of file tile16_editor.h.

Referenced by UpdateTile16Edit().

◆ current_page_

int yaze::editor::Tile16Editor::current_page_ = 0
private

Definition at line 470 of file tile16_editor.h.

Referenced by UpdateTile16Edit().

◆ kTilesPerPage

constexpr int yaze::editor::Tile16Editor::kTilesPerPage = 64
staticconstexprprivate

Definition at line 471 of file tile16_editor.h.

Referenced by UpdateTile16Edit().

◆ kTilesPerRow

constexpr int yaze::editor::Tile16Editor::kTilesPerRow = 8
staticconstexprprivate

◆ notify_tile16

util::NotifyValue<uint32_t> yaze::editor::Tile16Editor::notify_tile16
private

Definition at line 474 of file tile16_editor.h.

◆ notify_palette

util::NotifyValue<uint8_t> yaze::editor::Tile16Editor::notify_palette
private

Definition at line 475 of file tile16_editor.h.

◆ all_tiles_types_

std::array<uint8_t, 0x200> yaze::editor::Tile16Editor::all_tiles_types_
private

Definition at line 477 of file tile16_editor.h.

Referenced by Initialize().

◆ blockset_canvas_

gui::Canvas yaze::editor::Tile16Editor::blockset_canvas_
private
Initial value:

Definition at line 480 of file tile16_editor.h.

Referenced by Initialize(), UpdateBlockset(), and UpdateTile16Edit().

◆ blockset_selector_

gui::TileSelectorWidget yaze::editor::Tile16Editor::blockset_selector_ {"Tile16BlocksetSelector"}
private

Definition at line 483 of file tile16_editor.h.

Referenced by Initialize(), and UpdateBlockset().

◆ tile16_blockset_bmp_

gfx::Bitmap yaze::editor::Tile16Editor::tile16_blockset_bmp_
private

◆ tile16_edit_canvas_

gui::Canvas yaze::editor::Tile16Editor::tile16_edit_canvas_
private
Initial value:
{
"Tile16EditCanvas",
ImVec2(64, 64),

Definition at line 488 of file tile16_editor.h.

Referenced by DrawPaletteSettings(), Initialize(), and UpdateTile16Edit().

◆ current_tile16_bmp_

◆ tile8_source_canvas_

gui::Canvas yaze::editor::Tile16Editor::tile8_source_canvas_
private
Initial value:
{
"Tile8SourceCanvas",
constexpr int kTilesheetHeight
Definition snes_tile.h:17
constexpr int kTilesheetWidth
Definition snes_tile.h:16

Definition at line 495 of file tile16_editor.h.

Referenced by DrawContextMenu(), DrawPaletteSettings(), Initialize(), LoadTile8(), Update(), and UpdateTile16Edit().

◆ current_gfx_bmp_

gfx::Bitmap yaze::editor::Tile16Editor::current_gfx_bmp_
private

◆ tile_edit_table_

gui::Table yaze::editor::Tile16Editor::tile_edit_table_
private
Initial value:
{"##TileEditTable", 3, ImGuiTableFlags_Borders,
ImVec2(0, 0)}

Definition at line 501 of file tile16_editor.h.

Referenced by Initialize().

◆ tile16_blockset_

◆ current_gfx_individual_

◆ palette_editor_

PaletteEditor yaze::editor::Tile16Editor::palette_editor_
private

Definition at line 507 of file tile16_editor.h.

◆ palette_

◆ overworld_palette_

◆ status_

absl::Status yaze::editor::Tile16Editor::status_
private

Definition at line 511 of file tile16_editor.h.

Referenced by DrawContextMenu(), DrawTile16Editor(), Update(), and UpdateAsPanel().

◆ on_changes_committed_

std::function<absl::Status()> yaze::editor::Tile16Editor::on_changes_committed_
private

◆ current_tile16_data_

gfx::Tile16 yaze::editor::Tile16Editor::current_tile16_data_
private

Definition at line 517 of file tile16_editor.h.

Referenced by GetCurrentTile16Data(), and SetCurrentTile().


The documentation for this class was generated from the following files: