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. | |
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 19 of file object_parser.cc.
References DetermineSubtype(), ParseSubtype1(), ParseSubtype2(), ParseSubtype3(), and rom_.
Referenced by yaze::zelda3::RoomObject::LoadTilesWithParser(), and yaze::test::TEST_F().
absl::StatusOr< ObjectRoutineInfo > yaze::zelda3::ObjectParser::ParseObjectRoutine | ( | int16_t | object_id | ) |
Parse object routine data.
object_id | The object ID |
Definition at line 39 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 59 of file object_parser.cc.
References DetermineSubtype(), yaze::zelda3::kRoomObjectSubtype1, yaze::zelda3::kRoomObjectSubtype2, yaze::zelda3::kRoomObjectSubtype3, yaze::zelda3::ObjectSubtypeInfo::max_tile_count, 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 93 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 215 of file object_parser.cc.
Referenced by GetObjectSubtype(), and ParseObject().
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 225 of file object_parser.cc.
References yaze::zelda3::ObjectDrawInfo::both_layers, yaze::zelda3::ObjectDrawInfo::draw_routine_id, yaze::zelda3::ObjectDrawInfo::is_horizontal, yaze::zelda3::ObjectDrawInfo::routine_name, and yaze::zelda3::ObjectDrawInfo::tile_count.
Referenced by yaze::zelda3::TEST_F(), and yaze::zelda3::TEST_F().
|
private |
Parse subtype 1 objects (0x00-0xFF)
Definition at line 120 of file object_parser.cc.
References yaze::Rom::data(), yaze::zelda3::kRoomObjectSubtype1, yaze::zelda3::kRoomObjectTileAddress, ReadTileData(), rom_, and yaze::Rom::size().
Referenced by ParseObject().
|
private |
Parse subtype 2 objects (0x100-0x1FF)
Definition at line 138 of file object_parser.cc.
References yaze::Rom::data(), yaze::zelda3::kRoomObjectSubtype2, yaze::zelda3::kRoomObjectTileAddress, ReadTileData(), rom_, and yaze::Rom::size().
Referenced by ParseObject().
|
private |
Parse subtype 3 objects (0x200+)
Definition at line 156 of file object_parser.cc.
References yaze::Rom::data(), 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 174 of file object_parser.cc.
References yaze::Rom::data(), rom_, yaze::Rom::size(), and yaze::gfx::WordToTileInfo().
Referenced by ParseSubtype1(), ParseSubtype2(), and ParseSubtype3().
|
private |
Definition at line 166 of file object_parser.h.
Referenced by ParseObject(), ParseObjectRoutine(), ParseSubtype1(), ParseSubtype2(), ParseSubtype3(), and ReadTileData().