yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
object_parser.h
Go to the documentation of this file.
1#ifndef YAZE_APP_ZELDA3_DUNGEON_OBJECT_PARSER_H
2#define YAZE_APP_ZELDA3_DUNGEON_OBJECT_PARSER_H
3
4#include <cstdint>
5#include <vector>
6
7#include "absl/status/status.h"
8#include "absl/status/statusor.h"
9#include "app/gfx/snes_tile.h"
10#include "app/rom.h"
11
12namespace yaze {
13namespace zelda3 {
14
32
45
63
68 int draw_routine_id; // Which drawing pattern to use (0-24)
69 int tile_count; // How many tiles this object has
70 bool is_horizontal; // Orientation
72 bool both_layers; // Draw to both BG1 and BG2
73 std::string routine_name; // Human-readable routine name
74
76 : draw_routine_id(0),
77 tile_count(1),
78 is_horizontal(true),
79 is_vertical(false),
80 both_layers(false),
81 routine_name("Unknown") {}
82};
83
91 public:
92 explicit ObjectParser(Rom* rom) : rom_(rom) {}
93
100 absl::StatusOr<std::vector<gfx::TileInfo>> ParseObject(int16_t object_id);
101
108 absl::StatusOr<ObjectRoutineInfo> ParseObjectRoutine(int16_t object_id);
109
116 absl::StatusOr<ObjectSubtypeInfo> GetObjectSubtype(int16_t object_id);
117
125 absl::StatusOr<ObjectSizeInfo> ParseObjectSize(int16_t object_id,
126 uint8_t size_byte);
127
131 int DetermineSubtype(int16_t object_id) const;
132
138 ObjectDrawInfo GetObjectDrawInfo(int16_t object_id) const;
139
140 private:
144 absl::StatusOr<std::vector<gfx::TileInfo>> ParseSubtype1(int16_t object_id);
145
149 absl::StatusOr<std::vector<gfx::TileInfo>> ParseSubtype2(int16_t object_id);
150
154 absl::StatusOr<std::vector<gfx::TileInfo>> ParseSubtype3(int16_t object_id);
155
163 absl::StatusOr<std::vector<gfx::TileInfo>> ReadTileData(int address,
164 int tile_count);
165
167};
168
169} // namespace zelda3
170} // namespace yaze
171
172#endif // YAZE_APP_ZELDA3_DUNGEON_OBJECT_PARSER_H
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:71
Direct ROM parser for dungeon objects.
absl::StatusOr< ObjectSubtypeInfo > GetObjectSubtype(int16_t object_id)
Get object subtype information.
absl::StatusOr< ObjectRoutineInfo > ParseObjectRoutine(int16_t object_id)
Parse object routine data.
absl::StatusOr< ObjectSizeInfo > ParseObjectSize(int16_t object_id, uint8_t size_byte)
Parse object size and orientation.
absl::StatusOr< std::vector< gfx::TileInfo > > ParseSubtype2(int16_t object_id)
Parse subtype 2 objects (0x100-0x1FF)
absl::StatusOr< std::vector< gfx::TileInfo > > ParseObject(int16_t object_id)
Parse object data directly from ROM.
absl::StatusOr< std::vector< gfx::TileInfo > > ParseSubtype1(int16_t object_id)
Parse subtype 1 objects (0x00-0xFF)
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.
ObjectDrawInfo GetObjectDrawInfo(int16_t object_id) const
Get draw routine information for an object.
int DetermineSubtype(int16_t object_id) const
Determine object subtype from ID.
Main namespace for the application.
Draw routine information for object rendering.
Object routine information.
Object size and orientation information.
Object subtype information.