yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::zelda3::ObjectParser Class Reference

Direct ROM parser for dungeon objects. More...

#include <object_parser.h>

Collaboration diagram for yaze::zelda3::ObjectParser:

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< ObjectRoutineInfoParseObjectRoutine (int16_t object_id)
 Parse object routine data.
 
absl::StatusOr< ObjectSubtypeInfoGetObjectSubtype (int16_t object_id)
 Get object subtype information.
 
absl::StatusOr< ObjectSizeInfoParseObjectSize (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

Romrom_
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ObjectParser()

yaze::zelda3::ObjectParser::ObjectParser ( Rom rom)
inlineexplicit

Definition at line 92 of file object_parser.h.

Member Function Documentation

◆ ParseObject()

absl::StatusOr< std::vector< gfx::TileInfo > > yaze::zelda3::ObjectParser::ParseObject ( int16_t  object_id)

Parse object data directly from ROM.

Parameters
object_idThe object ID to parse
Returns
StatusOr containing the parsed tile data

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().

Here is the call graph for this function:

◆ ParseObjectRoutine()

absl::StatusOr< ObjectRoutineInfo > yaze::zelda3::ObjectParser::ParseObjectRoutine ( int16_t  object_id)

Parse object routine data.

Parameters
object_idThe object ID
Returns
StatusOr containing routine information

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.

Here is the call graph for this function:

◆ GetObjectSubtype()

absl::StatusOr< ObjectSubtypeInfo > yaze::zelda3::ObjectParser::GetObjectSubtype ( int16_t  object_id)

Get object subtype information.

Parameters
object_idThe object ID
Returns
StatusOr containing subtype information

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().

Here is the call graph for this function:

◆ ParseObjectSize()

absl::StatusOr< ObjectSizeInfo > yaze::zelda3::ObjectParser::ParseObjectSize ( int16_t  object_id,
uint8_t  size_byte 
)

Parse object size and orientation.

Parameters
object_idThe object ID
size_byteThe size byte from object data
Returns
StatusOr containing size and orientation info

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.

◆ DetermineSubtype()

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().

◆ GetObjectDrawInfo()

ObjectDrawInfo yaze::zelda3::ObjectParser::GetObjectDrawInfo ( int16_t  object_id) const

Get draw routine information for an object.

Parameters
object_idThe object ID to look up
Returns
ObjectDrawInfo containing draw routine details

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().

◆ ParseSubtype1()

absl::StatusOr< std::vector< gfx::TileInfo > > yaze::zelda3::ObjectParser::ParseSubtype1 ( int16_t  object_id)
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().

Here is the call graph for this function:

◆ ParseSubtype2()

absl::StatusOr< std::vector< gfx::TileInfo > > yaze::zelda3::ObjectParser::ParseSubtype2 ( int16_t  object_id)
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().

Here is the call graph for this function:

◆ ParseSubtype3()

absl::StatusOr< std::vector< gfx::TileInfo > > yaze::zelda3::ObjectParser::ParseSubtype3 ( int16_t  object_id)
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().

Here is the call graph for this function:

◆ ReadTileData()

absl::StatusOr< std::vector< gfx::TileInfo > > yaze::zelda3::ObjectParser::ReadTileData ( int  address,
int  tile_count 
)
private

Read tile data from ROM.

Parameters
addressThe address to read from
tile_countNumber of tiles to read
Returns
StatusOr containing tile data

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().

Here is the call graph for this function:

Member Data Documentation

◆ rom_

Rom* yaze::zelda3::ObjectParser::rom_
private

The documentation for this class was generated from the following files: