Direct ROM parser for dungeon objects. More...
#include <object_parser.h>

Public Member Functions | |
| ObjectParser (Rom *rom) | |
| absl::StatusOr< std::vector< gfx::TileInfo > > | ParseObject (int16_t object_id) |
| Parse object data directly from ROM. | |
| absl::StatusOr< ObjectRoutineInfo > | ParseObjectRoutine (int16_t object_id) |
| Parse object routine data. | |
| absl::StatusOr< ObjectSubtypeInfo > | GetObjectSubtype (int16_t object_id) |
| Get object subtype information. | |
| absl::StatusOr< ObjectSizeInfo > | ParseObjectSize (int16_t object_id, uint8_t size_byte) |
| Parse object size and orientation. | |
| int | DetermineSubtype (int16_t object_id) const |
| Determine object subtype from ID. | |
| ObjectDrawInfo | GetObjectDrawInfo (int16_t object_id) const |
| Get draw routine information for an object. | |
Private Member Functions | |
| absl::StatusOr< std::vector< gfx::TileInfo > > | ParseSubtype1 (int16_t object_id) |
| Parse subtype 1 objects (0x00-0xFF) | |
| absl::StatusOr< std::vector< gfx::TileInfo > > | ParseSubtype2 (int16_t object_id) |
| Parse subtype 2 objects (0x100-0x1FF) | |
| absl::StatusOr< std::vector< gfx::TileInfo > > | ParseSubtype3 (int16_t object_id) |
| Parse subtype 3 objects (0x200+) | |
| absl::StatusOr< std::vector< gfx::TileInfo > > | ReadTileData (int address, int tile_count) |
| Read tile data from ROM. | |
| int | GetSubtype2TileCount (int16_t object_id) const |
| Get tile count for subtype 2 objects. | |
| int | GetSubtype3TileCount (int16_t object_id) const |
| Get tile count for subtype 3 objects. | |
| int | ResolveTileCountForObject (int16_t object_id) const |
Private Attributes | |
| Rom * | rom_ |
Direct ROM parser for dungeon objects.
This class replaces the SNES emulation approach with direct ROM parsing, providing better performance and reliability for object rendering.
Definition at line 90 of file object_parser.h.
|
inlineexplicit |
Definition at line 92 of file object_parser.h.
| absl::StatusOr< std::vector< gfx::TileInfo > > yaze::zelda3::ObjectParser::ParseObject | ( | int16_t | object_id | ) |
Parse object data directly from ROM.
| object_id | The object ID to parse |
Definition at line 54 of file object_parser.cc.
References DetermineSubtype(), ParseSubtype1(), ParseSubtype2(), ParseSubtype3(), and rom_.
Referenced by yaze::zelda3::RoomObject::LoadTilesWithParser().

| absl::StatusOr< ObjectRoutineInfo > yaze::zelda3::ObjectParser::ParseObjectRoutine | ( | int16_t | object_id | ) |
Parse object routine data.
| object_id | The object ID |
Definition at line 81 of file object_parser.cc.
References GetObjectSubtype(), yaze::zelda3::ObjectRoutineInfo::is_orientation_dependent, yaze::zelda3::ObjectRoutineInfo::is_repeatable, rom_, yaze::zelda3::ObjectRoutineInfo::routine_ptr, yaze::zelda3::ObjectRoutineInfo::tile_count, and yaze::zelda3::ObjectRoutineInfo::tile_ptr.

| absl::StatusOr< ObjectSubtypeInfo > yaze::zelda3::ObjectParser::GetObjectSubtype | ( | int16_t | object_id | ) |
Get object subtype information.
| object_id | The object ID |
Definition at line 102 of file object_parser.cc.
References DetermineSubtype(), yaze::zelda3::kRoomObjectSubtype1, yaze::zelda3::kRoomObjectSubtype2, yaze::zelda3::kRoomObjectSubtype3, yaze::zelda3::ObjectSubtypeInfo::max_tile_count, ResolveTileCountForObject(), yaze::zelda3::ObjectSubtypeInfo::routine_ptr, yaze::zelda3::ObjectSubtypeInfo::subtype, and yaze::zelda3::ObjectSubtypeInfo::subtype_ptr.
Referenced by ParseObjectRoutine().

| absl::StatusOr< ObjectSizeInfo > yaze::zelda3::ObjectParser::ParseObjectSize | ( | int16_t | object_id, |
| uint8_t | size_byte ) |
Parse object size and orientation.
| object_id | The object ID |
| size_byte | The size byte from object data |
Definition at line 141 of file object_parser.cc.
References yaze::zelda3::ObjectSizeInfo::height_tiles, yaze::zelda3::ObjectSizeInfo::is_horizontal, yaze::zelda3::ObjectSizeInfo::is_repeatable, yaze::zelda3::ObjectSizeInfo::repeat_count, and yaze::zelda3::ObjectSizeInfo::width_tiles.
| int yaze::zelda3::ObjectParser::DetermineSubtype | ( | int16_t | object_id | ) | const |
Determine object subtype from ID.
Definition at line 464 of file object_parser.cc.
Referenced by GetObjectSubtype(), ParseObject(), and ResolveTileCountForObject().
| ObjectDrawInfo yaze::zelda3::ObjectParser::GetObjectDrawInfo | ( | int16_t | object_id | ) | const |
Get draw routine information for an object.
| object_id | The object ID to look up |
Definition at line 492 of file object_parser.cc.
References yaze::zelda3::ObjectDrawInfo::both_layers, yaze::zelda3::DrawRoutineInfo::Diagonal, yaze::zelda3::DrawRoutineInfo::Downwards, yaze::zelda3::ObjectDrawInfo::draw_routine_id, yaze::zelda3::DrawRoutineRegistry::Get(), yaze::zelda3::ObjectDrawInfo::is_horizontal, yaze::zelda3::ObjectDrawInfo::is_vertical, yaze::zelda3::DrawRoutineIds::kRightwards1x1Solid_1to16_plus3, ResolveTileCountForObject(), yaze::zelda3::ObjectDrawInfo::routine_name, and yaze::zelda3::ObjectDrawInfo::tile_count.

|
private |
Parse subtype 1 objects (0x00-0xFF)
Definition at line 169 of file object_parser.cc.
References yaze::Rom::data(), yaze::zelda3::kRoomObjectSubtype1, yaze::zelda3::kRoomObjectTileAddress, LOG_DEBUG, ReadTileData(), rom_, and yaze::Rom::size().
Referenced by ParseObject().

|
private |
Parse subtype 2 objects (0x100-0x1FF)
Definition at line 222 of file object_parser.cc.
References yaze::Rom::data(), GetSubtype2TileCount(), yaze::zelda3::kRoomObjectSubtype2, yaze::zelda3::kRoomObjectTileAddress, LOG_DEBUG, ReadTileData(), rom_, and yaze::Rom::size().
Referenced by ParseObject().

|
private |
Parse subtype 3 objects (0x200+)
Definition at line 268 of file object_parser.cc.
References yaze::Rom::data(), GetSubtype3TileCount(), yaze::zelda3::kRoomObjectSubtype3, yaze::zelda3::kRoomObjectTileAddress, ReadTileData(), rom_, and yaze::Rom::size().
Referenced by ParseObject().

|
private |
Read tile data from ROM.
| address | The address to read from |
| tile_count | Number of tiles to read |
Definition at line 290 of file object_parser.cc.
References yaze::Rom::data(), LOG_DEBUG, rom_, yaze::Rom::size(), and yaze::gfx::WordToTileInfo().
Referenced by ParseSubtype1(), ParseSubtype2(), and ParseSubtype3().

|
private |
Get tile count for subtype 2 objects.
Different subtype 2 objects have different tile counts:
| object_id | The object ID |
Definition at line 337 of file object_parser.cc.
Referenced by ParseSubtype2(), and ResolveTileCountForObject().
|
private |
Get tile count for subtype 3 objects.
Different subtype 3 objects have different tile counts:
| object_id | The object ID |
Definition at line 375 of file object_parser.cc.
Referenced by ParseSubtype3(), and ResolveTileCountForObject().
|
private |
Definition at line 475 of file object_parser.cc.
References DetermineSubtype(), GetSubtype2TileCount(), and GetSubtype3TileCount().
Referenced by GetObjectDrawInfo(), and GetObjectSubtype().

|
private |
Definition at line 196 of file object_parser.h.
Referenced by ParseObject(), ParseObjectRoutine(), ParseSubtype1(), ParseSubtype2(), ParseSubtype3(), and ReadTileData().