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

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 53 of file object_parser.cc.

References DetermineSubtype(), ParseSubtype1(), ParseSubtype2(), ParseSubtype3(), and rom_.

Referenced by yaze::zelda3::RoomObject::LoadTilesWithParser().

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 80 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 101 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 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.

◆ DetermineSubtype()

int yaze::zelda3::ObjectParser::DetermineSubtype ( int16_t object_id) const

Determine object subtype from ID.

Definition at line 377 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 388 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.

◆ 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 169 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 224 of file object_parser.cc.

References yaze::Rom::data(), GetSubtype2TileCount(), 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 270 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().

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 292 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:

◆ GetSubtype2TileCount()

int yaze::zelda3::ObjectParser::GetSubtype2TileCount ( int16_t object_id) const
private

Get tile count for subtype 2 objects.

Different subtype 2 objects have different tile counts:

  • 4x4 corners (0x100-0x10F): 16 tiles
  • Weird corners (0x110-0x117): 12 tiles
  • Others: 8 tiles
Parameters
object_idThe object ID
Returns
Number of tiles to read

Definition at line 340 of file object_parser.cc.

Referenced by ParseSubtype2().

◆ GetSubtype3TileCount()

int yaze::zelda3::ObjectParser::GetSubtype3TileCount ( int16_t object_id) const
private

Get tile count for subtype 3 objects.

Different subtype 3 objects have different tile counts:

  • BigChest/OpenBigChest (0xFB1-0xFB2): 12 tiles (4x3)
  • TableRock4x3 variants: 12 tiles
  • 4x4 objects: 16 tiles
  • Most others: 8 tiles
Parameters
object_idThe object ID
Returns
Number of tiles to read

Definition at line 355 of file object_parser.cc.

Referenced by ParseSubtype3().

Member Data Documentation

◆ rom_

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

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