yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
door_types.h
Go to the documentation of this file.
1#ifndef YAZE_ZELDA3_DUNGEON_DOOR_TYPES_H
2#define YAZE_ZELDA3_DUNGEON_DOOR_TYPES_H
3
4#include <array>
5#include <cstdint>
6#include <string_view>
7
8namespace yaze {
9namespace zelda3 {
10
18enum class DoorDirection : uint8_t {
19 North = 0,
20 South = 1,
21 West = 2,
22 East = 3
23};
24
33enum class DoorType : uint8_t {
34 // Standard doors (0x00-0x06)
35 NormalDoor = 0x00,
36 NormalDoorLower = 0x02,
37 ExitLower = 0x04,
38 UnusedCaveExit = 0x06,
39
40 // Cave/dungeon exits (0x08-0x10)
41 WaterfallDoor = 0x08,
42 FancyDungeonExit = 0x0A,
44 CaveExit = 0x0E,
45 LitCaveExitLower = 0x10,
46
47 // Markers (0x12-0x16)
48 ExitMarker = 0x12,
49 DungeonSwapMarker = 0x14,
50 LayerSwapMarker = 0x16,
51
52 // Key doors and shutters (0x18-0x26)
53 DoubleSidedShutter = 0x18,
54 EyeWatchDoor = 0x1A,
55 SmallKeyDoor = 0x1C,
56 BigKeyDoor = 0x1E,
57 SmallKeyStairsUp = 0x20,
58 SmallKeyStairsDown = 0x22,
61 0x26,
62
63 // Destructible doors (0x28-0x30)
64 DashWall = 0x28,
65 BombableCaveExit = 0x2A,
67 BombableDoor = 0x2E,
68 ExplodingWall = 0x30,
69
70 // Special doors (0x32-0x40)
71 CurtainDoor = 0x32,
73 BottomSidedShutter = 0x36,
74 TopSidedShutter = 0x38,
79 0x40,
80
81 // Additional shutters (0x42-0x4A)
84 ExplicitRoomDoor = 0x46,
85 BottomShutterLower = 0x48,
86 TopShutterLower = 0x4A,
87
88 // Unusable/glitchy doors (0x4C-0x66)
92 UnusableBombedDoor = 0x52,
101 0x62,
104 0x66
105};
106
110constexpr std::string_view GetDoorTypeName(DoorType type) {
111 switch (type) {
112 // Standard doors
114 return "Normal Door";
116 return "Normal Door (Lower)";
118 return "Exit (Lower)";
120 return "Unused Cave Exit";
121 // Cave/dungeon exits
123 return "Waterfall Door";
125 return "Fancy Dungeon Exit";
127 return "Fancy Exit (Lower)";
129 return "Cave Exit";
131 return "Lit Cave Exit (Lower)";
132 // Markers
134 return "Exit Marker";
136 return "Dungeon Swap Marker";
138 return "Layer Swap Marker";
139 // Key doors and shutters
141 return "Double-Sided Shutter";
143 return "Eye Watch Door";
145 return "Small Key Door";
147 return "Big Key Door";
149 return "Small Key Stairs (Up)";
151 return "Small Key Stairs (Down)";
153 return "Key Stairs Up (Lower)";
155 return "Key Stairs Down (Lower)";
156 // Destructible
158 return "Dash Wall";
160 return "Bombable Cave Exit";
162 return "Unopenable Big Key Door";
164 return "Bombable Door";
166 return "Exploding Wall";
167 // Special
169 return "Curtain Door";
171 return "Unusable Bottom Shutter";
173 return "Bottom-Sided Shutter";
175 return "Top-Sided Shutter";
177 return "Unusable Door 0x3A";
179 return "Unusable Door 0x3C";
181 return "Unusable Door 0x3E";
183 return "Normal Door (One-Sided)";
184 // Additional shutters
186 return "Unused Double Shutter";
188 return "Double Shutter (Lower)";
190 return "Explicit Room Door";
192 return "Bottom Shutter (Lower)";
194 return "Top Shutter (Lower)";
195 // Unusable/glitchy
196 default:
197 return "Unknown/Glitchy Door";
198 }
199}
200
204constexpr std::string_view GetDoorDirectionName(DoorDirection dir) {
205 switch (dir) {
207 return "North";
209 return "South";
211 return "West";
213 return "East";
214 }
215 return "Unknown";
216}
217
224
225 int width_pixels() const { return width_tiles * 8; }
226 int height_pixels() const { return height_tiles * 8; }
227};
228
236 switch (dir) {
239 return {4, 3}; // 32x24 pixels
242 return {3, 4}; // 24x32 pixels
243 }
244 return {4, 3};
245}
246
258 DoorType type) {
259 if (dir == DoorDirection::North && type == DoorType::CurtainDoor) {
260 return {4, 4};
261 }
262 return GetDoorDimensions(dir);
263}
264
269constexpr DoorType DoorTypeFromRaw(uint8_t raw_type) {
270 return static_cast<DoorType>(raw_type);
271}
272
277constexpr DoorDirection DoorDirectionFromRaw(uint8_t raw_dir) {
278 return static_cast<DoorDirection>(raw_dir & 0x03);
279}
280
299
300} // namespace zelda3
301} // namespace yaze
302
303#endif // YAZE_ZELDA3_DUNGEON_DOOR_TYPES_H
constexpr std::array< DoorType, 20 > GetAllDoorTypes()
Get commonly used door types for UI dropdowns Returns the most frequently used door types (not all 52...
Definition door_types.h:285
constexpr DoorDirection DoorDirectionFromRaw(uint8_t raw_dir)
Convert raw direction byte to DoorDirection enum.
Definition door_types.h:277
constexpr DoorDimensions GetDoorDimensions(DoorDirection dir)
Get door dimensions based on direction.
Definition door_types.h:235
DoorType
Door types from ALTTP.
Definition door_types.h:33
@ NormalDoorOneSidedShutter
Normal door (lower layer; with one-sided shutters)
@ TopShutterLower
Top-sided shutter door (lower layer)
@ FancyDungeonExitLower
Fancy dungeon exit (lower layer)
@ UnusableGlitchyStairs64
Unusable glitchy/stairs up (lower layer)
@ FancyDungeonExit
Fancy dungeon exit.
@ SmallKeyDoor
Small key door.
@ ExitLower
Exit (lower layer)
@ SmallKeyStairsDown
Small key stairs (downwards)
@ UnusableNormalDoor4C
Unusable normal door (lower layer)
@ BombableCaveExit
Bombable cave exit.
@ UnusableBombedDoor
Unusable bombed-open door (lower layer)
@ SmallKeyStairsUp
Small key stairs (upwards)
@ UnusedCaveExit
Unused cave exit (lower layer)
@ DungeonSwapMarker
Dungeon swap marker.
@ NormalDoor
Normal door (upper layer)
@ BombableDoor
Bombable door.
@ LayerSwapMarker
Layer swap marker.
@ UnusableNormalDoor3A
Unusable normal door (lower layer)
@ ExplicitRoomDoor
Explicit room door.
@ UnusableNormalDoor58
Unusable normal door (lower layer)
@ BottomShutterLower
Bottom-sided shutter door (lower layer)
@ ExplodingWall
Exploding wall.
@ TopSidedShutter
Top-sided shutter door.
@ UnusableGlitchyStairsDown66
Unusable glitchy/stairs down (lower layer)
@ UnusableGlitchyStairs5C
Unusable glitchy/stairs up (lower layer)
@ LitCaveExitLower
Lit cave exit (lower layer)
@ DoubleSidedShutterLower
Double-sided shutter (lower layer)
@ UnusableBottomShutter
Unusable bottom-sided shutter door.
@ UnusableNormalDoor4E
Unusable normal door (lower layer)
@ UnusableGlitchyStairs5E
Unusable glitchy/stairs up (lower layer)
@ UnopenableBigKeyDoor
Unopenable, double-sided big key door.
@ NormalDoorLower
Normal door (lower layer)
@ BottomSidedShutter
Bottom-sided shutter door.
@ UnusedDoubleSidedShutter
Unused double-sided shutter.
@ UnusableGlitchyDoor54
Unusable glitchy door (lower layer)
@ UnusableGlitchyStairs60
Unusable glitchy/stairs up (lower layer)
@ SmallKeyStairsDownLower
Small key stairs (lower layer; downwards)
@ CurtainDoor
Curtain door.
@ WaterfallDoor
Waterfall door.
@ BigKeyDoor
Big key door.
@ EyeWatchDoor
Eye watch door.
@ UnusableGlitchyStairsDown62
Unusable glitchy/stairs down (lower layer)
@ SmallKeyStairsUpLower
Small key stairs (lower layer; upwards)
@ UnusableGlitchyStairs5A
Unusable glitchy/stairs up (lower layer)
@ UnusableNormalDoor3E
Unusable normal door (lower layer)
@ UnusableGlitchyDoor56
Unusable glitchy door (lower layer)
@ ExitMarker
Exit marker.
@ DoubleSidedShutter
Double sided shutter door.
@ UnusableNormalDoor3C
Unusable normal door (lower layer)
@ UnusableNormalDoor50
Unusable normal door (lower layer)
constexpr std::string_view GetDoorDirectionName(DoorDirection dir)
Get human-readable name for door direction.
Definition door_types.h:204
constexpr DoorType DoorTypeFromRaw(uint8_t raw_type)
Convert raw type byte to DoorType enum.
Definition door_types.h:269
constexpr std::string_view GetDoorTypeName(DoorType type)
Get human-readable name for door type.
Definition door_types.h:110
DoorDirection
Door direction on room walls.
Definition door_types.h:18
@ South
Bottom wall (horizontal door, 4x3 tiles)
@ North
Top wall (horizontal door, 4x3 tiles)
@ East
Right wall (vertical door, 3x4 tiles)
@ West
Left wall (vertical door, 3x4 tiles)
constexpr DoorDimensions GetEditorDoorDimensions(DoorDirection dir, DoorType type)
Get editor interaction dimensions for a door.
Definition door_types.h:257
Door dimensions in tiles (8x8 pixel tiles)
Definition door_types.h:221
int width_tiles
Width in 8x8 tiles.
Definition door_types.h:222
int height_tiles
Height in 8x8 tiles.
Definition door_types.h:223