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
62 // Destructible doors (0x28-0x30)
63 DashWall = 0x28,
64 BombableCaveExit = 0x2A,
66 BombableDoor = 0x2E,
67 ExplodingWall = 0x30,
68
69 // Special doors (0x32-0x40)
70 CurtainDoor = 0x32,
72 BottomSidedShutter = 0x36,
73 TopSidedShutter = 0x38,
78
79 // Additional shutters (0x42-0x4A)
82 ExplicitRoomDoor = 0x46,
83 BottomShutterLower = 0x48,
84 TopShutterLower = 0x4A,
85
86 // Unusable/glitchy doors (0x4C-0x66)
90 UnusableBombedDoor = 0x52,
101};
102
106constexpr std::string_view GetDoorTypeName(DoorType type) {
107 switch (type) {
108 // Standard doors
109 case DoorType::NormalDoor: return "Normal Door";
110 case DoorType::NormalDoorLower: return "Normal Door (Lower)";
111 case DoorType::ExitLower: return "Exit (Lower)";
112 case DoorType::UnusedCaveExit: return "Unused Cave Exit";
113 // Cave/dungeon exits
114 case DoorType::WaterfallDoor: return "Waterfall Door";
115 case DoorType::FancyDungeonExit: return "Fancy Dungeon Exit";
116 case DoorType::FancyDungeonExitLower: return "Fancy Exit (Lower)";
117 case DoorType::CaveExit: return "Cave Exit";
118 case DoorType::LitCaveExitLower: return "Lit Cave Exit (Lower)";
119 // Markers
120 case DoorType::ExitMarker: return "Exit Marker";
121 case DoorType::DungeonSwapMarker: return "Dungeon Swap Marker";
122 case DoorType::LayerSwapMarker: return "Layer Swap Marker";
123 // Key doors and shutters
124 case DoorType::DoubleSidedShutter: return "Double-Sided Shutter";
125 case DoorType::EyeWatchDoor: return "Eye Watch Door";
126 case DoorType::SmallKeyDoor: return "Small Key Door";
127 case DoorType::BigKeyDoor: return "Big Key Door";
128 case DoorType::SmallKeyStairsUp: return "Small Key Stairs (Up)";
129 case DoorType::SmallKeyStairsDown: return "Small Key Stairs (Down)";
130 case DoorType::SmallKeyStairsUpLower: return "Key Stairs Up (Lower)";
131 case DoorType::SmallKeyStairsDownLower: return "Key Stairs Down (Lower)";
132 // Destructible
133 case DoorType::DashWall: return "Dash Wall";
134 case DoorType::BombableCaveExit: return "Bombable Cave Exit";
135 case DoorType::UnopenableBigKeyDoor: return "Unopenable Big Key Door";
136 case DoorType::BombableDoor: return "Bombable Door";
137 case DoorType::ExplodingWall: return "Exploding Wall";
138 // Special
139 case DoorType::CurtainDoor: return "Curtain Door";
140 case DoorType::UnusableBottomShutter: return "Unusable Bottom Shutter";
141 case DoorType::BottomSidedShutter: return "Bottom-Sided Shutter";
142 case DoorType::TopSidedShutter: return "Top-Sided Shutter";
143 case DoorType::UnusableNormalDoor3A: return "Unusable Door 0x3A";
144 case DoorType::UnusableNormalDoor3C: return "Unusable Door 0x3C";
145 case DoorType::UnusableNormalDoor3E: return "Unusable Door 0x3E";
146 case DoorType::NormalDoorOneSidedShutter: return "Normal Door (One-Sided)";
147 // Additional shutters
148 case DoorType::UnusedDoubleSidedShutter: return "Unused Double Shutter";
149 case DoorType::DoubleSidedShutterLower: return "Double Shutter (Lower)";
150 case DoorType::ExplicitRoomDoor: return "Explicit Room Door";
151 case DoorType::BottomShutterLower: return "Bottom Shutter (Lower)";
152 case DoorType::TopShutterLower: return "Top Shutter (Lower)";
153 // Unusable/glitchy
154 default: return "Unknown/Glitchy Door";
155 }
156}
157
161constexpr std::string_view GetDoorDirectionName(DoorDirection dir) {
162 switch (dir) {
164 return "North";
166 return "South";
168 return "West";
170 return "East";
171 }
172 return "Unknown";
173}
174
181
182 int width_pixels() const { return width_tiles * 8; }
183 int height_pixels() const { return height_tiles * 8; }
184};
185
193 switch (dir) {
196 return {4, 3}; // 32x24 pixels
199 return {3, 4}; // 24x32 pixels
200 }
201 return {4, 3};
202}
203
208constexpr DoorType DoorTypeFromRaw(uint8_t raw_type) {
209 return static_cast<DoorType>(raw_type);
210}
211
216constexpr DoorDirection DoorDirectionFromRaw(uint8_t raw_dir) {
217 return static_cast<DoorDirection>(raw_dir & 0x03);
218}
219
248
249} // namespace zelda3
250} // namespace yaze
251
252#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:224
constexpr DoorDirection DoorDirectionFromRaw(uint8_t raw_dir)
Convert raw direction byte to DoorDirection enum.
Definition door_types.h:216
constexpr DoorDimensions GetDoorDimensions(DoorDirection dir)
Get door dimensions based on direction.
Definition door_types.h:192
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:161
constexpr DoorType DoorTypeFromRaw(uint8_t raw_type)
Convert raw type byte to DoorType enum.
Definition door_types.h:208
constexpr std::string_view GetDoorTypeName(DoorType type)
Get human-readable name for door type.
Definition door_types.h:106
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)
Door dimensions in tiles (8x8 pixel tiles)
Definition door_types.h:178
int width_tiles
Width in 8x8 tiles.
Definition door_types.h:179
int height_tiles
Height in 8x8 tiles.
Definition door_types.h:180