yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
draw_routine_registry.h
Go to the documentation of this file.
1#ifndef YAZE_ZELDA3_DUNGEON_DRAW_ROUTINES_DRAW_ROUTINE_REGISTRY_H
2#define YAZE_ZELDA3_DUNGEON_DRAW_ROUTINES_DRAW_ROUTINE_REGISTRY_H
3
4#include <unordered_map>
5#include <vector>
6
8
9namespace yaze {
10namespace zelda3 {
11
21namespace DrawRoutineIds {
22
23// Rightwards routines (0-4, 16, 20-32)
24constexpr int kRightwards2x2_1to15or32 = 0;
25constexpr int kRightwards2x4_1to15or26 = 1;
26constexpr int kRightwards2x4_1to16 = 2;
28constexpr int kRightwards2x2_1to16 = 4;
29constexpr int kRightwards4x4_1to16 = 16;
30constexpr int kRightwards1x2_1to16_plus2 = 20;
42
43// Diagonal routines (5-6, 17-18)
44constexpr int kDiagonalAcute_1to16 = 5;
45constexpr int kDiagonalGrave_1to16 = 6;
46constexpr int kDiagonalAcute_1to16_BothBG = 17;
47constexpr int kDiagonalGrave_1to16_BothBG = 18;
48
49// Downwards routines (7-15, 43-50, 65-71)
50constexpr int kDownwards2x2_1to15or32 = 7;
51constexpr int kDownwards4x2_1to15or26 = 8;
54constexpr int kDownwards2x2_1to16 = 11;
56constexpr int kDownwardsEdge1x1_1to16 = 13;
59constexpr int kDownwardsFloor4x4_1to16 = 43;
71constexpr int kDownwardsBar2x3_1to16 = 69;
72constexpr int kDownwardsPots2x2_1to16 = 70;
74
75// Vertical rail routine with CORNER+MIDDLE+END pattern (for 0x8A-0x8C)
77
78// Corner routines (19, 35-37, 75-78)
79constexpr int kCorner4x4 = 19;
80constexpr int kCorner4x4_BothBG = 35;
81constexpr int kWeirdCornerBottom_BothBG = 36;
82constexpr int kWeirdCornerTop_BothBG = 37;
83constexpr int kDiagonalCeilingTopLeft = 75;
84constexpr int kDiagonalCeilingBottomLeft = 76;
85constexpr int kDiagonalCeilingTopRight = 77;
86constexpr int kDiagonalCeilingBottomRight = 78;
87
88// Special routines (26, 33-34, 38-39)
89constexpr int kDoorSwitcherer = 26;
90constexpr int kSomariaLine = 33;
91constexpr int kWaterFace = 34;
92constexpr int kNothing = 38;
93constexpr int kChest = 39;
94
95// Additional rightwards (51-55, 72-74)
97constexpr int kRightwardsBar4x3_1to16 = 52;
98constexpr int kRightwardsShelf4x4_1to16 = 53;
102constexpr int kRightwardsPots2x2_1to16 = 73;
104
105// SuperSquare routines (56-64)
106constexpr int k4x4BlocksIn4x4SuperSquare = 56;
107constexpr int k3x3FloorIn4x4SuperSquare = 57;
108constexpr int k4x4FloorIn4x4SuperSquare = 58;
111constexpr int kBigHole4x4_1to16 = 61;
112constexpr int kSpike2x2In4x4SuperSquare = 62;
113constexpr int kTableRock4x4_1to16 = 63;
114constexpr int kWaterOverlay8x8_1to16 = 64;
115
116// Chest platform and moving wall routines (79-82)
117constexpr int kClosedChestPlatform = 79;
118constexpr int kMovingWallWest = 80;
119constexpr int kMovingWallEast = 81;
120constexpr int kOpenChestPlatform = 82;
121
122// Stair routines (83-91)
123constexpr int kInterRoomFatStairsUp = 83;
124constexpr int kInterRoomFatStairsDownA = 84;
125constexpr int kInterRoomFatStairsDownB = 85;
126constexpr int kAutoStairs = 86;
127constexpr int kStraightInterRoomStairs = 87;
128constexpr int kSpiralStairsGoingUpUpper = 88;
130constexpr int kSpiralStairsGoingUpLower = 90;
132
133// Interactive object routines (92-96)
134constexpr int kBigKeyLock = 92;
135constexpr int kBombableFloor = 93;
136constexpr int kEmptyWaterFace = 94;
137constexpr int kSpittingWaterFace = 95;
138constexpr int kDrenchingWaterFace = 96;
139
140// Additional Type 2/3 routines (97-115)
141constexpr int kWaterfall = 97;
142constexpr int kFloorTile4x2 = 98;
143constexpr int kCannonHole4x3 = 99;
144constexpr int kBed4x5 = 100;
145constexpr int kRightwards3x6 = 101;
146constexpr int kVerticalTurtleRockPipe = 102;
147constexpr int kHorizontalTurtleRockPipe = 103;
148constexpr int kLightBeam = 104;
149constexpr int kBigLightBeam = 105;
150constexpr int kBossShell4x4 = 106;
151constexpr int kSolidWallDecor3x4 = 107;
152constexpr int kArcheryGameTargetDoor = 108;
153constexpr int kGanonTriforceFloorDecor = 109;
154constexpr int kLargeCanvasObject = 110;
155constexpr int kUtility6x3 = 111;
156constexpr int kUtility3x5 = 112;
157constexpr int kSingle4x4 = 113;
158constexpr int kSingle4x3 = 114;
159constexpr int kRupeeFloor = 115;
160
161// Custom object routines (130+)
162constexpr int kCustomObject = 130;
163
164} // namespace DrawRoutineIds
165
174 public:
175 static DrawRoutineRegistry& Get();
176
177 // Initialize the registry - must be called once at startup
178 void Initialize();
179
180 // Look up routine info by ID
181 const DrawRoutineInfo* GetRoutineInfo(int routine_id) const;
182
183 // Get all registered routines
184 const std::vector<DrawRoutineInfo>& GetAllRoutines() const { return routines_; }
185
186 // Check if a routine draws to both BG layers
187 bool RoutineDrawsToBothBGs(int routine_id) const;
188
189 // Get routine metadata for dimension calculation
190 bool GetRoutineDimensions(int routine_id, int* base_width, int* base_height) const;
191
192 private:
194 void BuildRegistry();
195
196 std::vector<DrawRoutineInfo> routines_;
197 std::unordered_map<int, const DrawRoutineInfo*> routine_map_;
198 bool initialized_ = false;
199};
200
201} // namespace zelda3
202} // namespace yaze
203
204#endif // YAZE_ZELDA3_DUNGEON_DRAW_ROUTINES_DRAW_ROUTINE_REGISTRY_H
205
Unified draw routine registry.
const DrawRoutineInfo * GetRoutineInfo(int routine_id) const
const std::vector< DrawRoutineInfo > & GetAllRoutines() const
bool GetRoutineDimensions(int routine_id, int *base_width, int *base_height) const
bool RoutineDrawsToBothBGs(int routine_id) const
std::unordered_map< int, const DrawRoutineInfo * > routine_map_
std::vector< DrawRoutineInfo > routines_
static DrawRoutineRegistry & Get()
constexpr int kDownwardsLeftCorners2x1_1to16_plus12
constexpr int kRightwardsBottomCorners1x2_1to16_plus13
constexpr int kDownwardsRightCorners2x1_1to16_plus12
constexpr int kRightwardsTopCorners1x2_1to16_plus13
Metadata about a draw routine.