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::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) |
| int | CountObjectsSharingTileData (int16_t object_id) const |
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 70 of file object_tile_editor.h.
|
explicit |
Definition at line 198 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 200 of file object_tile_editor.cc.
References CaptureObjectLayout(), and yaze::zelda3::DefaultRoomObjectSizeForPlacement().
Referenced by 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 206 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::tile_data_address, and yaze::zelda3::RoomObject::tile_data_ptr_.
| 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 271 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 306 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 341 of file object_tile_editor.cc.
References yaze::zelda3::ObjectTileLayout::cells, yaze::zelda3::ObjectTileLayout::custom_filename, yaze::zelda3::CustomObjectManager::Get(), yaze::zelda3::ObjectTileLayout::HasModifications(), yaze::zelda3::ObjectTileLayout::is_custom, RETURN_IF_ERROR, rom_, yaze::zelda3::ObjectTileLayout::tile_data_address, yaze::gfx::TileInfoToWord(), and yaze::Rom::WriteByte().

| int yaze::zelda3::ObjectTileEditor::CountObjectsSharingTileData | ( | int16_t | object_id | ) | const |
Definition at line 437 of file object_tile_editor.cc.
References yaze::zelda3::RoomObject::EnsureTilesLoaded(), yaze::Rom::is_loaded(), rom_, yaze::zelda3::RoomObject::SetRom(), and yaze::zelda3::RoomObject::tile_data_ptr_.

|
staticconstexpr |
Definition at line 72 of file object_tile_editor.h.
Referenced by BuildTile8Atlas(), and yaze::editor::ObjectTileEditorPanel::DrawSourceSheet().
|
staticconstexpr |
Definition at line 73 of file object_tile_editor.h.
Referenced by yaze::editor::ObjectTileEditorPanel::DrawSourceSheet().
|
staticconstexpr |
Definition at line 74 of file object_tile_editor.h.
Referenced by BuildTile8Atlas().
|
staticconstexpr |
Definition at line 75 of file object_tile_editor.h.
Referenced by BuildTile8Atlas(), and yaze::editor::ObjectTileEditorPanel::DrawSourceSheet().
|
staticconstexpr |
Definition at line 76 of file object_tile_editor.h.
Referenced by BuildTile8Atlas(), and yaze::editor::ObjectTileEditorPanel::DrawSourceSheet().
|
private |
Definition at line 106 of file object_tile_editor.h.
Referenced by BuildTile8Atlas(), CaptureObjectLayout(), CountObjectsSharingTileData(), RenderLayoutToBitmap(), and WriteBack().