Captures and edits the tile8 composition of dungeon objects. More...
#include <object_tile_editor.h>

Public Member Functions | |
| ObjectTileEditor (Rom *rom) | |
| absl::StatusOr< ObjectTileLayout > | CaptureObjectLayout (int16_t object_id, const Room &room, const gfx::PaletteGroup &palette) |
| absl::StatusOr< ObjectTileLayout > | CaptureObjectLayout (int16_t object_id, const Room &room, const gfx::PaletteGroup &palette, uint8_t object_size) |
| absl::StatusOr< ObjectTileLayout > | CaptureEditableObjectLayout (int16_t object_id, const Room &room, const gfx::PaletteGroup &palette) |
| absl::Status | RenderLayoutToBitmap (const ObjectTileLayout &layout, gfx::Bitmap &bitmap, const uint8_t *room_gfx_buffer, const gfx::PaletteGroup &palette) |
| absl::Status | BuildTile8Atlas (gfx::Bitmap &atlas, const uint8_t *room_gfx_buffer, const gfx::PaletteGroup &palette, int display_palette=2) |
| absl::Status | WriteBack (const ObjectTileLayout &layout) |
| absl::StatusOr< ObjectTileWritePlan > | BuildStandardWritePlan (const ObjectTileLayout &layout) const |
| absl::Status | ApplyStandardWritePlan (const ObjectTileWritePlan &plan) |
| absl::StatusOr< ObjectTileSourceImpact > | AnalyzeStandardTileSourceImpact (const ObjectTileLayout &layout) const |
Static Public Member Functions | |
| static bool | IsEditableStandardObject (int16_t object_id) |
Static Public Attributes | |
| static constexpr int | kAtlasTilesPerRow = 16 |
| static constexpr int | kAtlasTileRows = 64 |
| static constexpr int | kAtlasTileCount = kAtlasTilesPerRow * kAtlasTileRows |
| static constexpr int | kAtlasWidthPx = kAtlasTilesPerRow * 8 |
| static constexpr int | kAtlasHeightPx = kAtlasTileRows * 8 |
Private Attributes | |
| Rom * | rom_ |
Captures and edits the tile8 composition of dungeon objects.
Uses ObjectDrawer's trace_only mode to capture every WriteTile8 call, producing an editable ObjectTileLayout. Supports rendering previews and writing changes back to ROM or custom .bin files.
Definition at line 194 of file object_tile_editor.h.
|
explicit |
Definition at line 233 of file object_tile_editor.cc.
| absl::StatusOr< ObjectTileLayout > yaze::zelda3::ObjectTileEditor::CaptureObjectLayout | ( | int16_t | object_id, |
| const Room & | room, | ||
| const gfx::PaletteGroup & | palette ) |
Definition at line 235 of file object_tile_editor.cc.
References CaptureObjectLayout(), and yaze::zelda3::DefaultRoomObjectSizeForPlacement().
Referenced by CaptureEditableObjectLayout(), CaptureObjectLayout(), yaze::editor::DungeonObjectSelector::DrawObjectAssetBrowser(), and yaze::editor::DungeonObjectSelector::GetOrCreatePreview().

| absl::StatusOr< ObjectTileLayout > yaze::zelda3::ObjectTileEditor::CaptureObjectLayout | ( | int16_t | object_id, |
| const Room & | room, | ||
| const gfx::PaletteGroup & | palette, | ||
| uint8_t | object_size ) |
Definition at line 241 of file object_tile_editor.cc.
References yaze::zelda3::CanonicalRoomObjectSize(), yaze::zelda3::ObjectDrawer::ClearTraceCollector(), yaze::zelda3::ObjectTileLayout::custom_filename, yaze::zelda3::ObjectDrawer::DrawObject(), yaze::zelda3::RoomObject::EnsureTilesLoaded(), yaze::zelda3::ObjectTileLayout::FromTraces(), yaze::core::FeatureFlags::get(), yaze::zelda3::CustomObjectManager::Get(), yaze::zelda3::ObjectGeometry::Get(), yaze::zelda3::Room::get_gfx_buffer(), yaze::zelda3::CustomObjectManager::GetObjectInternal(), yaze::zelda3::Room::id(), yaze::zelda3::ObjectTileLayout::is_custom, yaze::Rom::is_loaded(), yaze::zelda3::ObjectGeometry::ResolveAnchor(), yaze::zelda3::CustomObjectManager::ResolveFilename(), rom_, yaze::zelda3::RoomObject::SetRom(), yaze::zelda3::ObjectDrawer::SetTraceCollector(), yaze::zelda3::RoomObject::size_, yaze::zelda3::ObjectTileLayout::source_provenance, and yaze::zelda3::ObjectTileLayout::tile_data_address.
| absl::StatusOr< ObjectTileLayout > yaze::zelda3::ObjectTileEditor::CaptureEditableObjectLayout | ( | int16_t | object_id, |
| const Room & | room, | ||
| const gfx::PaletteGroup & | palette ) |
Definition at line 316 of file object_tile_editor.cc.
References yaze::zelda3::ObjectTileLayout::bounds_height, yaze::zelda3::ObjectTileLayout::bounds_width, CaptureObjectLayout(), yaze::zelda3::ObjectTileLayout::cells, yaze::zelda3::ObjectTileSourceProvenance::descriptor_pc_address, yaze::zelda3::ObjectTileSourceProvenance::expected_descriptor_word, yaze::zelda3::ObjectTileSourceSpan::expected_words, yaze::zelda3::ObjectTileLayout::is_custom, yaze::Rom::is_loaded(), IsEditableStandardObject(), yaze::zelda3::kRoomObjectSubtype2, yaze::zelda3::kRoomObjectTileAddress, yaze::zelda3::ObjectTileSourceProvenance::object_id, yaze::zelda3::ObjectTileLayout::object_id, yaze::zelda3::ObjectTileSourceSpan::pc_address, yaze::Rom::ReadWord(), rom_, yaze::Rom::size(), yaze::zelda3::ObjectTileLayout::source_provenance, yaze::zelda3::ObjectTileSourceProvenance::spans, and yaze::zelda3::ObjectTileLayout::tile_data_address.
|
static |
Definition at line 310 of file object_tile_editor.cc.
Referenced by yaze::editor::DungeonCanvasViewer::BuildSelectionContextMenuItems(), BuildStandardWritePlan(), CaptureEditableObjectLayout(), yaze::editor::ObjectTileEditorPanel::OpenForObject(), and yaze::editor::DungeonEditorV2::OpenObjectTileEditorForObject().
| absl::Status yaze::zelda3::ObjectTileEditor::RenderLayoutToBitmap | ( | const ObjectTileLayout & | layout, |
| gfx::Bitmap & | bitmap, | ||
| const uint8_t * | room_gfx_buffer, | ||
| const gfx::PaletteGroup & | palette ) |
Definition at line 414 of file object_tile_editor.cc.
References yaze::zelda3::ObjectTileLayout::bounds_height, yaze::zelda3::ObjectTileLayout::bounds_width, yaze::zelda3::ObjectTileLayout::cells, yaze::gfx::Bitmap::Create(), yaze::zelda3::ObjectDrawer::DrawTileToBitmap(), yaze::gfx::PaletteGroup::empty(), rom_, and yaze::gfx::Bitmap::SetPalette().
Referenced by yaze::editor::DungeonObjectSelector::GetOrCreatePreview().

| absl::Status yaze::zelda3::ObjectTileEditor::BuildTile8Atlas | ( | gfx::Bitmap & | atlas, |
| const uint8_t * | room_gfx_buffer, | ||
| const gfx::PaletteGroup & | palette, | ||
| int | display_palette = 2 ) |
Definition at line 449 of file object_tile_editor.cc.
References yaze::gfx::Bitmap::Create(), yaze::zelda3::ObjectDrawer::DrawTileToBitmap(), yaze::gfx::PaletteGroup::empty(), kAtlasHeightPx, kAtlasTileCount, kAtlasTilesPerRow, kAtlasWidthPx, yaze::gfx::PaletteGroup::palette_ref(), rom_, and yaze::gfx::Bitmap::SetPalette().
| absl::Status yaze::zelda3::ObjectTileEditor::WriteBack | ( | const ObjectTileLayout & | layout | ) |
Definition at line 484 of file object_tile_editor.cc.
References ApplyStandardWritePlan(), BuildStandardWritePlan(), yaze::zelda3::ObjectTileLayout::cells, yaze::zelda3::ObjectTileLayout::custom_filename, yaze::zelda3::CustomObjectManager::Get(), yaze::zelda3::ObjectTileLayout::HasModifications(), yaze::zelda3::ObjectTileLayout::is_custom, and yaze::gfx::TileInfoToWord().
| absl::StatusOr< ObjectTileWritePlan > yaze::zelda3::ObjectTileEditor::BuildStandardWritePlan | ( | const ObjectTileLayout & | layout | ) | const |
Definition at line 561 of file object_tile_editor.cc.
References yaze::zelda3::ObjectTileLayout::bounds_height, yaze::zelda3::ObjectTileLayout::bounds_width, yaze::zelda3::ObjectTileLayout::cells, yaze::zelda3::ObjectTileLayout::is_custom, yaze::Rom::is_loaded(), IsEditableStandardObject(), yaze::zelda3::kRoomObjectSubtype2, yaze::zelda3::kRoomObjectTileAddress, yaze::zelda3::ObjectTileLayout::object_id, yaze::zelda3::ObjectTileWritePlan::preconditions_, yaze::Rom::ReadWord(), rom_, yaze::Rom::size(), yaze::zelda3::ObjectTileLayout::source_provenance, yaze::gfx::TileInfoToWord(), yaze::zelda3::ObjectTileWritePlan::write_ranges_, and yaze::zelda3::ObjectTileWritePlan::writes_.
Referenced by AnalyzeStandardTileSourceImpact(), and WriteBack().
| absl::Status yaze::zelda3::ObjectTileEditor::ApplyStandardWritePlan | ( | const ObjectTileWritePlan & | plan | ) |
Definition at line 740 of file object_tile_editor.cc.
References yaze::Rom::AdvanceObjectTileRevision(), yaze::Transaction::Commit(), yaze::Rom::dirty(), yaze::Rom::is_loaded(), yaze::zelda3::ObjectTileWritePlan::preconditions_, yaze::Rom::ReadWord(), rom_, yaze::Rom::set_dirty(), yaze::Rom::size(), yaze::zelda3::ObjectTileWritePlan::write_ranges_, yaze::zelda3::ObjectTileWritePlan::writes_, and yaze::Transaction::WriteWord().
Referenced by WriteBack().
| absl::StatusOr< ObjectTileSourceImpact > yaze::zelda3::ObjectTileEditor::AnalyzeStandardTileSourceImpact | ( | const ObjectTileLayout & | layout | ) | const |
Definition at line 858 of file object_tile_editor.cc.
References yaze::zelda3::ObjectTileSourceImpact::affected_objects, BuildStandardWritePlan(), yaze::zelda3::ObjectTileLayout::is_custom, yaze::Rom::is_loaded(), yaze::zelda3::kLightableTorchDraw, yaze::zelda3::kRoomObjectTileAddress, yaze::zelda3::kTorchLightingChange, yaze::zelda3::ObjectTileSourceImpactEntry::object_id, yaze::zelda3::ObjectTileSourceImpactEntry::overlapping_ranges, yaze::zelda3::ObjectTileRuntimeConsumerImpactEntry::overlapping_ranges, yaze::zelda3::ObjectParser::ResolveTileReadRanges(), rom_, yaze::zelda3::ObjectTileSourceImpact::runtime_consumers, yaze::Rom::size(), and yaze::zelda3::ObjectTileLayout::source_provenance.

|
staticconstexpr |
Definition at line 196 of file object_tile_editor.h.
Referenced by BuildTile8Atlas(), and yaze::editor::ObjectTileEditorPanel::DrawSourceSheet().
|
staticconstexpr |
Definition at line 197 of file object_tile_editor.h.
Referenced by yaze::editor::ObjectTileEditorPanel::DrawSourceSheet().
|
staticconstexpr |
Definition at line 198 of file object_tile_editor.h.
Referenced by BuildTile8Atlas().
|
staticconstexpr |
Definition at line 199 of file object_tile_editor.h.
Referenced by BuildTile8Atlas(), and yaze::editor::ObjectTileEditorPanel::DrawSourceSheet().
|
staticconstexpr |
Definition at line 200 of file object_tile_editor.h.
Referenced by BuildTile8Atlas(), and yaze::editor::ObjectTileEditorPanel::DrawSourceSheet().
|
private |
Definition at line 250 of file object_tile_editor.h.
Referenced by AnalyzeStandardTileSourceImpact(), ApplyStandardWritePlan(), BuildStandardWritePlan(), BuildTile8Atlas(), CaptureEditableObjectLayout(), CaptureObjectLayout(), and RenderLayoutToBitmap().