yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dungeon_door_edges.h
Go to the documentation of this file.
1#ifndef YAZE_ZELDA3_ATLAS_DUNGEON_DOOR_EDGES_H_
2#define YAZE_ZELDA3_ATLAS_DUNGEON_DOOR_EDGES_H_
3
4// Door markers for the Dungeon Atlas: which doors sit on a room's outer wall,
5// their category, and the pairing of doors on facing walls of grid
6// neighbours. Ported from Oracle of Secrets Scripts/Maps/room_data.py
7// (DOOR_CAT, pair_doors) so both pictures agree; these are display
8// heuristics, not game rules.
9
10#include <cstdint>
11#include <string>
12#include <vector>
13
14namespace yaze::zelda3::atlas {
15
16enum class DoorCategory : uint8_t {
17 kOpen,
20 kKey,
21 kBigKey,
22 kBomb,
23 kExit,
25 kOther,
26 kIgnore, // Layer swap markers: never drawn.
27};
28
31
32// A door as the room stores it (zelda3::Room::Door).
34 int direction = 0; // zelda3::DoorDirection: 0 N, 1 S, 2 W, 3 E.
35 int tile_x = 0;
36 int tile_y = 0;
37 int type = 0; // zelda3::DoorType byte.
38 std::string type_name;
39};
40
41// A door on the outer wall, as drawn in the gutter.
42struct AtlasDoor {
43 char wall = 'N'; // N, S, W, E
44 int pos = 0; // Tile position along the wall (0-63).
45 int type = 0;
46 std::string type_name;
48};
49
50// Doors on the outer wall with their category. Inner doors and layer swap
51// markers are dropped; a normal door within 2 tiles of an exit marker on the
52// same wall is that exit.
53std::vector<AtlasDoor> OuterWallDoors(const std::vector<AtlasDoorFact>& doors);
54
55struct DoorEdge {
56 int a = 0; // Room with the door.
57 int b = 0; // Grid neighbour (N = a-0x10, E = a+1).
58 char dir = 'E';
59 int pos = 0;
61 bool both_sides = false; // The neighbour has a matching door.
62 bool one_sided_type = false; // One of the doors is a one-sided type.
63 std::vector<std::string> types;
64};
65
66// Pairs doors on facing walls (within 3 tiles). The stronger category wins
67// (big key > key > shutter > bomb > open > one-sided); a door with no partner
68// is a one-side edge. `doors_by_room` has one entry per room.
69std::vector<DoorEdge> PairDoorEdges(
70 const std::vector<std::vector<AtlasDoor>>& doors_by_room);
71
72} // namespace yaze::zelda3::atlas
73
74#endif // YAZE_ZELDA3_ATLAS_DUNGEON_DOOR_EDGES_H_
std::vector< AtlasDoor > OuterWallDoors(const std::vector< AtlasDoorFact > &doors)
DoorCategory DoorCategoryForType(int door_type)
std::vector< DoorEdge > PairDoorEdges(const std::vector< std::vector< AtlasDoor > > &doors_by_room)
const char * DoorCategoryName(DoorCategory category)
std::vector< std::string > types