Draws dungeon objects to background buffers using game patterns. More...
#include <object_drawer.h>

Classes | |
| struct | DoorDef |
| struct | TileTrace |
| struct | TraceContext |
Public Member Functions | |
| ObjectDrawer (Rom *rom, int room_id, const uint8_t *room_gfx_buffer=nullptr) | |
| absl::Status | DrawObject (const RoomObject &object, gfx::BackgroundBuffer &bg1, gfx::BackgroundBuffer &bg2, const gfx::PaletteGroup &palette_group, const DungeonState *state=nullptr, gfx::BackgroundBuffer *layout_bg1=nullptr, gfx::BackgroundBuffer *layout_bg2=nullptr) |
| Draw a room object to background buffers. | |
| void | ResetChestIndex () |
| void | SetBG1RevealMaskSource (gfx::BG1RevealMaskSource source) |
| void | SetRoomFloorGraphics (uint8_t floor1, uint8_t floor2) |
| void | DrawDoor (const DoorDef &door, int door_index, gfx::BackgroundBuffer &bg1, gfx::BackgroundBuffer &bg2, const DungeonState *state=nullptr, gfx::BackgroundBuffer *layout_bg1=nullptr, gfx::BackgroundBuffer *layout_bg2=nullptr) |
| Draw a door to background buffers. | |
| void | DrawPotItem (uint8_t item_id, int x, int y, gfx::BackgroundBuffer &bg) |
| Draw a pot item visualization. | |
| absl::Status | DrawObjectList (const std::vector< RoomObject > &objects, gfx::BackgroundBuffer &bg1, gfx::BackgroundBuffer &bg2, const gfx::PaletteGroup &palette_group, const DungeonState *state=nullptr, gfx::BackgroundBuffer *layout_bg1=nullptr, bool reset_room_event_indices=true, gfx::BackgroundBuffer *layout_bg2=nullptr) |
| Draw all objects in a room. | |
| int | GetDrawRoutineId (int16_t object_id) const |
| Get draw routine ID for an object. | |
| int | GetDrawRoutineCount () const |
| Get the total number of registered draw routines. | |
| void | InitializeDrawRoutines () |
| Initialize draw routine registry Must be called before drawing objects. | |
| void | DrawTileToBitmap (gfx::Bitmap &bitmap, const gfx::TileInfo &tile_info, int pixel_x, int pixel_y, const uint8_t *tiledata) |
| Draw a single tile directly to bitmap. | |
| absl::Status | DrawRoomDrawObjectData2x2 (uint16_t object_id, int tile_x, int tile_y, RoomObject::LayerType layer, uint16_t room_draw_object_data_offset, gfx::BackgroundBuffer &bg1, gfx::BackgroundBuffer &bg2) |
| Draw a fixed 2x2 (16x16) tile pattern from RoomDrawObjectData. | |
| std::pair< int, int > | CalculateObjectDimensions (const RoomObject &object) |
| Calculate the dimensions (width, height) of an object in pixels. | |
| void | SetTraceCollector (std::vector< TileTrace > *collector, bool trace_only=false) |
| void | ClearTraceCollector () |
| bool | TraceOnly () const |
Protected Types | |
| using | DrawRoutine |
Protected Member Functions | |
| void | DrawChest (const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr) |
| void | DrawBigChest (const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr) |
| void | DrawBigKeyLock (const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr) |
| void | DrawNothing (const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr) |
| void | CustomDraw (const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr) |
| void | DrawRightwards4x4_1to16 (const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr) |
| void | DrawRightwardsDecor4x3spaced4_1to16 (const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr) |
| void | DrawLargeCanvasObject (const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, int width, int height) |
| void | DrawCustomObject (const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr) |
| void | DrawMissingCustomObjectPlaceholder (gfx::BackgroundBuffer &bg, int tile_x, int tile_y) |
| void | DrawUsingRegistryRoutine (int routine_id, const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state) |
| void | WriteTile8 (gfx::BackgroundBuffer &bg, int tile_x, int tile_y, const gfx::TileInfo &tile_info) |
| bool | IsValidTilePosition (int tile_x, int tile_y) const |
| void | MarkBg1RectRevealed (gfx::BackgroundBuffer &bg1, int start_px, int start_py, int pixel_width, int pixel_height) |
| void | MarkBg1OpaqueTilePixelsRevealed (gfx::BackgroundBuffer &bg1, const gfx::TileInfo &tile_info, int pixel_x, int pixel_y, const uint8_t *tiledata) |
| void | DrawDoorIndicator (gfx::BackgroundBuffer &bg, int tile_x, int tile_y, int width, int height, DoorType type, DoorDirection direction) |
| void | SetTraceContext (const RoomObject &object, RoomObject::LayerType layer) |
| void | PushTrace (int tile_x, int tile_y, const gfx::TileInfo &tile_info) |
Static Protected Member Functions | |
| static bool | RoutineDrawsToBothBGs (int routine_id) |
| static bool | RequiresRectangularBg1Mask (const RoomObject &object) |
| static void | TraceHookThunk (gfx::BackgroundBuffer *bg, int tile_x, int tile_y, const gfx::TileInfo &tile_info, void *user_data) |
Protected Attributes | |
| std::vector< DrawRoutine > | draw_routines_ |
| bool | routines_initialized_ = false |
| TraceContext | trace_context_ {} |
| std::vector< TileTrace > * | trace_collector_ = nullptr |
| bool | trace_only_ = false |
| Rom * | rom_ |
| int | room_id_ |
| int | current_chest_index_ = 0 |
| int | current_room_event_index_ = 0 |
| bool | has_room_floor_graphics_ = false |
| uint8_t | floor1_graphics_ = 0 |
| uint8_t | floor2_graphics_ = 0 |
| gfx::BackgroundBuffer * | registry_secondary_bg_ = nullptr |
| const gfx::BackgroundBuffer * | registry_primary_layout_bg_ = nullptr |
| RoomObject::LayerType | registry_primary_layer_ = RoomObject::LayerType::BG1 |
| RoomObject::LayerType | registry_secondary_layer_ = RoomObject::LayerType::BG2 |
| gfx::BackgroundBuffer * | active_object_bg1_mask_ = nullptr |
| gfx::BackgroundBuffer * | active_layout_bg1_mask_ = nullptr |
| gfx::BackgroundBuffer * | active_mask_source_bg_ = nullptr |
| gfx::BG1RevealMaskSource | bg1_reveal_mask_source_ |
| const uint8_t * | room_gfx_buffer_ |
Static Protected Attributes | |
| static constexpr int | kMaxTilesX = 64 |
| static constexpr int | kMaxTilesY = 64 |
Draws dungeon objects to background buffers using game patterns.
This class interprets object IDs and draws them to BG1/BG2 buffers using the patterns extracted from the game's drawing routines. Based on ZScream's DungeonObjectData.cs and Subtype1_Draw.cs patterns.
Architecture:
Definition at line 36 of file object_drawer.h.
|
protected |
Definition at line 215 of file object_drawer.h.
|
explicit |
Definition at line 104 of file object_drawer.cc.
References InitializeDrawRoutines().

| absl::Status yaze::zelda3::ObjectDrawer::DrawObject | ( | const RoomObject & | object, |
| gfx::BackgroundBuffer & | bg1, | ||
| gfx::BackgroundBuffer & | bg2, | ||
| const gfx::PaletteGroup & | palette_group, | ||
| const DungeonState * | state = nullptr, | ||
| gfx::BackgroundBuffer * | layout_bg1 = nullptr, | ||
| gfx::BackgroundBuffer * | layout_bg2 = nullptr ) |
Draw a room object to background buffers.
| object | The object to draw |
| bg1 | Background layer 1 buffer (object buffer) |
| bg2 | Background layer 2 buffer (object buffer) |
| palette_group | Current palette group for color mapping |
| layout_bg1 | Optional upper layout owner for fixed-tilemap mutations |
| layout_bg2 | Optional lower layout owner for fixed-tilemap mutations |
Definition at line 239 of file object_drawer.cc.
References active_layout_bg1_mask_, active_mask_source_bg_, active_object_bg1_mask_, yaze::zelda3::RoomObject::BG1, yaze::zelda3::RoomObject::BG2, yaze::zelda3::DrawRoutineUtils::ClearTraceHook(), yaze::gfx::DecodeDungeonFloorTilePattern(), draw_routines_, DrawCustomObject(), floor1_graphics_, floor2_graphics_, yaze::zelda3::DimensionService::Get(), yaze::zelda3::DrawRoutineRegistry::Get(), yaze::zelda3::ObjectDimensionTable::Get(), GetDrawRoutineId(), yaze::zelda3::DrawRoutineRegistry::GetRoutineInfo(), yaze::zelda3::DimensionService::GetSelectionBoundsPixels(), has_room_floor_graphics_, yaze::zelda3::HasActiveCustomObjectOverride(), yaze::Rom::is_loaded(), yaze::zelda3::object_render_routing::IsMixedStraightInterroomObject(), yaze::zelda3::object_render_routing::IsNorthMixedStraightInterroomObject(), yaze::zelda3::DrawRoutineIds::kAgahnimsAltar, yaze::zelda3::DrawRoutineIds::kAutoStairs, yaze::zelda3::DrawRoutineIds::kFortuneTellerRoom, yaze::zelda3::kRoomObjectTileAddress, yaze::zelda3::kRoomObjectTileAddressFloor, yaze::zelda3::DrawRoutineIds::kSanctuaryWall, yaze::zelda3::DrawRoutineIds::kSpiralStairsGoingDownLower, yaze::zelda3::DrawRoutineIds::kSpiralStairsGoingDownUpper, yaze::zelda3::DrawRoutineIds::kSpiralStairsGoingUpLower, yaze::zelda3::DrawRoutineIds::kSpiralStairsGoingUpUpper, yaze::zelda3::DrawRoutineIds::kStraightInterRoomStairs, yaze::zelda3::ObjectDimensionTable::LoadFromRom(), LOG_DEBUG, LOG_WARN, MarkBg1RectRevealed(), yaze::zelda3::DrawRoutineInfo::min_tiles, yaze::zelda3::DrawRoutineInfo::name, registry_primary_layer_, registry_primary_layout_bg_, registry_secondary_bg_, registry_secondary_layer_, RequiresRectangularBg1Mask(), rom_, RoutineDrawsToBothBGs(), routines_initialized_, yaze::zelda3::RoomObject::SetRom(), SetTraceContext(), yaze::zelda3::DrawRoutineUtils::SetTraceHook(), trace_collector_, trace_only_, TraceHookThunk(), yaze::Rom::vector(), and WriteTile8().
Referenced by yaze::editor::anonymous_namespace{dungeon_canvas_issue_report.cc}::BuildObjectTraceReport(), yaze::zelda3::ObjectTileEditor::CaptureObjectLayout(), DrawObjectList(), yaze::emu::render::EmulatorRenderService::RenderDungeonObjectStatic(), and yaze::editor::TileObjectHandler::RenderGhostPreviewBitmap().
|
inline |
Definition at line 76 of file object_drawer.h.
References current_chest_index_, and current_room_event_index_.
Referenced by DrawObjectList().
|
inline |
Definition at line 80 of file object_drawer.h.
References bg1_reveal_mask_source_.
Referenced by yaze::editor::anonymous_namespace{dungeon_canvas_issue_report.cc}::BuildObjectTraceReport(), yaze::zelda3::RoomLayout::Draw(), and yaze::zelda3::Room::RenderObjectsToBackground().
|
inline |
Definition at line 85 of file object_drawer.h.
References floor1_graphics_, floor2_graphics_, and has_room_floor_graphics_.
Referenced by yaze::editor::anonymous_namespace{dungeon_canvas_issue_report.cc}::BuildObjectTraceReport(), yaze::zelda3::ObjectTileEditor::CaptureObjectLayout(), yaze::zelda3::RoomLayout::Draw(), yaze::emu::render::EmulatorRenderService::RenderDungeonObjectStatic(), yaze::editor::TileObjectHandler::RenderGhostPreviewBitmap(), and yaze::zelda3::Room::RenderObjectsToBackground().
| void yaze::zelda3::ObjectDrawer::DrawDoor | ( | const DoorDef & | door, |
| int | door_index, | ||
| gfx::BackgroundBuffer & | bg1, | ||
| gfx::BackgroundBuffer & | bg2, | ||
| const DungeonState * | state = nullptr, | ||
| gfx::BackgroundBuffer * | layout_bg1 = nullptr, | ||
| gfx::BackgroundBuffer * | layout_bg2 = nullptr ) |
Draw a door to background buffers.
| door | Door definition (type, direction, position) |
| bg1 | Background layer 1 object buffer |
| bg2 | Background layer 2 object buffer |
| layout_bg1 | Optional upper-layer layout buffer. Door priority promotion is applied to both BG1 owners without repainting pixels. |
| layout_bg2 | Optional lower-layer layout buffer for door routines that mutate existing BG2 priority. |
Definition at line 1595 of file object_drawer.cc.
References bg1_reveal_mask_source_, yaze::zelda3::BigKeyDoor, yaze::gfx::BackgroundBuffer::bitmap(), yaze::zelda3::BottomShutterLower, yaze::zelda3::BottomSidedShutter, yaze::zelda3::CaveExit, yaze::gfx::BackgroundBuffer::ClearBG1RevealMaskRect(), yaze::zelda3::CurtainDoor, yaze::Rom::data(), yaze::zelda3::ObjectDrawer::DoorDef::direction, yaze::zelda3::DoubleSidedShutter, yaze::zelda3::DoubleSidedShutterLower, DrawDoorIndicator(), DrawTileToBitmap(), yaze::zelda3::DungeonSwapMarker, yaze::zelda3::East, yaze::zelda3::ExitLower, yaze::zelda3::ExitMarker, yaze::zelda3::ExplicitRoomDoor, yaze::zelda3::ExplodingWall, yaze::zelda3::FancyDungeonExit, yaze::zelda3::FancyDungeonExitLower, yaze::zelda3::ObjectDrawer::DoorDef::GetDimensions(), yaze::zelda3::GetDoorDimensions(), yaze::zelda3::GetDoorDirectionName(), yaze::zelda3::GetDoorTypeName(), yaze::zelda3::ObjectDrawer::DoorDef::GetTileCoords(), yaze::Rom::is_loaded(), yaze::zelda3::DungeonState::IsDoorOpen(), yaze::zelda3::DungeonState::IsDoorSwitchActive(), yaze::zelda3::kDoorGfxDown, yaze::zelda3::kDoorGfxLeft, yaze::zelda3::kDoorGfxRight, yaze::zelda3::kDoorGfxUp, yaze::zelda3::LayerSwapMarker, yaze::zelda3::LitCaveExitLower, LOG_DEBUG, yaze::gfx::BackgroundBuffer::mutable_coverage_data(), yaze::gfx::BackgroundBuffer::mutable_priority_data(), yaze::zelda3::NormalDoor, yaze::zelda3::NormalDoorLower, yaze::zelda3::NormalDoorOneSidedShutter, yaze::zelda3::North, yaze::zelda3::ObjectDrawer::DoorDef::position, yaze::zelda3::DoorPositionManager::PositionToRenderTileCoords(), yaze::zelda3::DoorPositionManager::PositionToTileCoords(), rom_, room_gfx_buffer_, room_id_, yaze::gfx::BackgroundBuffer::SetPriorityAt(), yaze::gfx::BackgroundBuffer::SetTileAt(), yaze::Rom::size(), yaze::zelda3::SmallKeyStairsDown, yaze::zelda3::SmallKeyStairsDownLower, yaze::zelda3::SmallKeyStairsUp, yaze::zelda3::SmallKeyStairsUpLower, yaze::zelda3::South, yaze::zelda3::TopShutterLower, yaze::zelda3::TopSidedShutter, yaze::zelda3::ObjectDrawer::DoorDef::type, yaze::zelda3::UnusedCaveExit, yaze::zelda3::WaterfallDoor, yaze::zelda3::West, yaze::zelda3::DoorDimensions::width_tiles, and yaze::gfx::WordToTileInfo().
Referenced by yaze::zelda3::Room::RenderObjectsToBackground().
| void yaze::zelda3::ObjectDrawer::DrawPotItem | ( | uint8_t | item_id, |
| int | x, | ||
| int | y, | ||
| gfx::BackgroundBuffer & | bg ) |
Draw a pot item visualization.
| item_id | Item ID |
| x | X coordinate (pixels) |
| y | Y coordinate (pixels) |
| bg | Background buffer |
Definition at line 3140 of file object_drawer.cc.
References yaze::gfx::BackgroundBuffer::bitmap(), yaze::gfx::BackgroundBuffer::ClearBG1RevealMaskRect(), and yaze::gfx::BackgroundBuffer::mutable_coverage_data().
Referenced by yaze::zelda3::Room::RenderObjectsToBackground().

| absl::Status yaze::zelda3::ObjectDrawer::DrawObjectList | ( | const std::vector< RoomObject > & | objects, |
| gfx::BackgroundBuffer & | bg1, | ||
| gfx::BackgroundBuffer & | bg2, | ||
| const gfx::PaletteGroup & | palette_group, | ||
| const DungeonState * | state = nullptr, | ||
| gfx::BackgroundBuffer * | layout_bg1 = nullptr, | ||
| bool | reset_room_event_indices = true, | ||
| gfx::BackgroundBuffer * | layout_bg2 = nullptr ) |
Draw all objects in a room.
| objects | Vector of room objects |
| bg1 | Background layer 1 buffer (object buffer) |
| bg2 | Background layer 2 buffer (object buffer) |
| palette_group | Current palette group for color mapping |
| layout_bg1 | Optional upper layout owner for fixed-tilemap mutations |
| reset_room_event_indices | If true, reset the chest-only and shared chest/lock counters before drawing (set false on subsequent USDASM list passes; see Room::RenderObjectsToBackground) |
| layout_bg2 | Optional lower layout owner for fixed-tilemap mutations. Kept after reset_room_event_indices for source compatibility with existing positional callers. |
Definition at line 523 of file object_drawer.cc.
References yaze::gfx::BackgroundBuffer::bitmap(), DrawObject(), yaze::zelda3::GetEffectiveObjectLayerSemantics(), yaze::zelda3::kBg1, yaze::zelda3::kBg2, yaze::zelda3::kBothBg1Bg2, LOG_DEBUG, and ResetChestIndex().
Referenced by yaze::zelda3::RoomLayout::Draw(), and yaze::zelda3::Room::RenderObjectsToBackground().

| int yaze::zelda3::ObjectDrawer::GetDrawRoutineId | ( | int16_t | object_id | ) | const |
Get draw routine ID for an object.
| object_id | The object ID to look up |
Definition at line 1586 of file object_drawer.cc.
References yaze::zelda3::DrawRoutineRegistry::Get(), and yaze::zelda3::DrawRoutineRegistry::GetRoutineIdForObject().
Referenced by DrawObject(), and yaze::editor::DungeonObjectSelector::DrawObjectAssetBrowser().

|
inline |
Get the total number of registered draw routines.
Definition at line 149 of file object_drawer.h.
References draw_routines_.
| void yaze::zelda3::ObjectDrawer::InitializeDrawRoutines | ( | ) |
Initialize draw routine registry Must be called before drawing objects.
Definition at line 582 of file object_drawer.cc.
References draw_routines_, DrawBigKeyLock(), DrawChest(), DrawCustomObject(), DrawNothing(), DrawUsingRegistryRoutine(), yaze::zelda3::RoomObject::id_, yaze::zelda3::DrawRoutineIds::kActual4x4, yaze::zelda3::DrawRoutineIds::kAgahnimsAltar, yaze::zelda3::DrawRoutineIds::kArcheryGameTargetDoor, yaze::zelda3::DrawRoutineIds::kBed4x5, yaze::zelda3::DrawRoutineIds::kBigGrayRock, yaze::zelda3::DrawRoutineIds::kBigLightBeam, yaze::zelda3::DrawRoutineIds::kBigWallDecor, yaze::zelda3::DrawRoutineIds::kBossShell4x4, yaze::zelda3::DrawRoutineIds::kDamFloodGate, yaze::zelda3::DrawRoutineIds::kDownwardsEdge1x1_1to16plus7, yaze::zelda3::DrawRoutineIds::kFloorLight, yaze::zelda3::DrawRoutineIds::kFortuneTellerRoom, yaze::zelda3::DrawRoutineIds::kGanonTriforceFloorDecor, yaze::zelda3::DrawRoutineIds::kHorizontalTurtleRockPipe, yaze::zelda3::DrawRoutineIds::kLightBeam, yaze::zelda3::DrawRoutineIds::kMagicBatAltar, yaze::zelda3::DrawRoutineIds::kRightwards3x6, yaze::zelda3::DrawRoutineIds::kRupeeFloor, yaze::zelda3::DrawRoutineIds::kSanctuaryWall, yaze::zelda3::DrawRoutineIds::kSingle2x2, yaze::zelda3::DrawRoutineIds::kSingle4x3, yaze::zelda3::DrawRoutineIds::kSingle4x4, yaze::zelda3::DrawRoutineIds::kSmithyFurnace, yaze::zelda3::DrawRoutineIds::kSolidWallDecor3x4, yaze::zelda3::DrawRoutineIds::kTableBowl, yaze::zelda3::DrawRoutineIds::kUtility3x5, yaze::zelda3::DrawRoutineIds::kUtility6x3, yaze::zelda3::DrawRoutineIds::kVerticalTurtleRockPipe, yaze::zelda3::DrawRoutineIds::kVitreousGooDamage, yaze::zelda3::DrawRoutineIds::kWaterfall47, yaze::zelda3::DrawRoutineIds::kWaterfall48, yaze::zelda3::DrawRoutineIds::kWaterHopStairsA, yaze::zelda3::DrawRoutineIds::kWaterHopStairsB, yaze::zelda3::DrawRoutineIds::kWeird2x4_1to16, and routines_initialized_.
Referenced by ObjectDrawer(), yaze::emu::render::EmulatorRenderService::RenderDungeonObjectStatic(), and yaze::editor::TileObjectHandler::RenderGhostPreviewBitmap().
| void yaze::zelda3::ObjectDrawer::DrawTileToBitmap | ( | gfx::Bitmap & | bitmap, |
| const gfx::TileInfo & | tile_info, | ||
| int | pixel_x, | ||
| int | pixel_y, | ||
| const uint8_t * | tiledata ) |
Draw a single tile directly to bitmap.
| bitmap | Target bitmap to draw to |
| tile_info | Tile information (ID, palette, mirroring) |
| pixel_x | X pixel coordinate in bitmap |
| pixel_y | Y pixel coordinate in bitmap |
| tiledata | Source graphics data from ROM |
Definition at line 2863 of file object_drawer.cc.
References yaze::gfx::Bitmap::height(), yaze::gfx::TileInfo::horizontal_mirror_, yaze::gfx::TileInfo::id_, yaze::gfx::Bitmap::is_active(), LOG_DEBUG, yaze::gfx::Bitmap::mutable_data(), yaze::gfx::TileInfo::palette_, yaze::gfx::Bitmap::set_modified(), yaze::gfx::TileInfo::vertical_mirror_, and yaze::gfx::Bitmap::width().
Referenced by yaze::zelda3::ObjectTileEditor::BuildTile8Atlas(), DrawDoor(), yaze::zelda3::ObjectTileEditor::RenderLayoutToBitmap(), and WriteTile8().
| absl::Status yaze::zelda3::ObjectDrawer::DrawRoomDrawObjectData2x2 | ( | uint16_t | object_id, |
| int | tile_x, | ||
| int | tile_y, | ||
| RoomObject::LayerType | layer, | ||
| uint16_t | room_draw_object_data_offset, | ||
| gfx::BackgroundBuffer & | bg1, | ||
| gfx::BackgroundBuffer & | bg2 ) |
Draw a fixed 2x2 (16x16) tile pattern from RoomDrawObjectData.
USDASM uses hardcoded offsets into RoomDrawObjectData for certain special objects that are NOT part of the room object stream (e.g. pushable blocks and lightable torches). See bank_01.asm: RoomDraw_PushableBlock and RoomDraw_LightableTorch.
| object_id | Identifier used only for tracing/debugging (not used for routine lookup) |
| tile_x | Top-left X position in tiles |
| tile_y | Top-left Y position in tiles |
| layer | Target layer (BG1/BG2) |
| room_draw_object_data_offset | Offset from RoomDrawObjectData base (not an absolute PC address) |
Definition at line 2972 of file object_drawer.cc.
References yaze::zelda3::RoomObject::BG2, yaze::Rom::is_loaded(), yaze::zelda3::kRoomObjectTileAddress, rom_, SetTraceContext(), yaze::Rom::vector(), yaze::gfx::WordToTileInfo(), and WriteTile8().
Referenced by yaze::zelda3::Room::RenderObjectsToBackground().
| std::pair< int, int > yaze::zelda3::ObjectDrawer::CalculateObjectDimensions | ( | const RoomObject & | object | ) |
Calculate the dimensions (width, height) of an object in pixels.
| object | The object to calculate dimensions for |
Definition at line 3042 of file object_drawer.cc.
References yaze::zelda3::DimensionService::Get(), and yaze::zelda3::DimensionService::GetPixelDimensions().

| void yaze::zelda3::ObjectDrawer::SetTraceCollector | ( | std::vector< TileTrace > * | collector, |
| bool | trace_only = false ) |
Definition at line 110 of file object_drawer.cc.
References trace_collector_, and trace_only_.
Referenced by yaze::editor::anonymous_namespace{dungeon_canvas_issue_report.cc}::BuildObjectTraceReport(), and yaze::zelda3::ObjectTileEditor::CaptureObjectLayout().
| void yaze::zelda3::ObjectDrawer::ClearTraceCollector | ( | ) |
Definition at line 116 of file object_drawer.cc.
References trace_collector_, and trace_only_.
Referenced by yaze::editor::anonymous_namespace{dungeon_canvas_issue_report.cc}::BuildObjectTraceReport(), and yaze::zelda3::ObjectTileEditor::CaptureObjectLayout().
|
inline |
Definition at line 211 of file object_drawer.h.
References trace_only_.
|
protected |
Definition at line 2540 of file object_drawer.cc.
References current_chest_index_, current_room_event_index_, DrawUsingRegistryRoutine(), yaze::zelda3::RoomObject::id_, yaze::zelda3::DrawRoutineIds::kSingle2x2, room_id_, WriteTile8(), yaze::zelda3::RoomObject::x_, and yaze::zelda3::RoomObject::y_.
Referenced by InitializeDrawRoutines().

|
protected |
Definition at line 2588 of file object_drawer.cc.
References current_chest_index_, current_room_event_index_, DrawUsingRegistryRoutine(), yaze::zelda3::DungeonState::IsBigChestOpen(), yaze::zelda3::DrawRoutineIds::kSingle4x3, and room_id_.

|
protected |
Definition at line 2610 of file object_drawer.cc.
References current_room_event_index_, DrawUsingRegistryRoutine(), yaze::zelda3::DungeonState::IsBigKeyLockOpen(), yaze::zelda3::DrawRoutineIds::kBigKeyLock, and room_id_.
Referenced by InitializeDrawRoutines().

|
protected |
Definition at line 2624 of file object_drawer.cc.
References yaze::zelda3::RoomObject::id_, and LOG_DEBUG.
Referenced by InitializeDrawRoutines().
|
protected |
Definition at line 2634 of file object_drawer.cc.
References WriteTile8(), yaze::zelda3::RoomObject::x_, and yaze::zelda3::RoomObject::y_.

|
protected |
Definition at line 2645 of file object_drawer.cc.
References yaze::zelda3::RoomObject::id_, LOG_DEBUG, yaze::zelda3::RoomObject::size_, WriteTile8(), yaze::zelda3::RoomObject::x_, and yaze::zelda3::RoomObject::y_.

|
protected |
Definition at line 2680 of file object_drawer.cc.
References yaze::zelda3::RoomObject::size_, WriteTile8(), yaze::zelda3::RoomObject::x_, and yaze::zelda3::RoomObject::y_.

|
protected |
Definition at line 3025 of file object_drawer.cc.
References WriteTile8(), yaze::zelda3::RoomObject::x_, and yaze::zelda3::RoomObject::y_.

|
protected |
Definition at line 3047 of file object_drawer.cc.
References yaze::zelda3::CustomObjectRuntimeTileWord(), yaze::zelda3::CustomObjectManager::Get(), yaze::zelda3::RoomObject::id_, LOG_DEBUG, yaze::zelda3::RoomObject::size_, yaze::gfx::WordToTileInfo(), yaze::zelda3::RoomObject::x_, and yaze::zelda3::RoomObject::y_.
Referenced by DrawObject(), and InitializeDrawRoutines().

|
protected |
Definition at line 3091 of file object_drawer.cc.
References yaze::gfx::BackgroundBuffer::bitmap(), yaze::gfx::BackgroundBuffer::ClearBG1RevealMaskRect(), yaze::gfx::BackgroundBuffer::mutable_coverage_data(), and yaze::gfx::BackgroundBuffer::mutable_priority_data().

|
protected |
Definition at line 163 of file object_drawer.cc.
References yaze::zelda3::DrawRoutineUtils::ClearTraceHook(), yaze::zelda3::DrawRoutineRegistry::Get(), yaze::zelda3::DrawRoutineRegistry::GetRoutineInfo(), LOG_DEBUG, registry_primary_layer_, registry_primary_layout_bg_, registry_secondary_bg_, registry_secondary_layer_, rom_, room_gfx_buffer_, room_id_, SetTraceContext(), yaze::zelda3::DrawRoutineUtils::SetTraceHook(), yaze::zelda3::DrawContext::target_bg, yaze::zelda3::RoomObject::tiles(), and WriteTile8().
Referenced by DrawBigChest(), DrawBigKeyLock(), DrawChest(), and InitializeDrawRoutines().
|
protected |
Definition at line 2764 of file object_drawer.cc.
References active_layout_bg1_mask_, active_mask_source_bg_, active_object_bg1_mask_, bg1_reveal_mask_source_, yaze::gfx::BackgroundBuffer::bitmap(), yaze::gfx::BackgroundBuffer::ClearBG1RevealMaskRect(), DrawTileToBitmap(), IsValidTilePosition(), LOG_DEBUG, MarkBg1OpaqueTilePixelsRevealed(), yaze::gfx::BackgroundBuffer::mutable_coverage_data(), yaze::gfx::BackgroundBuffer::mutable_priority_data(), yaze::gfx::TileInfo::over_, PushTrace(), room_gfx_buffer_, yaze::gfx::BackgroundBuffer::SetTileAt(), yaze::gfx::TileInfoToWord(), and trace_only_.
Referenced by CustomDraw(), DrawChest(), DrawLargeCanvasObject(), DrawObject(), DrawRightwards4x4_1to16(), DrawRightwardsDecor4x3spaced4_1to16(), DrawRoomDrawObjectData2x2(), and DrawUsingRegistryRoutine().
|
protected |
Definition at line 2858 of file object_drawer.cc.
References kMaxTilesY.
Referenced by WriteTile8().
|
staticprotected |
Definition at line 573 of file object_drawer.cc.
References yaze::zelda3::DrawRoutineRegistry::Get(), and yaze::zelda3::DrawRoutineRegistry::RoutineDrawsToBothBGs().
Referenced by DrawObject().

|
protected |
Definition at line 2710 of file object_drawer.cc.
References bg1_reveal_mask_source_, and yaze::gfx::BackgroundBuffer::SetBG1RevealMaskRect().
Referenced by DrawObject().

|
protected |
Definition at line 2717 of file object_drawer.cc.
References bg1_reveal_mask_source_, yaze::gfx::BackgroundBuffer::bitmap(), yaze::gfx::TileInfo::horizontal_mirror_, yaze::gfx::TileInfo::id_, yaze::gfx::BackgroundBuffer::mutable_bg1_reveal_mask_data(), and yaze::gfx::TileInfo::vertical_mirror_.
Referenced by WriteTile8().

|
staticprotected |
Definition at line 507 of file object_drawer.cc.
Referenced by DrawObject().
|
protected |
Definition at line 2433 of file object_drawer.cc.
References bg1_reveal_mask_source_, yaze::zelda3::BigKeyDoor, yaze::gfx::BackgroundBuffer::bitmap(), yaze::zelda3::BombableCaveExit, yaze::zelda3::BombableDoor, yaze::zelda3::BottomShutterLower, yaze::zelda3::BottomSidedShutter, yaze::zelda3::CaveExit, yaze::gfx::BackgroundBuffer::ClearBG1RevealMaskRect(), yaze::zelda3::CurtainDoor, yaze::zelda3::DashWall, yaze::zelda3::DoubleSidedShutter, yaze::zelda3::DoubleSidedShutterLower, yaze::zelda3::DungeonSwapMarker, yaze::zelda3::ExitMarker, yaze::zelda3::ExplodingWall, yaze::zelda3::EyeWatchDoor, yaze::zelda3::FancyDungeonExit, yaze::zelda3::FancyDungeonExitLower, yaze::zelda3::LayerSwapMarker, yaze::zelda3::LitCaveExitLower, yaze::gfx::BackgroundBuffer::mutable_coverage_data(), yaze::zelda3::NormalDoor, yaze::zelda3::NormalDoorLower, yaze::zelda3::SmallKeyDoor, yaze::zelda3::SmallKeyStairsDown, yaze::zelda3::SmallKeyStairsDownLower, yaze::zelda3::SmallKeyStairsUp, yaze::zelda3::SmallKeyStairsUpLower, yaze::zelda3::TopShutterLower, yaze::zelda3::TopSidedShutter, yaze::zelda3::UnopenableBigKeyDoor, and yaze::zelda3::WaterfallDoor.
Referenced by DrawDoor().

|
protected |
Definition at line 121 of file object_drawer.cc.
References yaze::zelda3::ObjectDrawer::TraceContext::layer, yaze::zelda3::ObjectDrawer::TraceContext::object_id, yaze::zelda3::ObjectDrawer::TraceContext::size, and trace_context_.
Referenced by DrawObject(), DrawRoomDrawObjectData2x2(), and DrawUsingRegistryRoutine().
|
protected |
Definition at line 128 of file object_drawer.cc.
References yaze::gfx::TileInfo::horizontal_mirror_, yaze::gfx::TileInfo::id_, yaze::zelda3::ObjectDrawer::TraceContext::layer, yaze::zelda3::ObjectDrawer::TileTrace::object_id, yaze::zelda3::ObjectDrawer::TraceContext::object_id, yaze::gfx::TileInfo::over_, yaze::gfx::TileInfo::palette_, yaze::zelda3::ObjectDrawer::TraceContext::size, trace_collector_, trace_context_, and yaze::gfx::TileInfo::vertical_mirror_.
Referenced by TraceHookThunk(), and WriteTile8().
|
staticprotected |
Definition at line 153 of file object_drawer.cc.
References PushTrace().
Referenced by DrawObject().

|
protected |
Definition at line 287 of file object_drawer.h.
Referenced by DrawObject(), GetDrawRoutineCount(), and InitializeDrawRoutines().
|
protected |
Definition at line 288 of file object_drawer.h.
Referenced by DrawObject(), and InitializeDrawRoutines().
|
protected |
Definition at line 301 of file object_drawer.h.
Referenced by PushTrace(), and SetTraceContext().
|
protected |
Definition at line 302 of file object_drawer.h.
Referenced by ClearTraceCollector(), DrawObject(), PushTrace(), and SetTraceCollector().
|
protected |
Definition at line 303 of file object_drawer.h.
Referenced by ClearTraceCollector(), DrawObject(), SetTraceCollector(), TraceOnly(), and WriteTile8().
|
protected |
Definition at line 305 of file object_drawer.h.
Referenced by DrawDoor(), DrawObject(), DrawRoomDrawObjectData2x2(), and DrawUsingRegistryRoutine().
|
protected |
Definition at line 306 of file object_drawer.h.
Referenced by DrawBigChest(), DrawBigKeyLock(), DrawChest(), DrawDoor(), and DrawUsingRegistryRoutine().
|
mutableprotected |
Definition at line 307 of file object_drawer.h.
Referenced by DrawBigChest(), DrawChest(), and ResetChestIndex().
|
mutableprotected |
Definition at line 308 of file object_drawer.h.
Referenced by DrawBigChest(), DrawBigKeyLock(), DrawChest(), and ResetChestIndex().
|
protected |
Definition at line 309 of file object_drawer.h.
Referenced by DrawObject(), and SetRoomFloorGraphics().
|
protected |
Definition at line 310 of file object_drawer.h.
Referenced by DrawObject(), and SetRoomFloorGraphics().
|
protected |
Definition at line 311 of file object_drawer.h.
Referenced by DrawObject(), and SetRoomFloorGraphics().
|
protected |
Definition at line 312 of file object_drawer.h.
Referenced by DrawObject(), and DrawUsingRegistryRoutine().
|
protected |
Definition at line 313 of file object_drawer.h.
Referenced by DrawObject(), and DrawUsingRegistryRoutine().
|
protected |
Definition at line 314 of file object_drawer.h.
Referenced by DrawObject(), and DrawUsingRegistryRoutine().
|
protected |
Definition at line 315 of file object_drawer.h.
Referenced by DrawObject(), and DrawUsingRegistryRoutine().
|
protected |
Definition at line 316 of file object_drawer.h.
Referenced by DrawObject(), and WriteTile8().
|
protected |
Definition at line 317 of file object_drawer.h.
Referenced by DrawObject(), and WriteTile8().
|
protected |
Definition at line 318 of file object_drawer.h.
Referenced by DrawObject(), and WriteTile8().
|
protected |
Definition at line 319 of file object_drawer.h.
Referenced by DrawDoor(), DrawDoorIndicator(), MarkBg1OpaqueTilePixelsRevealed(), MarkBg1RectRevealed(), SetBG1RevealMaskSource(), and WriteTile8().
|
protected |
Definition at line 322 of file object_drawer.h.
Referenced by DrawDoor(), DrawUsingRegistryRoutine(), and WriteTile8().
|
staticconstexprprotected |
Definition at line 325 of file object_drawer.h.
|
staticconstexprprotected |
Definition at line 326 of file object_drawer.h.
Referenced by IsValidTilePosition().